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 RepositoryException
stateMgr - state managerntReg - node type registrynodeId - node idRepositoryException - if the node state can't be loadedpublic Name getName()
public NodeId getNodeId()
public NodeId getParentId()
public NodeStateEx getParent() throws RepositoryException
null if root nodeRepositoryException - 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)
nullname - name of the propertypublic InternalValue getPropertyValue(Name name)
nullname - name of the propertypublic void setPropertyValue(Name name, InternalValue value) throws RepositoryException
name - name of the propertyvalue - value to setRepositoryException - if an error occurspublic void setPropertyValues(Name name, int type, InternalValue[] values) throws RepositoryException
name - name of the propertytype - property typevalues - values to setRepositoryException - if an error occurspublic PropertyState setPropertyValues(Name name, int type, InternalValue[] values, boolean multiple) throws RepositoryException
name - name of the propertytype - type of the valuesvalues - values to setmultiple - truefor MV propertiesRepositoryException - if an error occurspublic EffectiveNodeType getEffectiveNodeType() throws RepositoryException
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 RepositoryException
name - name of the nodetrue if the child was removedRepositoryException - if an error occurspublic boolean removeNode(NodeStateEx node) throws RepositoryException
node - child node to removetrue if the child was removedRepositoryException - if an error occurspublic boolean removeNode(Name name, int index) throws RepositoryException
name - name of the child nodeindex - index of the child nodetrue if the child was removed.RepositoryException - if an error occurspublic boolean removeNode(ChildNodeEntry entry) throws RepositoryException
entry - entry to removetrue if the child was removed.RepositoryException - if an error occurspublic boolean removeProperty(Name name) throws RepositoryException
name - name of the propertytrue if the property was removed.RepositoryException - if an error occurspublic NodeStateEx getNode(Name name, int index) throws RepositoryException
null if the node does not exist.name - name of the child nodeindex - index of the child nodeRepositoryException - if an error occurspublic NodeStateEx getNode(NodeId id) throws RepositoryException
id - node idRepositoryException - 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 NoSuchNodeTypeException, ConstraintViolationException, RepositoryException
nodeName - name of the new nodenodeTypeName - node type nameid - id of the new nodeNoSuchNodeTypeException - if the node type does not existConstraintViolationException - if there is a constraint violationRepositoryException - if an error occurspublic NodeStateEx addNode(Name nodeName, Name nodeTypeName, NodeId id, boolean referenceable) throws NoSuchNodeTypeException, ConstraintViolationException, RepositoryException
nodeName - name of the new nodenodeTypeName - node type nameid - id of the new nodereferenceable - if true, a UUID property is createdNoSuchNodeTypeException - if the node type does not existConstraintViolationException - if there is a constraint violationRepositoryException - if an error occurspublic void setMixins(Set<Name> mixinTypeNames) throws RepositoryException
mixinTypeNames - the mixin type namesRepositoryException - if an error occurspublic NodeStateEx moveFrom(NodeStateEx src, Name name, boolean createShare) throws RepositoryException
src - shareable source nodename - name of new nodecreateShare - if true a share is created instead.RepositoryException - if an error occurspublic NodeStateEx[] getChildNodes() throws RepositoryException
RepositoryException - if an error occurspublic void store()
throws RepositoryException
RepositoryException - if an error occurspublic void store(boolean recursively)
throws RepositoryException
recursively
flag also stores the modified child nodes recursively.recursively - whether to store the nodes recursively or just this
single node.RepositoryException - if an error occurspublic void reload()
throws RepositoryException
RepositoryException - if an error occurspublic void copyFrom(PropertyImpl prop) throws RepositoryException
prop - source propertyRepositoryException - if an error occurspublic void copyFrom(PropertyState prop) throws RepositoryException
prop - source propertyRepositoryException - if an error occurspublic QNodeDefinition getDefinition() throws RepositoryException
RepositoryException - if an error occurspublic QPropertyDefinition getDefinition(PropertyState prop) throws RepositoryException
prop - the property stateRepositoryException - if an error occurspublic boolean hasAncestor(NodeId nodeId) throws RepositoryException
nodeId - the node id of the ancestortrue if it has the indicated ancestorRepositoryException - if an error occursCopyright © 2004–2022 The Apache Software Foundation. All rights reserved.