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 intANY_PROPERTY_TYPE
-
Constructor Summary
Constructors Constructor Description NodeTypeUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringgetIllegalChildNodeType(NodeTypeManager manager, String legalType)Returns a node type that is nor legalType nor a sub type of ofstatic StringgetUndefinedChildNodeName(NodeType nodeType)Returns a name that is not defined by the nodeType's child node defstatic ValuegetValueAccordingToValueConstraints(Session session, PropertyDefinition propDef, boolean satisfied)Returns a value according to the value contraints of aPropertyDefinitionstatic ValuegetValueOfType(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 NodeDefinitionlocateChildNodeDef(Session session, boolean isProtected, boolean mandatory)Locate a child node def parsing all node typesstatic NodeDefinitionlocateChildNodeDef(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 PropertyDefinitionlocatePropertyDef(Session session, boolean isProtected, boolean mandatory)Locate a property def parsing all node typesstatic PropertyDefinitionlocatePropertyDef(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 returnedNodeDefis according to paramdefaultPrimaryType. If false, the returnedNodeDefmight have a default primary type or not.defaultPrimaryType- ifregardDefaultPrimaryTypeis true: if true, the returnedNodeDefhas a default primary type, else notresidual- if true, the returnedNodeDefis 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 returnedNodeDefis according to paramdefaultPrimaryType. If false, the returnedNodeDefmight have a default primary type or not.defaultPrimaryType- ifregardDefaultPrimaryTypeis true: if true, the returnedNodeDefhas a default primary type, else notresidual- if true, the returnedNodeDefis 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 returnedNodeDefis protected, else notmandatory- if true, the returnedNodeDefis mandatory, else not- Returns:
- the first
NodeDeffound 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 returnedPropertyDefis multiple, else notisProtected- if true, the returnedPropertyDefis protected, else notresidual- if true, the returnedPropertyDefis of the residual name "*", else not- Returns:
- the first
PropertyDeffound 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 returnedPropertyDefis protected, else notmandatory- if true, the returnedPropertyDefis mandatory, else not- Returns:
- the first
PropertyDeffound 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- ThePropertyDefinitionwhose constraints will be regardedsatisfied- If true, the returnedValuewill satisfying the constraints - If false, the returnedValuewill not satisfying the constraints.- Returns:
- Depending on param
satisfiedaValuesatisfying or not satistying the constraints ofpropDefwill be returned. Null will be returned if no accordantValuecould be build. - Throws:
ValueFormatExceptionRepositoryException
-
-