1 Reply Latest reply on Jan 6, 2007 6:32 AM by koen.aers

    Finding task instances for pooled actors

    bnsbr

      Hi all,

      I'm trying to get a list of tasks for a user based on the pooled actors of that task. Searching at the docs, I have found in section "11.3.4. Pull model" the suggestion to use TaskMgmtSession.findPooledTaskInstances method. Trying to do that I get a empty list of tasks. My process is based on swinlanes that use expressions to assign tasks. Bellow is one part of the processdefinition.xml:


      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.1"
       name="inss">
       <swimlane name="beneficiario">
       <assignment expression="group(beneficiario)" class="br.unb.cic.identity.assignment.INSSExpressionAssignmentHandler"></assignment>
       </swimlane>
       <swimlane name="medico">
       <assignment expression="group(medico)" class="br.unb.cic.identity.assignment.INSSExpressionAssignmentHandler"></assignment>
       </swimlane>
       <swimlane name="administrativo">
       <assignment expression="group(administrativo)" class="br.unb.cic.identity.assignment.INSSExpressionAssignmentHandler"></assignment>
       </swimlane>
       <start-state name="Requerimento de auxilio doenca">
       <task name="Requerimento de auxilio doenca" swimlane="beneficiario">
       <controller>
       <variable name="nit" access="read,write,required" mapped-name="NIT"></variable>
       <variable name="cpf" access="read,write,required" mapped-name="CPF"></variable>
       <variable name="ultimoDia" access="read,write,required" mapped-name="Ultimo dia trabalhado"></variable>
       </controller>
       </task>
       <transition name="" to="Marcar pericia"></transition>
       </start-state>
       <end-state name="end"></end-state>
      


      The strange part is that debugging the system, everything seems to be fine. The task instance is in the database and 2 of the 3 conditions of the query used to get the list of tasks for pooled actors (TaskMgmtSession.findPooledTaskInstancesByActorId) are met, the actorId of the taskInstance is null and the task instance is open. The problem is on the condition that compares that pooledActor.actorId to the swimlaneActorId, bellow is the query used in the TaskMgmtSession.findPooledTaskInstances(String actorId) method:

       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.isOpen = true
      


      The values stored in the important tables are:
      users:
      
      id:1
      username:test
      
      id:2
      username:test2
      
      id:3
      username:test3
      -------------------------
      groups:
      
      id:1
      name:beneficiario
      
      id:2
      name:medico
      
      id:3
      name:administrativo
      ---------------------------
      membership:
      
      id:1
      user_id:1
      group_id:1
      
      id:2
      user_id:2
      group_id:2
      
      id:3
      user_id:3
      group_id:3
      ------------------------------
      swimlane:
      
      id:1
      name_:medico
      actoridexpression_: null
      pooledactorexpression_: null
      
      id:2
      name_:administrativo
      actoridexpression_: null
      pooledactorexpression_: null
      
      id:3
      name_:beneficiario
      actoridexpression_: null
      pooledactorexpression_: null
      ----------------------------------
      swimlaneinstance:
      
      id:2
      name_:administrativo
      actorid: null
      swimlane_:2
      taskmgmtinstance_:2
      ------------------------------
      pooledactor:
      
      id:1
      actorid_:administrativo
      swimlaneinstance_:2
      


      I think that this is the relevant data about the stored values at the database. As you can see the value of the field that is compared on the query (pooledActor.actorId) contains the name of the group that is assigned to that task, but the value that the method (TaskMgmtSession.findPooledTaskInstances(String actorId)) receive is the actorId of the user, and not the name of the group and then the query result is empty...


      Can anyone help? Any clues ?

      Thanks,
      Bruno.

        • 1. Re: Finding task instances for pooled actors
          koen.aers

          Hi Bruno,

          Nice to see jBPM is used in Brazil. Maybe your problem is already solved, but from what I can see it is due to the fact that you are combining an assignment handler (br.unb.cic.identity.assignment.INSSExpressionAssignmentHandler) with an assignment expression in your swimlane assignment. What is the handler exactly doing?

          Regards,
          Koen