jbpm 获得当前流程所有的任务节点名称

//流程管理的几个service
ProcessEngine processEngine = Configuration.getProcessEngine();
RepositoryService repositoryService = processEngine.getRepositoryService();

ExecutionService executionService = processEngine.getExecutionService();
//发布流程定义:获得流程定义deploymentId

String deploymentId = repositoryService.repositoryService.createDeployment().addResourceFromClasspath("jbpm/exp.jpdl.xml").deploy();

//获得流程定义的ID
String id = repositoryService.createProcessDefinitionQuery().deploymentId(deploymentId).uniqueResult().getId();

//启动流程实例
ProcessInstance processInstance = executionService.startProcessInstanceById(id);

//获得所有的activity
ExecutionImpl executionimpl = (ExecutionImpl) processInstance; //Execution的实例
ProcessDefinitionImpl processDefinitionImpl = executionimpl.getProcessDefinition(); //ProcessDefinition的实例

Map mapActivity = processDefinitionImpl.getActivitiesMap(); //获得给流程下所有的activity

for(String str : mapActivity.keySet()){
if(mapActivity.get(str).getType() == "task") { //判断节点类型
System.out.println(str);//该任务节点的名称
}
}

你可能感兴趣的:(jbpm 获得当前流程所有的任务节点名称)