4 Replies Latest reply on Oct 15, 2005 4:25 PM by kukeltje

    [bug?] taskInstance.setPooledActors()

    the_t

      Hello,

      I think I have found a bug/unexpected behaviour, or at least inconsistency with setting the pooled actors for a taskInstance.

      TaskMgmtSession.java

      private static final String findPooledTaskInstancesByActorId =
      "select distinct ti " +
      "from org.jbpm.taskmgmt.exe.PooledActor pooledActor " +
      " join pooledActor.taskInstances ti " +
      "where pooledActor.actorId = :swimlaneActorId " +
      " and ti.actorId is null " +
      " and ti.end is null " +
      " and ti.isCancelled = false";


      As you can see, the ti.actorId is null statement requires that the actorId is set to null, otherwise it will not retrieve pooledActors.

      But when you look at the TaskInstance.java:
      public void setPooledActors(String[] actorIds) {
      this.pooledActors = PooledActor.createPool(actorIds);
      }


      As you can see, when you setPooledActors(), then you would expect that when you call taskMgmtSession.findPooledTaskInstances() next, you would get the pooledActors for that task. But unfortunately the actorId does not get reset to null by setPooledActors, so you need to do that seperately in the client code.

      This does not seem to a bug to me, that is solved very easily:
      public void setPooledActors(String[] actorIds) {
      this.actorId = null;
      this.pooledActors = PooledActor.createPool(actorIds);
      }


      Just add this line to sePooledActors() and everything works as expected :)

        • 1. Re: [bug?] taskInstance.setPooledActors()
          kukeltje

          Why not set the actorID to null yourself before calling the setPooledActors? That's a nice workaround to, without the need to modify the jbpm core at this time.

          Could you file a jira issue for this.

          • 2. Re: [bug?] taskInstance.setPooledActors()
            the_t

             

            "kukeltje" wrote:
            Why not set the actorID to null yourself before calling the setPooledActors? That's a nice workaround to, without the need to modify the jbpm core at this time.

            Could you file a jira issue for this.

            Ofcourse I did it like that temporary (now just recompiled the source) :)
            But then you always need to remember to do these two things together and in the right order, while it is very easy to fix. I'll try to file a report in JIRA, never tried it before.

            • 3. Re: [bug?] taskInstance.setPooledActors()
              the_t
              • 4. Re: [bug?] taskInstance.setPooledActors()
                kukeltje

                 

                But then you always need to remember to do these two things together and in the right order, while it is very easy to fix.


                In the company I work for, we (I) have created our own workflow API. around the jBPM one. I'd implement it in there. There are more things you do not want certain developers to have knowledge of.
                And besides that, I can use jBPM now in a small process and switch to (unfortunately) Staffware once that becomes operational (I had to little influence to keep Staffware out, but maybe by getting jBPM in via the backdoor, I can show it's capabilities)

                Some of these things could go in the jBPM api, e.g. like starting a process with passing it a map of variables. The advantage we get if it is done IN jBPM, is that you can use the values of these variables in the start-process-event. Currently you can't. I just filed a Jira issue for this http://jira.jboss.org/jira/browse/JBPM-412