7 Replies Latest reply on May 12, 2006 4:22 AM by Ronald van Kuijk

    Reassign Task Instance to Group

    David Hosier Novice

      Ok, now that I've figured out my Timer issues, I'm trying to figure out how to reassign a task to a group. I see setActorId() and setPooledActors(), but I'm wondering if there is a way to specify a group such that when I call JbpmContext.getGroupTaskList(), the tasks will show up there. I tried putting the group into both of the set() methods mentioned above with no luck. I even tried

      taskInstance.getTask().setActorIdExpression("group(Sesame Street)");
      taskInstance.assign();
      

      That didn't work, and I didn't really expect it to. I'd love to avoid having to take the group name and look up all the members of the group and set them as pooled actors if at all possible. Any ideas? Thanks.

        • 1. Re: Reassign Task Instance to Group
          Ronald van Kuijk Master

          setPooledActors() should notr be used WITH setActord(). If the latter is done, it is assigned to that actor. Set it to null to have it show up in the group tasklist (use a group name with pooledactors, not individual actor ids)

          • 2. Re: Reassign Task Instance to Group
            David Hosier Novice

            Thanks for the response. Just to make sure I understand, are you saying I should do the following?

            taskInstance.setActorId(null);
            taskInstance.setPooledActors(new String[] {groupName});
            


            • 3. Re: Reassign Task Instance to Group
              David Hosier Novice

              Well, I tried the above code, and it didn't seem to work. My users in the new group do not have visibility of the task when I call JbpmContext.getGroupTaskList().

              • 4. Re: Reassign Task Instance to Group
                Ronald van Kuijk Master

                that is what I meant, surprises me it does not work. I'll get back to you later

                • 5. Re: Reassign Task Instance to Group
                  Tom Baeyens Master

                  Since this is a recurring question. I checked the docs and indeed the text for this part is really confusing. sorry :-)

                  So here's the meat of that crappy explanation:

                  * The actorId denotes the person to which this task is assigned. If a task instance has an actorId, that task will appear in the user's personal task list.

                  * The pooled actors denote the candidates for the task instance. This means that the task is offered to many users and one has to take it into his/her personal task list in order to start working on it. Taking a task means that the given actor will put his id in the task instance's actorId.

                  * Now here it comes: a pooled actorId, can be a reference to a user OR a group OR a system.

                  * So to fetch all the task instances for which a given actor is a candidate (= the user's grouptasklist) you need to do the following:
                  Make a collection that includes the user's actorId and all the ids of groups that the user belongs to. Then search for task instances that are not in a personal task list (actorId==null) and for which there is a match in the pooled actorIds.

                  The motivation behind this is that we want to separate the identity component from jBPM task assignment. jBPM only stores Strings as actorIds and doesn't know the relation between the users, groups and other identity information.

                  is this better ? then i'll replace the original with this in the userguide :-)

                  regards, tom.

                  • 6. Re: Reassign Task Instance to Group
                    Tom Baeyens Master

                    ah, and one more thing for ronald,

                    the actorId can be combined with the pooledActorIds.

                    when an actorId is present, the pooledActorId is indeed ignored. But there might be a situation in which you want to identify a group of people that can do the job. And immediately select one of the group to do it.

                    Now if that user says "i'm not qualified" and he wants to put it back in the group, he can just do this by erasing the actorId.

                    • 7. Re: Reassign Task Instance to Group
                      Ronald van Kuijk Master

                       

                      "tom.baeyens@jboss.com" wrote:
                      when an actorId is present, the pooledActorId is indeed ignored. But there might be a situation in which you want to identify a group of people that can do the job. And immediately select one of the group to do it.


                      Oh, I agree. That is what we internally need. We are working assignmenthandler that sets the groupname in the pooledactors (we do not use actorid's there) and set the actorid with one person from that group (either random or based on workload etc)