oracle.apps.fnd.wf.engine
Class WorkItemProcess

java.lang.Object
  |
  +--oracle.apps.fnd.wf.common.Element
        |
        +--oracle.apps.fnd.wf.common.BaseComponent
              |
              +--oracle.apps.fnd.wf.engine.EngineBaseComponent
                    |
                    +--oracle.apps.fnd.wf.engine.WorkItemProcessActivity
                          |
                          +--oracle.apps.fnd.wf.engine.WorkItemProcess

public class WorkItemProcess
extends WorkItemProcessActivity

This public class represents an instance of a group of activities that forms a logical process unit. Its children are the individual activity instance created at runtime to fulfill the business logic defined by the process. It delegates the workflow functionality to an engine class. It is owned either by a WorkItem or another WorkItemProcess. It encapsulates all flow functions

startFlow
continueFlow
suspendFlow
abortFlow
resumeFlow


Field Summary
static java.lang.String RCS_ID
           
static boolean RCS_ID_RECORDED
           
 
Fields inherited from class oracle.apps.fnd.wf.engine.WorkItemProcessActivity
IGNORE, LOOP, RESET
 
Fields inherited from class oracle.apps.fnd.wf.engine.EngineBaseComponent
ACTIVE, BLOCK, CANCELLED, COMPLETE, ERROR, FORCED_COMPLETE, NOT_INITIALIZED, SUSPENDED, WAITING
 
Fields inherited from class oracle.apps.fnd.wf.common.Element
ELEMENT_DB_CREATED, ELEMENT_DB_CREATING, ELEMENT_DB_DIRTY, ELEMENT_DB_LOADED, ELEMENT_DB_LOADING, ELEMENT_DB_NOT_INITIALIZED, ELEMENT_DB_SAVED, ELEMENT_DB_SAVING
 
Constructor Summary
WorkItemProcess(java.lang.String name)
          Constructor with a name.
 
Method Summary
 void abortFlow()
          Aborts an existing this process
 void addChild(WorkItemProcessActivity pActivity)
          This method override the parent method to be sure that workitem is assigned to each child of this process.
 WorkItemProcessActivity addStartActivity(ProcessActivity processActivity)
          This method used by an engine only.
 boolean cancel(WorkflowContext pCtx, ActivityResult pActivityResult, WorkItemProcessActivity pActivity)
          Called to cancel this process.
 ActivityResult continueFlow(java.lang.String pActivityId, ActivityResult pActivityResult)
          A convenient method for continueFlow with a runtime id
 ActivityResult continueFlow(WorkItemProcessActivity pActivity, ActivityResult pActivityResult)
          Continues flow with a previously blocked activity.
 void continueFlow(WorkItemProcessActivity pActivity, java.lang.String pActivityResult)
          For backward compabilility
 ActivityResult execute(WorkflowContext pCtx, ActivityResult pActivityResult)
          Execution entry point of a process.
 Activity getActivity()
          This method override WorkItemProcessActivity to deal with root process that does not have a ProcessActivity instance
 WorkItemProcessActivity getActivityByLabel(java.lang.String pLabel)
          Get the process activity instance, identified by given design time label.
 WorkItemProcessActivity getActivityByName(java.lang.String pName)
          Get the process activity instance, identified by given runtime id It is possbile that there may be more than one instance.
 java.util.List getBlockedActivities(WorkflowContext pCtx)
          This list all current blocking activities, including those of subprocesses of this activity.
 java.util.List getInstancesByNode(ProcessActivity pProcessActivity)
          Convenient method to list all WorkItemProcessActivities for a given ProcessActivity.
 java.lang.String getName()
          Get internal name of this process
 java.util.List getPendingActivities(WorkflowContext pCtx)
          Returns a list of activity currently pending for execution.
 Process getProcess()
          Retrieve the meta defintion of this process.
 java.lang.String getProcessName()
          Return the name of process defintion
 ActivityResult handleError(WorkflowContext pCtx, java.lang.Throwable pThrowable)
          Handle errors that occurs in this process.
 void resumeFlow()
          Resume a previous suspended this process
 void retryActivity(WorkItemProcessActivity pActivity)
          Retry a blocked activity
 void skipActivity(WorkItemProcessActivity pActivity, java.lang.String pReturnCode)
          Skip a blocked activity
 ActivityResult startFlow()
          Starts a previously created flow.
 void suspendFlow()
          Suspends an existing this process
 void updateProcessStatus(WorkflowContext pCtx, ActivityResult pActivityResult)
          Force closing all pending activity.
 
