org.apache.jackrabbit.core.version
Class NodeStateEx

java.lang.Object
  extended by org.apache.jackrabbit.core.version.NodeStateEx

public class NodeStateEx
extends Object

This Class provides some basic node operations directly on the node state.


Constructor Summary
NodeStateEx(UpdatableItemStateManager stateMgr, NodeTypeRegistry ntReg, NodeState nodeState, Name name)
          Creates a new persistent node
 
Method Summary
 NodeStateEx addNode(Name nodeName, Name nodeTypeName, NodeId id, boolean referenceable)
          Adds a new child node with the given name
 void copyFrom(PropertyImpl prop)
          copies a property
 NodeStateEx[] getChildNodes()
          returns all child nodes
 EffectiveNodeType getEffectiveNodeType()
          Returns the effective (i.e. merged and resolved) node type representation of this node's primary and mixin node types.
 Name getName()
          returns the name of this node
 NodeStateEx getNode(Name name, int index)
          retrieves the child node with the given name and 1-base index or null if the node does not exist.
 NodeId getNodeId()
          Returns the id of this node.
 NodeId getParentId()
          Returns the parent id of this node
 PropertyState[] getProperties()
          Returns the properties of this node
 InternalValue getPropertyValue(Name name)
          Returns the value of the given property or null
 InternalValue[] getPropertyValues(Name name)
          Returns the values of the given property of null
 NodeState getState()
          Returns the underlaying node state.
 boolean hasNode(Name name)
          checks if the given child node exists.
 boolean hasProperty(Name name)
          Checks if the given property exists
 void reload()
          reloads the persistent state recursively
 boolean removeNode(Name name)
          removes the (first) child node with the given name.
 boolean removeNode(Name name, int index)
          removes the child node with the given name and 1-based index
 boolean removeProperty(Name name)
          removes the property with the given name
 void setPropertyValue(Name name, InternalValue value)
          Sets the property value
 void setPropertyValues(Name name, int type, InternalValue[] values)
          Sets the property values
 void setPropertyValues(Name name, int type, InternalValue[] values, boolean multiple)
          Sets the property values
 void store()
          stores the persistent state recursively
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeStateEx

public NodeStateEx(UpdatableItemStateManager stateMgr,
                   NodeTypeRegistry ntReg,
                   NodeState nodeState,
                   Name name)
Creates a new persistent node

Parameters:
stateMgr -
nodeState -
Method Detail

getName

public Name getName()
returns the name of this node

Returns:
the name of this node

getNodeId

public NodeId getNodeId()
Returns the id of this node.

Returns:
the id of this node.

getParentId

public NodeId getParentId()
Returns the parent id of this node

Returns:
the parent id of this node

getState

public NodeState getState()
Returns the underlaying node state.

Returns:
the underlaying node state.

getProperties

public PropertyState[] getProperties()
                              throws ItemStateException
Returns the properties of this node

Returns:
the properties of this node
Throws:
ItemStateException

hasProperty

public boolean hasProperty(Name name)
Checks if the given property exists

Parameters:
name -
Returns:
true if the given property exists.

getPropertyValues

public InternalValue[] getPropertyValues(Name name)
Returns the values of the given property of null

Parameters:
name -
Returns:
the values of the given property.

getPropertyValue

public InternalValue getPropertyValue(Name name)
Returns the value of the given property or null

Parameters:
name -
Returns:
the value of the given property.

setPropertyValue

public void setPropertyValue(Name name,
                             InternalValue value)
                      throws RepositoryException
Sets the property value

Parameters:
name -
value -
Throws:
RepositoryException

setPropertyValues

public void setPropertyValues(Name name,
                              int type,
                              InternalValue[] values)
                       throws RepositoryException
Sets the property values

Parameters:
name -
type -
values -
Throws:
RepositoryException

setPropertyValues

public void setPropertyValues(Name name,
                              int type,
                              InternalValue[] values,
                              boolean multiple)
                       throws RepositoryException
Sets the property values

Parameters:
name -
type -
values -
Throws:
RepositoryException

getEffectiveNodeType

public EffectiveNodeType getEffectiveNodeType()
                                       throws RepositoryException
Returns the effective (i.e. merged and resolved) node type representation of this node's primary and mixin node types.

Returns:
the effective node type
Throws:
RepositoryException

hasNode

public boolean hasNode(Name name)
checks if the given child node exists.

Parameters:
name -
Returns:
true if the given child exists.

removeNode

public boolean removeNode(Name name)
                   throws RepositoryException
removes the (first) child node with the given name.

Parameters:
name -
Returns:
true if the child was removed
Throws:
RepositoryException

removeNode

public boolean removeNode(Name name,
                          int index)
                   throws RepositoryException
removes the child node with the given name and 1-based index

Parameters:
name -
index -
Returns:
true if the child was removed.
Throws:
RepositoryException

removeProperty

public boolean removeProperty(Name name)
                       throws RepositoryException
removes the property with the given name

Parameters:
name -
Returns:
true if the property was removed.
Throws:
RepositoryException

getNode

public NodeStateEx getNode(Name name,
                           int index)
                    throws RepositoryException
retrieves the child node with the given name and 1-base index or null if the node does not exist.

Parameters:
name -
index -
Returns:
the node state.
Throws:
RepositoryException

addNode

public NodeStateEx addNode(Name nodeName,
                           Name nodeTypeName,
                           NodeId id,
                           boolean referenceable)
                    throws NoSuchNodeTypeException,
                           ConstraintViolationException,
                           RepositoryException
Adds a new child node with the given name

Parameters:
nodeName -
nodeTypeName -
Returns:
the node state
Throws:
NoSuchNodeTypeException
ConstraintViolationException
RepositoryException

getChildNodes

public NodeStateEx[] getChildNodes()
                            throws RepositoryException
returns all child nodes

Returns:
the child nodes.
Throws:
RepositoryException

store

public void store()
           throws RepositoryException
stores the persistent state recursively

Throws:
RepositoryException

reload

public void reload()
            throws RepositoryException
reloads the persistent state recursively

Throws:
RepositoryException

copyFrom

public void copyFrom(PropertyImpl prop)
              throws RepositoryException
copies a property

Parameters:
prop -
Throws:
RepositoryException


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