Java Reference
In-Depth Information
The state of the manager is represented by the class process_mgr_
stateType . It conforms to the Enumeration pattern (see Enumeration idiom
(McCluskey 2001)). This pattern is used to represent the possible values of
the states of the workflow objects.
package WorkflowModel;
public class process_mgr_stateType {
private final String value;
private process_mgr_stateType(String value)
{ this. value # value; }
public static final process_mgr_stateType enabled #
new process_mgr_stateType("enabled");
public static final process_mgr_stateType disabled #
new process_mgr_stateType("disabled");
public String toString(){ return value;}
}
The workflow execution objects (i.e. processes and activities) share
several common features that are collected in the WfExecutionObjectImpl
class that implements the WfExecutionObject interface. These features
include mainly the management of state transitions and the recording of
history events. The first feature takes advantage of the WfObjectState class
that realizes the State pattern (see State pattern (Gamma et al . 1995)), the
second uses the WfEventAuditImpl class that implements the WfEventAudit
interface. Here we skip these classes for reasons of space.
The instance of a process is represented by the class WfProcessImpl . The
constructor links the instance to its manager, the process definition and the
requester. Each instance is assigned a unique identifier; in the presence of a
persistent database this id could be generated by the database itself.
The method start() activates the process instance, checks if the process
has been started already, then it creates the activities corresponding to the
initial activities of the process definition, and finally sends an event to
the requester to notify it that the process started (or that some error was
encountered).
When an activity of the process is completed, the method completed()
is invoked. This method checks whether it was the last activity to be
completed. In this case it changes the state of the process to completed .
Otherwise it creates the activities corresponding to the successors in the
process definition.
package WfEngine;
...
public class WfProcessImpl
extends ExecutionObjectImpl
implements WfProcess {
WfRequester originator;
WfProcessMgr processManager;
WfProcessDefinition definition;
Search WWH ::




Custom Search