Interface ITypeDescriptor

  • All Superinterfaces:
    org.apache.wicket.util.io.IClusterable, IObservable, Serializable
    All Known Implementing Classes:
    BuiltinTypeDescriptor, JavaTypeDescriptor

    public interface ITypeDescriptor
    extends org.apache.wicket.util.io.IClusterable, IObservable
    The description of a (JCR) type. The type system is based on the JCR one, but enriched with additional information for the CMS interface.

    One refinement over the JCR type system is the use of 'pseudo-types'. These types do not directly correspond to JCR types, but instead use a different type for their storage (the 'real' type). This allows additional semantics to be provided on top of simpler storage, and is usually also represented differently in the document editor.

    The mutator methods / setters can only be used in a type editing context such as the document type editor. In other cases, the type should be considered immutable and the mutator methods may not be invoked.

    • Method Detail

      • getName

        String getName()
        The name of the type. It can be used to retrieve the type from a type store.
        Returns:
        name of the type
      • getType

        String getType()
        The name of the underlying type can be different if this is a "pseudo" type. This can be used to impose additional conditions on the original type, or to associate different templates with the type.

        For type descriptors that do not correspond to current or draft versions of a namespace, the prefix will be the JCR prefix. (E.g. myproject_0_0 when version 0.1 is current)

        Returns:
        the name of the real (JCR) type
      • getSuperTypes

        List<String> getSuperTypes()
        The super types of the type. The type inherits fields from these types and the primary item, if it is defined in any of them. If the type is primitive, null will be returned.
        Returns:
        an immutable list of super types.
      • getSubTypes

        List<ITypeDescriptor> getSubTypes()
        Retrieve all types that descend from the type.
        Returns:
        an immutable list of sub types.
      • getFields

        Map<String,​IFieldDescriptor> getFields()
        The map of fields that are declared in this type of any of its super types. If the type is primitive, null will be returned.
        Returns:
        an immutable list of fields in the type
      • getDeclaredFields

        Map<String,​IFieldDescriptor> getDeclaredFields()
        The map of fields that are declared in this type. This does not include the fields that are declared in any of the super types. If the type is primitive, null will be returned.
        Returns:
        the list of fields declared in the type
      • getField

        IFieldDescriptor getField​(String key)
        Retrieve the field associated with a key.
        Parameters:
        key -
        Returns:
        the field descriptor
      • isNode

        boolean isNode()
        Is the type a compound or mixin type, corresponding to a node type. False for the primitive types or any of their pseudo variants.
        Returns:
        whether the type corresponds to a node type
      • isMixin

        boolean isMixin()
        Does the type correspond to a mixin, i.e. can it be added dynamically to a Node.
        Returns:
        whether the type corresponds to a mixin node type
      • isType

        boolean isType​(String typeName)
        Returns true if this type is typeName or a subtype of typeName, otherwise returns false.
        Parameters:
        typeName - the name of a node type.
        Returns:
        a boolean
      • getValidators

        Set<String> getValidators()
        The symbolic names for validators associated with this type.
        Returns:
        the names of applicable validators
      • isValidationCascaded

        boolean isValidationCascaded()
        Returns true if validation is cascaded, i.e. whether fields with this type are automatically validated. When false, the field needs the "required" validator to get the field value validated.
        Returns:
        whether fields of the type are automatically validated
      • setSuperTypes

        void setSuperTypes​(List<String> superTypes)
        Set the super types of the type. If the type is a mixin type, then all of the super types must be mixin types too. This should not include nt:base for node types.
        Parameters:
        superTypes - the list of super types
      • removeField

        void removeField​(String name)
                  throws TypeException
        Remove a field from the type.
        Parameters:
        name - the name of the field that is removed
        Throws:
        TypeException
      • setPrimary

        void setPrimary​(String name)
        Declare one of the fields to be the primary item. This is only valid when the field has been declared in the type, not in any of its super types. Additionally, none of the super types may have defined a primary item.
        Parameters:
        name -
      • setIsNode

        void setIsNode​(boolean isNode)
      • setIsMixin

        void setIsMixin​(boolean isMixin)
      • addValidator

        void addValidator​(String validator)
      • setIsValidationCascaded

        void setIsValidationCascaded​(boolean isCascaded)
        Parameters:
        isCascaded - are fields of this type always validated