cancel
Showing results for 
Search instead for 
Did you mean: 

How to get Sequence flow in b/w tasks.

verjender
Champ in-the-making
Champ in-the-making
I have created a process in which i created multiple tasks.

Task service can provide me all the tasks belong my process.

List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstanceId).list();

But how will i determine, the sequence flow b/w the tasks. i.e Which is my first task. what is the next task?
2 REPLIES 2

vasile_dirla
Star Contributor
Star Contributor
Hi,
You have to use the related BpmnModel.
<code>
  BpmnModel model = repositoryService.getBpmnModel(processDefinitionId);
</code>

poloche
Champ in-the-making
Champ in-the-making
Because you have in your bpmn definition file something like
<code>
<process id="aSimpleWorkflow" name="A Simple Workflow" isExecutable="true">
    <startEvent id="startEvent" name="Start"></startEvent>
    <endEvent id="endEvent" name="End"></endEvent>
    <userTask id="task1" name="The Task 1"></userTask>
    <userTask id="task2" name="The task 2"></userTask>
    <userTask id="task 3" name="The task 3"></userTask>
    <userTask id="task 4" name="The task 4"></userTask>
    <sequenceFlow id="flow1" sourceRef="startEvent" targetRef="task1"></sequenceFlow>
    <sequenceFlow id="flow2" sourceRef="task1" targetRef="task2"></sequenceFlow>
    <sequenceFlow id="flow3" sourceRef="task2" targetRef="task3"></sequenceFlow>
    <sequenceFlow id="flow4" sourceRef="task3" targetRef="task4"></sequenceFlow>
    <sequenceFlow id="flow5" sourceRef="task4" targetRef="endEvent"></sequenceFlow>
  </process>
</code>
do you really need to know the sequence flow?
I mean as I understood when the process start the first task(task1) will start and will be in the list of your query, when you complete this task the next task(task2) will be ready and in the list of the query.