cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti 6 how to get all activity(will be executed) by process instance

einsdan
Champ in-the-making
Champ in-the-making

Map<String, Object> variables = new HashMap<String, Object>();

variables.put("flag", 1);

runtimeService.startProcessInstanceByKey(processDefinitionKey, variables);

// how to get all the list of tasks to be executed here

// if flag is 1, I will get task list(task1, task2, task4)

// if flag is 0, I will get task list(task1, task3)

3 REPLIES 3

ryandawson
Elite Collaborator
Elite Collaborator

Seems like what you're looking to do is to find the process definition and then traverse it to find what follows the gateway on each of its outgoing branches. There are examples in the Activiti codebase for finding a process definition (Activiti/DelegateHelper.java at master · Activiti/Activiti · GitHub ) and for traversing it (Activiti/BpmnJsonConverter.java at master · Activiti/Activiti · GitHub ). Part of what you'll presumably want to do is to locate the exclusive gateway (Activiti/ExclusiveGatewayValidator.java at master · Activiti/Activiti · GitHub ). In your case you'll want to get the definition through the either the RepositoryService or the RuntimeService.

I notice master has moved a bit but the code I referred to is still there if you search for getProcess and BpmnModel. Though perhaps a better place to look is Activiti/SubProcessWithExtensionsConverterTest.java at 6.0-release · Activiti/Activiti · GitHub 

nnvnaveen
Champ in-the-making
Champ in-the-making

Ryan Dawson‌, i could not find in the test cases, and i have similar ask.please let me know for the right testcase