org.apache.jackrabbit.test.api.nodetype
Class NodeTypeUtil

java.lang.Object
  extended by org.apache.jackrabbit.test.api.nodetype.NodeTypeUtil

public class NodeTypeUtil
extends java.lang.Object

Utility class to locate item definitions in the NodeTyeManager.


Field Summary
static int ANY_PROPERTY_TYPE
           
 
Constructor Summary
NodeTypeUtil()
           
 
Method Summary
static java.lang.String getIllegalChildNodeType(javax.jcr.nodetype.NodeTypeManager manager, java.lang.String legalType)
          Returns a node type that is nor legalType nor a sub type of of
static java.lang.String getUndefinedChildNodeName(javax.jcr.nodetype.NodeType nodeType)
          Returns a name that is not defined by the nodeType's child node def
static javax.jcr.Value getValueAccordingToValueConstraints(javax.jcr.Session session, javax.jcr.nodetype.PropertyDefinition propDef, boolean satisfied)
          Returns a value according to the value contraints of a PropertyDefinition
static javax.jcr.Value getValueOfType(javax.jcr.Session session, int type)
          Returns any value of the requested type
static javax.jcr.nodetype.NodeDefinition locateChildNodeDef(javax.jcr.Session session, boolean isProtected, boolean mandatory)
          Locate a child node def parsing all node types
static javax.jcr.nodetype.NodeDefinition locateChildNodeDef(javax.jcr.Session session, boolean regardDefaultPrimaryType, boolean defaultPrimaryType, boolean residual)
          Locate a non-protected child node def parsing all node types
static javax.jcr.nodetype.PropertyDefinition locatePropertyDef(javax.jcr.Session session, boolean isProtected, boolean mandatory)
          Locate a property def parsing all node types
static javax.jcr.nodetype.PropertyDefinition locatePropertyDef(javax.jcr.Session session, int propertyType, boolean multiple, boolean isProtected, boolean constraints, boolean residual)
          Locate a property def parsing all node types
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANY_PROPERTY_TYPE

public static final int ANY_PROPERTY_TYPE
See Also:
Constant Field Values
Constructor Detail

NodeTypeUtil

public NodeTypeUtil()
Method Detail

locateChildNodeDef

public static javax.jcr.nodetype.NodeDefinition locateChildNodeDef(javax.jcr.Session session,
                                                                   boolean regardDefaultPrimaryType,
                                                                   boolean defaultPrimaryType,
                                                                   boolean residual)
                                                            throws javax.jcr.RepositoryException
Locate a non-protected child node def 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:
javax.jcr.RepositoryException

locateChildNodeDef

public static javax.jcr.nodetype.NodeDefinition locateChildNodeDef(javax.jcr.Session session,
                                                                   boolean isProtected,
                                                                   boolean mandatory)
                                                            throws javax.jcr.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:
javax.jcr.RepositoryException

locatePropertyDef

public static javax.jcr.nodetype.PropertyDefinition locatePropertyDef(javax.jcr.Session session,
                                                                      int propertyType,
                                                                      boolean multiple,
                                                                      boolean isProtected,
                                                                      boolean constraints,
                                                                      boolean residual)
                                                               throws javax.jcr.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:
javax.jcr.RepositoryException

locatePropertyDef

public static javax.jcr.nodetype.PropertyDefinition locatePropertyDef(javax.jcr.Session session,
                                                                      boolean isProtected,
                                                                      boolean mandatory)
                                                               throws javax.jcr.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:
javax.jcr.RepositoryException

getUndefinedChildNodeName

public static java.lang.String getUndefinedChildNodeName(javax.jcr.nodetype.NodeType nodeType)
Returns a name that is not defined by the nodeType's child node def


getIllegalChildNodeType

public static java.lang.String getIllegalChildNodeType(javax.jcr.nodetype.NodeTypeManager manager,
                                                       java.lang.String legalType)
                                                throws javax.jcr.RepositoryException
Returns a node type that is nor legalType nor a sub type of of

Throws:
javax.jcr.RepositoryException

getValueOfType

public static javax.jcr.Value getValueOfType(javax.jcr.Session session,
                                             int type)
                                      throws javax.jcr.ValueFormatException,
                                             java.lang.UnsupportedOperationException,
                                             javax.jcr.RepositoryException
Returns any value of the requested type

Throws:
javax.jcr.ValueFormatException
java.lang.UnsupportedOperationException
javax.jcr.RepositoryException

getValueAccordingToValueConstraints

public static javax.jcr.Value getValueAccordingToValueConstraints(javax.jcr.Session session,
                                                                  javax.jcr.nodetype.PropertyDefinition propDef,
                                                                  boolean satisfied)
                                                           throws javax.jcr.ValueFormatException,
                                                                  javax.jcr.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:
javax.jcr.ValueFormatException
javax.jcr.RepositoryException


Copyright © 2004-2010 Apache Software Foundation. All Rights Reserved.