方式一、
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity)
((RepositoryServiceImpl)repositoryService)
.getDeployedProcessDefinition(actDefId);
List<ActivityImpl> activitiList = def.getActivities();
for(ActivityImpl act : activitiList){
System.out.println("活动节点:" + processDefinition.getProperty("name"));
}
方式二、
ProcessDefinition pd = repositoryService.createProcessDefinitionQuery().processDefinitionId(processId).singleResult();
final String processDefinitionKey = pd.getKey();
ProcessDefinitionEntity processDefinition = ((ProcessEngineConfigurationImpl)processEngineConfiguration)
.getCommandExecutorTxRequiresNew()
.execute(new Command<ProcessDefinitionEntity>() {
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context
.getProcessEngineConfiguration()
.getDeploymentCache()
.findDeployedLatestProcessDefinitionByKey(processDefinitionKey);
}
});
List<ActivityImpl> activitiList = processDefinition.getActivities();
for(ActivityImpl act : activitiList){
System.out.println("活动节点:" + act.getProperty("name"));
}