org.jpox.state
Class LifeCycleState

java.lang.Object
  extended byorg.jpox.state.LifeCycleState

public abstract class LifeCycleState
extends java.lang.Object

Base Class representing the life cycle state. Implemented for individual states.

Version:
$Revision: 1.14 $

Field Summary
static int DETACHED_CLEAN
          Detached-Clean
static int DETACHED_DIRTY
          Detached-Dirty
static int HOLLOW
          Hollow
static int ILLEGAL_STATE
          illegal state
protected  boolean isDeleted
           
protected  boolean isDirty
           
protected  boolean isNew
           
protected  boolean isPersistent
           
protected  boolean isTransactional
           
protected static Localiser LOCALISER
           
static int P_CLEAN
          Persistent-Clean
static int P_DELETED
          Persistent-Deleted
static int P_DIRTY
          Persistent-Dirty
static int P_NEW
          Persistent-New
static int P_NEW_DELETED
          Persistent-New-Deleted
static int P_NONTRANS
          Persistent-NonTransactional
protected  int stateType
           
static int T_CLEAN
          Transaction-Clean
static int T_DIRTY
          Transaction-Dirty
static int TOTAL
          total number of states
static int TRANSIENT
          transient
 
Constructor Summary
LifeCycleState()
           
 
Method Summary
protected  LifeCycleState changeState(StateManagerImpl sm, int newStateType)
          Utility to change state to a new state.
protected  LifeCycleState changeTransientState(StateManagerImpl sm, int newStateType)
          Utility to change state to a new state.
static LifeCycleState getLifeCycleState(int stateType)
          Returns the LifeCycleState for the state constant.
 boolean isDeleted()
          Return whether the object is deleted.
 boolean isDirty()
          Return whether the object is dirty, ie has been changed (created, updated, deleted) in this Tx.
 boolean isNew()
          Return whether the object was newly created.
 boolean isPersistent()
          Return whether the object is persistent.
 boolean isTransactional()
          Return whether the object is transactional.
 int stateType()
          Returns the type of the life cycle state
abstract  java.lang.String toString()
          Method to return a string version of this object.
 LifeCycleState transitionCommit(StateManagerImpl sm, javax.jdo.Transaction tx)
          Method to transition to commit state.
 LifeCycleState transitionDeletePersistent(StateManagerImpl sm)
          Method to transition to delete persistent state.
 LifeCycleState transitionDetach(StateManagerImpl sm)
          Method to transition to detached-clean.
 LifeCycleState transitionEvict(StateManagerImpl sm)
          Method to transition to evict state.
 LifeCycleState transitionMakeNontransactional(StateManagerImpl sm)
          Method to transition to nontransactional state.
 LifeCycleState transitionMakePersistent(StateManagerImpl sm)
          Method to transition to persistent state.
 LifeCycleState transitionMakeTransactional(StateManagerImpl sm)
          Method to transition to transactional state.
 LifeCycleState transitionMakeTransient(StateManagerImpl sm, boolean useFetchPlan)
          Method to transition to transient state.
 LifeCycleState transitionReadField(StateManagerImpl sm, boolean isLoaded)
          Method to transition to read-field state.
 LifeCycleState transitionRefresh(StateManagerImpl sm)
          Method to transition to refresh state.
 LifeCycleState transitionRetrieve(StateManagerImpl sm, boolean fgOnly)
          Method to transition to retrieve state.
 LifeCycleState transitionRetrieve(StateManagerImpl sm, javax.jdo.FetchPlan fetchPlan)
          Method to transition to retrieve state.
 LifeCycleState transitionRollback(StateManagerImpl sm, javax.jdo.Transaction tx)
          Method to transition to rollback state.
 LifeCycleState transitionSerialize(StateManagerImpl sm)
          Method to transition when serialised.
 LifeCycleState transitionWriteField(StateManagerImpl sm)
          Method to transition to write-field state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER

TRANSIENT

public static final int TRANSIENT
transient

See Also:
Constant Field Values

P_NEW

public static final int P_NEW
Persistent-New

See Also:
Constant Field Values

P_CLEAN

public static final int P_CLEAN
Persistent-Clean

See Also:
Constant Field Values

P_DIRTY

public static final int P_DIRTY
Persistent-Dirty

See Also:
Constant Field Values

HOLLOW

public static final int HOLLOW
Hollow

See Also:
Constant Field Values

T_CLEAN

public static final int T_CLEAN
Transaction-Clean

See Also:
Constant Field Values

T_DIRTY

public static final int T_DIRTY
Transaction-Dirty

See Also:
Constant Field Values

P_NEW_DELETED

public static final int P_NEW_DELETED
Persistent-New-Deleted

See Also:
Constant Field Values

P_DELETED

public static final int P_DELETED
Persistent-Deleted

See Also:
Constant Field Values

P_NONTRANS

public static final int P_NONTRANS
Persistent-NonTransactional

See Also:
Constant Field Values

DETACHED_CLEAN

public static final int DETACHED_CLEAN
Detached-Clean

See Also:
Constant Field Values

DETACHED_DIRTY

