用
PvmTransition表示箭头的类。而这些类是从
从任务id获得指向外面的连接线
从一个节点转向另一个节点 最后还是得需要执行taskService.complete(taskId,varies);
List<PvmTransition> list = ActivityImpl.getOutgoingTransitions() ;
从任务id获得指向外面的连接线
ProcessDefinitionEntity.getActivities()
Task currentTask = (Task) taskService.createTaskQuery().taskId(taskId)
.singleResult();
/**
*
*@User :Test
*@date :2014-6-26 下午02:45:34
*@return :Execution
*@userFor :获得执行节点 ExecutionEntity.getActivityId() 获得节点id
*currentTask.getExecutionId()
*/
private ExecutionEntity getExecution(String executionId) {
ExecutionEntity execution = (ExecutionEntity) (Execution) runtimeService
.createExecutionQuery().executionId(executionId).singleResult();
return execution;
}
/**
*
*@User :Test
*@date :2014-6-26 下午02:38:39
*@return :ActivityImpl
*@userFor :根据flowId获得下一个节点 ExecutionEntity.getActivityId()
*/
private ActivityImpl getNextTask(ProcessDefinitionEntity processDefinition,
String activitiId, String flowId) {
ActivityImpl result = null;
boolean breakFlag = false;
List activitiList = processDefinition.getActivities();
for (Iterator iterator = activitiList.iterator(); iterator.hasNext();) {
ActivityImpl activityImpl = (ActivityImpl) iterator.next();
if (breakFlag)
break;
String id = activityImpl.getId();
if (activitiId.equals(id)) {
List outTransitions = activityImpl.getOutgoingTransitions();
for (Iterator iterator1 = outTransitions.iterator(); iterator1
.hasNext();) {
PvmTransition pvm = (PvmTransition) iterator1.next();
if (flowId.length() > 0 && pvm.getId().equals(flowId)) {
result = (ActivityImpl) pvm.getDestination();
breakFlag = true;
break;
}
}
}
}
return result;
}
从一个节点转向另一个节点 最后还是得需要执行taskService.complete(taskId,varies);
// 获取当前节点的所以出口(这个方法做的不好,应该返回List<TransitionImpl>才对的,这样就不用下面的强转换了,我想以后版本会改了这点)
List<PvmTransition> pvmTransitionList = activeActivity
.getOutgoingTransitions();
for (PvmTransition pvmTransition : pvmTransitionList) {
TransitionImpl transitionImpl = (TransitionImpl) pvmTransition;// 强转为TransitionImpl
transitionImpl.setDestination(endActivity);
}
//最后还是得需要执行complete方法
taskService.complete(taskId);