activiti6获取流程图上所有节点
Controller
@RequestMapping("/dis")
@ApiOperation(value = "显示流程图所有节点", httpMethod = "GET", notes = "显示流程图所有节点")
@ResponseBody
public ResponseVo<Collection<FlowElement>> dis(String deploymentId) {
return new ResponseVo(jbpmProcessinstanceService.dis(deploymentId));
}
Service
public Collection<FlowElement> dis(String deploymentId){
//流程定义id
ProcessDefinition processDefinition=ProcessEngines.getDefaultProcessEngine()
.getRepositoryService().createProcessDefinitionQuery()
.deploymentId(deploymentId)
.singleResult();
BpmnModel bpmnModel = ProcessEngines.getDefaultProcessEngine().getRepositoryService().getBpmnModel(processDefinition.getId());
Process process = bpmnModel.getProcesses().get(0);
//获取所有节点
Collection<FlowElement> flowElements = process.getFlowElements();
//获取活动节点
//List<UserTask> TaskList = process.findFlowElementsOfType(UserTask.class);
return flowElements;
}