|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jboss.dna.graph.session.GraphSession.Node<Payload,PropertyPayload>
@NotThreadSafe public static class GraphSession.Node<Payload,PropertyPayload>
Constructor Summary | |
---|---|
GraphSession.Node(GraphSession<Payload,PropertyPayload> cache,
GraphSession.Node<Payload,PropertyPayload> parent,
GraphSession.NodeId nodeId,
Location location)
|
Method Summary | |
---|---|
void |
clearChanges()
Clear any transient changes that have been accumulated in this node. |
void |
cloneNode()
Clone this node (and all nodes below it). |
boolean |
containsChangesWithExternalDependencies()
This method determines whether this node, or any nodes below it, contain changes that depend on nodes that are outside of this branch. |
void |
copyTo(GraphSession.Node<Payload,PropertyPayload> parent)
Copy this node (and all nodes below it) and place the copy under the supplied parent location. |
GraphSession.Node<Payload,PropertyPayload> |
createChild(Name name)
Create a new child node with the supplied name. |
GraphSession.Node<Payload,PropertyPayload> |
createChild(Name name,
Collection<Property> idProperties)
Create a new child node with the supplied name and multiple initial identification properties. |
GraphSession.Node<Payload,PropertyPayload> |
createChild(Name name,
Collection<Property> idProperties,
Property... remainingProperties)
Create a new child node with the supplied name and multiple initial properties. |
GraphSession.Node<Payload,PropertyPayload> |
createChild(Name name,
Property... properties)
Create a new child node with the supplied name and multiple initial properties. |
void |
destroy()
Remove this node from it's parent and destroy it's contents. |
boolean |
equals(Object obj)
|
GraphSession.Node<Payload,PropertyPayload> |
getChild(Name name,
int sns)
Get the child with the supplied name and SNS index. |
GraphSession.Node<Payload,PropertyPayload> |
getChild(Path.Segment segment)
Get the child with the supplied segment. |
Iterable<GraphSession.Node<Payload,PropertyPayload>> |
getChildren()
Get an iterator over the children. |
Iterable<GraphSession.Node<Payload,PropertyPayload>> |
getChildren(Name name)
Get an iterator over the children that have the supplied name. |
int |
getChildrenCount()
Get the number of children. |
int |
getChildrenCount(Name name)
Get the number of children that have the same supplied name. |
long |
getExpirationTimeInMillis()
Get the time when this node expires. |
GraphSession.Node<Payload,PropertyPayload> |
getFirstChild(Name name)
Get the first child matching the name and lowest SNS index |
Location |
getLocation()
Get the current location for this node. |
Name |
getName()
Get the name of this node, without any same-name-sibling index. |
GraphSession.NodeId |
getNodeId()
|
GraphSession.Node<Payload,PropertyPayload> |
getParent()
Get this node's parent node. |
Path |
getPath()
Get the current path to this node. |
Payload |
getPayload()
|
Collection<GraphSession.PropertyInfo<PropertyPayload>> |
getProperties()
Get the information for each of the properties on this node. |
GraphSession.PropertyInfo<PropertyPayload> |
getProperty(Name name)
Get from this node the property with the supplied name. |
int |
getPropertyCount()
Get the number of properties owned by this node. |
Set<Name> |
getPropertyNames()
Get the names of the properties on this node. |
Path.Segment |
getSegment()
Get the path segment for this node. |
GraphSession<Payload,PropertyPayload> |
getSession()
Get the session to which this node belongs. |
GraphSession.StructureSnapshot<PropertyPayload> |
getSnapshot(boolean pathsOnly)
Obtain a snapshot of the structure below this node. |
String |
getString(NamespaceRegistry registry)
Utility method to obtain a string representation that uses the namespace prefixes where appropriate. |
boolean |
hasChild(Name name,
int sns)
Determine whether this node has a child with the supplied name and SNS index. |
boolean |
hasChild(Path.Segment segment)
Determine whether this node has a child with the supplied name and SNS index. |
int |
hashCode()
|
boolean |
isAtOrBelow(GraphSession.Node<Payload,PropertyPayload> other)
|
boolean |
isChanged(boolean recursive)
Determine whether this node has been marked as having changes. |
boolean |
isExpired()
Determine if this node's information has expired. |
boolean |
isLeaf()
Determine if this node is a leaf node with no children. |
boolean |
isLoaded()
Determine if this node is loaded and usable. |
boolean |
isNew()
Determine whether this node has been created since the last save. |
boolean |
isRoot()
|
boolean |
isStale()
Determine whether this node is stale because it was dropped from the cache. |
void |
loadedWith(List<Location> children,
Map<Name,GraphSession.PropertyInfo<PropertyPayload>> properties,
DateTime expirationTime)
Define the persistent child information that this node is to be populated with. |
void |
markAsChanged()
Mark this node as having changes. |
void |
markAsCopied()
|
void |
markAsNew()
Mark this node has having been created and not yet saved. |
void |
moveTo(GraphSession.Node<Payload,PropertyPayload> parent)
Move this node from its current location so that is is a child of the supplied parent. |
void |
moveTo(GraphSession.Node<Payload,PropertyPayload> parent,
Name newNodeName)
Move this node from its current location so that is is a child of the supplied parent, renaming the node in the process. |
void |
onCachedNodes(GraphSession.NodeVisitor<Payload,PropertyPayload> visitor)
Visit all loaded and unloaded nodes in the cache. |
void |
onChangedNodes(GraphSession.NodeVisitor<Payload,PropertyPayload> visitor)
Visit all changed nodes in the cache. |
void |
onLoadedNodes(GraphSession.NodeVisitor<Payload,PropertyPayload> visitor)
Visit all nodes in the cache that are already loaded |
void |
orderChildBefore(Path.Segment childToBeMoved,
Path.Segment before)
Move the specified child to be located immediately before the other supplied node. |
GraphSession.PropertyInfo<PropertyPayload> |
removeProperty(Name name)
Remove a property from this node. |
void |
rename(Name newNodeName)
Rename this node to have a different name. |
void |
setPayload(Payload payload)
|
GraphSession.PropertyInfo<PropertyPayload> |
setProperty(Property property,
boolean isMultiValued,
PropertyPayload payload)
Set the supplied property information on this node. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public GraphSession.Node(GraphSession<Payload,PropertyPayload> cache, GraphSession.Node<Payload,PropertyPayload> parent, GraphSession.NodeId nodeId, Location location)
Method Detail |
---|
public GraphSession<Payload,PropertyPayload> getSession()
public final long getExpirationTimeInMillis()
Long.MAX_VALUE
if there is no expiration or if the node has not been loadedisExpired()
,
isLoaded()
public final boolean isExpired()
public final boolean isLoaded()
public void loadedWith(List<Location> children, Map<Name,GraphSession.PropertyInfo<PropertyPayload>> properties, DateTime expirationTime)
This method is intended to be called by the GraphSession.Operations#materialize(org.jboss.dna.graph.Node, Node)
, and should not be called by other components.
children
- the children for this node; may not be nullproperties
- the properties for this node; may not be nullexpirationTime
- the time that this cached information expires, or null if there is no expirationpublic final boolean isChanged(boolean recursive)
recursive
- true if the nodes under this node should be checked, or false if only this node should be checked
public final boolean isNew()
changed
.
public boolean containsChangesWithExternalDependencies()
public void clearChanges()
markAsChanged()
public final void markAsChanged()
clearChanges()
,
markAsNew()
public final void markAsCopied()
public final void markAsNew()
clearChanges()
,
markAsChanged()
public void moveTo(GraphSession.Node<Payload,PropertyPayload> parent)
parent
- the new parent for this node; may not be null
RepositorySourceException
- if the parent node is to be loaded but a problem is encountered while doing so
IllegalArgumentException
- if this is the root nodepublic void moveTo(GraphSession.Node<Payload,PropertyPayload> parent, Name newNodeName)
parent
- the new parent for this node; may not be nullnewNodeName
- the new name for the node, or null if the node should keep the same name
RepositorySourceException
- if the parent node is to be loaded but a problem is encountered while doing so
IllegalArgumentException
- if this is the root nodepublic void rename(Name newNodeName)
newNodeName
- public void copyTo(GraphSession.Node<Payload,PropertyPayload> parent)
parent
- the new parent for the new copy; may not be null
RepositorySourceException
- if the parent node is to be loaded but a problem is encountered while doing so
IllegalArgumentException
- if the parent is null, or if this is the root node
AccessControlException
- if the caller does not have the permission to perform the operationpublic void cloneNode()
parent
, and will be given the appropriate same-name-sibling index.
This is equivalent to calling node.copyTo(node.getParent())
IllegalArgumentException
- if this is the root nodepublic void orderChildBefore(Path.Segment childToBeMoved, Path.Segment before) throws PathNotFoundException
childToBeMoved
- the path segment specifying the child that is to be movedbefore
- the path segment of the node before which the childToBeMoved
should be placed, or null if the
child should be moved to the end
PathNotFoundException
- if the childToBeMoved
or before
segments do not specify an
existing child
IllegalArgumentException
- if either segment is null or does not specify an existing nodepublic void destroy()
AccessControlException
- if the caller does not have the permission to perform the operationpublic final boolean isRoot()
public boolean isStale()
public GraphSession.Node<Payload,PropertyPayload> getParent()
public final GraphSession.NodeId getNodeId()
public Name getName()
public final Path.Segment getSegment()
path segment
for this node.
public final Path getPath()
public final Location getLocation()
public GraphSession.Node<Payload,PropertyPayload> createChild(Name name)
name
- the name of the new child node
IllegalArgumentException
- if the name is null
RepositorySourceException
- if this node must be loaded but doing so results in a problempublic GraphSession.Node<Payload,PropertyPayload> createChild(Name name, Property... properties)
name
- the name of the new child nodeproperties
- the (non-identification) properties for the new node
IllegalArgumentException
- if the name or properties are null
ValidationException
- if the new node is not valid as a child
RepositorySourceException
- if this node must be loaded but doing so results in a problempublic GraphSession.Node<Payload,PropertyPayload> createChild(Name name, Collection<Property> idProperties)
name
- the name of the new child nodeidProperties
- the identification properties for the new node
IllegalArgumentException
- if the name or properties are null
ValidationException
- if the new node is not valid as a child
RepositorySourceException
- if this node must be loaded but doing so results in a problempublic GraphSession.Node<Payload,PropertyPayload> createChild(Name name, Collection<Property> idProperties, Property... remainingProperties)
name
- the name of the new child nodeidProperties
- the identification properties for the new noderemainingProperties
- the remaining (non-identification) properties for the new node
IllegalArgumentException
- if the name or properties are null
ValidationException
- if the new node is not valid as a child
RepositorySourceException
- if this node must be loaded but doing so results in a problempublic boolean hasChild(Path.Segment segment)
segment
- the segment of the child
RepositorySourceException
- if there is a problem loading this node's information from the storepublic boolean hasChild(Name name, int sns)
name
- the name of the childsns
- the same-name-sibling index; must be 1 or more
RepositorySourceException
- if there is a problem loading this node's information from the storepublic GraphSession.Node<Payload,PropertyPayload> getChild(Path.Segment segment)
segment
- the segment of the child
PathNotFoundException
- if the children have been loaded and the child does not exist
RepositorySourceException
- if there is a problem loading this node's information from the storepublic GraphSession.Node<Payload,PropertyPayload> getFirstChild(Name name)
name
- the name of the child
PathNotFoundException
- if the children have been loaded and the child does not exist
RepositorySourceException
- if there is a problem loading this node's information from the storepublic GraphSession.Node<Payload,PropertyPayload> getChild(Name name, int sns)
name
- the name of the childsns
- the same-name-sibling index; must be 1 or more
PathNotFoundException
- if the children have been loaded and the child does not exist
RepositorySourceException
- if there is a problem loading this node's information from the storepublic Iterable<GraphSession.Node<Payload,PropertyPayload>> getChildren(Name name)
name
- the of the child nodes to be returned; may not be null
RepositorySourceException
- if there is a problem loading this node's information from the storepublic Iterable<GraphSession.Node<Payload,PropertyPayload>> getChildren()
RepositorySourceException
- if there is a problem loading this node's information from the storepublic int getChildrenCount()
RepositorySourceException
- if there is a problem loading this node's information from the storepublic int getChildrenCount(Name name)
name
- the name of the children to count
RepositorySourceException
- if there is a problem loading this node's information from the storepublic boolean isLeaf()
RepositorySourceException
- if there is a problem loading this node's information from the storepublic GraphSession.PropertyInfo<PropertyPayload> getProperty(Name name)
name
- the property name; may not be null
public GraphSession.PropertyInfo<PropertyPayload> setProperty(Property property, boolean isMultiValued, PropertyPayload payload)
property
- the new property; may not be nullisMultiValued
- true if the property is multi-valuedpayload
- the optional payload for this property; may be null
AccessControlException
- if the caller does not have the permission to perform the operationpublic GraphSession.PropertyInfo<PropertyPayload> removeProperty(Name name)
name
- the name of the property to be removed; may not be null
public Set<Name> getPropertyNames()
public Collection<GraphSession.PropertyInfo<PropertyPayload>> getProperties()
public int getPropertyCount()
public boolean isAtOrBelow(GraphSession.Node<Payload,PropertyPayload> other)
public Payload getPayload()
public void setPayload(Payload payload)
payload
- Sets payload to the specified value.public final int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public String getString(NamespaceRegistry registry)
registry
- the namespace registry, or null if no prefixes should be used
public String toString()
toString
in class Object
Object.toString()
public void onLoadedNodes(GraphSession.NodeVisitor<Payload,PropertyPayload> visitor)
visitor
- the visitor; may not be nullpublic void onCachedNodes(GraphSession.NodeVisitor<Payload,PropertyPayload> visitor)
visitor
- the visitor; may not be nullpublic void onChangedNodes(GraphSession.NodeVisitor<Payload,PropertyPayload> visitor)
visitor
- the visitor; may not be nullpublic GraphSession.StructureSnapshot<PropertyPayload> getSnapshot(boolean pathsOnly)
pathsOnly
- true if the snapshot should only include paths, or false if the entire locations should be included
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |