参考文档:
http://www.cnblogs.com/mingforyou/p/5351332.html
http://blog.csdn.net/jackyrongvip/article/details/9256531
/** * getJobProcessDefinitionMap * 查找UserTask节点中CandidateUsers不空的流程,并按照CandidateUser分类存储流程列表。 * @param @return 设定文件 * @return Map> DOM对象 * @throws * @since CodingExample Ver 1.1 */ private Map > getJobProcessDefinitionMap() { Map > jobProcessDefinitionCaditateMap = new HashMap >(); List processDefinitionList = findLastVersionProcessDefinition(); for(ProcessDefinition processDefinition : processDefinitionList){ BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinition.getId()); List processList = bpmnModel.getProcesses(); if(processList != null && processList.size() > 0){ for(org.activiti.bpmn.model.Process process : processList){ if(process != null){ Collection flowElementCollection = process.getFlowElements(); if(flowElementCollection != null && flowElementCollection.size() > 0){ for(FlowElement flowElement : flowElementCollection){ if(flowElement instanceof UserTask){ UserTask userTask = (UserTask)flowElement; List candidateUsers = userTask.getCandidateUsers(); if(candidateUsers != null && candidateUsers.size() > 0){ for(String candidateUser : candidateUsers){ if(!StringUtils.isBlank(candidateUser)){ Set processDefinitionCaditateSet = null; if(jobProcessDefinitionCaditateMap.containsKey(candidateUser)){ processDefinitionCaditateSet = jobProcessDefinitionCaditateMap.get(candidateUser); }else{ processDefinitionCaditateSet = new HashSet (); jobProcessDefinitionCaditateMap.put(candidateUser, processDefinitionCaditateSet); } if(!processDefinitionCaditateSet.contains(processDefinition)){ processDefinitionCaditateSet.add(processDefinition); } } } } } } } } } } } return jobProcessDefinitionCaditateMap; }