Interface ContentType
-
public interface ContentType
An immutable Hippo Content Type representation providing a more relaxed and enhanced form of anEffectiveNodeType
exposing only non-residualContentTypeProperty
andContentTypeChild
elements with additional meta-data describing theseContentTypeItems
.A ContentType is always backed by an underlying EffectiveNodeType, and for all EffectiveNodeTypes a ContentType is provided. For EffectiveNodeTypes which do not have a corresponding ContentType pre-defined, a ContentType definition is automatically derived, see
isDerivedType()
.The
getProperties()
andgetChildren()
methods provides direct access to these elements, but also can be access separately by name throughgetItem(String)
Note that in case of aisDerivedType()
both a ContentTypeProperty and ContentTypeChild element may be defined by the same name, in which casegetItem(String)
will only provide access to the corresponding child element (see also JCR-2.0 5.1.8).Some pre-defined ContentTypes may represent an aggregate (
isAggregate()
) which means that the ContentType also combines one or more mixin types, besides possibly having superTypes as well. This can happen when a pre-defined ContentType is enhanced with one or more mixins after its initial definition, as well as its underlying JCR NodeType definition was created, Currently the Jackrabbit JCR repository doesn't support adding extra mixins to an existing NodeType definition, thus for ContentTypes these must be aggregated separately.ContentType definitions representing existing the EffectiveNodeType of an JCR Node instance can also be an aggregate if the Node instance has additional mixins besides its primary NodeType.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description SortedSet<String>
getAggregatedTypes()
Map<String,ContentTypeChild>
getChildren()
EffectiveNodeType
getEffectiveNodeType()
ContentTypeItem
getItem(String name)
A convenient method to directly access a definedContentTypeProperty
orContentTypeChild
element by its name.String
getName()
String
getPrefix()
Map<String,ContentTypeProperty>
getProperties()
SortedSet<String>
getSuperTypes()
default List<String>
getValidators()
boolean
isAggregate()
boolean
isCascadeValidate()
Deprecated.Use validation as offered by the hippo-services-validation module.boolean
isCompoundType()
boolean
isContentType(String contentTypeName)
boolean
isDerivedType()
boolean
isDocumentType()
boolean
isMixin()
long
version()
-
-
-
Method Detail
-
version
long version()
- Returns:
- The immutable version of the ContentTypes instance used to create this definition
-
isDerivedType
boolean isDerivedType()
- Returns:
- True if there is no ContentType definition backing this type but it only and fully is derived from the underlying EffectiveNodeType
-
isAggregate
boolean isAggregate()
- Returns:
- True if this is an aggregation of multiple ContentTypes like through a combination of ContentTypes or JCR Node Type mixins
-
getEffectiveNodeType
EffectiveNodeType getEffectiveNodeType()
- Returns:
- the immutable and aggregated or effective JCR Repository
NodeType
representation which underlies this ContentType definition
-
getName
String getName()
- Returns:
- the Qualified name of the ContentType (see also JCR-2.0 3.2.5.2); or the list of aggregated ContentType names as [
,...] if isAggregate()
- See Also:
NodeTypeDefinition.getName()
-
getPrefix
String getPrefix()
- Returns:
- The namespace prefix as used by this ContentType (derived from its name); or null if
isAggregate()
-
getSuperTypes
SortedSet<String> getSuperTypes()
- Returns:
- The natural ordered set of names of all directly or inherited parent ContentType or JCR NodeTypes for this ContentType. Never null but may be empty.
- See Also:
NodeType.getSupertypes()
-
getAggregatedTypes
SortedSet<String> getAggregatedTypes()
- Returns:
- The natural ordered set of aggregated ContentTypes or JCR NodeTypes mixins, at least containing
getName()
even if notisAggregate()
-
isContentType
boolean isContentType(String contentTypeName)
- Parameters:
contentTypeName
- The name of a ContentType- Returns:
- True if the name of this ContentType or any of its
getSuperTypes()
is equal to contentTypeName - See Also:
NodeType.isNodeType(String)
-
isDocumentType
boolean isDocumentType()
- Returns:
- True if this ContentType represents a DocumentType.
-
isCompoundType
boolean isCompoundType()
- Returns:
- True if this ContentType can only be used as compound child type within a DocumentType defining ContentType.
-
isMixin
boolean isMixin()
- Returns:
- True if this ContentType can only be used to define a Mixin on another ContentType.
- See Also:
NodeTypeDefinition.isMixin()
-
isCascadeValidate
@Deprecated boolean isCascadeValidate()
Deprecated.Use validation as offered by the hippo-services-validation module. Cascading is then obsolete.isCascadeValidate indicates whether a content item will automatically be validated when it is of this type. If the value is false, the item will not be validated; then validation will only be trigger when the field that defines it has a 'required' validator.
TODO: determine if 'true' is a proper or even meaningful ifisDerivedType()
- Returns:
- True when a content item of this type will automatically be validated
-
getProperties
Map<String,ContentTypeProperty> getProperties()
- Returns:
- The aggregated map of ContentTypeProperty elements, keyed by their property name.
- See Also:
NodeType.getChildNodeDefinitions()
-
getChildren
Map<String,ContentTypeChild> getChildren()
- Returns:
- The aggregated map of ContentTypeChild elements, keyed by their child name.
- See Also:
NodeType.getPropertyDefinitions()
-
getItem
ContentTypeItem getItem(String name)
A convenient method to directly access a definedContentTypeProperty
orContentTypeChild
element by its name.Note that a
isDerivedType()
ContentType is allowed to have both a property and child element by the same name. In that case this method will only provide access to the child element by that name (see also JCR-2.0 5.1.8). The same named property element in that case can still be accessed throughgetProperties()
.
For notisDerivedType()
ContentTypes duplicate named properties and children are not supported, so in that case this method can be relied upon to access all defined ContentTypeItem elements- Parameters:
name
- the name of a definedContentTypeProperty
orContentTypeChild
element- Returns:
- a
ContentTypeProperty
orContentTypeChild
element by that name
-
-