Class NodeTypeUtil
- java.lang.Object
-
- org.apache.jackrabbit.test.api.nodetype.NodeTypeUtil
-
public class NodeTypeUtil extends Object
Utility class to locate item definitions in the NodeTyeManager.
-
-
Field Summary
Fields Modifier and Type Field Description static int
ANY_PROPERTY_TYPE
-
Constructor Summary
Constructors Constructor Description NodeTypeUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
getIllegalChildNodeType(NodeTypeManager manager, String legalType)
Returns a node type that is nor legalType nor a sub type of ofstatic String
getUndefinedChildNodeName(NodeType nodeType)
Returns a name that is not defined by the nodeType's child node defstatic Value
getValueAccordingToValueConstraints(Session session, PropertyDefinition propDef, boolean satisfied)
Returns a value according to the value contraints of aPropertyDefinition
static Value
getValueOfType(Session session, int type)
Returns any value of the requested typestatic List<NodeDefinition>
locateAllChildNodeDef(Session session, boolean regardDefaultPrimaryType, boolean defaultPrimaryType, boolean residual)
Locate all non-protected child node def declared by a non-abstract node type parsing all node typesstatic NodeDefinition
locateChildNodeDef(Session session, boolean isProtected, boolean mandatory)
Locate a child node def parsing all node typesstatic NodeDefinition
locateChildNodeDef(Session session, boolean regardDefaultPrimaryType, boolean defaultPrimaryType, boolean residual)
Locate a non-protected child node def declared by a non-abstract node type parsing all node typesstatic PropertyDefinition
locatePropertyDef(Session session, boolean isProtected, boolean mandatory)
Locate a property def parsing all node typesstatic PropertyDefinition
locatePropertyDef(Session session, int propertyType, boolean multiple, boolean isProtected, boolean constraints, boolean residual)
Locate a property def parsing all node types
-
-
-
Field Detail
-
ANY_PROPERTY_TYPE
public static final int ANY_PROPERTY_TYPE
- See Also:
- Constant Field Values
-
-
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 typesregardDefaultPrimaryType
- if true, the default primary type of the returnedNodeDef
is according to paramdefaultPrimaryType
. If false, the returnedNodeDef
might have a default primary type or not.defaultPrimaryType
- ifregardDefaultPrimaryType
is true: if true, the returnedNodeDef
has a default primary type, else notresidual
- if true, the returnedNodeDef
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 typesregardDefaultPrimaryType
- if true, the default primary type of the returnedNodeDef
is according to paramdefaultPrimaryType
. If false, the returnedNodeDef
might have a default primary type or not.defaultPrimaryType
- ifregardDefaultPrimaryType
is true: if true, the returnedNodeDef
has a default primary type, else notresidual
- if true, the returnedNodeDef
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 typesisProtected
- if true, the returnedNodeDef
is protected, else notmandatory
- if true, the returnedNodeDef
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 typespropertyType
- the type of the returned property. -1 indicates to return a property of any type but not UNDEFIENDmultiple
- if true, the returnedPropertyDef
is multiple, else notisProtected
- if true, the returnedPropertyDef
is protected, else notresidual
- if true, the returnedPropertyDef
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 typesisProtected
- if true, the returnedPropertyDef
is protected, else notmandatory
- if true, the returnedPropertyDef
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
-
getIllegalChildNodeType
public static String getIllegalChildNodeType(NodeTypeManager manager, String legalType) throws RepositoryException
Returns a node type that is nor legalType nor a sub type of of- Throws:
RepositoryException
-
getValueOfType
public static Value getValueOfType(Session session, int type) throws ValueFormatException, UnsupportedOperationException, RepositoryException
Returns any value of the requested type
-
getValueAccordingToValueConstraints
public static Value getValueAccordingToValueConstraints(Session session, PropertyDefinition propDef, boolean satisfied) throws ValueFormatException, RepositoryException
Returns a value according to the value contraints of aPropertyDefinition
- Parameters:
propDef
- ThePropertyDefinition
whose constraints will be regardedsatisfied
- If true, the returnedValue
will satisfying the constraints - If false, the returnedValue
will not satisfying the constraints.- Returns:
- Depending on param
satisfied
aValue
satisfying or not satistying the constraints ofpropDef
will be returned. Null will be returned if no accordantValue
could be build. - Throws:
ValueFormatException
RepositoryException
-
-