wt.lifecycle
Class LifeCycleHelper

java.lang.Object
  extended bywt.lifecycle.LifeCycleHelper
All Implemented Interfaces:
Externalizable, Serializable

public class LifeCycleHelper
extends Object
implements Externalizable

LifeCycleHelper provides client invokable methods to life cycle services. These methods are executed on the client side.

Supported API: true

Extendable: false

See Also:
Serialized Form

Field Summary
static String ALL
          Transition initialization directive identifying all states in a sequence (life cycle).
private static String CLASSNAME
           
private static Set deterministicTransitions
           
static long EXTERNALIZATION_VERSION_UID
           
static String FIRST
          Transition initialization directive identifying the first state in a sequence (life cycle).
private static String INIT_PROPERTY_PREFIX
           
static String LAST
          Transition initialization directive identifying the last state in a sequence (life cycle).
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
static LifeCycleService service
          

Supported API: false
private static Map transitionDirectives
           
private static boolean VERBOSE
           
 
Constructor Summary
LifeCycleHelper()
           
 
Method Summary
static Map getDefaultTransitions(List states, int index)
          Returns a map of the default transitions for the state at the specified index in the specified list.
private static Set getDefaultTransitions(Set stateSet, ArrayList stateList, int index, List transitionDirectives)
          Returns the set of states computed for the first applicable transition directive.
private static Set getDefaultTransitions(Set stateSet, ArrayList stateList, int index, Object transitionDirective)
          Returns the set of states computed for the specified transition directive.
private static Set getDefaultTransitions(Set stateSet, ArrayList stateList, int index, Set transitionDirectives)
          Returns the union of the sets of states computed for each list of transition directives.
private static Object getTransitionDirective(String token)
          Returns a transition initialization directive specified by the argument token.
private static List getTransitionDirectiveList(String tokenString)
          Returns a list of transition directives, parsed from the argument token string.
private static Map getTransitionDirectives(WTProperties wtProperties)
          Returns a map of transitions to sets of lists of transition directives as specified in the WTProperties object.
private static Set getTransitionDirectiveSet(String tokenString)
          Returns a set of lists of transition directives, parsed from the argument token string.
static boolean isDeterministic(Transition transition)
          Returns true if the argrument transition is among those specified in the system configuration to be deterministic and false otherwise.
static boolean isFinalPhase(PhaseTemplate aPhaseTemplate)
          Answers whether the PhaseTemplate is a final phase

