Search in sources :

Example 1 with HistoricDecisionInstanceStatisticsQuery

use of org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery 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 HistoricDecisionInstanceStatisticsQuery

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

the class MultiTenancyHistoricDecisionInstanceStatisticsQueryTest method testQueryAuthenticatedTenant.

@Test
public void testQueryAuthenticatedTenant() {
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().tenantIdIn(TENANT_ONE).singleResult();
    identityService.setAuthentication(USER_ID, null, Arrays.asList(TENANT_ONE));
    HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
    assertThat(query.count(), is(3L));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 3 with HistoricDecisionInstanceStatisticsQuery

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

the class MultiTenancyHistoricDecisionInstanceStatisticsQueryTest method testQueryNoAuthenticatedTenants.

@Test
public void testQueryNoAuthenticatedTenants() {
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().tenantIdIn(TENANT_ONE).singleResult();
    identityService.setAuthentication(USER_ID, null, null);
    HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
    assertThat(query.count(), is(0L));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 4 with HistoricDecisionInstanceStatisticsQuery

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

the class MultiTenancyHistoricDecisionInstanceStatisticsQueryTest method testQueryDisabledTenantCheck.

@Test
public void testQueryDisabledTenantCheck() {
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().tenantIdIn(TENANT_ONE).singleResult();
    engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
    identityService.setAuthentication(USER_ID, null, null);
    HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
    assertThat(query.count(), is(3L));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Example 5 with HistoricDecisionInstanceStatisticsQuery

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

the class MultiTenancySharedDecisionInstanceStatisticsQueryTest method testQueryDisabledTenantCheck.

@Test
public void testQueryDisabledTenantCheck() {
    DecisionRequirementsDefinition decisionRequirementsDefinition = repositoryService.createDecisionRequirementsDefinitionQuery().singleResult();
    engineRule.getProcessEngineConfiguration().setTenantCheckEnabled(false);
    identityService.setAuthentication(USER_ID, null, null);
    HistoricDecisionInstanceStatisticsQuery query = historyService.createHistoricDecisionInstanceStatisticsQuery(decisionRequirementsDefinition.getId());
    assertThat(query.count(), is(3L));
}
Also used : DecisionRequirementsDefinition(org.camunda.bpm.engine.repository.DecisionRequirementsDefinition) HistoricDecisionInstanceStatisticsQuery(org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery) Test(org.junit.Test)

Aggregations

HistoricDecisionInstanceStatisticsQuery (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatisticsQuery)14 DecisionRequirementsDefinition (org.camunda.bpm.engine.repository.DecisionRequirementsDefinition)13 Test (org.junit.Test)13 ArrayList (java.util.ArrayList)1 NullValueException (org.camunda.bpm.engine.exception.NullValueException)1 HistoricDecisionInstanceStatistics (org.camunda.bpm.engine.history.HistoricDecisionInstanceStatistics)1 HistoricDecisionInstanceStatisticsDto (org.camunda.bpm.engine.rest.dto.history.HistoricDecisionInstanceStatisticsDto)1