use of org.camunda.bpm.engine.history.HistoricTaskInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceReportQueryDto method executeCompletedReport.
public List<HistoricTaskInstanceReportResult> executeCompletedReport(ProcessEngine engine) {
HistoricTaskInstanceReport reportQuery = createNewReportQuery(engine);
applyFilters(reportQuery);
if (PROCESS_DEFINITION.equals(groupby)) {
return reportQuery.countByProcessDefinitionKey();
} else if (TASK_NAME.equals(groupby)) {
return reportQuery.countByTaskName();
} else {
throw new InvalidRequestException(Response.Status.BAD_REQUEST, "groupBy parameter has invalid value: " + groupby);
}
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceReport in project camunda-bpm-platform by camunda.
the class HistoricTaskReportRestServiceTest method setUpMockReportQuery.
private HistoricTaskInstanceReport setUpMockReportQuery() {
HistoricTaskInstanceReport mockedReportQuery = mock(HistoricTaskInstanceReport.class);
List<HistoricTaskInstanceReportResult> taskReportResults = createMockHistoricTaskInstanceReport();
List<HistoricTaskInstanceReportResult> taskReportResultsWithProcDef = createMockHistoricTaskInstanceReportWithProcDef();
when(mockedReportQuery.completedAfter(any(Date.class))).thenReturn(mockedReportQuery);
when(mockedReportQuery.completedBefore(any(Date.class))).thenReturn(mockedReportQuery);
when(mockedReportQuery.countByTaskName()).thenReturn(taskReportResults);
when(mockedReportQuery.countByProcessDefinitionKey()).thenReturn(taskReportResultsWithProcDef);
List<DurationReportResult> durationReportByMonth = createMockHistoricTaskInstanceDurationReport(MONTH);
when(mockedReportQuery.duration(MONTH)).thenReturn(durationReportByMonth);
List<DurationReportResult> durationReportByQuarter = createMockHistoricTaskInstanceDurationReport(QUARTER);
when(mockedReportQuery.duration(QUARTER)).thenReturn(durationReportByQuarter);
when(processEngine.getHistoryService().createHistoricTaskInstanceReport()).thenReturn(mockedReportQuery);
return mockedReportQuery;
}
Aggregations