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);
}
}
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);
}
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;
}
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());
}
}
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);
}
Aggregations