public abstract class ItemState extends Object
ItemState represents the state of an Item.| Modifier and Type | Class and Description |
|---|---|
static interface |
ItemState.MergeResult
A MergeResult represents the result of a
merge(ItemState, boolean)
operation. |
protected class |
ItemState.SimpleMergeResult
A SimpleMergeResult is just a holder for a modification status.
|
| Modifier | Constructor and Description |
|---|---|
protected |
ItemState(HierarchyEntry entry,
ItemStateFactory isf,
ItemDefinitionProvider definitionProvider)
Constructs an item state
|
protected |
ItemState(int initialStatus,
HierarchyEntry entry,
ItemStateFactory isf,
ItemDefinitionProvider definitionProvider)
Constructs an item state
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(ItemStateLifeCycleListener listener)
Add an
ItemStateLifeCycleListener |
HierarchyEntry |
getHierarchyEntry()
The
HierarchyEntry corresponding to this ItemState. |
abstract ItemId |
getId()
Utility method:
Returns the identifier of this item state.
|
Iterator<ItemStateLifeCycleListener> |
getListeners()
Unmodifiable iterator over the listeners present on this item state.
|
Name |
getName()
Utility method:
Returns the name of this state.
|
NodeState |
getParent()
Utility method: Shortcut for calling
'getParent().getNodeState()' on the
hierarchy entry. |
Path |
getPath()
Utility method:
Returns the path of this item state.
|
int |
getStatus()
Returns the status of this item.
|
abstract ItemId |
getWorkspaceId()
Utility method:
Returns the identifier of this item state.
|
void |
invalidate()
Invalidates this state: set its
Status to Status.INVALIDATED
if the current status is Status.EXISTING. |
abstract boolean |
isNode()
Utility method:
Determines if this item state represents a node.
|
boolean |
isValid()
Returns
true if this item state is valid and can be accessed. |
abstract ItemState.MergeResult |
merge(ItemState another,
boolean keepChanges)
Merge all data from the given state into this state.
|
void |
removeListener(ItemStateLifeCycleListener listener)
Remove an
ItemStateLifeCycleListener |
abstract boolean |
revert()
Revert all transient modifications made to this ItemState.
|
void |
setStatus(int newStatus)
Sets the new status of this item.
|
protected ItemState(HierarchyEntry entry, ItemStateFactory isf, ItemDefinitionProvider definitionProvider)
entry - isf - definitionProvider - protected ItemState(int initialStatus,
HierarchyEntry entry,
ItemStateFactory isf,
ItemDefinitionProvider definitionProvider)
entry - isf - definitionProvider - public HierarchyEntry getHierarchyEntry()
HierarchyEntry corresponding to this ItemState.HierarchyEntry corresponding to this ItemState.public boolean isValid()
true if this item state is valid and can be accessed.Status.isValid(int),
Status.isStale(int)public abstract boolean isNode()
public Name getName()
hierarchy entry.public abstract ItemId getId() throws RepositoryException
hierarchy entry.RepositoryExceptionpublic abstract ItemId getWorkspaceId() throws RepositoryException
RepositoryExceptionpublic Path getPath() throws RepositoryException
hierarchy entry.RepositoryException - if an error occurspublic NodeState getParent() throws ItemNotFoundException, RepositoryException
hierarchy entry.ItemNotFoundExceptionRepositoryExceptionpublic final int getStatus()
public void setStatus(int newStatus)
newStatus - the new statuspublic abstract ItemState.MergeResult merge(ItemState another, boolean keepChanges)
keepChanges' is true, transient modifications present on
this state are not touched. Otherwise this state is completely reset
according to the given other state.another - keepChanges - public abstract boolean revert()
public void addListener(ItemStateLifeCycleListener listener)
ItemStateLifeCycleListenerlistener - the new listener to be informed on modificationspublic void removeListener(ItemStateLifeCycleListener listener)
ItemStateLifeCycleListenerlistener - an existing listenerpublic Iterator<ItemStateLifeCycleListener> getListeners()
ItemStateLifeCycleListeners.public void invalidate()
Status to Status.INVALIDATED
if the current status is Status.EXISTING. Does nothing otherwise.Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.