ACTIVITI如何获取下一步节点
2015-08-12 · 知道合伙人数码行家
关注
展开全部
1、首先是根据流程ID获取当前任务:
List<Task> tasks = taskService.createTaskQuery().processInstanceId(procInstanceId).list();
2、然后根据当前任务获取当前流程的流程定义,然后根据流程定义获得所有的节点:
ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl)rs).getDeployedProcessDefinition(task.getProcessDefinitionId());
List<ActivityImpl> activitiList = def.getActivities(); //rs是指RepositoryService的实例
3、根据任务获取当前流程执行ID,执行实例以及当前流程节点的ID:
String excId = task.getExecutionId();
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(excId).singleResult();
String activitiId = execution.getActivityId();
4、然后循环activitiList 并判断出当前流程所处节点,然后得到当前节点实例,根据节点实例获取所有从当前节点出发的路径,然后根据路径获得下一个节点实例:
for(ActivityImpl activityImpl:activitiList){
String id = activityImpl.getId();
if(activitiId.equals(id)){
System.out.println("当前任务:"+activityImpl.getProperty("name")); //输出某个节点的某种属性
List<PvmTransition> outTransitions = activityImpl.getOutgoingTransitions();//获取从某个节点出来的所有线路
for(PvmTransition tr:outTransitions){
PvmActivity ac = tr.getDestination(); //获取线路的终点节点
System.out.println("下一步任务任务:"+ac.getProperty("name"));
}
break;
}
}
List<Task> tasks = taskService.createTaskQuery().processInstanceId(procInstanceId).list();
2、然后根据当前任务获取当前流程的流程定义,然后根据流程定义获得所有的节点:
ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl)rs).getDeployedProcessDefinition(task.getProcessDefinitionId());
List<ActivityImpl> activitiList = def.getActivities(); //rs是指RepositoryService的实例
3、根据任务获取当前流程执行ID,执行实例以及当前流程节点的ID:
String excId = task.getExecutionId();
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(excId).singleResult();
String activitiId = execution.getActivityId();
4、然后循环activitiList 并判断出当前流程所处节点,然后得到当前节点实例,根据节点实例获取所有从当前节点出发的路径,然后根据路径获得下一个节点实例:
for(ActivityImpl activityImpl:activitiList){
String id = activityImpl.getId();
if(activitiId.equals(id)){
System.out.println("当前任务:"+activityImpl.getProperty("name")); //输出某个节点的某种属性
List<PvmTransition> outTransitions = activityImpl.getOutgoingTransitions();//获取从某个节点出来的所有线路
for(PvmTransition tr:outTransitions){
PvmActivity ac = tr.getDestination(); //获取线路的终点节点
System.out.println("下一步任务任务:"+ac.getProperty("name"));
}
break;
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询