|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jeceira.item.state.NodeState
Implements the GoF state pattern to manage node states.
Field Summary | |
static NodeState |
CREATED
Represents a node existing only in the transient storage of a session. |
static NodeState |
MODIFIED
Represents a node saved in a persistent storage and subsequently modified. |
static NodeState |
REMOVED
Represents a node whose removal through the current session has been saved. |
static NodeState |
REMOVED_PERSISTENT
Represents a node saved in a persistent storage and subsequently removed through the current session. |
static NodeState |
REMOVED_PERSISTENT_MODIFIED
Represents a node saved in a persistent storage, modified through the current session, and subsequently removed. |
static NodeState |
REMOVED_TRANSIENT
Represents a node removed before it has been stored persistently. |
static NodeState |
SAVED
Represents a node saved in a persistent storage. |
Constructor Summary | |
protected |
NodeState(java.lang.String stateName)
Creates a node state with the specified name. |
Method Summary | |
protected static void |
changeState(SessionNode node,
NodeState nextState)
Changes state of a node. |
protected abstract void |
changeStateOnRemoval(SessionNode node)
Performs state transition in case of removal of the corresponding node. |
protected void |
changeStateOnSave(SessionNode node,
java.util.List events,
boolean processOrderEvents)
Recursively sets the state of the specified node and its subtree after it has been successfully saved. |
protected abstract void |
doChangeStateOnSave(SessionNode node,
java.util.List events,
boolean processOrderEvents)
Sets the state of the specified node after it has been successfully saved. |
protected abstract void |
doSave(Transaction transaction,
SessionNode node,
boolean reordered)
Validates and applies changes made on the specified node through the current session. |
protected abstract void |
entry(SessionNode node)
Performs entry action of this state as a result of the state transition on the specified node. |
abstract boolean |
isModified()
Indicates if this state denotes a modified node. |
abstract boolean |
isNew()
Indicates if this state denotes a new node. |
abstract boolean |
isRemoved()
Indicates if this state denotes a removed node. |
abstract void |
modify(SessionNode node)
Marks the specified node as modified; called if the node has changed its position under the parent node. |
void |
remove(SessionNode node)
Marks the specified node and its descendants as removed through the current session. |
void |
save(SessionNode node)
Saves pending changes on the specified node and its subtree. |
protected void |
save(Transaction transaction,
SessionNode node,
boolean reordered)
Saves pending changes on the specified node and its subtree in context of a running transaction. |
static void |
setInitialState(SessionNode node)
Initializes the state of a newly created node. |
static void |
setSavedState(SessionNode node)
Initializes the state of a node retrieved from a persistent storage. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final NodeState CREATED
public static final NodeState MODIFIED
public static final NodeState REMOVED
public static final NodeState REMOVED_PERSISTENT
public static final NodeState REMOVED_PERSISTENT_MODIFIED
public static final NodeState REMOVED_TRANSIENT
public static final NodeState SAVED
Constructor Detail |
protected NodeState(java.lang.String stateName)
Method Detail |
protected static void changeState(SessionNode node, NodeState nextState)
entry(SessionNode)
method is called on the next state with the
node as an argument.
public static void setInitialState(SessionNode node)
public static void setSavedState(SessionNode node)
protected abstract void changeStateOnRemoval(SessionNode node) throws RepositoryException
RepositoryException
protected void changeStateOnSave(SessionNode node, java.util.List events, boolean processOrderEvents) throws RepositoryException
RepositoryException
protected abstract void doChangeStateOnSave(SessionNode node, java.util.List events, boolean processOrderEvents) throws RepositoryException
RepositoryException
protected abstract void doSave(Transaction transaction, SessionNode node, boolean reordered) throws RepositoryException
RepositoryException
protected abstract void entry(SessionNode node)
public abstract boolean isModified()
public abstract boolean isNew()
public abstract boolean isRemoved()
SessionNode#remove()
method was called on it and
its parent has not been saved yet.
public abstract void modify(SessionNode node)
public void remove(SessionNode node) throws RepositoryException
RepositoryException
public void save(SessionNode node) throws RepositoryException
changeStateOnSave(SessionNode, List, boolean)
method.
RepositoryException
protected void save(Transaction transaction, SessionNode node, boolean reordered) throws RepositoryException
RepositoryException
public java.lang.String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |