Interface ContentType


  • public interface ContentType
    An immutable Hippo Content Type representation providing a more relaxed and enhanced form of an EffectiveNodeType exposing only non-residual ContentTypeProperty and ContentTypeChild elements with additional meta-data describing these ContentTypeItems.

    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() and getChildren() methods provides direct access to these elements, but also can be access separately by name through getItem(String)
    Note that in case of a isDerivedType() both a ContentTypeProperty and ContentTypeChild element may be defined by the same name, in which case getItem(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 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 not isAggregate()
      • 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 if isDerivedType()
        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()
      • getValidators

        default List<String> getValidators()
        Returns:
        The set of validators for this ContentType, may be empty but never null.
        Since:
        13.3