wt.lifecycle
Class LifeCycleDefinitionHandler

java.lang.Object
  extended bywt.lifecycle.LifeCycleDefinitionHandler

public final class LifeCycleDefinitionHandler
extends Object

Handle the Definition of a LifeCycle Template. The LifeCycle Definition is passed in a TransactionContainer which is a structure containing a set of assertions. Each assertion contains an object and the type of update: add, remove, modify.

Supported API: false

Extendable: false


Field Summary
private static int AD_HOC_ACL_LINK
           
private static int AD_HOC_ACL_SPEC
           
private static int CRITERION
           
protected static boolean debug
           
private static int DEFAULT_CRITERION_LINK
           
private static String INITIAL_PHASE
           
private static int INITIAL_PHASE_LINK
           
private static int LIFE_CYCLE_TEMPLATE
           
private static int OTHER_BC_OBJECT
           
private static int OTHER_RBC_OBJECT
           
private static int PHASE_LINK
           
private static int PHASE_SUCCESSION_LINK
           
private static int PHASE_TEMPLATE
           
private static String RESOURCE
           
private static String SERVICE_NAME
           
private static boolean VERBOSE
           
 
Constructor Summary
LifeCycleDefinitionHandler()
           
 
Method Summary
private static void deletePhaseTemplate(PhaseTemplate pt)
          Process the deletion of a PhaseTemplate object.
private static int getTypeOfObject(Assertion asser)
          Determine the type of object in the Assertion.
private static void preValidateAssertion(Assertion asser)
          Prior to doing any processing, pre-validate the assertion.
private static void processAdHocAclLink(Assertion asser)
          Process the AdHocAclLink object's assertion.
private static void processAdHocAclSpec(Assertion asser)
          Process the AdHocAclSpec object's assertion.
private static void processAssertion(Assertion asser)
          Attempt to process the assertion.
private static void processCriterion(Assertion asser)
          Process the Criterion object's assertion.
private static void processDefaultCriterionLink(Assertion asser)
          Process the DefaultCriterion object's assertion.
private static void processInitialPhaseLink(Assertion asser)
          Process the InitialPhase link object's assertion.
private static void processLifeCycleTemplate(Assertion asser)
          Process the LifeCycleTemplate object's assertion.
protected static TransactionResult processLifeCycleTemplateTransaction(TransactionContainer aTran)
          Process the TransactionContainer.
private static void processPhaseLink(Assertion asser)
          Process the PhaseLink's link assertion.
private static void processPhaseSuccessionLink(Assertion asser)
          Process the PhaseSuccession link object's assertion.
private static void processPhaseTemplate(Assertion asser)
          Process the PhaseTemplate object's assertion.
private static void validateAdHocAclSpec(AdHocAclSpec ahas)
          Validate the AdHocAclSpec.
private static void validateAssertion(Object targetObject)
          Validate that the object remains in a valid structure.
private static void validateCriterion(Criterion c)
          Validate the Criterion.
private static void validatePhaseTemplate(PhaseTemplate pt)
          Validate the PhaseTemplate object.
 
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

LIFE_CYCLE_TEMPLATE

private static final int LIFE_CYCLE_TEMPLATE
See Also:
Constant Field Values

PHASE_TEMPLATE

private static final int PHASE_TEMPLATE
See Also:
Constant Field Values

AD_HOC_ACL_SPEC

private static final int AD_HOC_ACL_SPEC
See Also:
Constant Field Values

CRITERION

private static final int CRITERION
See Also:
Constant Field Values

PHASE_LINK

private static final int PHASE_LINK
See Also:
Constant Field Values

INITIAL_PHASE_LINK

private static final int INITIAL_PHASE_LINK
See Also:
Constant Field Values

PHASE_SUCCESSION_LINK

private static final int PHASE_SUCCESSION_LINK
See Also:
Constant Field Values

AD_HOC_ACL_LINK

private static final int AD_HOC_ACL_LINK
See Also:
Constant Field Values

