Search in sources :

Example 1 with HistoricDecisionInstanceStatistics

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics in project camunda-bpm-platform by camunda.

the class HistoricDecisionStatisticsRestServiceImpl method getDecisionStatistics.

@Override
public List<HistoricDecisionInstanceStatisticsDto> getDecisionStatistics(String decisionRequirementsDefinitionId, String decisionInstanceId) {
    List<HistoricDecisionInstanceStatisticsDto> result = new ArrayList<HistoricDecisionInstanceStatisticsDto>();
    HistoricDecisionInstanceStatisticsQuery statisticsQuery = processEngine.getHistoryService().createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinitionId);
    if (decisionInstanceId != null) {
        statisticsQuery.decisionInstanceId(decisionInstanceId);
    }
    for (HistoricDecisionInstanceStatistics stats : statisticsQuery.list()) {
        result.add(HistoricDecisionInstanceStatisticsDto.fromDecisionDefinitionStatistics(stats));
    }
    return result;
}
Also used : HistoricDecisionInstanceStatistics(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics) ArrayList(java.util.ArrayList) HistoricDecisionInstanceStatisticsDto(org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceStatisticsDto) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)

Example 2 with HistoricDecisionInstanceStatistics

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics in project camunda-bpm-platform by camunda.

the class MockProvider method createMockHistoricDecisionStatistics.

public static List<HistoricDecisionInstanceStatistics> createMockHistoricDecisionStatistics() {
    HistoricDecisionInstanceStatistics statistics = mock(HistoricDecisionInstanceStatistics.class);
    when(statistics.getDecisionDefinitionKey()).thenReturn(EXAMPLE_DECISION_DEFINITION_KEY);
    when(statistics.getEvaluations()).thenReturn(1);
    HistoricDecisionInstanceStatistics anotherStatistics = mock(HistoricDecisionInstanceStatistics.class);
    when(anotherStatistics.getDecisionDefinitionKey()).thenReturn(ANOTHER_DECISION_DEFINITION_KEY);
    when(anotherStatistics.getEvaluations()).thenReturn(2);
    List<HistoricDecisionInstanceStatistics> decisionResults = new ArrayList<HistoricDecisionInstanceStatistics>();
    decisionResults.add(statistics);
    decisionResults.add(anotherStatistics);
    return decisionResults;
}
Also used : HistoricDecisionInstanceStatistics(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)2 HistoricDecisionInstanceStatistics (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics)2 HistoricDecisionInstanceStatisticsQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)1 HistoricDecisionInstanceStatisticsDto (org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceStatisticsDto)1