cancel
Showing results for 
Search instead for 
Did you mean: 

correct order of tasks

aurelienpel
Champ in-the-making
Champ in-the-making
Hi,

I would like to have all tasks from the .xml file, so I did :


processDefinition =
               (ProcessDefinitionEntity)
               ((RepositoryServiceImpl) ProcessEngines
                     .getDefaultProcessEngine()
                     .getRepositoryService())
                     .getDeployedProcessDefinition(processDefinitionId);
   
           if (processDefinition != null) {
               for (ActivityImpl activity : processDefinition.getActivities()) {
                 String type = (String) activity.getProperty("type");
                 if(type.equals("userTask")){
                    String myTaskId = (String) activity.getId();
                    String myTaskDocumentation = (String) activity.getProperty("documentation");
                   
                    allTasks.put(myTaskId, myTaskDocumentation);
                 }
               }
           }


I have all of them, here is my result :


{task1=this is 1, task3=this is 3, task4=this is 4, Task2=this is 2}


but you can see in the attached files that the order is not the same. I would like this order : 1,2,3,4 ; so the order of the tasks in the correct way.
I don't know if it is possible. If so, what could I add to my function ?

thanks for your help !

Aurelien
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Aurelien,
                                        
in the case of parallel flow  


             +-> B ->
             |       |
Start -> A -+        + -> End
             |       |
              +-> C -+
Which one is first/last?

if you want to you can traverse process diagram and find correct order.

Regards
Martin

Hi Martin,

Thanks for your reply.
Indeed, it is not actually my case but it could be. It may give firstly the top flow and then the bottom flow, just an idea 🙂
But if I don't have any parallel flow, is it possible to have the correct order ? (to match with my example)

Regards

Aurelien

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Aurelien.

You can get correct order only by process tracing process diagram from start to end. (there can be several start/end points to…. it is not easy to set correct order in process definition. It is much easier in sequence flow (your case) or in porocess instance (by time).

Regards
Martin

aurelienpel
Champ in-the-making
Champ in-the-making
Hi Martin,

Ok I understand what you mean.
Thanks for your help !

Regards

Aurelien