Package org.activiti.engine

Examples of org.activiti.engine.TaskService


  public static void main(String[] args) {
    ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
    RuntimeService runtimeService = processEngine.getRuntimeService();
    RepositoryService repositoryService = processEngine.getRepositoryService();

    TaskService taskService = processEngine.getTaskService();
    ManagementService managementService = processEngine.getManagementService();
    IdentityService identityService = processEngine.getIdentityService();
    HistoryService historyService = processEngine.getHistoryService();
    FormService formService = processEngine.getFormService();
View Full Code Here


            .getVariable(processInstance.getProcessInstanceId(),
                DESCRIPTION_KEY),
        endsWith("I hate your xxxing shop!"));

    // get a handle on the task service
    TaskService taskService = activitiRule.getTaskService();

    // seach for a task for candidate-group 'itsupport-critical'
    Task approveCriticalIssueTask = taskService.createTaskQuery()
        .processInstanceId(processInstance.getProcessInstanceId())
        .taskCandidateGroup(itSupportGroup.getId()).singleResult();
    assertThat(approveCriticalIssueTask.getName(),
        equalTo("Approve Critical Issue"));

    // claim the task for the user 'itguy'
    taskService.claim(approveCriticalIssueTask.getId(), itguy.getId());

    // approve the request and complete the task
    Map<String, Object> taskParams = new HashMap<String, Object>();
    taskParams.put("requestApproved", "true");
    taskService.complete(approveCriticalIssueTask.getId(), taskParams);

    // now we should have received an email..
    smtpServer.waitForIncomingEmail(5000L, 1);
    MimeMessage[] messages = smtpServer.getReceivedMessages();
    assertThat(messages.length, equalTo(1));
View Full Code Here

  @Test
  @Deployment(resources="open-account.bpmn")
  public void testApprovedPath() throws Exception {
    // Get services
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    TaskService taskService = activitiRule.getTaskService();
    HistoryService historyService = activitiRule.getHistoryService();
   
    // Prepare mock for muleService
    MuleService muleService = mock(MuleService.class);
    Mocks.register("mule", muleService);
   
    // Start process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("open-account-mule");
   
    runtimeService.signal(processInstance.getId());
   
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("approved", true);
   
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId(), variables);
   
    assertEquals(0, runtimeService.createProcessInstanceQuery().list().size());
   
    List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list();
    assertEquals(7, activityInstances.size());
View Full Code Here

  @Test
  @Deployment(resources="open-account.bpmn")
  public void testNonApprovedPath() throws Exception {
    // Get services
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    TaskService taskService = activitiRule.getTaskService();
    HistoryService historyService = activitiRule.getHistoryService();
   
    // Prepare mock for muleService
    MuleService muleService = mock(MuleService.class);
    Mocks.register("mule", muleService);
   
    // Start process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("open-account-mule");
   
    runtimeService.signal(processInstance.getId());
   
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("approved", false);
   
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId(), variables);
   
    assertEquals(0, runtimeService.createProcessInstanceQuery().list().size());
   
    List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list();
    assertEquals(7, activityInstances.size());
View Full Code Here

  @Test
  @Deployment(resources="open-account.bpmn")
  public void testApprovedPath() throws Exception {
    // Get services
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    TaskService taskService = activitiRule.getTaskService();
    HistoryService historyService = activitiRule.getHistoryService();
   
    // Prepare fake camel behavior
    CamelBehaviourStub camelBehaviour = new CamelBehaviourStub();
    Mocks.register("camel", camelBehaviour);
   
    // Start process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("open-account");
   
    runtimeService.signal(processInstance.getId());
   
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("approved", true);
   
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId(), variables);
   
    assertEquals(0, runtimeService.createProcessInstanceQuery().list().size());
   
    List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list();
    assertEquals(7, activityInstances.size());
View Full Code Here

  @Test
  @Deployment(resources="open-account.bpmn")
  public void testNonApprovedPath() throws Exception {
    // Get services
    RuntimeService runtimeService = activitiRule.getRuntimeService();
    TaskService taskService = activitiRule.getTaskService();
    HistoryService historyService = activitiRule.getHistoryService();
   
    // Prepare fake camel behavior
    CamelBehaviourStub camelBehaviour = new CamelBehaviourStub();
    Mocks.register("camel", camelBehaviour);
   
    // Start process instance
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("open-account");
   
    runtimeService.signal(processInstance.getId());
   
    Map<String, Object> variables = new HashMap<String, Object>();
    variables.put("approved", false);
   
    Task task = taskService.createTaskQuery().singleResult();
    taskService.complete(task.getId(), variables);
   
    assertEquals(0, runtimeService.createProcessInstanceQuery().list().size());
   
    List<HistoricActivityInstance> activityInstances = historyService.createHistoricActivityInstanceQuery().orderByHistoricActivityInstanceStartTime().asc().list();
    assertEquals(7, activityInstances.size());
View Full Code Here

     */
    @RequestMapping("workspace-claimTask")
    public String claimTask(@RequestParam("taskId") String taskId) {
        String userId = SpringSecurityUtils.getCurrentUserId();

        TaskService taskService = processEngine.getTaskService();
        taskService.claim(taskId, userId);

        return "redirect:/bpm/workspace-listPersonalTasks.do";
    }
View Full Code Here

     * @return
     */
    @RequestMapping("workspace-delegateTask")
    public String delegateTask(@RequestParam("taskId") String taskId,
            @RequestParam("userId") String userId) {
        TaskService taskService = processEngine.getTaskService();
        taskService.delegateTask(taskId, userId);

        return "redirect:/bpm/workspace-listPersonalTasks.do";
    }
View Full Code Here

     *
     * @return
     */
    @RequestMapping("workspace-resolveTask")
    public String resolveTask(@RequestParam("taskId") String taskId) {
        TaskService taskService = processEngine.getTaskService();
        taskService.resolveTask(taskId);

        return "redirect:/bpm/workspace-listPersonalTasks.do";
    }
View Full Code Here

     * 协办.
     */
    @RequestMapping("workspace-doDelegateHelp")
    public String doDelegateHelp(@RequestParam("taskId") String taskId,
            @RequestParam("attorney") String attorney) {
        TaskService taskService = processEngine.getTaskService();
        taskService.delegateTask(taskId, attorney);

        return "redirect:/bpm/workspace-listPersonalTasks.do";
    }
View Full Code Here

TOP

Related Classes of org.activiti.engine.TaskService

Copyright © 2018 www.massapicom. 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.