Methods inherited from class oracle.apps.fnd.wf.engine.WorkItemProcessActivity
createExitTransitioins, getErrorProcess, getInstancePath, getOnRevisit, getOutTransitions, getProcessActivity, getRuntimeMsg, getWorkItemProcess, isEndActivity, isHistory
 
Methods inherited from class oracle.apps.fnd.wf.engine.EngineBaseComponent
addChild, getAttributeValue, getAttributeValues, getEndDate, getMetaType, getStartDate, getStatus, getWorkItem, isActive, isComplete, save, setAttributeValue, setAttributeValues, setMetaType, setStatus
 
Methods inherited from class oracle.apps.fnd.wf.common.BaseComponent
getChildByTypeAndName, getChildren, getChildrenByName, getChildrenByType, getParent, removeChild, removeChildren
 
Methods inherited from class oracle.apps.fnd.wf.common.Element
create, getDBStatus, getId, load, setStore, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

RCS_ID

public static final java.lang.String RCS_ID

RCS_ID_RECORDED

public static final boolean RCS_ID_RECORDED
Constructor Detail

WorkItemProcess

public WorkItemProcess(java.lang.String name)
Constructor with a name.
Parameters:
name - :String internal name of the process. It should be unique within the scope of WorkItem
Method Detail

continueFlow

public ActivityResult continueFlow(WorkItemProcessActivity pActivity,
                                   ActivityResult pActivityResult)
                            throws WorkflowException
Continues flow with a previously blocked activity.
Parameters:
pActivity - :WorkItemProcessActivity that activity from which this flow will continue
pActivityResult - :ActivityResult the return code used to continue the flow, this value dictates the route the flows out the activity
Returns:
activity:ActivityResult result from last activity
Throws:
WorkflowException - for failing assertion, or other engine errors.
java.lang.IllegalArgumentException - Exception

continueFlow

public ActivityResult continueFlow(java.lang.String pActivityId,
                                   ActivityResult pActivityResult)
                            throws WorkflowException
A convenient method for continueFlow with a runtime id
Parameters:
pActivityId - : String activity runtime id from which the engine will continue the flow
pActivityResult - : ActivityResult result with wich the engine will be used to decide the exit routes.
Returns:
ActivityResult the result code on engine exits
Throws:
WorkflowException - for failing assertion, or other engine errors.

continueFlow

public void continueFlow(WorkItemProcessActivity pActivity,
                         java.lang.String pActivityResult)
                  throws WorkflowException
For backward compabilility
Parameters:
pActivity - within which the engine is running
pActivityResult - - String representation of an activity result
Throws:
WorkflowException - Exception To be deprecated

startFlow

public ActivityResult startFlow()
                         throws WorkflowException
Starts a previously created flow. This process must be a root process
Returns:
return-value
Throws:
WorkflowException - for failing assertion, or other engine errors.

abortFlow

public void abortFlow()
               throws WorkflowException
Aborts an existing this process
Throws:
WorkflowException - for failing assertion, or other engine errors.

suspendFlow

public void suspendFlow()
                 throws WorkflowException
Suspends an existing this process
Throws:
WorkflowException - for failing assertion, or other engine errors.

resumeFlow

public void resumeFlow()
                throws WorkflowException
Resume a previous suspended this process
Throws:
WorkflowException - for failing assertion, or other engine errors.

handleError

public ActivityResult handleError(WorkflowContext pCtx,
                                  java.lang.Throwable pThrowable)
                           throws UnhandledFaultException
Handle errors that occurs in this process. Errors are normally handled by WorkItemProcessActivity, but if that activity decides to buble up the error handling, this method get invoked.
Overrides:
handleError in class WorkItemProcessActivity
Parameters:
pCtx - :WorkflowContext context information when error occured
pThrowable - : Throwable error details
Returns:
ActivityResult when it handled, if not handled, always throw an UnhandledFaultException
Throws:
UnhandledFaultException - if fault is not handled

skipActivity

public void skipActivity(WorkItemProcessActivity pActivity,
                         java.lang.String pReturnCode)
                  throws WorkflowException
Skip a blocked activity
Parameters:
pActivity - Activity to be skipped
pReturnCode - the return code to be used when skipping occurs. It should be one of the valid return code for this activity, or null if does not needed
Throws:
WorkflowException - for failing assertion, or other engine errors.
java.lang.IllegalArgumentException - Exception

retryActivity

public void retryActivity(WorkItemProcessActivity pActivity)
                   throws WorkflowException
Retry a blocked activity
Parameters:
pActivity - Activity to be retried one of the valid return code for this activity, or null if does not needed
Throws:
WorkflowException - for failing assertion, or other engine errors.
java.lang.IllegalArgumentException - Exception

