3 Replies Latest reply on May 5, 2010 5:32 AM by Jaber C. Mourad

    find User tasks

    Jaber C. Mourad Novice

      Hi,

       

      I'm trying to find some tasks assign to a user, but no success !

       

      I have done a mock identity service to produce test data

       

      My test process :

      <?xml version="1.0" encoding="UTF-8"?>
      
      <process key="test" name="userTaskTest" version="1" xmlns="http://jbpm.org/4.0/jpdl">
          <start candidate-users="john" g="0,0,80,40" name="init">
            <transition to="johnTask" g="-93,-24"/>
          </start>
      
          <end g="258,238,80,40" name="theEnd"/>
         <task candidate-users="sarah" g="170,179,92,52" name="sarahTask">
            <transition g="-81,-24" name="to theEnd" to="theEnd"/>
         </task>
         <task candidate-users="john" g="46,65,92,52" name="johnTask">
            <transition g="-110,-24" name="to SarahTask" to="sarahTask"/>
         </task>
      </process>

       

       

      My test :

       

      RepositoryService repositoryService = processEngine.getRepositoryService();
      ProcessDefinition testProcess = repositoryService.createProcessDefinitionQuery()
                      .processDefinitionKey("test").uniqueResult();
      ExecutionService executionService = processEngine.getExecutionService();
      ProcessInstance instance = executionService.startProcessInstanceByKey("test");
      logger.info("instance state : {}", instance.getState());
      Set<String> activities = instance.findActiveActivityNames();
      for (String activity : activities) {
              logger.info("Activity : {}", activity);
      }
      
      TaskService taskService = processEngine.getTaskService();
      
      List<Task> tasks = taskService.findPersonalTasks("john");
      assertFalse("No tasks for John !", tasks.isEmpty());
      

       

      No tasks for john !

      Expected 1 because of candidate-users="john" in the task "johnTask", am I wrong ?

       

      How to make it works ?

       

      Thanks