6 Replies Latest reply on May 29, 2006 1:19 AM by pavan kumar

    how to assign a task with multiple users?

    pavan kumar Newbie

      I need to assign a task to multiple users. I tried with the
      group expression of the swimlane, but it doesnt seem to be working.

      What my understanding is that, by creating users, and groups in jbpm,
      and create a swimlane with group expression, assign the swimlane
      to a task node, now whichever user in the group logs in, he has to
      find the task in his list, but this does not seem to be happening.

      Does the jbpm internally assign the tasks to the users in the group,
      or do we need to manually assign the tasks programmatically??

        • 1. Re: how to assign a task with multiple users?
          Ronald van Kuijk Master

          as pointed out in another thread of this same day, it could be that you need to use a different method to retrieve the pooled actors tasklist.

          http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3946405

          • 2. Re: how to assign a task with multiple users?
            pavan kumar Newbie

            Hi Ronald,
            i really did not understand what u have said. I can retrieve the tasks
            from jbpmContext.getTaskMgmtSession().findPooledTaskInstances(group).
            now say users bert, ernie belong to a group 'testgroup', (there is also a prbm here, how the relation between the users and group is maintained in jbpm?)
            i assign a single task instance to the group 'testgroup',
            now if bert, ernie login, will they be able to see the task in their task list??

            If no, then should i calculate the tasks for the user whenever he logs in, by firing the query to retrieve the tasks from the pooled task list? is this not handled in the jbpm?

            • 3. Re: how to assign a task with multiple users?
              Matthias Bräuer Newbie

              Hi, IMHO the problem lies with the implementation of the class ExpressionAssignmentHandler's assign() method:

              [...]
              
               // else if the expression evaluated to a user
               } else if (entity instanceof User) {
               // do direct assignment
               assignable.setActorId(entity.getName());
              
               // else if the expression evaluated to a group
               } else if (entity instanceof Group) {
               // put the group in the pool
               assignable.setPooledActors(new String []{entity.getName()});
               }
              
              [..]
              


              As can be seen a group is not assigned to the pooled actors as an array of the users contained in it, but as an array with only one element, namely the group itself. Thus, the users in that group won't see the task in their task list as for jBPM the set of pooled actors only consists of one actor with the name of the group.

              In my project I have written an own AssignmentHandler which does its job fine. :-)

              So long, Matthew

              • 4. Re: how to assign a task with multiple users?
                Ronald van Kuijk Master

                 

                "kpavan_8" wrote:
                Hi Ronald,
                i really did not understand what u have said. I can retrieve the tasks
                from jbpmContext.getTaskMgmtSession().findPooledTaskInstances(group).


                Yes


                "kpavan_8" wrote:

                now say users bert, ernie belong to a group 'testgroup', (there is also a prbm here, how the relation between the users and group is maintained in jbpm?)


                In the DB, the identity module does this. There is no ui for this yet, so look at the contents of the identity tables and create your own entries

                "kpavan_8" wrote:

                i assign a single task instance to the group 'testgroup',
                now if bert, ernie login, will they be able to see the task in their task list??


                Yes, they should if they are a member of the testgroup

                "kpavan_8" wrote:


                If no, then should i calculate the tasks for the user whenever he logs in, by firing the query to retrieve the tasks from the pooled task list?


                No

                "kpavan_8" wrote:
                is this not handled in the jbpm?


                It is


                If it does not work this way, please let us know.

                btw, what version of jBPM are you using?

                • 5. Re: how to assign a task with multiple users?
                  Ronald van Kuijk Master

                   

                  "MatthiasBraeuer" wrote:
                  As can be seen a group is not assigned to the pooled actors as an array of the users contained in it, but as an array with only one element, namely the group itself.


                  Correct, this is as designed

                  "MatthiasBraeuer" wrote:

                  Thus, the users in that group won't see the task in their task list as for jBPM the set of pooled actors only consists of one actor with the name of the group.


                  Not correct, well not completely. (I could also have written: "correct, wel not completely ;-) )

                  The implementation of the getPooledTaskInstances(actorId), assumes you provide the array of actorIds (user, group or system) in advance. So you have to look what groups a user belongs to, put that in an array and pass it on to the method. It is not enough to provide the id of an individual user. The identity mechanism does not look if the provided id is an individual user and then looks if the user is a member of certain groups and these groups have tasks).

                  If the latter is behaviour that is expected (which I can imagine) please file a jira issue for it.


                  • 6. Re: how to assign a task with multiple users?
                    pavan kumar Newbie

                    Ronald,
                    I am using jBPM 3.1.1
                    I dont think the tasks assigned to group are automatically assigned to the individual users in the group, i tried it in the websale example. i could not
                    find the tasks in the UI for the individual users.

                    Mathew,
                    I think I should also do the same thing, write my own assignment handler or
                    compute the tasks whenever the user tries to login.
                    can u post u'r assignment handler code?