1 2 Previous Next 16 Replies Latest reply on Dec 3, 2012 9:58 AM by Alex Pavlov

    Defining users for TaskServer - jbpm5

    Odelya Holiday Novice
        • 1. Defining users for TaskServer - jbpm5
          Mauricio Salatino Master

          You can add new users on demand, there is no problem with that. When new users are added, if they belong to a group assigned in a task, they will be able to claim the task and work on it. There is no trouble with that. The only thing that you cannot do is to create an fixed assignment in your process to an unexisting user. Let's say you create the Activity1 and you assign it to "Paul", but Paul doesn't exist yet, the task assignment will fail because Paul doesn't exist.

          In the other hand if you define an Activity1 assigned to a group, let's say "Group(Operator)" then you can create Paul and if Paul belongs to the Operator group, he will be able to claim the task and work on it without troubles.

          Greetings, hope it helps!

          • 2. Defining users for TaskServer - jbpm5
            Odelya Holiday Novice

            Thanks.

             

            In the code I start the server like this:

             

            taskService = new TaskService(emf, SystemEventListenerFactory.getSystemEventListener());

            taskSession = taskService.createSession();

            taskSession.addUser(myuser);

            server = new MinaTaskServer(taskService);

             

            and I invoke it only once - startup of application.

             

            so you mean that I can write taskSession.addGroup(myuser); while the server is running will add it to db?

            • 3. Defining users for TaskServer - jbpm5
              Mauricio Salatino Master

              Yes, it should work perfectly. The taskSession.addGroup(myuser) will endup doing a SQL query inside a database.. nothing more complicated than that.. and the assignments will be done at runtime, querying those tables.

              Greetings. Hope it helps!

              • 4. Defining users for TaskServer - jbpm5
                Cristiano Nicolai Newbie

                I'm wondering if there is a better way to deal with users and groups. My point is, and probably is a very common use case, to have users and groups in a external source, like DB or LDAP, forcing a replication of this data to TaskServer DB.

                 

                Any thought?

                • 5. Defining users for TaskServer - jbpm5
                  Mauricio Salatino Master

                  Yes of course, that's why all the classes inside: https://github.com/krisv/jbpm/tree/master/jbpm-human-task/src/main/java/org/jbpm/userprofile

                  exist. They abstract the model of users and these classes can be extended to wrap your user/group models. Please take a look at the comments in the classes, those probably are the answer to your question.

                  Greetings!

                  • 6. Defining users for TaskServer - jbpm5
                    dan lo Newbie

                    Hi,

                     

                    I had read those classes, but still not sure how can i connect my own LDAP with JBPM 5. Is there any sample or tutorial for LDAP/JBPM5?

                     

                    Many thanks.

                    • 7. Re: Defining users for TaskServer - jbpm5
                      Diduch Cordova Newbie

                      HOW CAN I OBTAIN THE USERS OF A GROUP.... AND HOW CAN I ADD A USER IN A GROUP... IN WHAT TABLE CAN I SEE THAT... JBPM4 HAD THE MEMBERSHIP TABLE.... FOR EXAMPLE:

                       

                      GROUPS: ONE, TWO

                       

                      USERS: USER1, USER2, USER3

                       

                      I WANT TO THE GROUP ONE HAS USER1 AND USER2 AND IN THE ANOTHER GROUP THE USER3

                       

                      WHEN I HAVE A TASK I WANT TO IN THE GROUP ONE, ONE OF ITS MEMBERS TAKES THE TASK...

                       

                      I WANT TO MAKE THIS IN THE ECLIPSE-DROOLS...

                      • 8. Defining users for TaskServer - jbpm5
                        Alex Pavlov Newbie

                        Cristiano Nicolai wrote:

                         

                        I'm wondering if there is a better way to deal with users and groups. My point is, and probably is a very common use case, to have users and groups in a external source, like DB or LDAP, forcing a replication of this data to TaskServer DB.

                         

                        Any thought?

                         

                        Mauricio Salatino wrote:

                         

                        Yes of course, that's why all the classes inside: https://github.com/krisv/jbpm/tree/master/jbpm-human-task/src/main/java/org/jbpm/userprofile

                        exist. They abstract the model of users and these classes can be extended to wrap your user/group models. Please take a look at the comments in the classes, those probably are the answer to your question.

                        Greetings!

                         

                        Mauricio, could you please elaborate a bit further? I do not see the UserProfileManager class (the one, the custom implementation of UserProfileRepository interface is supposed to be plugged in) to be used at all. Furthermore, the org.jbpm.task.User object is hardcoded to be an entity in a local database and since Task entity has a reference to the User object, the very moment TaskServiceSession.addTask() tries to persist the Task object for user, which is not in the local database, exception inevitably fires:

                         

                        java.sql.BatchUpdateException: Cannot add or update a child row: a foreign key constraint fails (`taskserver`.`task`, CONSTRAINT `FK27A9A59E619A0` FOREIGN KEY (`createdBy_id`) REFERENCES `organizationalentity` (`id`))

                         

                        The bottom line: all users must be replicated in the task server database. Definitely not the way to go, and this is probably why all the classes in the org.jbpm.userprofile exist. But I do not see how one could make any use of the org.jbpm.userprofile package at all.

                         

                        So, could you please describe, what is the recommended way to integrate the task server with an external user repository?

                         

                        Thank you,

                        Alex

                        • 9. Re: Defining users for TaskServer - jbpm5
                          Hans Liss Newbie

                          Alex, have you heard any news on this issue? I would also like to set up a task server using a central directory through a custom DAO. The org.jbpm.userprofile stuff looks promising, but it's not being used anywhere in jbpm5, as far as I can determine.

                           

                          Best regards,

                           

                          Hans

                          • 10. Re: Defining users for TaskServer - jbpm5
                            Alex Pavlov Newbie

                            Hi Hans,

                             

                            I got no feedback on this issue ever. Finally I had to patch the jbpm code to allow subclassing of the TaskService, see

                             

                            https://issues.jboss.org/browse/JBPM-3074

                             

                            and implemented custom SeamTaskService, which provides a method for replication of user/groups database from Seam IdentityStore.

                             

                            I have no idea whether JBPM-3074 patch is included into jbpm though. We do not use jbpm any more. I have tried using multiple open source BPMN engines and I found that the common approach, the "executable XML" is not practical, at least for me. I prefer good old plain Java instead of complicated puzzle made of plugins, property dialog boxes and code snippets written in scripting languages. I implement BPMN nodes as annotated POJOs being handled by a simple BPMN engine, which consults BPMN XML only to route tokens between the nodes (POJOs) automatically instantinating and persisting the nodes.

                            • 11. Re: Defining users for TaskServer - jbpm5
                              Hans Liss Newbie

                              Hi Alex,


                              Thanks for your answer. I was afraid of this. I want to avoid doing any replication whatsoever, since there is absolutely no reason to keep copies of User/Group data locally when it's readily available in the directory, so I think even your workaround will not be optimal for me, besides involving more development work than I would have expected using an off the shelf product.

                               

                              Your new approach seems interesting. Have you considered releasing your work publicly?

                               

                              Best regards,

                               

                              Hans

                              • 12. Re: Defining users for TaskServer - jbpm5
                                Alex Pavlov Newbie

                                Hans,

                                 

                                you are not confined to use the CommandBasedWSHumanTaskHandler. You may develop (and if you are serious about jbpm you will probably have to) your own implementation of WorkItemHandler. As a matter of fact, WS-HumanTask specification is not a part of BPMN at all. In my opnion, WS-HumanTask is overgeneralized description of human task life cycle, using it makes sense only if you use a complete WS-HT compatible package featuring user interface and user interface development tools. If you plan building your own user interface, introducing WS-HT server component would be probably unnecessary complication.

                                 

                                re. Your new approach seems interesting. Have you considered releasing your work publicly?

                                 

                                It is released as open source (Apache v. 2.0 license). Just check my profile for the link. I interested in further info, I would suggest using PM, this is jbpm forum after all.

                                 

                                By the way, to avoid false impression of me criticising jBPM: I have spent several months implementing pilot projects using several open source BPMN engines and, if forced (by customer, contract etc) to pick the winner, I would stick to jBPM - it was the only package I was comfortable to work with. Not a completely "smoke and mirrors" (Bonita), no ties with VMware/Spring  (Activiti), based on mature software (Drools), to be supported by JBoss (at least this is what mentioned several times here)...

                                 

                                Sincerely,

                                Alex

                                • 13. Re: Defining users for TaskServer - jbpm5
                                  Stephen McConnell Newbie

                                  I started digging into the org.jbpm.userprofile package on the grounds that it looked looke a good starting point to figure out how jBPM leverages external authentication and authorisation when dealing with actors and workflow.  I stumbled upon UserProfileRepository while walking though the UserProifileManager (from the same package). According to class-level documentation in UserProfileManager retrieves and updates user profiles using a pluggable UserProfileRepository.

                                   

                                  Thing is - in the jBPM source repository (http://sourceforge.net/projects/jbpm/files/jBPM%205/jbpm-5.2.0.Final/jbpm-5.2.0.Final-src.zip/download) there is no implementation of UserProfileRepository.

                                   

                                  This raises a couple of issues:

                                   

                                  1. is UserProfileRepository and friends an unfinished work-in-progress?
                                  2. should I be looking somewhere else as the entry-point for integration of jBPM into an existing enterprise security framework?

                                   

                                   

                                  Cheers, Steve.

                                  • 14. Re: Defining users for TaskServer - jbpm5
                                    Demian Calcaprina Master

                                    Hi Stephen. I don't know about the user profile manager. But for 5.2, you have an interface called org.jbpm.task.service.UserGroupCallback. When an operation to task server is done it will check in the defined implementation whether the user or grupo exists, and get the users of the groups.

                                     

                                    You can write an implementation of this simple interface, and set the system property jbpm.usergroup.callback with the name of your class (or user a .properties file), and then you will have the integration between your enterprise security framework and jbpm6.

                                     

                                    Hope this helps,

                                     

                                    Demian

                                    1 2 Previous Next