Java Reference
In-Depth Information
The activities are represented by the
WfActivityImpl
class that implements
the
WfActivity
interface. The constructor has the main task of assigning the
activity to some workflow participant.
package
WfEngine;
...
class
WfActivityImpl
extends
ExecutionObjectImpl
implements
WfActivity {
WfProcess process;
WfActivityDefinition definition;
Vector workItems
#
new
Vector();
Vector context
#
new
Vector();
static private long
uniqueId
#
1;
static private
String getId(){
return
Long.toString(uniqueId
!!
);
}
public
WfActivityImpl(WfProcess proc,
WfActivityDefinition def) {
super(def.getName());
process
#
proc;
definition
#
def;
try
{
set_description(def.getDescription());
set_key(getId());
}
catch
(Exception e){ }
// set up activity assignments
WfParticipant performer
#
def.getPerformer();
Actor actor
#
Organization.match(performer.getName());
WfAssignmentImpl workItem
#
new WfAssignmentImpl
(
this
,actor);
workItems.add(workItem);
actor.addWorkItem(workItem);
}
public void
complete()
throws
BaseException,
CannotComplete {
if
(state.workflow_state()
##
workflow_stateType.open &&
state.while_open()
##
while_openType.running){
change_state(workflow_stateType.closed,
null
,
null
,
how_closedType.completed);
history.add(
new
WfEventAuditImpl(
this
,"Completed"));
((WfProcessImpl)process).completed(
this
);
}
else
{
throw new
WorkflowModel.CannotComplete(); }
}
...
}