读取一个流程定义中的任务名称
List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey(processDefinitionKey).list();
Map<String, String> keys = new HashMap<String, String>();
for (ProcessDefinition processDefinition : definitions) {
ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(processDefinition.getId());
List<ActivityImpl> activitiList = processDefinitionEntity.getActivities();
for (ActivityImpl activity : activitiList) {
ActivityBehavior activityBehavior = activity.getActivityBehavior();
if (activityBehavior instanceof UserTaskActivityBehavior) {
UserTaskActivityBehavior userTaskActivityBehavior = (UserTaskActivityBehavior) activityBehavior;
TaskDefinition taskDefinition = userTaskActivityBehavior.getTaskDefinition();
keys.put(taskDefinition.getKey(), taskDefinition.getNameExpression().toString());
}
}
}