AnsweredAssumed Answered

Select Tasks With Variables In Single Query

Question asked by maier on May 13, 2011
Latest reply on May 13, 2011 by frederikheremans1
Hi everybody,

is there a way to get a list of tasks with its variables in one query? Of course, I can get the required data the following way (example):


List<Task> tasks = taskService.createTaskQuery().taskAssignee("mike").list();
for (Task task: tasks) {
  Map<String, Object> vars = taskService.getVariables(task.getId());
  System.out.println(task.getId() + " - " + task.getDueDate() + " - " + vars.get("var1") + " - " + vars.get("var2"));
}

I don't really like that solution since there has to be done a seperate query task for each task which might cause a lot of single database queries… I would prefer if the variable map would be directly provided with the task:


List<Task> tasks = taskService.createTaskQuery().taskAssignee("mike").list();
for (Task task: tasks) {
  Map<String, Object> vars = task.getVariables();
  System.out.println(task.getId() + " - " + task.getDueDate() + " - " + vars.get("var1") + " - " + vars.get("var2"));
}

But since this is not possible: Is there already another way I could handle my issue?

Thank You!
Mike

Outcomes