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)
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
Ryan Dawson, i could not find in the test cases, and i have similar ask.please let me know for the right testcase
Ask for and offer help to other Alfresco Process Services and Activiti Users and members of the Alfresco team.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.