Java Reference
In-Depth Information
history.add(event);
originator.receive_event(event);
}
else
throw new
WorkflowModel.AlreadyRunning();
else
throw new
WorkflowModel.CannotStart();
}
void
completed(WfActivityImpl current)
throws
WfBase.BaseException {
WfEventAudit event
#
new
WfEventAuditImpl
(current,"activity completed");
history.add(event);
originator.receive_event(event);
Collection nextActivities
#
current.definition.
nextActivities();
if
(nextActivities.isEmpty()){
// When a possible "last" activity has completed,
// check if there are other pending (i.e. open)
// activities
WfActivityIterator it
#
get_iterator_step();
WfActivity act;
while
((act
#
it.get_next_object()) !
#
null
){
if
(act.workflow_state().equals
(workflow_stateType.open)){
// If an open activity is found then it was not
// the last activity and nothing is to be done.
return
;
}
}
// Otherwise, it was effectively the last activity,
// the process then is completed.
change_state(workflow_stateType.closed,
null
,
null
,
how_closedType.completed);
event
#
new WfEventAuditImpl(
this
,"process completed");
history.add(event);
originator.receive_event(event);
return
;
}
// creates the successive activities
Iterator it
#
nextActivities.iterator();
while
(it.hasNext()){
WfActivity activity
#
new
WfActivityImpl(
this
,
(WfActivityDefinition)it.next());
steps.add(activity);
}
}
...
}