IActivityInstance fromActivityInstance = null;
for (int i = 0; i < fromActivityIdList.size(); i++) {
String fromActivityId = (String) fromActivityIdList.get(i);
Object obj = netInstance.getWFElementInstance(fromActivityId);
fromActivityInstance = (IActivityInstance) obj;
Token newToken = new Token();
((Token) newToken).setAlive(true);
((Token) newToken).setNodeId(fromActivityId);
newToken.setProcessInstanceId(thisTaskInstance
.getProcessInstanceId());
newToken.setProcessInstance(((TaskInstance) thisTaskInstance)
.getAliveProcessInstance());
newToken.setFromActivityId(thisTaskInstance.getActivityId());
newToken.setStepNumber(newStepNumber);
newToken.setValue(0);
persistenceService.saveOrUpdateToken(newToken);
this.createTaskInstances(newToken, fromActivityInstance);
if (rtCtx.isEnableTrace()) {
ProcessInstanceTrace trace = new ProcessInstanceTrace();
trace.setProcessInstanceId(thisTaskInstance
.getProcessInstanceId());
trace.setStepNumber(newStepNumber);
trace.setType(ProcessInstanceTrace.REJECT_TYPE);
trace.setFromNodeId(thisActivity.getId());
trace.setToNodeId(fromActivityId);
trace.setEdgeId("");
rtCtx.getPersistenceService()
.saveOrUpdateProcessInstanceTrace(trace);
}
}
ITransitionInstance theLeavingTransitionInstance = (ITransitionInstance) fromActivityInstance
.getLeavingTransitionInstances().get(0);
ISynchronizerInstance synchronizerInstance = (ISynchronizerInstance) theLeavingTransitionInstance
.getLeavingNodeInstance();
if (synchronizerInstance.getEnteringTransitionInstances().size() > fromActivityIdList
.size()) {
Token supplementToken = new Token();
((Token) supplementToken).setAlive(false);
((Token) supplementToken).setNodeId(synchronizerInstance
.getSynchronizer().getId());
supplementToken.setProcessInstanceId(thisTaskInstance
.getProcessInstanceId());
supplementToken
.setProcessInstance(((TaskInstance) thisTaskInstance)
.getAliveProcessInstance());
supplementToken.setFromActivityId("EMPTY(created by reject)");
supplementToken
.setStepNumber(thisTaskInstance.getStepNumber() + 1);
supplementToken.setValue(synchronizerInstance.getVolume()
- theLeavingTransitionInstance.getWeight()
* fromActivityIdList.size());
persistenceService.saveOrUpdateToken(supplementToken);
}
} finally {