throw new EngineException(processInstance,
taskInstance.getActivity(),
"DefaultSubflowTaskInstanceRunner:TaskInstance的任务类型错误,只能为SUBFLOW类型");
}
Task task = taskInstance.getTask();
SubWorkflowProcess Subflow = ((SubflowTask) task).getSubWorkflowProcess();
WorkflowDefinition subWorkflowDef = runtimeContext.getDefinitionService().getTheLatestVersionOfWorkflowDefinition(Subflow.getWorkflowProcessId());
if (subWorkflowDef == null) {
WorkflowProcess parentWorkflowProcess = taskInstance.getWorkflowProcess();
throw new EngineException(taskInstance.getProcessInstanceId(), parentWorkflowProcess,
taskInstance.getTaskId(),
"系统中没有Id为" + Subflow.getWorkflowProcessId() + "的流程定义");
}
WorkflowProcess subWorkflowProcess = subWorkflowDef.getWorkflowProcess();
if (subWorkflowProcess == null) {
WorkflowProcess parentWorkflowProcess = taskInstance.getWorkflowProcess();
throw new EngineException(taskInstance.getProcessInstanceId(), parentWorkflowProcess,
taskInstance.getTaskId(),
"系统中没有Id为" + Subflow.getWorkflowProcessId() + "的流程定义");
}
IPersistenceService persistenceService = runtimeContext.getPersistenceService();
//更改任务的状态和开始时间
((TaskInstance) taskInstance).setState(ITaskInstance.RUNNING);