throw new EngineException(taskInstance.getProcessInstanceId(),
process, taskInstance.getTaskId(), "与activityId="
+ taskInstance.getActivityId() + "对应的token数量(="
+ tokens.size() + ")不正确,正确只能为1,因此无法完成complete操作");
}
IToken token = tokens.get(0);
// stepNumber不相等,不允许执行结束操作。
if (token.getStepNumber().intValue() != taskInstance.getStepNumber()
.intValue()) {
return;
}
if (token.isAlive() == false) {
WorkflowProcess process = taskInstance.getWorkflowProcess();
throw new EngineException(taskInstance.getProcessInstanceId(),
process, taskInstance.getTaskId(), "与activityId="
+ taskInstance.getActivityId()
+ "对应的token.alive=false,因此无法完成complete操作");
}
INetInstance netInstance = rtCtx.getKernelManager().getNetInstance(
taskInstance.getProcessId(), taskInstance.getVersion());
Object obj = netInstance.getWFElementInstance(taskInstance
.getActivityId());
if (obj == null) {
WorkflowProcess process = taskInstance.getWorkflowProcess();
throw new EngineException(taskInstance.getProcessInstanceId(),
process, taskInstance.getTaskId(), "系统没有找到与activityId="
+ taskInstance.getActivityId()
+ "对应activityInstance,无法执行complete操作。");
}
token.setProcessInstance(processInstance);
((IActivityInstance) obj).complete(token, targetActivityInstance);
}