org.apache.jackrabbit.core.nodetype
Class EffectiveNodeType

java.lang.Object
  extended byorg.apache.jackrabbit.core.nodetype.EffectiveNodeType
All Implemented Interfaces:
Cloneable

public class EffectiveNodeType
extends Object
implements Cloneable

An EffectiveNodeType represents one or more NodeTypes as one 'effective' node type where inheritance is resolved.

Instances of EffectiveNodeType are immutable.


Method Summary
 void checkAddNodeConstraints(QName name)
           
 void checkAddNodeConstraints(QName name, QName nodeTypeName)
           
 void checkRemoveItemConstraints(QName name)
           
 void checkRequiredPrimaryType(QName nodeTypeName, QName[] requiredPrimaryTypes)
           
static void checkSetPropertyValueConstraints(PropDef pd, InternalValue[] values)
          Tests if the value constraints defined in the property definition pd are satisfied by the the specified values.
protected  Object clone()
           
static EffectiveNodeType create(NodeTypeRegistry ntReg, NodeTypeDef ntd)
          Factory method: creates an effective node type representation of a node type definition.
 ItemDef[] getAllItemDefs()
           
 NodeDef[] getAllNodeDefs()
           
 QName[] getAllNodeTypes()
           
 PropDef[] getAllPropDefs()
           
 NodeDef getApplicableChildNodeDef(QName name, QName nodeTypeName)
          Returns the applicable child node definition for a child node with the specified name and node type.
 PropDef getApplicablePropertyDef(QName name, int type)
          Returns the applicable property definition for a property with the specified name and type.
 PropDef getApplicablePropertyDef(QName name, int type, boolean multiValued)
          Returns the applicable property definition for a property with the specified name, type and multiValued characteristic.
 NodeDef[] getAutoCreateNodeDefs()
           
 PropDef[] getAutoCreatePropDefs()
           
 QName[] getInheritedNodeTypes()
           
 NodeDef[] getMandatoryNodeDefs()
           
 PropDef[] getMandatoryPropDefs()
           
 QName[] getMergedNodeTypes()
           
 ItemDef[] getNamedItemDefs()
           
 ItemDef[] getNamedItemDefs(QName name)
           
 NodeDef[] getNamedNodeDefs()
           
 NodeDef[] getNamedNodeDefs(QName name)
           
 PropDef[] getNamedPropDefs()
           
 PropDef[] getNamedPropDefs(QName name)
           
 ItemDef[] getUnnamedItemDefs()
           
 NodeDef[] getUnnamedNodeDefs()
           
 PropDef[] getUnnamedPropDefs()
           
 boolean hasNamedItemDef(QName name)
           
 boolean includesNodeType(QName nodeTypeName)
          Determines whether this effective node type representation includes (either through inheritance or aggregation) the given node type.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static EffectiveNodeType create(NodeTypeRegistry ntReg,
                                       NodeTypeDef ntd)
                                throws NodeTypeConflictException,
                                       NoSuchNodeTypeException
Factory method: creates an effective node type representation of a node type definition. Whereas all referenced node types must exist (i.e. must be registered), the definition itself is not required to be registered.

Parameters:
ntReg -
ntd -
Returns:
Throws:
NodeTypeConflictException
NoSuchNodeTypeException

getMergedNodeTypes

public QName[] getMergedNodeTypes()

getInheritedNodeTypes

public QName[] getInheritedNodeTypes()

getAllNodeTypes

public QName[] getAllNodeTypes()

getAllItemDefs

public ItemDef[] getAllItemDefs()

getNamedItemDefs

public ItemDef[] getNamedItemDefs()

getUnnamedItemDefs

public ItemDef[] getUnnamedItemDefs()

hasNamedItemDef

public boolean hasNamedItemDef(QName name)

getNamedItemDefs

public ItemDef[] getNamedItemDefs(QName name)

getAllNodeDefs

public NodeDef[] getAllNodeDefs()

getNamedNodeDefs

public NodeDef[] getNamedNodeDefs()

getNamedNodeDefs

public NodeDef[] getNamedNodeDefs(QName name)

getUnnamedNodeDefs