DEFAULT_CRITERION_LINK

private static final int DEFAULT_CRITERION_LINK
See Also:
Constant Field Values

OTHER_BC_OBJECT

private static final int OTHER_BC_OBJECT
See Also:
Constant Field Values

OTHER_RBC_OBJECT

private static final int OTHER_RBC_OBJECT
See Also:
Constant Field Values

VERBOSE

private static final boolean VERBOSE

SERVICE_NAME

private static final String SERVICE_NAME
See Also:
Constant Field Values

INITIAL_PHASE

private static final String INITIAL_PHASE
See Also:
Constant Field Values

debug

protected static boolean debug
Constructor Detail

LifeCycleDefinitionHandler

public LifeCycleDefinitionHandler()
Method Detail

processLifeCycleTemplateTransaction

protected static TransactionResult processLifeCycleTemplateTransaction(TransactionContainer aTran)
Process the TransactionContainer. Within a single transaction, process all the assertions in the LifeCycle Definition TransactionContainer and validate that the assertions leave the LifeCycle Definition with an appropriate structure.

Parameters:
aTran - A TransactionContainer that contains a set of assertions about a LifeCycle Definition.

preValidateAssertion

private static void preValidateAssertion(Assertion asser)
                                  throws WTException
Prior to doing any processing, pre-validate the assertion. If the assertion's target object is a link & the assertion is a Replace, ERROR. If the assertion's target object is an InitialPhase & the assertion is a Remove, ERROR. If the assertion's target object is a LifeCycleTemplate & the assertion is a Remove, ERROR.

Parameters:
asser - An assertion found in the TransactionContainer that needs to be pre-validated.
Throws:
WTException

processAssertion

private static void processAssertion(Assertion asser)
                              throws WTException
Attempt to process the assertion. Process the assertion by determining the type of object it contains and then calling the appropriate method to process the object. If the type of object found in the assertion is not expected by the LifeCycleDefinitionHandler, throw a WTException.

Parameters:
asser - An assertion found in the TransactionContainer that needs to be processed.
Throws:
WTException - A WTException is thrown when the object found in the assertion is not expected by the LifeCycleDefinitionHandler.

getTypeOfObject

private static int getTypeOfObject(Assertion asser)
Determine the type of object in the Assertion. Evaluate the type of Container and the type of target object.

Parameters:
asser - The assertion whose object type needs to be determined
Returns:
int An integer representing the object class.

processLifeCycleTemplate

private static void processLifeCycleTemplate(Assertion asser)
                                      throws WTException
Process the LifeCycleTemplate object's assertion. A LifeCycleTemplate can be added or replaced.

Parameters:
asser - The assertion that contains the LifeCycleTemplate to be processed.
Throws:
WTException - An error occurred in the persistence of the LifeCycleTemplate object.

processPhaseTemplate

private static void processPhaseTemplate(Assertion asser)
                                  throws WTException
Process the PhaseTemplate object's assertion. A PhaseTemplate can be added, replaced or deleted. The deletion of a PhaseTemplate triggers the deletion of all objects and links dependent on it.

Parameters:
asser - The assertion that contains the PhaseTemplate to be processed.
Throws:
WTException - An error occurred in the persistence of the PhaseTemplate object.

processAdHocAclSpec

private static void processAdHocAclSpec(Assertion asser)
                                 throws WTException
Process the AdHocAclSpec object's assertion. An AdHocAclSpec can be added, replaced or deleted. The deletion of an AdHocAclSpec triggers the deletion of all objects and links dependent on it.

Parameters:
asser - The assertion that contains the AdHocAclSpec to be processed.
Throws:
WTException - An error occurred in the persistence of the AdHocAclSpec object.

processCriterion

private static void processCriterion(Assertion asser)
                              throws WTException
Process the Criterion object's assertion. A Criterion can be added, replaced or deleted. The deletion of a Criterion triggers the deletion of all objects and links dependent on it.

