Examples of HistoryService


Examples of org.activiti.engine.HistoryService

        try {
            procId = WfUtil.launchWf(log,workflowName,build.getParent().getName(),build.getNumber());
           
            if (procId != null){
                // TODO 5: is there a better way than polling to detect the termination of a process?
                HistoryService hstSvc = eng.getHistoryService();
                while (true){
                    // TODO 8: can we get a hold of any exception the engine is throwing and show it at least in the log?
                    // TODO 8: builder should log each time the process makes a state change
                    HistoricProcessInstance hProcInst = hstSvc.createHistoricProcessInstanceQuery().processInstanceId(procId).singleResult();
                    if (hProcInst.getEndTime() != null){
                        String wbr = getWorkflowBuildResult(hstSvc,procId);
                        log.println(Consts.UI_PREFIX+": \""+workflowName+"\" ended ("+wbr+")");
                        if (Result.FAILURE.toString().equals(wbr)) result = false;
                        break;
View Full Code Here

Examples of org.activiti.engine.HistoryService

 
  public void testSimplestTask() {
    RuntimeService runtimeService = processEngine.getRuntimeService();
    TaskService taskService = processEngine.getTaskService();
    ManagementService managementService = processEngine.getManagementService();
    HistoryService historyService = processEngine.getHistoryService();

    Task task = taskService
      .createTaskQuery()
      .taskName("simpleTask2")
      .singleResult();
   
    String processInstanceId = task.getProcessInstanceId();
   
    long expectedHistoryTaskInstances = -1;
    String schemaHistory = managementService.getProperties().get("schema.history");
    if (schemaHistory.startsWith("create(5.0)")) {
      expectedHistoryTaskInstances = 0;
    } else {
      expectedHistoryTaskInstances = 2;
    }
   
    assertEquals(expectedHistoryTaskInstances,
      historyService.createHistoricTaskInstanceQuery()
        .processInstanceId(processInstanceId)
        .orderByTaskName().asc()
        .count());
     
    taskService.complete(task.getId());
   
    assertEquals(1, runtimeService
            .createExecutionQuery()
            .processInstanceId(processInstanceId)
            .list()
            .size());

    assertEquals(expectedHistoryTaskInstances+1,
            historyService.createHistoricTaskInstanceQuery()
              .processInstanceId(processInstanceId)
              .orderByTaskName().asc()
              .count());
           
    task = taskService
      .createTaskQuery()
      .taskName("simpleTask3")
      .singleResult();

    taskService.complete(task.getId());

    assertEquals(0, runtimeService
            .createExecutionQuery()
            .processInstanceId(processInstanceId)
            .list()
            .size());

    assertEquals(expectedHistoryTaskInstances+1,
            historyService.createHistoricTaskInstanceQuery()
              .processInstanceId(processInstanceId)
              .orderByTaskName().asc()
              .count());
  }
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

    RepositoryService repoService = mock(RepositoryService.class);
    IdentityService identityService = mock(IdentityService.class);
    TaskService taskService = mock(TaskService.class);
    RuntimeService runtimeService = mock(RuntimeService.class);
    FormService formService = mock(FormService.class);
    HistoryService historyService = mock(HistoryService.class);
    ManagementService managementService = mock(ManagementService.class);
    CaseService caseService = mock(CaseService.class);
    FilterService filterService = mock(FilterService.class);

    when(engine.getRepositoryService()).thenReturn(repoService);
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

  }

  @Override
  public List<HistoricActivityStatisticsDto> getHistoricActivityStatistics(String processDefinitionId, Boolean includeCanceled, Boolean includeFinished,
      Boolean includeCompleteScope, String sortBy, String sortOrder) {
    HistoryService historyService = processEngine.getHistoryService();

    HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId);

    if (includeCanceled != null && includeCanceled) {
      query.includeCanceled();
    }
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

    this.engine = engine;
    this.activityInstanceId = activityInstanceId;
  }

  public HistoricActivityInstanceDto getHistoricActivityInstance() {
    HistoryService historyService = engine.getHistoryService();
    HistoricActivityInstance instance = historyService.createHistoricActivityInstanceQuery()
      .activityInstanceId(activityInstanceId).singleResult();

    if (instance == null) {
      throw new InvalidRequestException(Status.NOT_FOUND, "Historic activity instance with id '" + activityInstanceId + "' does not exist");
    }
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

    this.processInstanceId = processInstanceId;
  }

  @Override
  public HistoricProcessInstanceDto getHistoricProcessInstance() {
    HistoryService historyService = engine.getHistoryService();
    HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();

    if (instance == null) {
      throw new InvalidRequestException(Status.NOT_FOUND, "Historic process instance with id " + processInstanceId + " does not exist");
    }
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

    this.engine = engine;
    this.caseActivityInstanceId = caseActivityInstanceId;
  }

  public HistoricCaseActivityInstanceDto getHistoricCaseActivityInstance() {
    HistoryService historyService = engine.getHistoryService();
    HistoricCaseActivityInstance instance = historyService.createHistoricCaseActivityInstanceQuery()
      .caseActivityInstanceId(caseActivityInstanceId).singleResult();

    if (instance == null) {
      throw new InvalidRequestException(Status.NOT_FOUND, "Historic case activity instance with id '" + caseActivityInstanceId + "' does not exist");
    }
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

    this.engine = engine;
    this.caseInstanceId = caseInstanceId;
  }

  public HistoricCaseInstanceDto getHistoricCaseInstance() {
    HistoryService historyService = engine.getHistoryService();
    HistoricCaseInstance instance = historyService.createHistoricCaseInstanceQuery().caseInstanceId(caseInstanceId).singleResult();

    if (instance == null) {
      throw new InvalidRequestException(Status.NOT_FOUND, "Historic case instance with id '" + caseInstanceId + "' does not exist");
    }
View Full Code Here

Examples of org.camunda.bpm.engine.HistoryService

    managementServiceMock = mock(ManagementService.class);
    when(processEngine.getManagementService()).thenReturn(managementServiceMock);
    when(managementServiceMock.getProcessApplicationForDeployment(MockProvider.EXAMPLE_DEPLOYMENT_ID)).thenReturn(MockProvider.EXAMPLE_PROCESS_APPLICATION_NAME);
    when(managementServiceMock.getHistoryLevel()).thenReturn(ProcessEngineConfigurationImpl.HISTORYLEVEL_FULL);

    HistoryService historyServiceMock = mock(HistoryService.class);
    when(processEngine.getHistoryService()).thenReturn(historyServiceMock);
    historicTaskInstanceQueryMock = mock(HistoricTaskInstanceQuery.class);
    when(historyServiceMock.createHistoricTaskInstanceQuery()).thenReturn(historicTaskInstanceQueryMock);
    when(historicTaskInstanceQueryMock.taskId(eq(EXAMPLE_TASK_ID))).thenReturn(historicTaskInstanceQueryMock);
    HistoricTaskInstance historicTaskInstanceMock = createMockHistoricTaskInstance();
    when(historicTaskInstanceQueryMock.singleResult()).thenReturn(historicTaskInstanceMock);

    // replace the runtime container delegate & process application service with a mock
View Full Code Here

Examples of org.jbpm.api.HistoryService

      List<ProcessInstanceRef> results = adoptProcessInstances(processInstances);

      // add history info
      // TODO: optimize w. batch query
      HistoryService histService = this.processEngine.getHistoryService();
      for(ProcessInstanceRef inst : results)
      {
        HistoryProcessInstanceQuery hQuery = histService.createHistoryProcessInstanceQuery();
        hQuery.processInstanceId(inst.getId());
        HistoryProcessInstance entry = hQuery.uniqueResult();
        inst.setStartDate(entry.getStartTime());
      }
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.