public class NodeStateEx extends Object
Constructor and Description |
---|
NodeStateEx(UpdatableItemStateManager stateMgr,
NodeTypeRegistry ntReg,
NodeId nodeId)
Creates a new persistent node
|
NodeStateEx(UpdatableItemStateManager stateMgr,
NodeTypeRegistry ntReg,
NodeState nodeState,
Name name)
Creates a new persistent node
|
Modifier and Type | Method and Description |
---|---|
NodeStateEx |
addNode(Name nodeName,
Name nodeTypeName,
NodeId id)
Adds a new child node with the given name
|
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
|
void |
copyFrom(PropertyState prop)
copies a property
|
NodeStateEx[] |
getChildNodes()
returns all child nodes
|
QNodeDefinition |
getDefinition()
Returns the QNodeDefinition for this state
|
QPropertyDefinition |
getDefinition(PropertyState prop)
Returns the property definition for the property state
|
EffectiveNodeType |
getEffectiveNodeType()
Returns the effective (i.e.
|
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. |
NodeStateEx |
getNode(NodeId id)
Returns the node with the given id.
|
NodeId |
getNodeId()
Returns the id of this node.
|
NodeStateEx |
getParent()
Returns the parent node 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 or
null |
NodeState |
getState()
Returns the underlaying node state.
|
boolean |
hasAncestor(NodeId nodeId)
Checks if this state has the indicated ancestor
|
boolean |
hasNode(Name name)
checks if the given child node exists.
|
boolean |
hasNode(NodeId id)
Checks if the given node state exists
|
boolean |
hasProperty(Name name)
Checks if the given property exists
|
boolean |
hasProperty(PropertyId id)
Checks if the given property state exists
|
NodeStateEx |
moveFrom(NodeStateEx src,
Name name,
boolean createShare)
Moves the source node to this node using the given name.
|
void |
reload()
reloads the persistent state recursively
|
boolean |
removeNode(ChildNodeEntry entry)
removes the child node with the given child node entry
|
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 |
removeNode(NodeStateEx node)
removes the given child node
|
boolean |
removeProperty(Name name)
removes the property with the given name
|
void |
setMixins(Set<Name> mixinTypeNames)
Sets the given mixin types
|
void |
setPropertyValue(Name name,
InternalValue value)
Sets the property value
|
void |
setPropertyValues(Name name,
int type,
InternalValue[] values)
Sets the property values
|
PropertyState |
setPropertyValues(Name name,
int type,
InternalValue[] values,
boolean multiple)
Sets the property values
|
void |
store()
stores the persistent state recursively
|
void |
store(boolean recursively)
Stores the persistent state and depending on the
recursively
flag also stores the modified child nodes recursively. |
public NodeStateEx(UpdatableItemStateManager stateMgr, NodeTypeRegistry ntReg, NodeState nodeState, Name name)
stateMgr
- state managerntReg
- node type registrynodeState
- underlying node statename
- name (can be null)public NodeStateEx(UpdatableItemStateManager stateMgr, NodeTypeRegistry ntReg, NodeId nodeId) throws javax.jcr.RepositoryException
stateMgr
- state managerntReg
- node type registrynodeId
- node idjavax.jcr.RepositoryException
- if the node state can't be loadedpublic Name getName()
public NodeId getNodeId()
public NodeId getParentId()
public NodeStateEx getParent() throws javax.jcr.RepositoryException
null
if root nodejavax.jcr.RepositoryException
- if an error occurspublic NodeState getState()
public PropertyState[] getProperties() throws ItemStateException
ItemStateException
- if an error occurspublic boolean hasProperty(Name name)
name
- name of the propertytrue
if the given property exists.public InternalValue[] getPropertyValues(Name name)
null
name
- name of the propertypublic InternalValue getPropertyValue(Name name)
null
name
- name of the propertypublic void setPropertyValue(Name name, InternalValue value) throws javax.jcr.RepositoryException
name
- name of the propertyvalue
- value to setjavax.jcr.RepositoryException
- if an error occurspublic void setPropertyValues(Name name, int type, InternalValue[] values) throws javax.jcr.RepositoryException
name
- name of the propertytype
- property typevalues
- values to setjavax.jcr.RepositoryException
- if an error occurspublic PropertyState setPropertyValues(Name name, int type, InternalValue[] values, boolean multiple) throws javax.jcr.RepositoryException
name
- name of the propertytype
- type of the valuesvalues
- values to setmultiple
- true
for MV propertiesjavax.jcr.RepositoryException
- if an error occurspublic EffectiveNodeType getEffectiveNodeType() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic boolean hasNode(Name name)
name
- name of the nodetrue
if the given child exists.public boolean removeNode(Name name) throws javax.jcr.RepositoryException
name
- name of the nodetrue
if the child was removedjavax.jcr.RepositoryException
- if an error occurspublic boolean removeNode(NodeStateEx node) throws javax.jcr.RepositoryException
node
- child node to removetrue
if the child was removedjavax.jcr.RepositoryException
- if an error occurspublic boolean removeNode(Name name, int index) throws javax.jcr.RepositoryException
name
- name of the child nodeindex
- index of the child nodetrue
if the child was removed.javax.jcr.RepositoryException
- if an error occurspublic boolean removeNode(ChildNodeEntry entry) throws javax.jcr.RepositoryException
entry
- entry to removetrue
if the child was removed.javax.jcr.RepositoryException
- if an error occurspublic boolean removeProperty(Name name) throws javax.jcr.RepositoryException
name
- name of the propertytrue
if the property was removed.javax.jcr.RepositoryException
- if an error occurspublic NodeStateEx getNode(Name name, int index) throws javax.jcr.RepositoryException
null
if the node does not exist.name
- name of the child nodeindex
- index of the child nodejavax.jcr.RepositoryException
- if an error occurspublic NodeStateEx getNode(NodeId id) throws javax.jcr.RepositoryException
id
- node idjavax.jcr.RepositoryException
- if an error occurspublic boolean hasNode(NodeId id)
id
- node idtrue
if the node state existspublic boolean hasProperty(PropertyId id)
id
- property idtrue
if the property state existspublic NodeStateEx addNode(Name nodeName, Name nodeTypeName, NodeId id) throws javax.jcr.nodetype.NoSuchNodeTypeException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
nodeName
- name of the new nodenodeTypeName
- node type nameid
- id of the new nodejavax.jcr.nodetype.NoSuchNodeTypeException
- if the node type does not existjavax.jcr.nodetype.ConstraintViolationException
- if there is a constraint violationjavax.jcr.RepositoryException
- if an error occurspublic NodeStateEx addNode(Name nodeName, Name nodeTypeName, NodeId id, boolean referenceable) throws javax.jcr.nodetype.NoSuchNodeTypeException, javax.jcr.nodetype.ConstraintViolationException, javax.jcr.RepositoryException
nodeName
- name of the new nodenodeTypeName
- node type nameid
- id of the new nodereferenceable
- if true
, a UUID property is createdjavax.jcr.nodetype.NoSuchNodeTypeException
- if the node type does not existjavax.jcr.nodetype.ConstraintViolationException
- if there is a constraint violationjavax.jcr.RepositoryException
- if an error occurspublic void setMixins(Set<Name> mixinTypeNames) throws javax.jcr.RepositoryException
mixinTypeNames
- the mixin type namesjavax.jcr.RepositoryException
- if an error occurspublic NodeStateEx moveFrom(NodeStateEx src, Name name, boolean createShare) throws javax.jcr.RepositoryException
src
- shareable source nodename
- name of new nodecreateShare
- if true
a share is created instead.javax.jcr.RepositoryException
- if an error occurspublic NodeStateEx[] getChildNodes() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic void store() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic void store(boolean recursively) throws javax.jcr.RepositoryException
recursively
flag also stores the modified child nodes recursively.recursively
- whether to store the nodes recursively or just this
single node.javax.jcr.RepositoryException
- if an error occurspublic void reload() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic void copyFrom(PropertyImpl prop) throws javax.jcr.RepositoryException
prop
- source propertyjavax.jcr.RepositoryException
- if an error occurspublic void copyFrom(PropertyState prop) throws javax.jcr.RepositoryException
prop
- source propertyjavax.jcr.RepositoryException
- if an error occurspublic QNodeDefinition getDefinition() throws javax.jcr.RepositoryException
javax.jcr.RepositoryException
- if an error occurspublic QPropertyDefinition getDefinition(PropertyState prop) throws javax.jcr.RepositoryException
prop
- the property statejavax.jcr.RepositoryException
- if an error occurspublic boolean hasAncestor(NodeId nodeId) throws javax.jcr.RepositoryException
nodeId
- the node id of the ancestortrue
if it has the indicated ancestorjavax.jcr.RepositoryException
- if an error occursCopyright © 2004-2020 The Apache Software Foundation. All Rights Reserved.