getActivityByLabel

public WorkItemProcessActivity getActivityByLabel(java.lang.String pLabel)
                                           throws WorkflowException
Get the process activity instance, identified by given design time label. It is possbile there might be more than one instance. It is user's responsibility to ensure the uniquness.
Parameters:
pLabel - the label for the process activity
Returns:
WorkItemProcessAcitivy given by the label
Throws:
WorkflowException - for failing assertion, or other engine errors.

getActivityByName

public WorkItemProcessActivity getActivityByName(java.lang.String pName)
                                          throws WorkflowException
Get the process activity instance, identified by given runtime id It is possbile that there may be more than one instance. It is user's responsibility to ensure the uniquness.
Parameters:
pName - the internal name for the process activity
Returns:
WorkItemProcessAcitivy given by the internal name
Throws:
WorkflowException - for failing assertion, or other engine errors.

getName

public java.lang.String getName()
Get internal name of this process
Overrides:
getName in class BaseComponent
Returns:
Internal name of this process

getInstancesByNode

public java.util.List getInstancesByNode(ProcessActivity pProcessActivity)
Convenient method to list all WorkItemProcessActivities for a given ProcessActivity. At runtime, one process activity can have more than one workitem process activities created after it.
Parameters:
pProcessActivity - interested in
Returns:
a list of WorkflowProcessActivities for the given node. It could be empty list.

getBlockedActivities

public java.util.List getBlockedActivities(WorkflowContext pCtx)
This list all current blocking activities, including those of subprocesses of this activity.
Parameters:
pCtx - within which the engine is running
Returns:
list of blocking process activity instances.

getPendingActivities

public java.util.List getPendingActivities(WorkflowContext pCtx)
Returns a list of activity currently pending for execution. Including activity instances whose statuses are BLOCK and NOTINITIALIZED. For internal use only.
Parameters:
pCtx - within which the engine is running
Returns:
list of pending process activity instances.

getProcess

public Process getProcess()
                   throws WorkflowException
Retrieve the meta defintion of this process.
Returns:
Process - design time definition of this instance.
Throws:
WorkflowException - Exception

getActivity

public Activity getActivity()
                     throws WorkflowException
This method override WorkItemProcessActivity to deal with root process that does not have a ProcessActivity instance
Overrides:
getActivity in class WorkItemProcessActivity
Returns:
return-value
Throws:
WorkflowException - Exception

execute

public ActivityResult execute(WorkflowContext pCtx,
                              ActivityResult pActivityResult)
                       throws WorkflowException
Execution entry point of a process. It delegates the exection to the engine. This method is used internally by Engine only.
Overrides:
execute in class WorkItemProcessActivity
Parameters:
pCtx - within which the engine is running
pActivityResult - - Activity result that leads to this process starts
Returns:
ActivityResult - returning result from exection of this process.
Throws:
WorkflowException - when engine fails to start this process

updateProcessStatus

public void updateProcessStatus(WorkflowContext pCtx,
                                ActivityResult pActivityResult)
Force closing all pending activity. This happens when a process reaches end activity while there are more activities are in blocking status. This method is used only by an engine.
Parameters:
pCtx - within which the engine is running
pActivityResult - Parameter

cancel

public boolean cancel(WorkflowContext pCtx,
                      ActivityResult pActivityResult,
                      WorkItemProcessActivity pActivity)
               throws WorkflowException
Called to cancel this process. This method overrides activity level one and get called when engine decides a cancel operation is appropriate. This method implements cancel logic at the process level.
Overrides:
cancel in class WorkItemProcessActivity
Parameters:
pCtx - :WorkflowContext context when cancel gets called
pActivityResult - : ActivityResult result code that to be used for cancel call for each of its activities
pActivity - : WorkItemProcessActivity instance from which the cancel process is started.
Returns:
boolean true when the cancel is suceess for this process. It is only a sucess when all the activities in this process are cancelled successfully. If the process is not complete, a false will be returned.
Throws:
WorkflowException - when cancel an activity fails.

addChild

public void addChild(WorkItemProcessActivity pActivity)
This method override the parent method to be sure that workitem is assigned to each child of this process.
Parameters:
pActivity - WorkItemProcessActivity to be added

getProcessName

public java.lang.String getProcessName()
Return the name of process defintion

addStartActivity

public WorkItemProcessActivity addStartActivity(ProcessActivity processActivity)
                                         throws WorkflowException
This method used by an engine only. Do not directly call this methods.
Parameters:
processActivity - meta data for this instance
Returns:
newly created activity instance
Throws:
WorkflowException -