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

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Member II

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

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
Highlighted
Alfresco Employee

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

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.

Highlighted
Alfresco Employee

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

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 

Highlighted
Member II

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

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