4 Replies Latest reply on Apr 16, 2009 10:57 AM by ardavan

    ActorId & PooledActors

    ardavan

      Hi everyone,

      Can a TaskInstance object have a value for the:

      String actorId


      variable and at the same time for the

      String[] actorIds
      variable?

      or when you set the actorId to some value then you can't have any "pooled actors".

      Thank you

      Ardavan

        • 1. Re: ActorId & PooledActors
          swatis

          You can set pooled actors as well actor also.
          You can do the following
          assignable.setPooledActors(new String[]{"userA", "userB"});
          assignable.setActorId("userC");

          • 2. Re: ActorId & PooledActors
            ardavan

            Thanks for your answer Swatis.
            I am traveling around and don't have access to jBPM code for now on.

            My issue is:

            First by implementing the AssignmentHandlerInterface and using:
            assignable.setPooledActors(new String[] { groupNameId });
            I assign a taskinstance to a group of people.


            When a userA wants to "end" the taskInstance, the code is:
            taskInstance.setActorId("userA");
            taskInstance.end();

            After when I run a simple query looking for taskInstances that are ended and have pooledActors equal to groupNamedId, I have no results;
            as if my taskInstance.getPooledActors was equal to null.

            Is it comprehensible?

            • 3. Re: ActorId & PooledActors
              swatis

              Collection l_objClTskInstances = executionContext.getTaskMgmtInstance(
              ).getTaskInstances();
              Iterator it = l_objClTskInstances.iterator();


              while(it.hasNext()) {
              TaskInstance l_objTskInstance = (TaskInstance) it.next();
              if(l_objTskInstance.hasEnded()) {

              Iterator antIt = l_objTskInstance.getPooledActors().iterator();
              while(antIt.hasNext()) {
              PooledActor l_objPooledActor = (PooledActor) antIt.next();
              System.out.println("hello pooled task instance actors are " +
              l_objPooledActor.getActorId());
              }
              }
              }

              • 4. Re: ActorId & PooledActors
                ardavan

                Thank you my friend.
                There was an issue in my query. Now I am using this query and get the right information.

                public List findEndedPooledTaskInstancesByName(List actorIds) {
                 JbpmContext jbpmContext = Tools.jbpmConfiguration.createJbpmContext();
                 try {
                 List taskList;
                 Query query =
                 getSession(jbpmContext).createQuery("select distinct ti\n" +
                 " from org.jbpm.taskmgmt.exe.PooledActor pooledActor "+
                 " join pooledActor.taskInstances ti " +
                 " where pooledActor.actorId in ( :actorIds ) " +
                 " and ti.actorId != null " +
                 " and ti.end != null");
                 query.setParameterList("actorIds", actorIds);
                 taskList = query.list();
                 return taskList;
                 } finally {
                 jbpmContext.close();
                 }
                 }