Supported API: true
(package private) static WhereExpression noTransition(FromClause fc, int lctIdx)
          Returns a WHERE expression that selects a row from the argument FROM clause of a life cycle template query if the template does not have associated with it any transitions other than NEXT.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(LifeCycleHelper thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
static LifeCycleManaged setLifeCycle(LifeCycleManaged object, LifeCycleTemplate lifeCycle)
          Set the LifeCycle of the LifeCycleManaged object and clear out the rest of the Life Cycle cookie.
static LifeCycleManaged setLifeCycle(LifeCycleManaged object, LifeCycleTemplateReference lctRef)
          Set the LifeCycle of the LifeCycleManaged object.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

ALL

public static final String ALL
Transition initialization directive identifying all states in a sequence (life cycle).

Supported API: true

See Also:
Constant Field Values

FIRST

public static final String FIRST
Transition initialization directive identifying the first state in a sequence (life cycle).

Supported API: true

See Also:
Constant Field Values

LAST

public static final String LAST
Transition initialization directive identifying the last state in a sequence (life cycle).

Supported API: true

See Also:
Constant Field Values

INIT_PROPERTY_PREFIX

private static final String INIT_PROPERTY_PREFIX
See Also:
Constant Field Values

deterministicTransitions

private static Set deterministicTransitions

transitionDirectives

private static Map transitionDirectives

service

public static final LifeCycleService service


Supported API: false


serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE
Constructor Detail

LifeCycleHelper

public LifeCycleHelper()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(LifeCycleHelper thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

isFinalPhase

public static boolean isFinalPhase(PhaseTemplate aPhaseTemplate)
                            throws WTException
Answers whether the PhaseTemplate is a final phase

Supported API: true

Parameters:
aPhaseTemplate - phase template that is being evaluated
Returns:
boolean
Throws:
WTException

setLifeCycle

public static LifeCycleManaged setLifeCycle(LifeCycleManaged object,
                                            LifeCycleTemplate lifeCycle)
                                     throws LifeCycleException,
                                            WTPropertyVetoException
Set the LifeCycle of the LifeCycleManaged object and clear out the rest of the Life Cycle cookie. If the object is already persisted, this method will throw an exception.

Supported API: true

Parameters:
object - the LifeCycleManaged object whose life cycle will be set
lifeCycle - the LifeCycle to be set on the LifeCycleManaged object.
Returns:
LifeCycleManaged
Throws:
LifeCycleException
WTPropertyVetoException

setLifeCycle

public static LifeCycleManaged setLifeCycle(LifeCycleManaged object,
                                            LifeCycleTemplateReference lctRef)
                                     throws WTException,
                                            LifeCycleException,
                                            WTPropertyVetoException
Set the LifeCycle of the LifeCycleManaged object. If the object is already persisted, this method will throw an exception.

Supported API: true

Parameters:
object - the LifeCycleManaged object whose life cycle should be set
lctRef - the LifeCycleReference of the LifeCycle that should be set on the LifeCycleManaged object.
Returns:
LifeCycleManaged
Throws:
WTException
LifeCycleException
WTPropertyVetoException

isDeterministic

public static boolean isDeterministic(Transition transition)
Returns true if the argrument transition is among those specified in the system configuration to be deterministic and false otherwise. A transition is deterministic if it is permitted to be used at most once for a given source state.

Supported API: true

Parameters:
transition - the Transition whose configuration as deterministic is to be determined
Returns:
boolean

getDefaultTransitions

public static Map getDefaultTransitions(List states,
                                        int index)
                                 throws LifeCycleException
Returns a map of the default transitions for the state at the specified index in the specified list. The map's keys are Transition instances; its values are sets of applicable destination states

Supported API: false

Parameters:
states - list of states intended (though not required) to represent the sequence of unique states in a defined life cycle template; may not contain duplicates
index - index of a state in the List argument for which the default transitions are to be determined
Returns:
Map
Throws:
LifeCycleException

noTransition

static WhereExpression noTransition(FromClause fc,
                                    int lctIdx)
                             throws QueryException
Returns a WHERE expression that selects a row from the argument FROM clause of a life cycle template query if the template does not have associated with it any transitions other than NEXT.

Supported API: false

Parameters:
fc - FROM clause of a query spec for a life cycle template (wt.lifecycle.LifeCycleTemplate)
lctIdx - index of the life cycle template (wt.lifecycle.LifeCycleTemplate) in the argument FROM clause
Returns:
WhereExpression
Throws:
QueryException

getTransitionDirectives

private static Map getTransitionDirectives(WTProperties wtProperties)
                                    throws LifeCycleException
Returns a map of transitions to sets of lists of transition directives as specified in the WTProperties object.

Throws:
LifeCycleException

getTransitionDirectiveSet

private static Set getTransitionDirectiveSet(String tokenString)
                                      throws LifeCycleException
Returns a set of lists of transition directives, parsed from the argument token string.

Parameters:
tokenString - String of tokens specifying valid transition initialization directives
Returns:
a set of lists of transition initialization directives
Throws:
LifeCycleException - if any token is invalid
NullPointerException - if tokenString is null

getTransitionDirectiveList

private static List getTransitionDirectiveList(String tokenString)
                                        throws LifeCycleException
Returns a list of transition directives, parsed from the argument token string.

Parameters:
tokenString - String of tokens specifying valid transition initialization directives
Returns:
a list of transition initialization directives
Throws:
LifeCycleException - if any token is invalid
NullPointerException - if tokenString is null

getTransitionDirective

private static Object getTransitionDirective(String token)
                                      throws LifeCycleException
Returns a transition initialization directive specified by the argument token.

Parameters:
token - the parsed token specifying a valid transition initialization directive
Returns:
a transition initialization directive
Throws:
LifeCycleException - if the argument token is invalid
NullPointerException - if token is null

getDefaultTransitions

private static Set getDefaultTransitions(Set stateSet,
                                         ArrayList stateList,
                                         int index,
                                         Set transitionDirectives)
Returns the union of the sets of states computed for each list of transition directives.


getDefaultTransitions

private static Set getDefaultTransitions(Set stateSet,
                                         ArrayList stateList,
                                         int index,
                                         List transitionDirectives)
Returns the set of states computed for the first applicable transition directive.


getDefaultTransitions

private static Set getDefaultTransitions(Set stateSet,
                                         ArrayList stateList,
                                         int index,
                                         Object transitionDirective)
Returns the set of states computed for the specified transition directive.