use of org.camunda.bpm.engine.management.ActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class ProcessDefinitionResourceImpl method getActivityStatistics.
@Override
public List<StatisticsResultDto> getActivityStatistics(Boolean includeFailedJobs, Boolean includeIncidents, String includeIncidentsForType) {
if (includeIncidents != null && includeIncidentsForType != null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeIncidentsForType can be set.");
}
ManagementService mgmtService = engine.getManagementService();
ActivityStatisticsQuery query = mgmtService.createActivityStatisticsQuery(processDefinitionId);
if (includeFailedJobs != null && includeFailedJobs) {
query.includeFailedJobs();
}
if (includeIncidents != null && includeIncidents) {
query.includeIncidents();
} else if (includeIncidentsForType != null) {
query.includeIncidentsForType(includeIncidentsForType);
}
List<ActivityStatistics> queryResults = query.list();
List<StatisticsResultDto> results = new ArrayList<StatisticsResultDto>();
for (ActivityStatistics queryResult : queryResults) {
StatisticsResultDto dto = ActivityStatisticsResultDto.fromActivityStatistics(queryResult);
results.add(dto);
}
return results;
}
use of org.camunda.bpm.engine.management.ActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStatisticsQueryTest method testQueryNoAuthenticatedTenantForActivityStatistics.
public void testQueryNoAuthenticatedTenantForActivityStatistics() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SingleTaskProcess");
identityService.setAuthentication("user", null);
ActivityStatisticsQuery query = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId());
assertThat(query.count(), is(0L));
}
use of org.camunda.bpm.engine.management.ActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStatisticsQueryTest method testQueryDisabledTenantCheckForActivityStatistics.
public void testQueryDisabledTenantCheckForActivityStatistics() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SingleTaskProcess");
identityService.setAuthentication("user", null);
processEngineConfiguration.setTenantCheckEnabled(false);
ActivityStatisticsQuery query = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId());
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.management.ActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStatisticsQueryTest method testQueryAuthenticatedTenantForActivityStatistics.
public void testQueryAuthenticatedTenantForActivityStatistics() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SingleTaskProcess");
ActivityStatisticsQuery query = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId());
assertThat(query.count(), is(1L));
}
use of org.camunda.bpm.engine.management.ActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class MultiTenancyStatisticsQueryTest method testActivityStatistics.
public void testActivityStatistics() {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("SingleTaskProcess");
ActivityStatisticsQuery query = managementService.createActivityStatisticsQuery(processInstance.getProcessDefinitionId());
assertThat(query.count(), is(1L));
}
Aggregations