use of org.camunda.bpm.engine.history.CleanableHistoricCaseInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricCaseDefinitionRestServiceImpl method getCleanableHistoricCaseInstanceReport.
@Override
public List<CleanableHistoricCaseInstanceReportResultDto> getCleanableHistoricCaseInstanceReport(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
CleanableHistoricCaseInstanceReportDto queryDto = new CleanableHistoricCaseInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
CleanableHistoricCaseInstanceReport query = queryDto.toQuery(processEngine);
List<CleanableHistoricCaseInstanceReportResult> reportResult;
if (firstResult != null || maxResults != null) {
reportResult = executePaginatedQuery(query, firstResult, maxResults);
} else {
reportResult = query.list();
}
return CleanableHistoricCaseInstanceReportResultDto.convert(reportResult);
}
use of org.camunda.bpm.engine.history.CleanableHistoricCaseInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricCaseInstanceReportTest method testReportByInvalidCaseDefinitionKey.
@Test
public void testReportByInvalidCaseDefinitionKey() {
CleanableHistoricCaseInstanceReport report = historyService.createCleanableHistoricCaseInstanceReport();
try {
report.caseDefinitionKeyIn(null);
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
try {
report.caseDefinitionKeyIn("abc", null, "def");
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.CleanableHistoricCaseInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricCaseInstanceReportTest method testReportByInvalidCaseDefinitionId.
@Test
public void testReportByInvalidCaseDefinitionId() {
CleanableHistoricCaseInstanceReport report = historyService.createCleanableHistoricCaseInstanceReport();
try {
report.caseDefinitionIdIn(null);
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
try {
report.caseDefinitionIdIn("abc", null, "def");
fail("Expected NotValidException");
} catch (NotValidException e) {
// expected
}
}
use of org.camunda.bpm.engine.history.CleanableHistoricCaseInstanceReport in project camunda-bpm-platform by camunda.
the class CleanableHistoricCaseInstanceReportServiceTest method setupHistoryReportMock.
private void setupHistoryReportMock() {
CleanableHistoricCaseInstanceReport report = mock(CleanableHistoricCaseInstanceReport.class);
when(report.caseDefinitionIdIn(anyString())).thenReturn(report);
when(report.caseDefinitionKeyIn(anyString())).thenReturn(report);
CleanableHistoricCaseInstanceReportResult reportResult = mock(CleanableHistoricCaseInstanceReportResult.class);
when(reportResult.getCaseDefinitionId()).thenReturn(EXAMPLE_CD_ID);
when(reportResult.getCaseDefinitionKey()).thenReturn(EXAMPLE_CD_KEY);
when(reportResult.getCaseDefinitionName()).thenReturn(EXAMPLE_CD_NAME);
when(reportResult.getCaseDefinitionVersion()).thenReturn(EXAMPLE_CD_VERSION);
when(reportResult.getHistoryTimeToLive()).thenReturn(EXAMPLE_TTL);
when(reportResult.getFinishedCaseInstanceCount()).thenReturn(EXAMPLE_FINISHED_CI_COUNT);
when(reportResult.getCleanableCaseInstanceCount()).thenReturn(EXAMPLE_CLEANABLE_CI_COUNT);
when(reportResult.getTenantId()).thenReturn(EXAMPLE_TENANT_ID);
CleanableHistoricCaseInstanceReportResult anotherReportResult = mock(CleanableHistoricCaseInstanceReportResult.class);
when(anotherReportResult.getCaseDefinitionId()).thenReturn(ANOTHER_EXAMPLE_CD_ID);
when(anotherReportResult.getCaseDefinitionKey()).thenReturn(ANOTHER_EXAMPLE_CD_KEY);
when(anotherReportResult.getCaseDefinitionName()).thenReturn("cdName");
when(anotherReportResult.getCaseDefinitionVersion()).thenReturn(33);
when(anotherReportResult.getHistoryTimeToLive()).thenReturn(null);
when(anotherReportResult.getFinishedCaseInstanceCount()).thenReturn(13l);
when(anotherReportResult.getCleanableCaseInstanceCount()).thenReturn(0l);
when(anotherReportResult.getTenantId()).thenReturn(ANOTHER_EXAMPLE_TENANT_ID);
List<CleanableHistoricCaseInstanceReportResult> mocks = new ArrayList<CleanableHistoricCaseInstanceReportResult>();
mocks.add(reportResult);
mocks.add(anotherReportResult);
when(report.list()).thenReturn(mocks);
when(report.count()).thenReturn((long) mocks.size());
historicCaseInstanceReport = report;
when(processEngine.getHistoryService().createCleanableHistoricCaseInstanceReport()).thenReturn(historicCaseInstanceReport);
}
use of org.camunda.bpm.engine.history.CleanableHistoricCaseInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricCaseDefinitionRestServiceImpl method getCleanableHistoricCaseInstanceReportCount.
@Override
public CountResultDto getCleanableHistoricCaseInstanceReportCount(UriInfo uriInfo) {
CleanableHistoricCaseInstanceReportDto queryDto = new CleanableHistoricCaseInstanceReportDto(objectMapper, uriInfo.getQueryParameters());
queryDto.setObjectMapper(objectMapper);
CleanableHistoricCaseInstanceReport query = queryDto.toQuery(processEngine);
long count = query.count();
CountResultDto result = new CountResultDto();
result.setCount(count);
return result;
}
Aggregations