ProcessDefinitionEntity def = (ProcessDefinitionEntity) ((RepositoryServiceImpl)repositoryService).getDeployedProcessDefinition(delegateTask.getProcessDefinitionId());
List<ActivityImpl> activitiList = def.getActivities(); //rs是指RepositoryService的实例
ExecutionEntity execution = (ExecutionEntity) runtimeService.createExecutionQuery().executionId(delegateTask.getExecutionId()).singleResult();
String activitiId = execution.getActivityId();
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(); //获取线路的终点节点
String s=(String) ac.getProperty("multiInstance");
if("parallel".equals(s)){
String targetUserTaskId= ac.getId();
BpmnModel bpmnModel = repositoryService.getBpmnModel(def.getId());
List<Process> processes = bpmnModel.getProcesses();
for (Process process : processes) {
List<UserTask> userTaskList = process.findFlowElementsOfType(UserTask.class);
for (UserTask userTask : userTaskList) {
if(userTask.getId().equals(targetUserTaskId)){
List<String> candidateUsers = userTask.getCandidateUsers();
/*String[] assingneeArray=complateDto.getUserIds().split(",");
variables.put("assigneeList", Arrays.asList(assingneeArray));*/
System.out.println(candidateUsers);
}
}
}
}
}
}
}
}
网友评论