13 Replies Latest reply on Apr 3, 2009 12:51 PM by kukeltje

    Dynamic Group / PooledActors

      Is it possible to assign a task to a group that's determined at query / runtime?

      Let's take this example:

      I create a new task, and assign it to actors A and B

      Before A or B step up to claim it, I add a new Actor (C) to the system, who needs to have retroactive ability to claim that task.

      Can anyone point me in the direction of how I could implement this?

      As far as I can tell, the pooled actors / groups (are those terms interchangeable) are a static list set up when the task is created.

      Thanks!

        • 1. Re: Dynamic Group / PooledActors
          kukeltje

          Yes, by putting the group name in the pooled actors and before you query the pooled tasks, decide what groups your specific users is in and add that groupname to the list.

          And 'yes' they are interchangeable, technically. For the list that is passed to the pooled actors query they are all just strings

          • 2. Re: Dynamic Group / PooledActors

            Would that be done by assigning the task to "group(foo)"?

            • 3. Re: Dynamic Group / PooledActors
              kukeltje

              via an expression? Not sure, never used them since they are related to the jBPM identity model which I never used. If the docs are not clear (which thwey might not in this area) looking at the source is the easiest to see what is going on.

              • 4. Re: Dynamic Group / PooledActors

                yeah, the identity side of things lacks docs pretty badly. i'd kill for more examples.

                how else would you assign something to a group other than "group(foo)" ?

                • 5. Re: Dynamic Group / PooledActors
                  kukeltje

                  by setting the pooledactors to "foo" and before displaying the group tasklist get all the groupnames the actor is member of and feed that to the method (as mentioned in several other posts the last days)

                  • 6. Re: Dynamic Group / PooledActors

                    I think the problem is that the user might not even be defined when I assign the task to the pool.

                    Everything I've seen says once the task is assigned to a actor/pool, that list stays static.

                    Do I have that completely wrong?

                    • 7. Re: Dynamic Group / PooledActors
                      kukeltje

                      ASSIGN THE GROUPNAME to the pooled actors, not ALL INDIVIDUAL ACTORS.... if you know you use it this way you can lookup pooled tasks by the groups the user belongs to...

                      • 8. Re: Dynamic Group / PooledActors

                        I don't want to query by the group, I want to query by a user who wasn't part of the group when the group was assigned to the task.

                        Anyway, I'll give it a shot.

                        One thing I'm not sure about - you can set the group(foo) expression in the workflow definition, but can you do it programmatically? Is it as simple as just extending ExpressionHandler and doing this.expression = "group(foo)" ?

                        Thanks for all your help :)

                        • 9. Re: Dynamic Group / PooledActors
                          kukeltje

                          sigh.....

                          please read.....

                          1: Assign task to pooledActor with the groupname
                          2: new user logs in
                          3: decide what groups that user is a member of NOW
                          4: look up the pooled tasks using the groupnames from 2

                          fixed...

                          • 10. Re: Dynamic Group / PooledActors

                            Ok, I think we're both getting frustrated :)

                            Perhaps I'm not understanding or explaining things right.

                            1) Is this right? In my ExpressionHandler, do something like:

                            assign(Assignable assignable, ExecutionContext executionContext) {
                             // do some stuff to dynamically figure out what group to assign to
                             assignable.setPooledActors(new String[] { "group(my-dynamic-group)"});
                            }
                            


                            2) I would actually like to do task lookups by pooled actorId, not group id. If this is not possible, I can probably get around it.

                            • 11. Re: Dynamic Group / PooledActors
                              kukeltje

                              1: no

                              assign(Assignable assignable, ExecutionContext executionContext) {
                               // do some stuff to dynamically figure out what group to assign to
                               assignable.setPooledActors(new String[] { "my-dynamic-group"});
                              }
                              


                              Assign to the group NAME, not use an expression

                              2: Why is this such a problem? ANY decent I&AM solution has a way to decide which groups a user belong to....

                              as mentioned multiple times in this topic and other ones... for the engine any string you put in the pooled actors is just a string.... without meaning. You give the meaning to it yourself. That is the nice thing wich makes it flexible

                              • 12. Re: Dynamic Group / PooledActors

                                Wait, I think I actually get it.

                                You're saying that since the value of the actorId is pretty much disconnected from reality, I can use any arbitrary string as the actorId, which would mean using the group name.

                                And as long as I can figure out what the group name is when assigning AND when querying, I can do it however I like.

                                When you were saying "group" I was thinking JBPM identity group, not my-own-custom-group.

                                Sorry for being thick headed about this. In my defense, I've been on pain medication :)

                                Thanks for the help.

                                • 13. Re: Dynamic Group / PooledActors
                                  kukeltje

                                  Yep.... no problem... glad you got it eventually :-)