if( task == null || !(task instanceof TaskEntity))
throw new ApplicationException("当前任务为空或类型不正确!");
// 当前节点
ActivityImpl currActivity = getActivityImpl(task, null);
// 清空当前流向
List<PvmTransition> oriPvmTransitionList = clearTransition(currActivity);
// 创建新流向
TransitionImpl newTransition = currActivity.createOutgoingTransition();
// 目标节点
ActivityImpl targetActivity = getActivityImpl(task, histTask.getTaskDefinitionKey());
// 设置新流向的目标节点
newTransition.setDestination( targetActivity );
// 执行转向任务
taskService.complete(task.getId(), variables);
//获取新Task
Task newTask = getCurrentTask( task.getProcessInstanceId() );
if( newTask != null ){
//新任务从流程定义恢复,原签收人从历史任务中得到
taskService.claim(newTask.getId(), histTask.getAssignee() );
}
// 删除目标节点新流入
targetActivity.getIncomingTransitions().remove(newTransition);
// 还原以前流向
restoreTransition(currActivity, oriPvmTransitionList);
//保存操作日志