@Immutable public class NodeTypes extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
NodeTypes.Listener |
static class |
NodeTypes.NodeCardinality
List of ways to filter the returned node definitions
|
static interface |
NodeTypes.NodeDefinitionSet
A set of child node definitions under a parent with a specific primary type and optional mixin types.
|
static class |
NodeTypes.PropertyCardinality
List of ways to filter the returned property definitions
|
static interface |
NodeTypes.Supplier |
Modifier | Constructor and Description |
---|---|
protected |
NodeTypes(ExecutionContext context) |
protected |
NodeTypes(ExecutionContext context,
Iterable<org.modeshape.jcr.JcrNodeType> nodeTypes,
int version) |
Modifier and Type | Method and Description |
---|---|
boolean |
allowsNameSiblings(Name primaryType,
Set<Name> mixinTypes)
Determine if either the primary type or any of the mixin types allows SNS.
|
protected org.modeshape.jcr.JcrNodeDefinition |
findChildNodeDefinitionForUnstructured() |
protected org.modeshape.jcr.JcrNodeType |
findTypeInMapOrList(Name typeName,
Collection<org.modeshape.jcr.JcrNodeType> pendingList)
Finds the named type in the given collection of types pending registration if it exists, else returns the type definition
from the repository
|
Set<Name> |
getAllNodeTypeNames()
Return an immutable snapshot of the names of the node types currently registered in this node type manager.
|
Collection<org.modeshape.jcr.JcrNodeType> |
getAllNodeTypes()
Return the immutable list of node types that are currently registered in this node type manager.
|
Collection<org.modeshape.jcr.JcrPropertyDefinition> |
getAllPropertyDefinitions() |
Set<Name> |
getAllSubtypes(Name nodeTypeName) |
Collection<org.modeshape.jcr.JcrNodeDefinition> |
getAutoCreatedChildNodeDefinitions(Name nodeType)
Get the auto-created child node definitions for the named node type.
|
Collection<org.modeshape.jcr.JcrPropertyDefinition> |
getAutoCreatedPropertyDefinitions(Name nodeType)
Get the auto-created property definitions for the named node type.
|
int |
getBucketIdLengthForUnorderedCollection(Name nodeTypeName,
Set<Name> mixinTypes)
Determine the length of a bucket ID for an unordered collection, based on its type and possible mixins.
|
org.modeshape.jcr.JcrNodeDefinition |
getChildNodeDefinition(org.modeshape.jcr.NodeDefinitionId id) |
NodeType |
getJcrNodeType(Name nodeTypeName) |
Collection<org.modeshape.jcr.JcrNodeDefinition> |
getMandatoryChildNodeDefinitions(Name primaryType,
Set<Name> mixinTypes)
Get the mandatory child node definitions for a node with the named primary type and mixin types.
|
Collection<org.modeshape.jcr.JcrPropertyDefinition> |
getMandatoryPropertyDefinitions(Name primaryType,
Set<Name> mixinTypes)
Get the mandatory property definitions for a node with the named primary type and mixin types.
|
Collection<org.modeshape.jcr.JcrNodeType> |
getMixinNodeTypes()
Return an immutable snapshot of the mixin node types that are currently registered in this node type manager.
|
Collection<org.modeshape.jcr.JcrNodeType> |
getPrimaryNodeTypes()
Return an immutable snapshot of the primary node types that are currently registered in this node type manager.
|
org.modeshape.jcr.JcrPropertyDefinition |
getPropertyDefinition(org.modeshape.jcr.PropertyDefinitionId id) |
int |
getVersion()
Get the version number of this cache.
|
boolean |
hasMandatoryChildNodeDefinitions(Name primaryType,
Set<Name> mixinTypes)
Determine if the named primary node type or mixin types has at least one mandatory child node definitions declared on it or
any of its supertypes.
|
boolean |
hasMandatoryPropertyDefinitions(Name primaryType,
Set<Name> mixinTypes)
Determine if the named primary node type or mixin types has at least one mandatory property definitions declared on it or
any of its supertypes.
|
boolean |
isCreated(Name primaryType,
Set<Name> mixinTypes)
Determine if at least one of the named primary node type or mixin types is or subtypes the 'mix:created' mixin type.
|
boolean |
isETag(Name primaryType,
Set<Name> mixinTypes)
Determine if at least one of the named primary node type or mixin types is or subtypes the 'mix:etag' mixin type.
|
boolean |
isFullyDefinedType(Name primaryTypeName,
Set<Name> mixinTypeNames)
Determine if the named node type does not appear in any of the other sets.
|
boolean |
isLastModified(Name primaryType,
Set<Name> mixinTypes)
Determine if at least one of the named primary node type or mixin types is or subtypes the 'mix:lastModified' mixin type.
|
boolean |
isMixin(Name nodeTypeName)
Determine whether the node type given by the supplied name is a mixin node type.
|
boolean |
isNtResource(Name primaryType)
Determine if the named primary node type is or subtypes the 'nt:resource' node type.
|
boolean |
isQueryable(Name nodeTypeName,
Set<Name> mixinTypes)
Check if the node type and mixin types are queryable or not.
|
boolean |
isReferenceable(Name primaryType,
Set<Name> mixinTypes)
Determine if at least one of the named primary node type or mixin types is or subtypes the 'mix:referenceable' mixin type.
|
boolean |
isReferenceProperty(Name nodeTypeName,
Name propertyName)
Determine if the named property on the node type is a reference property.
|
boolean |
isShareable(Name primaryType,
Set<Name> mixinTypes)
Determine if at least one of the named primary node type or mixin types is or subtypes the 'mix:shareable' mixin type.
|
boolean |
isTypeOrSubtype(Name[] nodeTypeNames,
Name candidateSupertypeName)
Determine whether at least one of the node's given node types matches or extends the node type with the supplied name.
|
boolean |
isTypeOrSubtype(Name nodeTypeName,
Name candidateSupertypeName)
Determine whether the node's given node type matches or extends the node type with the supplied name.
|
boolean |
isTypeOrSubtype(Set<Name> nodeTypeNames,
Name candidateSupertypeName)
Determine whether at least one of the node's given node types matches or extends the node type with the supplied name.
|
boolean |
isUnorderedCollection(Name nodeTypeName,
Collection<Name> mixinTypes)
Determine if the named node type or any of the mixin types subtypes the 'mode:unorderedCollection' type.
|
boolean |
isVersionable(Name nodeTypeName)
Determine if the named node type is or subtypes the 'mix:versionable' mixin type.
|
boolean |
isVersionable(Name primaryType,
Collection<Name> mixinTypes)
Determine if at least one of the named primary node type or mixin types is or subtypes the 'mix:versionable' mixin type.
|
protected NameFactory |
nameFactory() |
protected List<org.modeshape.jcr.JcrNodeType> |
supertypesFor(NodeTypeDefinition nodeType,
Collection<org.modeshape.jcr.JcrNodeType> pendingTypes)
Returns the list of node types for the supertypes defined in the given node type.
|
String |
toString() |
protected void |
validate(org.modeshape.jcr.JcrNodeType nodeType,
List<org.modeshape.jcr.JcrNodeType> supertypes,
List<org.modeshape.jcr.JcrNodeType> pendingTypes)
Validates that the given node type definition is valid under the ModeShape and JCR type rules within the given context.
|
protected NodeTypes |
with(Collection<org.modeshape.jcr.JcrNodeType> addedNodeTypes)
Obtain a new version of this cache with the specified node types added to the new cache.
|
protected NodeTypes |
without(Collection<org.modeshape.jcr.JcrNodeType> removedNodeTypes)
Obtain a new version of this cache with the specified node types removed from the new cache.
|
protected NodeTypes(ExecutionContext context)
protected NodeTypes(ExecutionContext context, Iterable<org.modeshape.jcr.JcrNodeType> nodeTypes, int version)
protected NodeTypes without(Collection<org.modeshape.jcr.JcrNodeType> removedNodeTypes)
removedNodeTypes
- the node types that are to be removed from the resulting cache; may not be null but may be emptyprotected NodeTypes with(Collection<org.modeshape.jcr.JcrNodeType> addedNodeTypes)
addedNodeTypes
- the node types that are to be added to the resulting cache; may not be null but may be emptyprotected final NameFactory nameFactory()
public int getVersion()
public boolean isFullyDefinedType(Name primaryTypeName, Set<Name> mixinTypeNames)
Note that this method's signature is different from the other methods. This is because a node's primary type and mixin types must all be fully-defined types.
primaryTypeName
- the name of the primary node type; may not be nullmixinTypeNames
- the set of mixin type names; may be null or emptypublic boolean isTypeOrSubtype(Name nodeTypeName, Name candidateSupertypeName)
nodeTypeName
- the name of the node type of a node; may not be nullcandidateSupertypeName
- the name of the potential supertype node type; may not be nullpublic boolean isTypeOrSubtype(Set<Name> nodeTypeNames, Name candidateSupertypeName)
nodeTypeNames
- the names of the node types of a node; may not be nullcandidateSupertypeName
- the name of the potential supertype node type; may not be nullpublic boolean isTypeOrSubtype(Name[] nodeTypeNames, Name candidateSupertypeName)
nodeTypeNames
- the names of the node types of a node; may not be nullcandidateSupertypeName
- the name of the potential supertype node type; may not be nullpublic boolean isCreated(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may be null or emptypublic boolean isLastModified(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may be null or emptypublic boolean isNtResource(Name primaryType)
primaryType
- the primary type name; may not be nullpublic boolean isETag(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may be null or emptypublic boolean isReferenceable(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may be null or emptypublic boolean isShareable(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may be null or emptypublic boolean allowsNameSiblings(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may be null or emptytrue
if either the primary type or any of the mixin types allows SNS. If neither allow SNS,
this will return false
public boolean isVersionable(Name nodeTypeName)
nodeTypeName
- the node type name; may be nullpublic boolean isUnorderedCollection(Name nodeTypeName, Collection<Name> mixinTypes)
nodeTypeName
- the node type name; may be nullmixinTypes
- the mixin type names; may be null or emptypublic int getBucketIdLengthForUnorderedCollection(Name nodeTypeName, Set<Name> mixinTypes)
nodeTypeName
- the primary type of the collection; may not be null.mixinTypes
- the mixin type names; may be null or emptypublic boolean isVersionable(Name primaryType, Collection<Name> mixinTypes)
primaryType
- the primary type name; may be nullmixinTypes
- the mixin type names; may not be null but may be emptypublic boolean isReferenceProperty(Name nodeTypeName, Name propertyName)
nodeTypeName
- the name of the node type; may not be nullpropertyName
- the name of the property definition; may not be nullPropertyType.REFERENCE
, PropertyType.WEAKREFERENCE
, or
PropertyType.SIMPLE_REFERENCE
, or false otherwisepublic boolean hasMandatoryPropertyDefinitions(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may not be null but may be emptypublic boolean hasMandatoryChildNodeDefinitions(Name primaryType, Set<Name> mixinTypes)
primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may not be null but may be emptypublic Collection<org.modeshape.jcr.JcrPropertyDefinition> getMandatoryPropertyDefinitions(Name primaryType, Set<Name> mixinTypes)
hasMandatoryPropertyDefinitions(Name, Set)
method should first be called with the primary type and mixin types; if
that method returns true
, then this method will never return an empty collection.primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may not be null but may be emptypublic Collection<org.modeshape.jcr.JcrNodeDefinition> getMandatoryChildNodeDefinitions(Name primaryType, Set<Name> mixinTypes)
hasMandatoryChildNodeDefinitions(Name, Set)
method should first be called with the primary type and mixin types;
if that method returns true
, then this method will never return an empty collection.primaryType
- the primary type name; may not be nullmixinTypes
- the mixin type names; may not be null but may be emptypublic Collection<org.modeshape.jcr.JcrPropertyDefinition> getAutoCreatedPropertyDefinitions(Name nodeType)
creating nodes
, which only needs the
auto-created properties for the primary type. It's also used when adding a mixin
.nodeType
- the node type name; may not be nullpublic Collection<org.modeshape.jcr.JcrNodeDefinition> getAutoCreatedChildNodeDefinitions(Name nodeType)
creating nodes
, which only needs the
auto-created properties for the primary type. It's also used when adding a mixin
.nodeType
- the node type name; may not be nullpublic Collection<org.modeshape.jcr.JcrNodeType> getAllNodeTypes()
public Set<Name> getAllNodeTypeNames()
public Collection<org.modeshape.jcr.JcrNodeType> getMixinNodeTypes()
getPrimaryNodeTypes()
public boolean isMixin(Name nodeTypeName)
nodeTypeName
- the name of the node typepublic Collection<org.modeshape.jcr.JcrNodeType> getPrimaryNodeTypes()
getMixinNodeTypes()
public org.modeshape.jcr.JcrPropertyDefinition getPropertyDefinition(org.modeshape.jcr.PropertyDefinitionId id)
public Collection<org.modeshape.jcr.JcrPropertyDefinition> getAllPropertyDefinitions()
public org.modeshape.jcr.JcrNodeDefinition getChildNodeDefinition(org.modeshape.jcr.NodeDefinitionId id)
public boolean isQueryable(Name nodeTypeName, Set<Name> mixinTypes)
nodeTypeName
- a Name
, never null
mixinTypes
- the mixin type names; may not be null but may be emptyfalse
if at least one of the node types is not queryable, true
otherwiseprotected final org.modeshape.jcr.JcrNodeDefinition findChildNodeDefinitionForUnstructured()
protected org.modeshape.jcr.JcrNodeType findTypeInMapOrList(Name typeName, Collection<org.modeshape.jcr.JcrNodeType> pendingList)
typeName
- the name of the type to retrievependingList
- a collection of types that have passed validation but have not yet been committed to the repositorypendingList
if it exists in the collection or from the
registered types
if it exists there; may be nullprotected List<org.modeshape.jcr.JcrNodeType> supertypesFor(NodeTypeDefinition nodeType, Collection<org.modeshape.jcr.JcrNodeType> pendingTypes) throws RepositoryException
nodeType
- a node type with a non-null array of supertypespendingTypes
- the list of types that have been processed in this type batch but not yet committed to the repository's
set of typesRepositoryException
- if any of the names in the array of supertype names does not correspond to an
already-registered node type or a node type that is pending registrationprotected void validate(org.modeshape.jcr.JcrNodeType nodeType, List<org.modeshape.jcr.JcrNodeType> supertypes, List<org.modeshape.jcr.JcrNodeType> pendingTypes) throws RepositoryException
nodeType
- the node type to attempt to validatesupertypes
- the names of the supertypes of the node typependingTypes
- the list of types previously registered in this batch but not yet committed to the repositoryRepositoryException
- if the given node type template is not validCopyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.