|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.jcr2spi.hierarchy.NodeEntryImpl
public class NodeEntryImpl
NodeEntryImpl implements common functionality for child
node entry implementations.
| Field Summary | |
|---|---|
protected EntryFactory |
factory
The item state factory to create the the item state. |
protected Name |
name
The name of the target item state. |
protected NodeEntryImpl |
parent
Hard reference to the parent NodeEntry. |
| Method Summary | |
|---|---|
NodeState |
addNewNodeEntry(Name nodeName,
String uniqueID,
Name primaryNodeType,
QNodeDefinition definition)
Adds a new, transient child NodeEntry |
PropertyState |
addNewPropertyEntry(Name propName,
QPropertyDefinition definition)
Add a new, transient PropertyEntry to this NodeEntry
and return the PropertyState associated with the new entry. |
NodeEntry |
addNodeEntry(Name nodeName,
String uniqueID,
int index)
Adds a new child NodeEntry to this entry. |
void |
addPropertyEntries(Collection propNames)
Adds property entries for the given Names. |
PropertyEntry |
addPropertyEntry(Name propName)
Add an existing PropertyEntry with the given name. |
void |
collectStates(ChangeLog changeLog,
boolean throwOnStale)
If the underlying state is available and transiently modified, new or stale, it gets added to the changeLog. |
boolean |
denotesNode()
Returns true. |
HierarchyEntry |
getDeepEntry(Path path)
Traverse the tree below this entry and return the child entry matching the given path. |
NodeId |
getId()
|
int |
getIndex()
|
ItemState |
getItemState()
If this HierarchyEntry has already been resolved before
(see HierarchyEntry.isAvailable()), that ItemState is returned. |
Name |
getName()
|
Iterator |
getNodeEntries()
Returns a unmodifiable iterator of NodeEntry objects
denoting the the valid child NodeEntries present on this NodeEntry. |
List |
getNodeEntries(Name nodeName)
Returns a unmodifiable List of NodeEntrys with the
specified name. |
NodeEntry |
getNodeEntry(Name nodeName,
int index)
Returns the valid NodeEntry with the specified name
and index or null if there's no matching entry. |
NodeEntry |
getNodeEntry(Name nodeName,
int index,
boolean loadIfNotFound)
Returns the valid NodeEntry with the specified name
and index or null if there's no matching entry. |
NodeState |
getNodeState()
|
NodeEntry |
getParent()
Returns the NodeEntry being parent to this
HierarchyEntry. |
Path |
getPath()
|
Iterator |
getPropertyEntries()
Returns an unmodifiable Iterator over those children that represent valid PropertyEntries. |
PropertyEntry |
getPropertyEntry(Name propName)
Returns the valid PropertyEntry with the specified name
or null if no matching entry exists. |
PropertyEntry |
getPropertyEntry(Name propName,
boolean loadIfNotFound)
Returns the valid PropertyEntry with the specified name
or null if no matching entry exists. |
int |
getStatus()
Unless this HierarchyEntry has been resolved this method
returns Status._UNDEFINED_ otherwise it returns the status of
the underlying ItemState. |
String |
getUniqueID()
|
NodeId |
getWorkspaceId()
Returns the ID that must be used for resolving this entry OR loading its children entries from the persistent layer. |
Path |
getWorkspacePath()
|
boolean |
hasNodeEntry(Name nodeName)
Determines if there is a valid NodeEntry with the
specified nodeName. |
boolean |
hasNodeEntry(Name nodeName,
int index)
Determines if there is a valid NodeEntry with the
specified name and index. |
boolean |
hasPropertyEntry(Name propName)
Determines if there is a property entry with the specified Name. |
void |
invalidate(boolean recursive)
Invalidates the underlying ItemState if available. |
boolean |
isAvailable()
Returns true if the referenced ItemState is
available. |
boolean |
isTransientlyMoved()
|
HierarchyEntry |
lookupDeepEntry(Path workspacePath)
Traverse the tree below this entry and return the child entry matching the given 'workspacePath', i.e. |
NodeEntry |
move(Name newName,
NodeEntry newParent,
boolean transientMove)
Moves this NodeEntry as new child entry of the
NodeEntry identified by newParent and/or renames
it to newName. |
void |
orderBefore(NodeEntry beforeEntry)
Reorders this NodeEntry before the sibling entry specified by the given beforeEntry. |
void |
refresh(Event childEvent)
The parent entry of a external event gets informed about the modification. |
void |
reload(boolean keepChanges,
boolean recursive)
If 'recursive' is true, the complete hierarchy below this entry is traversed and reloaded. |
void |
remove()
Removes this HierarchyEntry from its parent and sets the
status of the underlying ItemState to Status.REMOVED or to
Status.STALE_DESTROYED, respectively. |
void |
revert()
Calls HierarchyEntryImpl#revert() and moves all properties from the
attic back into th properties map. |
void |
setItemState(ItemState state)
Set the ItemState this hierarchyEntry will be resolved to. |
void |
setUniqueID(String uniqueID)
|
void |
transientRemove()
Traverses the hierarchy and marks all available item states as transiently removed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.jackrabbit.jcr2spi.hierarchy.HierarchyEntry |
|---|
getItemState, getName, getParent, getPath, getStatus, getWorkspacePath, isAvailable, setItemState |
| Field Detail |
|---|
protected Name name
protected NodeEntryImpl parent
NodeEntry.
protected final EntryFactory factory
| Method Detail |
|---|
public boolean denotesNode()
denotesNode in interface HierarchyEntryHierarchyEntry.denotesNode()public void invalidate(boolean recursive)
ItemState if available. If the
recursive flag is true, the hierarchy is traverses and
HierarchyEntry.invalidate(boolean) is called on all child entries.HierarchyEntry.reload(boolean, boolean)
this method only sets the status of this item state to Status.INVALIDATED and does not acutally update it with the persistent
state in the repository.
invalidate in interface HierarchyEntryHierarchyEntry.invalidate(boolean)
public void reload(boolean keepChanges,
boolean recursive)
reload in interface HierarchyEntryHierarchyEntry.reload(boolean, boolean)
public void revert()
throws RepositoryException
HierarchyEntryImpl#revert() and moves all properties from the
attic back into th properties map. If this HierarchyEntry has been
transiently moved, it is in addition moved back to its old parent.
Similarly reordering of child node entries is reverted.
revert in interface HierarchyEntryRepositoryException - if an error occurs.HierarchyEntry.revert()
public void transientRemove()
throws RepositoryException
Status.EXISTING_REMOVED if
the item is existing in the persistent storage or Status.REMOVED
if the item has been transiently added before. In the latter case, the
corresponding HierarchyEntries can be removed as well from their parent.
transientRemove in interface HierarchyEntryInvalidItemStateException - if this entry has been removed in the
mean time.
RepositoryException - if an error occurs while removing any of the item
states e.g. an item state is not valid anymore.HierarchyEntry.transientRemove()public void remove()
HierarchyEntryHierarchyEntry from its parent and sets the
status of the underlying ItemState to Status.REMOVED or to
Status.STALE_DESTROYED, respectively. If this entry is a
NodeEntry all descending ItemStates must get their status changed as well.
remove in interface HierarchyEntryHierarchyEntry.remove()
public void collectStates(ChangeLog changeLog,
boolean throwOnStale)
throws InvalidItemStateException
collectStates in interface HierarchyEntrychangeLog - the ChangeLog collecting the transient
item states present in a given tree.throwOnStale - If the given flag is true, this methods throws
InvalidItemStateException if this state is stale.
InvalidItemStateException - if throwOnStale is true and
this state is stale.HierarchyEntry.collectStates(ChangeLog, boolean)public NodeId getId()
getId in interface NodeEntryNodeId of this child node entry.NodeEntry.getId()public NodeId getWorkspaceId()
NodeEntrygetId() unless this entry or any of its ancestors has been
transiently moved.
getWorkspaceId in interface NodeEntryNodeEntry.getWorkspaceId()public String getUniqueID()
getUniqueID in interface NodeEntrynull if the node state cannot be
identified with a unique ID.NodeEntry.getUniqueID()public void setUniqueID(String uniqueID)
setUniqueID in interface NodeEntryNodeEntry.setUniqueID(String)public int getIndex()
getIndex in interface NodeEntryPath.INDEX_UNDEFINED is returned.NodeEntry.getIndex()
public NodeState getNodeState()
throws ItemNotFoundException,
RepositoryException
getNodeState in interface NodeEntryNodeState.
ItemNotFoundException - if the NodeState does not
exist.
RepositoryException - If an error occurs while retrieving the
NodeState.NodeEntry.getNodeState()
public HierarchyEntry getDeepEntry(Path path)
throws PathNotFoundException,
RepositoryException
NodeEntry
getDeepEntry in interface NodeEntryPathNotFoundException
RepositoryExceptionNodeEntry.getDeepEntry(Path)public HierarchyEntry lookupDeepEntry(Path workspacePath)
NodeEntrynull is return.
lookupDeepEntry in interface NodeEntrynull.NodeEntry.lookupDeepEntry(Path)public boolean hasNodeEntry(Name nodeName)
NodeEntryNodeEntry with the
specified nodeName.
hasNodeEntry in interface NodeEntrynodeName - Name object specifying a node name
true if there is a NodeEntry with
the specified nodeName.NodeEntry.hasNodeEntry(Name)
public boolean hasNodeEntry(Name nodeName,
int index)
NodeEntryNodeEntry with the
specified name and index.
hasNodeEntry in interface NodeEntrynodeName - Name object specifying a node name.index - 1-based index if there are same-name child node entries.
true if there is a NodeEntry with
the specified name and index.NodeEntry.hasNodeEntry(Name, int)
public NodeEntry getNodeEntry(Name nodeName,
int index)
throws RepositoryException
NodeEntryNodeEntry with the specified name
and index or null if there's no matching entry.
getNodeEntry in interface NodeEntrynodeName - Name object specifying a node name.index - 1-based index if there are same-name child node entries.
NodeEntry with the specified name and index
or null if there's no matching entry.
RepositoryException - If an unexpected error occurs.NodeEntry.getNodeEntry(Name, int)
public NodeEntry getNodeEntry(Name nodeName,
int index,
boolean loadIfNotFound)
throws RepositoryException
NodeEntryNodeEntry with the specified name
and index or null if there's no matching entry. If
loadIfNotFound is true, the implementation must make
sure, that it's list of child entries is up to date and eventually
try to load the node entry.
getNodeEntry in interface NodeEntrynodeName - Name object specifying a node name.index - 1-based index if there are same-name child node entries.
NodeEntry with the specified name and index
or null if there's no matching entry.
RepositoryException - If an unexpected error occurs.NodeEntry.getNodeEntry(Name, int, boolean)
public Iterator getNodeEntries()
throws RepositoryException
NodeEntryNodeEntry objects
denoting the the valid child NodeEntries present on this NodeEntry.
getNodeEntries in interface NodeEntryNodeEntry objects
RepositoryException - If an unexpected error occurs.NodeEntry.getNodeEntries()
public List getNodeEntries(Name nodeName)
throws RepositoryException
NodeEntryNodeEntrys with the
specified name.
getNodeEntries in interface NodeEntrynodeName - name of the child node entries that should be returned
NodeEntry objects
RepositoryException - If an unexpected error occurs.NodeEntry.getNodeEntries(Name)
public NodeEntry addNodeEntry(Name nodeName,
String uniqueID,
int index)
throws RepositoryException
NodeEntry
addNodeEntry in interface NodeEntryNodeEntry
RepositoryException - If an unexpected error occurs.NodeEntry.addNodeEntry(Name, String, int)
public NodeState addNewNodeEntry(Name nodeName,
String uniqueID,
Name primaryNodeType,
QNodeDefinition definition)
throws RepositoryException
NodeEntryNodeEntry
addNewNodeEntry in interface NodeEntryRepositoryException - If an error occurs.NodeEntry.addNewNodeEntry(Name, String, Name, QNodeDefinition)public boolean hasPropertyEntry(Name propName)
NodeEntryName.
hasPropertyEntry in interface NodeEntrypropName - Name object specifying a property name
true if there is a property entry with the specified
Name.NodeEntry.hasPropertyEntry(Name)public PropertyEntry getPropertyEntry(Name propName)
NodeEntryPropertyEntry with the specified name
or null if no matching entry exists.
getPropertyEntry in interface NodeEntrypropName - Name object specifying a property name.
PropertyEntry with the specified name or
null if no matching entry exists.NodeEntry.getPropertyEntry(Name)
public PropertyEntry getPropertyEntry(Name propName,
boolean loadIfNotFound)
throws RepositoryException
NodeEntryPropertyEntry with the specified name
or null if no matching entry exists. If
loadIfNotFound is true, the implementation must make
sure, that it's list of property entries is up to date and eventually
try to load the property entry with the given name.
getPropertyEntry in interface NodeEntrypropName - Name object specifying a property name.
PropertyEntry with the specified name or
null if no matching entry exists.
RepositoryException - If an unexpected error occurs.NodeEntry.getPropertyEntry(Name, boolean)public Iterator getPropertyEntries()
NodeEntry
getPropertyEntries in interface NodeEntryNodeEntry.getPropertyEntries()
public PropertyEntry addPropertyEntry(Name propName)
throws ItemExistsException
NodeEntryPropertyEntry with the given name.
Please note the difference to NodeEntry.addNewPropertyEntry(Name, QPropertyDefinition)
which adds a new, transient entry.
addPropertyEntry in interface NodeEntryPropertyEntry
ItemExistsException - if a child item exists with the given nameNodeEntry.addPropertyEntry(Name)
public void addPropertyEntries(Collection propNames)
throws ItemExistsException,
RepositoryException
NodeEntryNames. It depends on
the status of this NodeEntry, how conflicts are resolved
and whether or not existing entries that are missing in the iterator
get removed.
addPropertyEntries in interface NodeEntryItemExistsException
RepositoryException - if an unexpected error occurs.NodeEntry.addPropertyEntries(Collection)
public PropertyState addNewPropertyEntry(Name propName,
QPropertyDefinition definition)
throws ItemExistsException,
RepositoryException
NodeEntryPropertyEntry to this NodeEntry
and return the PropertyState associated with the new entry.
addNewPropertyEntry in interface NodeEntryItemExistsException
RepositoryException - if an unexpected error occurs.NodeEntry.addNewPropertyEntry(Name, QPropertyDefinition)
public void orderBefore(NodeEntry beforeEntry)
throws RepositoryException
NodeEntrybeforeEntry.
orderBefore in interface NodeEntrybeforeEntry - the child node where to insert the node before. If
null this entry is moved to the end of its parents child node entries.
RepositoryException - If an unexpected error occurs.NodeEntry.orderBefore(NodeEntry)
public NodeEntry move(Name newName,
NodeEntry newParent,
boolean transientMove)
throws RepositoryException
NodeEntryNodeEntry as new child entry of the
NodeEntry identified by newParent and/or renames
it to newName. If transientMove is true, an
implementation must make sure, that reverting this modification by calling
HierarchyEntry.revert() on the common ancestor of both parents
moves this NodeEntry back and resets the name to its original value.
move in interface NodeEntryRepositoryException - If the entry to be moved is not a child of this
NodeEntry or if an unexpected error occurs.NodeEntry.move(Name, NodeEntry, boolean)public boolean isTransientlyMoved()
isTransientlyMoved in interface NodeEntryNodeEntry is transiently moved.NodeEntry.isTransientlyMoved()public void refresh(Event childEvent)
NodeEntryEvent.getParentId() of the given childEvent must point
to this NodeEntry.
refresh in interface NodeEntrychildEvent - NodeEntry.refresh(Event)public Name getName()
getName in interface HierarchyEntryHierarchyEntry.getName()
public Path getPath()
throws RepositoryException
getPath in interface HierarchyEntryRepositoryExceptionHierarchyEntry.getPath()
public Path getWorkspacePath()
throws RepositoryException
getWorkspacePath in interface HierarchyEntryHierarchyEntry.getPath(). In case of moved items this method return the
original path as it is present on the persistent layer.
RepositoryExceptionHierarchyEntry.getWorkspacePath()public NodeEntry getParent()
HierarchyEntryNodeEntry being parent to this
HierarchyEntry.
getParent in interface HierarchyEntryHierarchyEntryHierarchyEntry.getParent()public int getStatus()
HierarchyEntryHierarchyEntry has been resolved this method
returns Status._UNDEFINED_ otherwise it returns the status of
the underlying ItemState.
getStatus in interface HierarchyEntryStatus._UNDEFINED_ if this
entry has not been resolved yet.HierarchyEntry.getStatus()public boolean isAvailable()
HierarchyEntrytrue if the referenced ItemState is
available. That is, the referenced ItemState has already
been resolved.
isAvailable in interface HierarchyEntrytrue if the ItemState is available;
otherwise false.HierarchyEntry.isAvailable()
public ItemState getItemState()
throws ItemNotFoundException,
RepositoryException
HierarchyEntry has already been resolved before
(see HierarchyEntry.isAvailable()), that ItemState is returned.
Note however, that the validity of the State is not asserted.ItemState
or if the corresponding state has been removed in the mean time.
getItemState in interface HierarchyEntryItemState.
ItemNotFoundException - if the ItemState does not
exist anymore.
RepositoryException - If an error occurs while retrieving the
ItemState.HierarchyEntry.getItemState()public void setItemState(ItemState state)
setItemState in interface HierarchyEntryHierarchyEntry.setItemState(ItemState)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||