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()
        The immutable version of the ContentTypes instance used to create this definition
      • isDerivedType

        boolean isDerivedType()
        True if there is no ContentType definition backing this type but it only and fully is derived from the underlying EffectiveNodeType
      • isAggregate

        boolean isAggregate()
        True if this is an aggregation of multiple ContentTypes like through a combination of ContentTypes or JCR Node Type mixins
      • getEffectiveNodeType

        EffectiveNodeType getEffectiveNodeType()
        the immutable and aggregated or effective JCR Repository NodeType representation which underlies this ContentType definition
      • getPrefix

        String getPrefix()
        The namespace prefix as used by this ContentType (derived from its name); or null if isAggregate()
      • getSuperTypes

        SortedSet<String> getSuperTypes()
        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:
      • getAggregatedTypes

        SortedSet<String> getAggregatedTypes()
        The natural ordered set of aggregated ContentTypes or JCR NodeTypes mixins, at least containing getName() even if not isAggregate()
      • isContentType

        boolean isContentType​(String contentTypeName)
        contentTypeName - The name of a ContentType
        True if the name of this ContentType or any of its getSuperTypes() is equal to contentTypeName
        See Also:
      • isDocumentType

        boolean isDocumentType()
        True if this ContentType represents a DocumentType.
      • isCompoundType

        boolean isCompoundType()
        True if this ContentType can only be used as compound child type within a DocumentType defining ContentType.
      • isMixin

        boolean isMixin()
        True if this ContentType can only be used to define a Mixin on another ContentType.
        See Also:
      • isCascadeValidate

        boolean isCascadeValidate()
        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()
        True when a content item of this type will automatically be validated
      • getValidators

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