12 Replies Latest reply on Mar 28, 2007 10:22 AM by falazar

    issue for Assignment to Group

    Srikanth Ramaswamy Newbie

      Hi,

      The below source is not able to assign to multiple user.

      I`ve create the hypersonic data

      User
      ********
      INSERT INTO JBPM_ID_USER VALUES(5,'U','sri','sri@sesamestreet.tv','sri)
      INSERT INTO JBPM_ID_USER VALUES(6,'U','mah','mah@sesamestreet.tv','mah')
      INSERT INTO JBPM_ID_USER VALUES(7,'U','raje','raje@sesamestreet.tv','raje)

      Group
      *******
      INSERT INTO JBPM_ID_GROUP VALUES(1,'G','operator','a',NULL)

      Membership
      ***********
      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(1,'M','member1','oper',5,1)
      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(2,'M','member2','oper',6,1)
      INSERT INTO JBPM_ID_MEMBERSHIP VALUES(3,'M','member3','oper',7,1)

      The below is my processdesing xml code

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition name="nccMultipleTask">
      
       <!-- SWIMLANES (= process roles) -->
      
       <swimlane name="customer" >
       <assignment expression="user(customer)" />
       </swimlane>
      
       <swimlane name="operator">
       <assignment expression="group(operator)" />
       </swimlane>
      
       <swimlane name="financial">
       <assignment expression="user(grover)" />
       </swimlane>
      
       <!-- NODES -->
      
       <start-state name="create new Loan Application">
       <task swimlane="customer">
       <controller>
       <variable name="name" access=",write"></variable>
       <variable name="amount" access=",write"></variable>
       <variable name="property" access=",write"></variable>
       <variable name="salary" access=",write"></variable>
       <variable name="address" access=",write"></variable>
       </controller>
       </task>
       <transition name="toloanfork" to="loanfork"></transition>
       </start-state>
      
       <fork name="loanfork">
       <transition name="toTask2" to="evaluate Loan Application by m"></transition>
       </fork>
      
       <join name="loanjoin">
       <transition name="Store" to="Financial Manager"></transition>
       </join>
      
       <end-state name="end" />
      
       <task-node name="Financial Manager">
       <task swimlane="financial">
       <controller>
       <variable name="name" access="read"></variable>
       <variable name="amount" access="read"></variable>
       <variable name="property" access="read"></variable>
       <variable name="salary" access="read"></variable>
       <variable name="address" access="read"></variable>
       <variable name="comment" access="read"></variable>
       <variable name="Final comment by grover" access=",write"></variable>
       </controller>
       </task>
       <transition name="toend" to="end"></transition>
       </task-node>
       <task-node name="evaluate Loan Application">
       <task swimlane="operator" >
       <controller>
       <variable name="name" access="read"></variable>
       <variable name="amount" access="read"></variable>
       <variable name="property" access="read"></variable>
       <variable name="salary" access="read"></variable>
       <variable name="address" access="read"></variable>
       <variable name="comment" access=",write"></variable>
       </controller>
       </task>
       <transition name="toloanjoin2" to="loanjoin"></transition>
       </task-node>
      
      </process-definition>
      



      It`s not going to assing the multpile user, it`s giving null, Please let me know what wrong in my code.

      A new task has been assigned to 'null'

      It`s inserting null value in actor id in JBPM_Swillaninstance table see below.

      INSERT INTO JBPM_SWIMLANEINSTANCE VALUES(61,'operator',NULL,67,35)


      Highly appreciate to solve my issue!

      Thanks & regards
      Srikanth


        • 1. Re: issue for Assignment to Group
          Srikanth Ramaswamy Newbie

          I mean when you complete the first task (ie start state) it`s giving the message in server
          "A new task has been assigned to `null`"

          • 2. Re: issue for Assignment to Group
            Gerhard Wittwer Newbie

            Hello

            There is nothing wrong in your code. The jBPM Workflow Engine Core doesn't handle the assignment of multiple users (group) well. It's a bug.
            There are some bug issues in the JIRA of jBPM.

            Perhaps I'm wrong with my statement, but I worked long and hard for a assignment of groups. It is not just so easy as it is descriped in the jBPM Manual.

            Search the forum for "assignment" and you will get some topics about the assignment with solutions how to do it.

            Regards
            Gerhard

            • 3. Re: issue for Assignment to Group
              Srikanth Ramaswamy Newbie

              Hello,

              I gone through some topic as your advice and i implement as below but still it is not assign, Could you please let me know what is wrong in my code.


              public void assign(Assignable assignable, ExecutionContext executionContext) {
              nccExpressionAssignmentHandler assignmentHandler = new nccExpressionAssignmentHandler();

              IdentitySession session = (IdentitySession) assignmentHandler.getExpressionSession();
              log.info("***************** Group Name --- "+groupName);
              Group group = session.getGroupByName(groupName);
              log.info("***************** Group Object for User list --- "+group);
              Set set = group.getUsers();
              log.info("***************** Set Object for User list --- "+set);
              log.info("***************** Set Object for User list --- "+set.size());
              String strUser[] = new String[set.size()];
              Iterator it = set.iterator();
              //Set userNames = new HashSet();
              ArrayList list = new ArrayList();
              int i =0;
              while (it.hasNext()){
              User user = (User) it.next();
              //userNames.add(new PooledActor(user.getName()));
              //list.add(new PooledActor(user.getName()));
              log.info("*******User Get Name in Assignment--- "+user.getName());
              strUser= user.getName();
              i++;
              }
              assignable.setPooledActors(strUser);
              }

              in process design xml file

              <swimlane name="group_operator">
               <assignment class = "com.ncc.nccMultipleTask.nccExpressionAssignmentHandler">
               <groupName>operator</groupName>
               </assignment>
               </swimlane>
              


              Appreciate to solve my issue!.

              regards
              Srikanth


              • 4. Re: issue for Assignment to Group
                Srikanth Ramaswamy Newbie

                Hi,

                It's look like jBPM Workflow Engine Core doesn't handle the assignment of multiple users (group) well.
                Even i did Assignment Handler to set the pooledActor in taskInstance , assignable... but no luck.

                Let me know the above bug is fixed

                regards
                Srikanth

                • 5. Re: issue for Assignment to Group
                  Tom Baeyens Master

                  best is to make sure there is a jira issue for it that explains the problem as good as possible. preferrably with a test case that shows the problem. thanks.

                  regards, tom.

                  • 6. Re: issue for Assignment to Group
                    eskina eskina Newbie

                    Hi!

                    I don't have success assignment group, working this example.....
                    I receive this message "A new task has been assigned to 'null'"

                    Please help me!

                    I use jbpm jbpm-starters-kit-3.1-beta2 with DB2.....

                    Thanks!!!!

                    • 7. Re: issue for Assignment to Group
                      Srikanth Ramaswamy Newbie

                      Hi,

                      i just implement in TaskInstance.java

                       public void copySwimlaneInstanceAssignment(SwimlaneInstance swimlaneInstance) {
                       setSwimlaneInstance(swimlaneInstance);
                      
                      /*setActorId(swimlaneInstance.actorId);
                      setPooledActors(swimlaneInstance.pooledActors!=null ? new HashSet(swimlaneInstance.pooledActors) : null);
                      */
                      
                      log.info("TaskInstance:copySwimlaneInstanceAssignment :: actorId "+swimlaneInstance.actorId);
                       if(swimlaneInstance.actorId!=null){
                       setActorId(swimlaneInstance.actorId);
                       }
                      
                      setPooledActors(swimlaneInstance.pooledActors!=null ? new HashSet(swimlaneInstance.pooledActors) : null);
                      Set set = swimlaneInstance.pooledActors;
                       Iterator it = set.iterator();
                       int i =0;
                      while (it.hasNext()){
                       Object obj = it.next();
                       User user = (User) obj;
                       setActorId(user.getName());
                       }
                       }
                       }
                      


                      it create the one task in jbpm_taskInstance table but it overide the last user.
                      For eg. in Group have 2 user say "tom","sri"
                      and it assing to sri. it should be create two record in jbpm_taskinstance as tom and sri user ...

                      Please share did anyone workaround this?



                      • 8. Re: issue for Assignment to Group
                        falazar Novice

                        Posted some more information on: http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3957080#3957080

                        It appears that when you assign a task to a Group(NAME) it WILL save it in the database to the appropriate group.
                        The web interface, does not however display tasks to the users that have been assigned to their groups correctly. So it appears the first part was done correctly, just the web interface section was never implemented.

                        This problem is referenced throughou the forums, and multiple times in the jira as well, with no good resolution.

                        Search Forum: groups 'assignment expression'

                        Regards
                        James Ratcliff

                        • 9. Re: issue for Assignment to Group
                          Bob K Newbie

                          Has there been a fix to enable group assignment? I've been playing with JBpm for a couple of days but have not been able to get group assignment to work. I'm using starter kit 3.1.3.

                          I tried modifying the jbpm/src/java.jbpm/org/jbpm/db/hibernate.queries.hbm.xml file with the query James posted but it did not seem to fix the issue of seeing it in the users tasklist.

                          If I run the query in query manager it does retrieve the taskinstances for the group users.

                          • 10. Re: issue for Assignment to Group
                            Ronald van Kuijk Master

                            group assignment *does* work as james states... just the webconsole does not show it. Create a fix there (we won't since the webconsole before 3.2 was 'demo' quality and the 3.2 webconsole is a major redesign....

                            • 11. Re: issue for Assignment to Group
                              Ronald van Kuijk Master

                              James, is it the webapp or the core that does things wrong. If it is the core, we need to fix it, if it is the webapp, we won't. (or the webconsole of 3.2 must work with 3.1, but that is not (goint to be?) tested by us.

                              • 12. Re: issue for Assignment to Group
                                falazar Novice

                                was just the webapp I believe, we updated ours to account for this a while back now.