Search in sources :

Example 1 with HistoricTaskInstanceReport

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);
    }
}
Also used : InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) HistoricTaskInstanceReport(org.camunda.bpm.engine.history.HistoricTaskInstanceReport)

Example 2 with HistoricTaskInstanceReport

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;
}
Also used : MockProvider.createMockHistoricTaskInstanceReport(org.camunda.bpm.engine.rest.helper.MockProvider.createMockHistoricTaskInstanceReport) HistoricTaskInstanceReport(org.camunda.bpm.engine.history.HistoricTaskInstanceReport) HistoricTaskInstanceReportResult(org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult) DurationReportResult(org.camunda.bpm.engine.history.DurationReportResult) Date(java.util.Date)

Aggregations

HistoricTaskInstanceReport (org.camunda.bpm.engine.history.HistoricTaskInstanceReport)2 Date (java.util.Date)1 DurationReportResult (org.camunda.bpm.engine.history.DurationReportResult)1 HistoricTaskInstanceReportResult (org.camunda.bpm.engine.history.HistoricTaskInstanceReportResult)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 MockProvider.createMockHistoricTaskInstanceReport (org.camunda.bpm.engine.rest.helper.MockProvider.createMockHistoricTaskInstanceReport)1