Package org.activiti.engine

Examples of org.activiti.engine.TaskService


    HistoryService historyService = activitiRule.getHistoryService();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().formProperties().list();
    assertEquals(1, list.size());
   
    // 获取第一个节点
    TaskService taskService = activitiRule.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertEquals("First Step", task.getName());
   
    TaskFormData taskFormData = formService.getTaskFormData(task.getId());
    assertNotNull(taskFormData);
    assertNull(taskFormData.getFormKey());
    List<FormProperty> taskFormProperties = taskFormData.getFormProperties();
    assertNotNull(taskFormProperties);
    for (FormProperty formProperty : taskFormProperties) {
      System.out.println(ToStringBuilder.reflectionToString(formProperty));
    }
    formProperties = new HashMap<String, String>();
    formProperties.put("setInFirstStep", "01/12/2012");
    formService.submitTaskFormData(task.getId(), formProperties);
   
    // 获取第二个节点
    task = taskService.createTaskQuery().taskName("Second Step").singleResult();
    assertNotNull(task);
    taskFormData = formService.getTaskFormData(task.getId());
    assertNotNull(taskFormData);
    List<FormProperty> formProperties2 = taskFormData.getFormProperties();
    assertNotNull(formProperties2);
View Full Code Here


    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("gateway", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());

    TaskService taskService = activitiRule.getTaskService();
    TaskQuery taskAssignee = taskService.createTaskQuery().taskAssignee("1");
    List<Task> list = taskAssignee.list();
    for (Task task : list) {
      System.out.println(ToStringBuilder.reflectionToString(task));
    }
    variableMap = new HashMap<String, Object>();
    variableMap.put("pass", false);
    taskService.complete(list.get(0).getId(), variableMap);
    System.out.println("A completed");
    taskAssignee = taskService.createTaskQuery().taskAssignee("1");
    list = taskAssignee.list();
    assertEquals(1, list.size());
    assertEquals("C", list.get(0).getName());
  }
View Full Code Here

    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("gateway", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());

    TaskService taskService = activitiRule.getTaskService();
    TaskQuery taskAssignee = taskService.createTaskQuery().taskAssignee("1");
    List<Task> list = taskAssignee.list();
    assertEquals(1, list.size());
    Task task = list.get(0);
    System.out.println(task.getAssignee());
View Full Code Here

    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("TimeBoundaryEvent", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
        + processInstance.getProcessDefinitionId());
   
    TaskService taskService = processEngine.getTaskService();
    Task task = taskService.createTaskQuery().singleResult();
    assertNotNull(task);
   
    taskService.complete(task.getId());
    Thread.sleep(2000);
    System.exit(0);
  }
View Full Code Here

    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("leave", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());
   
    TaskService taskService = activitiRule.getTaskService();
    long count = taskService.createTaskQuery().count();
    assertEquals(0, count);
   
    Task task = taskService.createTaskQuery().singleResult();
    System.out.println(task.getFormKey());
  }
View Full Code Here

    ProcessInstance processInstance1 = runtimeService.startProcessInstanceByKey("SignalIntermediateCatchEvent1", variableMap);
    assertNotNull(processInstance1.getId());
    System.out.println("id " + processInstance1.getId() + " "
        + processInstance1.getProcessDefinitionId());
   
    TaskService taskService = activitiRule.getTaskService();
    // 验证有两个用户任务
    List<Task> list = taskService.createTaskQuery().list();
    assertEquals(2, list.size());
   
    // 完成两个用户任务
    taskService.complete(list.get(0).getId());
    taskService.complete(list.get(1).getId());
   
    // 验证有两个正常运行的实例
    List<HistoricProcessInstance> list2 = activitiRule.getHistoryService().createHistoricProcessInstanceQuery().unfinished().list();
    assertEquals(2, list2.size());
   
View Full Code Here

    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("TraceVariablesOfTask", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());

    TaskService taskService = activitiRule.getTaskService();
    // 执行第一个任务
    Task task = taskService.createTaskQuery().singleResult();
    variableMap = new HashMap<String, Object>();
    for (int i = 0; i < 5; i++) {
      variableMap.put("task1-variable" + (i + 1), "task1-value" + (i + 1));
    }
    taskService.complete(task.getId(), variableMap);

    // 执行第二个任务
    task = taskService.createTaskQuery().singleResult();
    variableMap = new HashMap<String, Object>();
    for (int i = 0; i < 5; i++) {
      variableMap.put("task2-variable" + (i + 1), "task2-value" + (i + 1));
    }
    taskService.complete(task.getId(), variableMap);

    // Map<历史活动ID, Map<变量名称, 变量值>>
    Map<String, Map<String, Object>> activiy_name_value = new HashMap<String, Map<String, Object>>();

    // 从历史中读取变量
View Full Code Here

    variableMap.put("name", "Activiti");
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("AutoClaimForReject", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " " + processInstance.getProcessDefinitionId());
   
    TaskService taskService = activitiRule.getTaskService();
    Task task = taskService.createTaskQuery().taskCandidateGroup("role1").singleResult();
    assertEquals("分配给角色", task.getName());
    taskService.complete(task.getId());
   
    // 驳回请求
    task = taskService.createTaskQuery().taskAssignee("user1").singleResult();
    assertEquals("处理后驳回", task.getName());
    Map<String, Object> vairables = new HashMap<String, Object>();
    vairables.put("reject", true);
    taskService.complete(task.getId(), vairables);
   
    // 再次获取节点-分配给角色
    task = taskService.createTaskQuery().taskCandidateGroup("role1").singleResult();
    assertEquals("分配给角色", task.getName());
   
   
  }
View Full Code Here

            "process1", variableMap);
    assertNotNull(processInstance.getId());
    System.out.println("id " + processInstance.getId() + " "
            + processInstance.getProcessDefinitionId());
   
    TaskService taskService = activitiRule.getTaskService();
    long count = taskService.createTaskQuery().taskCandidateUser("kafeitu").count();
    assertEquals(1, count);
   
    count = taskService.createTaskQuery().taskCandidateUser("henryyan").count();
    assertEquals(1, count);
   
    count = taskService.createTaskQuery().taskCandidateGroup("group1").count();
    assertEquals(1, count);
   
    count = taskService.createTaskQuery().taskCandidateGroup("group2").count();
    assertEquals(1, count);
  }
View Full Code Here

       .singleResult();
    
     assertNotNull(processInstance);
    
     // Complete the task.  That will end the process instance
     TaskService taskService = processEngine.getTaskService();
     Task task = taskService
       .createTaskQuery()
       .list()
       .get(0);
     taskService.complete(task.getId());
    
     // Check if the process instance has really ended.  This means that the process definition has
     // re-loaded into the process definition cache
     processInstance = processEngine
       .getRuntimeService()
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.