Search in sources :

Example 1 with CleanableHistoricBatchReport

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;
}
Also used : CleanableHistoricBatchReportDto(org.camunda.bpm.engine.rest.dto.history.batch.CleanableHistoricBatchReportDto) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) CleanableHistoricBatchReport(org.camunda.bpm.engine.history.CleanableHistoricBatchReport)

Example 2 with CleanableHistoricBatchReport

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);
}
Also used : CleanableHistoricBatchReportResult(org.camunda.bpm.engine.history.CleanableHistoricBatchReportResult) ArrayList(java.util.ArrayList) CleanableHistoricBatchReport(org.camunda.bpm.engine.history.CleanableHistoricBatchReport)

Example 3 with CleanableHistoricBatchReport

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);
}
Also used : CleanableHistoricBatchReportDto(org.camunda.bpm.engine.rest.dto.history.batch.CleanableHistoricBatchReportDto) CleanableHistoricBatchReportResult(org.camunda.bpm.engine.history.CleanableHistoricBatchReportResult) CleanableHistoricBatchReport(org.camunda.bpm.engine.history.CleanableHistoricBatchReport)

Aggregations

CleanableHistoricBatchReport (org.camunda.bpm.engine.history.CleanableHistoricBatchReport)3 CleanableHistoricBatchReportResult (org.camunda.bpm.engine.history.CleanableHistoricBatchReportResult)2 CleanableHistoricBatchReportDto (org.camunda.bpm.engine.rest.dto.history.batch.CleanableHistoricBatchReportDto)2 ArrayList (java.util.ArrayList)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1