0 Replies Latest reply on Jul 18, 2006 12:21 PM by Daniel Lipski

    Retriving task instances for user

    Daniel Lipski Newbie

      Hi
      I have one more problem using jBPM.

      If i want to get all task instances for actor (push/pull) do i have to start from getTaskMgmtSession().findTaskInstances(actorID) always?

      Is there any other way ?

      If no, how to get task instances gropued by task nodes ?

      Something like this doesn't work (ClassCast):

      List<TaskInstance> tasks = workflowConfig.createJbpmContext().getTaskMgmtSession().findTaskInstances(actorId);
      
      Map<TaskNode, List<TaskInstance>> instancesGrouped = new HashMap<TaskNode, List<TaskInstance>>();
      for(TaskInstance task : tasks)
      {
       //ClassCast here
       TaskNode taskNode = (TaskNode)task.getToken().getNode();
       List<TaskInstance> instances = instancesGrouped.get(taskNode);
       if(instances == null)
       {
       instances = new ArrayList<TaskInstance>();
       instancesGrouped.put(taskNode,instances);
       }
       instances.add(task);
      
      }


      Maybe there is other, simplier way to do this.