Search in sources :

Example 6 with HistoryService

use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.

the class ActivityPerfTestWatcher method afterPass.

public void afterPass(PerfTestPass pass) {
    ProcessEngine processEngine = PerfTestProcessEngine.getInstance();
    HistoryService historyService = processEngine.getHistoryService();
    for (PerfTestRun run : pass.getRuns().values()) {
        logActivityResults(pass, run, historyService);
    }
}
Also used : PerfTestRun(org.camunda.bpm.qa.performance.engine.framework.PerfTestRun) HistoryService(org.camunda.bpm.engine.HistoryService) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) PerfTestProcessEngine(org.camunda.bpm.qa.performance.engine.junit.PerfTestProcessEngine)

Example 7 with HistoryService

use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.

the class MockedProcessEngineProvider method mockServices.

private void mockServices(ProcessEngine engine) {
    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);
    ExternalTaskService externalTaskService = mock(ExternalTaskService.class);
    when(engine.getRepositoryService()).thenReturn(repoService);
    when(engine.getIdentityService()).thenReturn(identityService);
    when(engine.getTaskService()).thenReturn(taskService);
    when(engine.getRuntimeService()).thenReturn(runtimeService);
    when(engine.getFormService()).thenReturn(formService);
    when(engine.getHistoryService()).thenReturn(historyService);
    when(engine.getManagementService()).thenReturn(managementService);
    when(engine.getCaseService()).thenReturn(caseService);
    when(engine.getFilterService()).thenReturn(filterService);
    when(engine.getExternalTaskService()).thenReturn(externalTaskService);
}
Also used : IdentityService(org.camunda.bpm.engine.IdentityService) ManagementService(org.camunda.bpm.engine.ManagementService) RuntimeService(org.camunda.bpm.engine.RuntimeService) TaskService(org.camunda.bpm.engine.TaskService) ExternalTaskService(org.camunda.bpm.engine.ExternalTaskService) ExternalTaskService(org.camunda.bpm.engine.ExternalTaskService) FormService(org.camunda.bpm.engine.FormService) FilterService(org.camunda.bpm.engine.FilterService) HistoryService(org.camunda.bpm.engine.HistoryService) CaseService(org.camunda.bpm.engine.CaseService) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 8 with HistoryService

use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.

the class HistoricProcessDefinitionRestServiceImpl method getHistoricActivityStatistics.

@Override
public List<HistoricActivityStatisticsDto> getHistoricActivityStatistics(UriInfo uriInfo, 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();
    }
    if (includeFinished != null && includeFinished) {
        query.includeFinished();
    }
    if (includeCompleteScope != null && includeCompleteScope) {
        query.includeCompleteScope();
    }
    final MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
    DateConverter dateConverter = new DateConverter();
    dateConverter.setObjectMapper(objectMapper);
    if (queryParameters.getFirst(QUERY_PARAM_STARTED_AFTER) != null) {
        Date startedAfter = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_STARTED_AFTER));
        query.startedAfter(startedAfter);
    }
    if (queryParameters.getFirst(QUERY_PARAM_STARTED_BEFORE) != null) {
        Date startedBefore = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_STARTED_BEFORE));
        query.startedBefore(startedBefore);
    }
    if (queryParameters.getFirst(QUERY_PARAM_FINISHED_AFTER) != null) {
        Date finishedAfter = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_FINISHED_AFTER));
        query.finishedAfter(finishedAfter);
    }
    if (queryParameters.getFirst(QUERY_PARAM_FINISHED_BEFORE) != null) {
        Date finishedBefore = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_FINISHED_BEFORE));
        query.finishedBefore(finishedBefore);
    }
    setSortOptions(query, sortOrder, sortBy);
    List<HistoricActivityStatisticsDto> result = new ArrayList<HistoricActivityStatisticsDto>();
    List<HistoricActivityStatistics> statistics = query.list();
    for (HistoricActivityStatistics currentStatistics : statistics) {
        result.add(HistoricActivityStatisticsDto.fromHistoricActivityStatistics(currentStatistics));
    }
    return result;
}
Also used : HistoricActivityStatisticsQuery(org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery) DateConverter(org.camunda.bpm.engine.rest.dto.converter.DateConverter) HistoricActivityStatisticsDto(org.camunda.bpm.engine.rest.dto.history.HistoricActivityStatisticsDto) ArrayList(java.util.ArrayList) HistoryService(org.camunda.bpm.engine.HistoryService) HistoricActivityStatistics(org.camunda.bpm.engine.history.HistoricActivityStatistics) Date(java.util.Date)

Example 9 with HistoryService

use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.

the class HistoricProcessInstanceRestServiceImpl method deleteAsync.

@Override
public BatchDto deleteAsync(DeleteHistoricProcessInstancesDto dto) {
    HistoryService historyService = processEngine.getHistoryService();
    HistoricProcessInstanceQuery historicProcessInstanceQuery = null;
    if (dto.getHistoricProcessInstanceQuery() != null) {
        historicProcessInstanceQuery = dto.getHistoricProcessInstanceQuery().toQuery(processEngine);
    }
    try {
        Batch batch = historyService.deleteHistoricProcessInstancesAsync(dto.getHistoricProcessInstanceIds(), historicProcessInstanceQuery, dto.getDeleteReason());
        return BatchDto.fromBatch(batch);
    } catch (BadUserRequestException e) {
        throw new InvalidRequestException(Status.BAD_REQUEST, e.getMessage());
    }
}
Also used : HistoricProcessInstanceQuery(org.camunda.bpm.engine.history.HistoricProcessInstanceQuery) Batch(org.camunda.bpm.engine.batch.Batch) HistoryService(org.camunda.bpm.engine.HistoryService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) BadUserRequestException(org.camunda.bpm.engine.BadUserRequestException)

Example 10 with HistoryService

use of org.camunda.bpm.engine.HistoryService in project camunda-bpm-platform by camunda.

the class HistoricActivityInstanceResourceImpl method getHistoricActivityInstance.

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");
    }
    return HistoricActivityInstanceDto.fromHistoricActivityInstance(instance);
}
Also used : HistoryService(org.camunda.bpm.engine.HistoryService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) HistoricActivityInstance(org.camunda.bpm.engine.history.HistoricActivityInstance)

Aggregations

HistoryService (org.camunda.bpm.engine.HistoryService)23 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)9 ManagementService (org.camunda.bpm.engine.ManagementService)5 Batch (org.camunda.bpm.engine.batch.Batch)4 ArrayList (java.util.ArrayList)3 HistoricBatch (org.camunda.bpm.engine.batch.history.HistoricBatch)3 HistoricActivityInstance (org.camunda.bpm.engine.history.HistoricActivityInstance)3 HistoricVariableInstance (org.camunda.bpm.engine.history.HistoricVariableInstance)3 VariableMap (org.camunda.bpm.engine.variable.VariableMap)3 List (java.util.List)2 FormService (org.camunda.bpm.engine.FormService)2 RepositoryService (org.camunda.bpm.engine.RepositoryService)2 TaskService (org.camunda.bpm.engine.TaskService)2 HistoricVariableUpdate (org.camunda.bpm.engine.history.HistoricVariableUpdate)2 VariableMapImpl (org.camunda.bpm.engine.variable.impl.VariableMapImpl)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 InputStream (java.io.InputStream)1 Date (java.util.Date)1 ProcessApplicationService (org.camunda.bpm.ProcessApplicationService)1 ProcessApplicationInfo (org.camunda.bpm.application.ProcessApplicationInfo)1