コード例 #1
0
  protected TaskSummary build(org.kie.server.api.model.instance.TaskSummary task) {
    TaskSummary taskSummary =
        new TaskSummary(
            task.getId(),
            task.getName(),
            task.getDescription(),
            task.getStatus(),
            task.getPriority(),
            task.getActualOwner(),
            task.getCreatedBy(),
            task.getCreatedOn(),
            task.getActivationTime(),
            task.getExpirationTime(),
            task.getProcessId(),
            -1,
            task.getProcessInstanceId(),
            task.getContainerId(),
            task.getParentId(),
            false);

    return taskSummary;
  }
  @Test
  public void testFindTaskAssignedAsBusinessAdmin() throws Exception {
    assertSuccess(
        client.createContainer(
            "definition-project", new KieContainerResource("definition-project", releaseId)));

    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put("stringData", "waiting for signal");
    parameters.put("personData", createPersonInstance("john"));

    Long processInstanceId =
        processClient.startProcess("definition-project", "definition-project.usertask", parameters);

    try {

      List<TaskSummary> tasks =
          taskClient.findTasksAssignedAsBusinessAdministrator("Administrator", 0, 10);
      assertNotNull(tasks);
      assertEquals(1, tasks.size());

      TaskSummary taskInstance = tasks.get(0);
      assertNotNull(taskInstance);
      assertEquals("First task", taskInstance.getName());
      assertEquals("", taskInstance.getDescription());
      assertEquals("Reserved", taskInstance.getStatus());
      assertEquals(0, taskInstance.getPriority().intValue());
      assertEquals("yoda", taskInstance.getActualOwner());
      assertEquals("yoda", taskInstance.getCreatedBy());
      assertEquals("definition-project.usertask", taskInstance.getProcessId());
      assertEquals("definition-project", taskInstance.getContainerId());
      assertEquals(-1, taskInstance.getParentId().longValue());
      assertEquals(processInstanceId, taskInstance.getProcessInstanceId());

      List<String> status = new ArrayList<String>();
      status.add(Status.InProgress.toString());

      tasks = taskClient.findTasksAssignedAsBusinessAdministrator("Administrator", status, 0, 10);
      assertNotNull(tasks);
      assertEquals(0, tasks.size());

    } finally {
      processClient.abortProcessInstance("definition-project", processInstanceId);
    }
  }