3 Replies Latest reply on Nov 15, 2005 5:57 AM by Gerhard Wittwer

    jbpm Identity and assignments : Using _name_  to assign task

    kamaljeet sandhu Newbie

      I have been working on an app with the identity component and now envisage
      a problem with the process assignments .

      The app allows the users to change the names of the user(their own) and group etc. over time(as all ref. is thru Ids and these are constant) .This screws up all assignments unless I use : getId().toString() as the _name_ in the processdefinitions .

      Is there somthing to do about it or just my peculiar ....as I have seen this name usage communicated as a plus in jbpm....

      Secondly if you use strings like group name in assignment instead of Ids does this automatically imply the names are not changeable in the app.

      Lastly is anyone using Identity component in a real app ?

      Any ideas greatly appreciated.

      -Sandhu

        • 1. Re: jbpm Identity and assignments : Using _name_  to assign
          Gerhard Wittwer Newbie

          Hello

          I'm using an extended identity module which is based on the jbpm identity module.

          My users / roles / groups couldn't change their names. But I've got problems with the assignment: It always assign the new task to a 'null'... I don't know why! The ExpressionAssignmentHandler gets the right entity and set ActorId or pooledActorIds (name of user/group/roles).

          If you got the same problem, it would be nice if you could help me with this (Why are they assigned to null??).

          I don't know if jbpm is working with the names or the id's of the actors. It's a question mark for me too...

          Regards
          Gerhard

          • 2. Re: jbpm Identity and assignments : Using _name_  to assign
            Ronald van Kuijk Master

            always? or jsut the second time a swimlane is used on a task? meaning assigment to the first tast is ok, the second task not.

            • 3. Re: jbpm Identity and assignments : Using _name_  to assign
              Gerhard Wittwer Newbie

              Hello

              First the assignment was always null. Then I added the following code to the "start new process" method:

              //create swimlane instances
               // this is necessary because its a bug in jbpm
               log.debug("create swimlane instances");
              
               Map swimlanes = ti.getTaskMgmtInstance().getProcessInstance().getProcessDefinition().getTaskMgmtDefinition().getSwimlanes();
               Iterator itr = swimlanes.keySet().iterator();
               while(itr.hasNext()) {
               Swimlane swimlane = (Swimlane)swimlanes.get(itr.next());
               log.debug("swimlane id="+swimlane.getId()+ " name="+swimlane.getName());
               SwimlaneInstance swi = ti.getTaskMgmtInstance().getProcessInstance().getTaskMgmtInstance().getInitializedSwimlaneInstance(new ExecutionContext(getTaskInstance().getTaskMgmtInstance().getProcessInstance().getRootToken()), swimlane);
               if(swi != null)
               {
               log.debug("swi.setActorId: "+swimlane.getName());
               swi.setActorId(swimlane.getName());
               }
               else
               log.warn("swimlane instance is null!");
               }


              After this it works for the first assignment, the second assignment for the same user was null.
              For example:
              1. User a creates new process (all SwimlaneInstances are generated)
              2. User a saves and closes the task
              3. Assignment for User b
              4. User b edits, saves and closes the task
              5. Assignment is null, should be User a

              I solved this problem:
              Always if a save and close action is executed for a task, the "save & close" method will execute the code (see top) and initializes the swimlaneInstances. This is a very bad workaround, but with this it is working (also the second assignment) and the metadata in the database looks fine.

              I saw, that in JIRA there are several open bug-taks for the assignement.

              Whats your point of view for the solution I'm using?

              Regards
              Gerhard