public NodeDef[] getUnnamedNodeDefs()

getAutoCreateNodeDefs

public NodeDef[] getAutoCreateNodeDefs()

getAllPropDefs

public PropDef[] getAllPropDefs()

getNamedPropDefs

public PropDef[] getNamedPropDefs()

getNamedPropDefs

public PropDef[] getNamedPropDefs(QName name)

getUnnamedPropDefs

public PropDef[] getUnnamedPropDefs()

getAutoCreatePropDefs

public PropDef[] getAutoCreatePropDefs()

getMandatoryPropDefs

public PropDef[] getMandatoryPropDefs()

getMandatoryNodeDefs

public NodeDef[] getMandatoryNodeDefs()

includesNodeType

public boolean includesNodeType(QName nodeTypeName)
Determines whether this effective node type representation includes (either through inheritance or aggregation) the given node type.

Parameters:
nodeTypeName - name of node type
Returns:
true if the given node type is included, otherwise false

checkSetPropertyValueConstraints

public static void checkSetPropertyValueConstraints(PropDef pd,
                                                    InternalValue[] values)
                                             throws ConstraintViolationException,
                                                    RepositoryException
Tests if the value constraints defined in the property definition pd are satisfied by the the specified values.

Note that the protected flag is not checked. Also note that no type conversions are attempted if the type of the given values does not match the required type as specified in the given definition.

Parameters:
pd - The definiton of the property
values - An array of InternalValue objects.
Throws:
ConstraintViolationException - if the value constraints defined in the property definition are satisfied by the the specified values
RepositoryException - if another error occurs

checkAddNodeConstraints

public void checkAddNodeConstraints(QName name)
                             throws ConstraintViolationException
Parameters:
name -
Throws:
ConstraintViolationException

checkAddNodeConstraints

public void checkAddNodeConstraints(QName name,
                                    QName nodeTypeName)
                             throws ConstraintViolationException,
                                    NoSuchNodeTypeException
Parameters:
name -
nodeTypeName -
Throws:
ConstraintViolationException
NoSuchNodeTypeException

getApplicableChildNodeDef

public NodeDef getApplicableChildNodeDef(QName name,
                                         QName nodeTypeName)
                                  throws NoSuchNodeTypeException,
                                         ConstraintViolationException
Returns the applicable child node definition for a child node with the specified name and node type. If there are multiple applicable definitions named definitions will take precedence over residual definitions.

Parameters:
name -
nodeTypeName -
Returns:
Throws:
NoSuchNodeTypeException
ConstraintViolationException - if no applicable child node definition could be found

getApplicablePropertyDef

public PropDef getApplicablePropertyDef(QName name,
                                        int type,
                                        boolean multiValued)
                                 throws ConstraintViolationException
Returns the applicable property definition for a property with the specified name, type and multiValued characteristic. If there are multiple applicable definitions the following rules will be applied:

Parameters:
name -
type -
multiValued -
Returns:
Throws:
ConstraintViolationException - if no applicable property definition could be found

getApplicablePropertyDef

public PropDef getApplicablePropertyDef(QName name,
                                        int type)
                                 throws ConstraintViolationException
Returns the applicable property definition for a property with the specified name and type. The multiValued flag is not taken into account in the selection algorithm. Other than getApplicablePropertyDef(QName, int, boolean) this method does not take the multiValued flag into account in the selection algorithm. If there more than one applicable definitions then the following rules are applied:

Parameters:
name -
type -
Returns:
Throws:
ConstraintViolationException - if no applicable property definition could be found

checkRemoveItemConstraints

public void checkRemoveItemConstraints(QName name)
                                throws ConstraintViolationException
Parameters:
name -
Throws:
ConstraintViolationException

checkRequiredPrimaryType

public void checkRequiredPrimaryType(QName nodeTypeName,
                                     QName[] requiredPrimaryTypes)
                              throws ConstraintViolationException,
                                     NoSuchNodeTypeException
Parameters:
nodeTypeName -
requiredPrimaryTypes -
Throws:
ConstraintViolationException
NoSuchNodeTypeException

clone

protected Object clone()


Copyright © 2004-2006 The Apache Software Foundation. All Rights Reserved.