Parameters:
asser - The assertion that contains the Criterion to be processed.
Throws:
WTException - An error occurred in the persistence of the Criterion object.

processPhaseLink

private static void processPhaseLink(Assertion asser)
                              throws WTException
Process the PhaseLink's link assertion. A PhaseLink can be added, or deleted. The deletion of a PhaseLink deletes any number of links between the given LifeCycleTemplate and PhaseTemplate.

Parameters:
asser - The assertion that contains the PhaseLink to be processed.
Throws:
WTException - An error occurred in the persistence of the PhaseLink link object.

processInitialPhaseLink

private static void processInitialPhaseLink(Assertion asser)
                                     throws WTException
Process the InitialPhase link object's assertion. An InitialPhase link can only be added because it updates the object reference on the LifeCycleTemplate.

Parameters:
asser - The assertion that contains the InitialPhaseLink to be processed.
Throws:
WTException - An error occurred in the persistence of the InitialPhaseLink link object.

processPhaseSuccessionLink

private static void processPhaseSuccessionLink(Assertion asser)
                                        throws WTException
Process the PhaseSuccession link object's assertion. A PhaseSuccession link can be added, or deleted. The deletion of a PhaseSuccession link deletes any number of links found between the given fromPhaseTemplate and targetPhaseTemplate.

Parameters:
asser - The assertion that contains the PhaseSuccessionLink to be processed.
Throws:
WTException - An error occurred in the persistence of the PhaseSuccession link object.

processAdHocAclLink

private static void processAdHocAclLink(Assertion asser)
                                 throws WTException
Process the AdHocAclLink object's assertion. An AdHocAclLink can be added, or deleted. The deletion of a AdHocAclLink deletes any number of links between the given PhaseTemplate and AdHocAclSpec.

Parameters:
asser - The assertion that contains the AdHocAclLink to be processed.
Throws:
WTException - An error occurred in the persistence of the AdHocAclLink link object.

processDefaultCriterionLink

private static void processDefaultCriterionLink(Assertion asser)
                                         throws WTException
Process the DefaultCriterion object's assertion. A DefaultCriterion link can be added, or deleted. The deletion of a DefaultCriterion link deletes any number of links between the given PhaseTemplate and Criterion.

Parameters:
asser - The assertion that contains the DefaultCriterion to be processed.
Throws:
WTException - An error occurred in the persistence of the DefaultCriterion link object.

deletePhaseTemplate

private static void deletePhaseTemplate(PhaseTemplate pt)
                                 throws WTException
Process the deletion of a PhaseTemplate object. Along with deleting the PhaseTemplate, call the appropriate methods to delete all the objects and links dependent on it.

Parameters:
pt - The PhaseTemplate to be deleted.
Throws:
WTException - An error occurred in the processing of the PhaseTemplate delete.

validateAssertion

private static void validateAssertion(Object targetObject)
                               throws WTException
Validate that the object remains in a valid structure.

Parameters:
targetObject - object to validated
Throws:
WTException - A validation error was found on the object.

validatePhaseTemplate

private static void validatePhaseTemplate(PhaseTemplate pt)
                                   throws WTException
Validate the PhaseTemplate object. The following assertions are checked:

Parameters:
pt - The PhaseTemplate object to be validated.
Throws:
WTException - A validation error was found on the object.

validateAdHocAclSpec

private static void validateAdHocAclSpec(AdHocAclSpec ahas)
                                  throws WTException
Validate the AdHocAclSpec. Only 1 AdHocAclLink link is allowed from the AdHocAclSpec.

Parameters:
ahas - The AdHocAclSpec object to be validated.
Throws:
WTException - A validation error was found on the object.

validateCriterion

private static void validateCriterion(Criterion c)
                               throws WTException
Validate the Criterion. Only 1 DefaultCriterion link is allowed from the Criterion object.

Parameters:
c - The Criterion object to be validated.
Throws:
WTException - A validation error was found on the object.