public static final int DETACHED_DIRTY
Detached-Dirty

See Also:
Constant Field Values

TOTAL

public static final int TOTAL
total number of states

See Also:
Constant Field Values

ILLEGAL_STATE

public static final int ILLEGAL_STATE
illegal state

See Also:
Constant Field Values

isDirty

protected boolean isDirty

isNew

protected boolean isNew

isDeleted

protected boolean isDeleted

isTransactional

protected boolean isTransactional

isPersistent

protected boolean isPersistent

stateType

protected int stateType
Constructor Detail

LifeCycleState

public LifeCycleState()
Method Detail

getLifeCycleState

public static final LifeCycleState getLifeCycleState(int stateType)
Returns the LifeCycleState for the state constant.

Parameters:
stateType - the type as integer
Returns:
the type as LifeCycleState object

stateType

public final int stateType()
Returns the type of the life cycle state

Returns:
the type of this life cycle state

changeState

protected final LifeCycleState changeState(StateManagerImpl sm,
                                           int newStateType)
Utility to change state to a new state.

Parameters:
sm - The state manager.
newStateType - The new state
Returns:
new LifeCycle state.

changeTransientState

protected final LifeCycleState changeTransientState(StateManagerImpl sm,
                                                    int newStateType)
Utility to change state to a new state.

Parameters:
sm - The state manager.
newStateType - The new state
Returns:
new LifeCycle state.

transitionMakePersistent

public LifeCycleState transitionMakePersistent(StateManagerImpl sm)
Method to transition to persistent state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionDeletePersistent

public LifeCycleState transitionDeletePersistent(StateManagerImpl sm)
Method to transition to delete persistent state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionMakeTransactional

public LifeCycleState transitionMakeTransactional(StateManagerImpl sm)
Method to transition to transactional state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionMakeNontransactional

public LifeCycleState transitionMakeNontransactional(StateManagerImpl sm)
Method to transition to nontransactional state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionMakeTransient

public LifeCycleState transitionMakeTransient(StateManagerImpl sm,
                                              boolean useFetchPlan)
Method to transition to transient state.

Parameters:
sm - StateManager.
useFetchPlan - to make transient the fields in the fetch plan
Returns:
new LifeCycle state.

transitionCommit

public LifeCycleState transitionCommit(StateManagerImpl sm,
                                       javax.jdo.Transaction tx)
Method to transition to commit state.

Parameters:
sm - StateManager.
tx - the Transaction been committed.
Returns:
new LifeCycle state.

transitionRollback

public LifeCycleState transitionRollback(StateManagerImpl sm,
                                         javax.jdo.Transaction tx)
Method to transition to rollback state.

Parameters:
sm - StateManager.
tx - Transaction.
Returns:
new LifeCycle state.

transitionRefresh

public LifeCycleState transitionRefresh(StateManagerImpl sm)
Method to transition to refresh state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionEvict

public LifeCycleState transitionEvict(StateManagerImpl sm)
Method to transition to evict state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionReadField

public LifeCycleState transitionReadField(StateManagerImpl sm,
                                          boolean isLoaded)
Method to transition to read-field state.

Parameters:
sm - StateManager.
isLoaded - if the field was previously loaded
Returns:
new LifeCycle state.

transitionWriteField

public LifeCycleState transitionWriteField(StateManagerImpl sm)
Method to transition to write-field state.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionRetrieve

public LifeCycleState transitionRetrieve(StateManagerImpl sm,
                                         boolean fgOnly)
Method to transition to retrieve state.

Parameters:
sm - StateManager.
fgOnly - only retrieve the current fetch group fields
Returns:
new LifeCycle state.

transitionRetrieve

public LifeCycleState transitionRetrieve(StateManagerImpl sm,
                                         javax.jdo.FetchPlan fetchPlan)
Method to transition to retrieve state.

Parameters:
sm - StateManager.
fetchPlan - the fetch plan to load fields
Returns:
new LifeCycle state.

transitionDetach

public LifeCycleState transitionDetach(StateManagerImpl sm)
Method to transition to detached-clean.

Parameters:
sm - StateManager.
Returns:
new LifeCycle state.

transitionSerialize

public LifeCycleState transitionSerialize(StateManagerImpl sm)
Method to transition when serialised.

Parameters:
sm - State Manager
Returns:
The new LifeCycle state

isDirty

public final boolean isDirty()
Return whether the object is dirty, ie has been changed (created, updated, deleted) in this Tx.

Returns:
Whether the object is dirty.

isNew

public final boolean isNew()
Return whether the object was newly created.

Returns:
Whether the object is new.

isDeleted

public final boolean isDeleted()
Return whether the object is deleted.

Returns:
Whether the object is deleted.

isTransactional

public final boolean isTransactional()
Return whether the object is transactional.

Returns:
Whether the object is transactional.

isPersistent

public final boolean isPersistent()
Return whether the object is persistent.

Returns:
Whether the object is persistent.

toString

public abstract java.lang.String toString()
Method to return a string version of this object.

Returns:
String version of the object.


Copyright © -2007 . All Rights Reserved.