use of org.camunda.bpm.engine.history.CleanableHistoricBatchReport in project camunda-bpm-platform by camunda.
the class HistoricBatchRestServiceImpl method getCleanableHistoricBatchesReportCount.
@Override
public CountResultDto getCleanableHistoricBatchesReportCount(UriInfo uriInfo) {
CleanableHistoricBatchReportDto queryDto = new CleanableHistoricBatchReportDto(objectMapper, uriInfo.getQueryParameters());
queryDto.setObjectMapper(objectMapper);
CleanableHistoricBatchReport query = queryDto.toQuery(processEngine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
use of org.camunda.bpm.engine.history.CleanableHistoricBatchReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricBatchReportServiceTest method setupHistoryReportMock.
private void setupHistoryReportMock() {
CleanableHistoricBatchReport report = mock(CleanableHistoricBatchReport.class);
CleanableHistoricBatchReportResult reportResult = mock(CleanableHistoricBatchReportResult.class);
when(reportResult.getBatchType()).thenReturn(EXAMPLE_TYPE);
when(reportResult.getHistoryTimeToLive()).thenReturn(EXAMPLE_TTL);
when(reportResult.getFinishedBatchesCount()).thenReturn(EXAMPLE_FINISHED_COUNT);
when(reportResult.getCleanableBatchesCount()).thenReturn(EXAMPLE_CLEANABLE_COUNT);
CleanableHistoricBatchReportResult anotherReportResult = mock(CleanableHistoricBatchReportResult.class);
when(anotherReportResult.getBatchType()).thenReturn("batchId2");
when(anotherReportResult.getHistoryTimeToLive()).thenReturn(null);
when(anotherReportResult.getFinishedBatchesCount()).thenReturn(13l);
when(anotherReportResult.getCleanableBatchesCount()).thenReturn(0l);
List<CleanableHistoricBatchReportResult> mocks = new ArrayList<CleanableHistoricBatchReportResult>();
mocks.add(reportResult);
mocks.add(anotherReportResult);
when(report.list()).thenReturn(mocks);
when(report.count()).thenReturn((long) mocks.size());
historicBatchReport = report;
when(processEngine.getHistoryService().createCleanableHistoricBatchReport()).thenReturn(historicBatchReport);
}
use of org.camunda.bpm.engine.history.CleanableHistoricBatchReport in project camunda-bpm-platform by camunda.
the class HistoricBatchRestServiceImpl method getCleanableHistoricBatchesReport.
@SuppressWarnings("unchecked")
@Override
public List<CleanableHistoricBatchReportResultDto> getCleanableHistoricBatchesReport(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
CleanableHistoricBatchReportDto queryDto = new CleanableHistoricBatchReportDto(objectMapper, uriInfo.getQueryParameters());
CleanableHistoricBatchReport query = queryDto.toQuery(processEngine);
List<CleanableHistoricBatchReportResult> reportResult;
if (firstResult != null || maxResults != null) {
reportResult = (List<CleanableHistoricBatchReportResult>) executePaginatedQuery(query, firstResult, maxResults);
} else {
reportResult = query.list();
}
return CleanableHistoricBatchReportResultDto.convert(reportResult);
}
Aggregations