AnsweredAssumed Answered

Get all user tasks' names in one long process

Question asked by lingnan on Jun 24, 2015
Latest reply on Jun 30, 2015 by jbarrez
Hi, I'm a beginner using Activiti. In my BPMN project, I have a really long line like this:

start -> usertask1 ->usertask3 ->usertask4->usertask5 -> … ->usertask 15 ->end     (task1 and task2 are paralleled)
        -> usertask2 ->
I want to get all the usertasks' names or I want to get usetask15's id and name. What I do now is

         TaskService taskService = activitiRule.getTaskService();
       List<Task> tasks = taskService.createTaskQuery().taskAssignee("kermit").list();
      for (Task task : tasks){
         System.out.println("Task available: " + task.getName());
      Task task = taskService.createTaskQuery().taskAssignee("kermit").singleResult();
       System.out.println("name " + task.getName());

OUTPUT: Task available: usertask1
Task available: usertask2
name usertask3

Using this method, I can only get usertask3 and if I want to get usertask15, I have to write lots of complete and taskService. Is there any quick way for me to get all the usertasks' name at the same time? Thank you very much!!