Package org.activiti.engine.task

Examples of org.activiti.engine.task.TaskQuery.singleResult()


    // After the process has started, the 'verify credit history' task should be active
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
    TaskService taskService = activitiRule.getTaskService();
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task verifyCreditTask = taskQuery.singleResult();
    assertEquals("Verify credit history", verifyCreditTask.getName());
   
    // Verify with Query API
    ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
    assertNotNull(subProcessInstance);
View Full Code Here


    assertNotNull(subProcessInstance);
    assertEquals(pi.getId(), runtimeService.createProcessInstanceQuery().subProcessInstanceId(subProcessInstance.getId()).singleResult().getId());
   
    // Completing the task with approval, will end the subprocess and continue the original process
    taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
    Task prepareAndShipTask = taskQuery.singleResult();
    assertEquals("Prepare and Ship", prepareAndShipTask.getName());
  }
}
View Full Code Here

  protected Task getCurrentTask( String processId ){
    TaskQuery query = taskService.createTaskQuery();
    query.active();
    query.processInstanceId(processId).listPage(0,1);
   
    return query.singleResult();
  }
 
  /**
   * 查询任务
   */
 
View Full Code Here

  })
  public void testOrderProcessWithCallActivity() {
    // After the process has started, the 'verify credit history' task should be active
    ProcessInstance pi = runtimeService.startProcessInstanceByKey("orderProcess");
    TaskQuery taskQuery = taskService.createTaskQuery();
    Task verifyCreditTask = taskQuery.singleResult();
    assertEquals("Verify credit history", verifyCreditTask.getName());
   
    // Verify with Query API
    ProcessInstance subProcessInstance = runtimeService.createProcessInstanceQuery().superProcessInstanceId(pi.getId()).singleResult();
    assertNotNull(subProcessInstance);
View Full Code Here

    assertNotNull(subProcessInstance);
    assertEquals(pi.getId(), runtimeService.createProcessInstanceQuery().subProcessInstanceId(subProcessInstance.getId()).singleResult().getId());
   
    // Completing the task with approval, will end the subprocess and continue the original process
    taskService.complete(verifyCreditTask.getId(), CollectionUtil.singletonMap("creditApproved", true));
    Task prepareAndShipTask = taskQuery.singleResult();
    assertEquals("Prepare and Ship", prepareAndShipTask.getName());
  }
}
View Full Code Here

        // Start process (main)
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("testCallActivityByExpression");

        // one task in the subprocess should be active after starting the process instance
        TaskQuery taskQuery = taskService.createTaskQuery();
        Task taskBeforeSubProcess = taskQuery.singleResult();
        assertEquals("Task before subprocess", taskBeforeSubProcess.getName());

        // Completing the task continues the process which leads to calling the subprocess. The sub process we want to
        // call is passed in as a variable into this task
        taskService.complete(taskBeforeSubProcess.getId());
View Full Code Here

        assertEquals("Task before subprocess", taskBeforeSubProcess.getName());

        // Completing the task continues the process which leads to calling the subprocess. The sub process we want to
        // call is passed in as a variable into this task
        taskService.complete(taskBeforeSubProcess.getId());
        Task taskInSubProcess = taskQuery.singleResult();
        assertEquals("Task in subprocess", taskInSubProcess.getName());

        // Completing the task in the subprocess, finishes the subprocess
        taskService.complete(taskInSubProcess.getId());
        Task taskAfterSubProcess = taskQuery.singleResult();
View Full Code Here

        Task taskInSubProcess = taskQuery.singleResult();
        assertEquals("Task in subprocess", taskInSubProcess.getName());

        // Completing the task in the subprocess, finishes the subprocess
        taskService.complete(taskInSubProcess.getId());
        Task taskAfterSubProcess = taskQuery.singleResult();
        assertEquals("Task after subprocess", taskAfterSubProcess.getName());

        // Completing this task end the process instance
        taskService.complete(taskAfterSubProcess.getId());
        assertProcessEnded(processInstance.getId());
View Full Code Here

        .taskId("invalid");
    assertEquals(7, query.list().size());
    assertEquals(7, query.count());

    try {
      query.singleResult();
      fail("expected exception");
    } catch (ActivitiException e) {
      // OK
    }
  }
View Full Code Here

    }
  }

  public void testQueryByNameLike() {
    TaskQuery query = taskService.createTaskQuery().taskNameLike("gonzo%");
    assertNotNull(query.singleResult());
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
  }
 
  public void testQueryByNameLikeOr() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.