Package org.activiti.engine

Examples of org.activiti.engine.HistoryService


    RepositoryService repositoryService = processEngine.getRepositoryService();

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

    Map<String, Object> variableMap = new HashMap<String, Object>();
    ProcessInstance instance = runtimeService.startProcessInstanceByKey("MultitaskingProcess", variableMap);
View Full Code Here


  @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());
   
    assertEquals("order_received", activityInstances.get(0).getActivityId());
    assertEquals("wait_for_postident", activityInstances.get(1).getActivityId());
    assertEquals("check_documents", activityInstances.get(2).getActivityId());
View Full Code Here

  @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());
   
    assertEquals("order_received", activityInstances.get(0).getActivityId());
    assertEquals("wait_for_postident", activityInstances.get(1).getActivityId());
    assertEquals("check_documents", activityInstances.get(2).getActivityId());
View Full Code Here

  @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());
   
    assertEquals("order_received", activityInstances.get(0).getActivityId());
    assertEquals("wait_for_postident", activityInstances.get(1).getActivityId());
    assertEquals("check_documents", activityInstances.get(2).getActivityId());
View Full Code Here

  @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());
   
    assertEquals("order_received", activityInstances.get(0).getActivityId());
    assertEquals("wait_for_postident", activityInstances.get(1).getActivityId());
    assertEquals("check_documents", activityInstances.get(2).getActivityId());
View Full Code Here

     */
    @RequestMapping("workspace-viewHistory")
    public String viewHistory(
            @RequestParam("processInstanceId") String processInstanceId,
            Model model) {
        HistoryService historyService = processEngine.getHistoryService();
        List<HistoricTaskInstance> historicTasks = historyService
                .createHistoricTaskInstanceQuery()
                .processInstanceId(processInstanceId).list();
        List<HistoricVariableInstance> historicVariableInstances = historyService
                .createHistoricVariableInstanceQuery()
                .processInstanceId(processInstanceId).list();
        model.addAttribute("historicTasks", historicTasks);
        model.addAttribute("historicVariableInstances",
                historicVariableInstances);
View Full Code Here

    /**
     * 未结流程.
     */
    public Page findRunningProcessInstances(String userId, Page page) {
        HistoryService historyService = processEngine.getHistoryService();

        // TODO: 改成通过runtime表搜索,提高效率
        long count = historyService.createHistoricProcessInstanceQuery()
                .startedBy(userId).unfinished().count();
        List<HistoricProcessInstance> historicProcessInstances = historyService
                .createHistoricProcessInstanceQuery().startedBy(userId)
                .unfinished()
                .listPage((int) page.getStart(), page.getPageSize());

        page.setResult(historicProcessInstances);
View Full Code Here

    /**
     * 已结流程.
     */
    public Page findCompletedProcessInstances(String userId, Page page) {
        HistoryService historyService = processEngine.getHistoryService();

        long count = historyService.createHistoricProcessInstanceQuery()
                .startedBy(userId).finished().count();
        List<HistoricProcessInstance> historicProcessInstances = historyService
                .createHistoricProcessInstanceQuery().startedBy(userId)
                .finished().listPage((int) page.getStart(), page.getPageSize());

        page.setResult(historicProcessInstances);
        page.setTotalCount(count);
View Full Code Here

    /**
     * 参与流程.
     */
    public Page findInvolvedProcessInstances(String userId, Page page) {
        HistoryService historyService = processEngine.getHistoryService();

        // TODO: finished(), unfinished()
        long count = historyService.createHistoricProcessInstanceQuery()
                .involvedUser(userId).count();
        List<HistoricProcessInstance> historicProcessInstances = historyService
                .createHistoricProcessInstanceQuery().involvedUser(userId)
                .listPage((int) page.getStart(), page.getPageSize());

        page.setResult(historicProcessInstances);
        page.setTotalCount(count);
View Full Code Here

    /**
     * 已办任务(历史任务).
     */
    public Page findHistoryTasks(String userId, Page page) {
        HistoryService historyService = processEngine.getHistoryService();

        long count = historyService.createHistoricTaskInstanceQuery()
                .taskAssignee(userId).finished().count();
        List<HistoricTaskInstance> historicTaskInstances = historyService
                .createHistoricTaskInstanceQuery().taskAssignee(userId)
                .finished().listPage((int) page.getStart(), page.getPageSize());
        page.setResult(historicTaskInstances);
        page.setTotalCount(count);

View Full Code Here

TOP

Related Classes of org.activiti.engine.HistoryService

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.