Class NodeTypeUtil


  • public class NodeTypeUtil
    extends Object
    Utility class to locate item definitions in the NodeTyeManager.
    • Constructor Detail

      • NodeTypeUtil

        public NodeTypeUtil()
    • Method Detail

      • locateChildNodeDef

        public static NodeDefinition locateChildNodeDef​(Session session,
                                                        boolean regardDefaultPrimaryType,
                                                        boolean defaultPrimaryType,
                                                        boolean residual)
                                                 throws RepositoryException
        Locate a non-protected child node def declared by a non-abstract node type parsing all node types
        Parameters:
        session - the session to access the node types
        regardDefaultPrimaryType - if true, the default primary type of the returned NodeDef is according to param defaultPrimaryType. If false, the returned NodeDef might have a default primary type or not.
        defaultPrimaryType - if regardDefaultPrimaryType is true: if true, the returned NodeDef has a default primary type, else not
        residual - if true, the returned NodeDef is of the residual name "*", else not
        Returns:
        Throws:
        RepositoryException
      • locateAllChildNodeDef

        public static List<NodeDefinition> locateAllChildNodeDef​(Session session,
                                                                 boolean regardDefaultPrimaryType,
                                                                 boolean defaultPrimaryType,
                                                                 boolean residual)
                                                          throws RepositoryException
        Locate all non-protected child node def declared by a non-abstract node type parsing all node types
        Parameters:
        session - the session to access the node types
        regardDefaultPrimaryType - if true, the default primary type of the returned NodeDef is according to param defaultPrimaryType. If false, the returned NodeDef might have a default primary type or not.
        defaultPrimaryType - if regardDefaultPrimaryType is true: if true, the returned NodeDef has a default primary type, else not
        residual - if true, the returned NodeDef is of the residual name "*", else not
        Returns:
        Throws:
        RepositoryException
      • locateChildNodeDef

        public static NodeDefinition locateChildNodeDef​(Session session,
                                                        boolean isProtected,
                                                        boolean mandatory)
                                                 throws RepositoryException
        Locate a child node def parsing all node types
        Parameters:
        session - the session to access the node types
        isProtected - if true, the returned NodeDef is protected, else not
        mandatory - if true, the returned NodeDef is mandatory, else not
        Returns:
        the first NodeDef found fitting the requirements
        Throws:
        RepositoryException
      • locatePropertyDef

        public static PropertyDefinition locatePropertyDef​(Session session,
                                                           int propertyType,
                                                           boolean multiple,
                                                           boolean isProtected,
                                                           boolean constraints,
                                                           boolean residual)
                                                    throws RepositoryException
        Locate a property def parsing all node types
        Parameters:
        session - the session to access the node types
        propertyType - the type of the returned property. -1 indicates to return a property of any type but not UNDEFIEND
        multiple - if true, the returned PropertyDef is multiple, else not
        isProtected - if true, the returned PropertyDef is protected, else not
        residual - if true, the returned PropertyDef is of the residual name "*", else not
        Returns:
        the first PropertyDef found fitting the requirements
        Throws:
        RepositoryException
      • locatePropertyDef

        public static PropertyDefinition locatePropertyDef​(Session session,
                                                           boolean isProtected,
                                                           boolean mandatory)
                                                    throws RepositoryException
        Locate a property def parsing all node types
        Parameters:
        session - the session to access the node types
        isProtected - if true, the returned PropertyDef is protected, else not
        mandatory - if true, the returned PropertyDef is mandatory, else not
        Returns:
        the first PropertyDef found fitting the requirements
        Throws:
        RepositoryException
      • getUndefinedChildNodeName

        public static String getUndefinedChildNodeName​(NodeType nodeType)
        Returns a name that is not defined by the nodeType's child node def
      • getValueAccordingToValueConstraints

        public static Value getValueAccordingToValueConstraints​(Session session,
                                                                PropertyDefinition propDef,
                                                                boolean satisfied)
                                                         throws ValueFormatException,
                                                                RepositoryException
        Returns a value according to the value contraints of a PropertyDefinition
        Parameters:
        propDef - The PropertyDefinition whose constraints will be regarded
        satisfied - If true, the returned Value will satisfying the constraints - If false, the returned Value will not satisfying the constraints.
        Returns:
        Depending on param satisfied a Value satisfying or not satistying the constraints of propDef will be returned. Null will be returned if no accordant Value could be build.
        Throws:
        ValueFormatException
        RepositoryException