use of org.camunda.bpm.engine.rest.dto.StatisticsResultDto 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.rest.dto.StatisticsResultDto in project camunda-bpm-platform by camunda.
the class ProcessDefinitionRestServiceImpl method getStatistics.
@Override
public List<StatisticsResultDto> getStatistics(Boolean includeFailedJobs, Boolean includeRootIncidents, 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.");
}
if (includeIncidents != null && includeRootIncidents != null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeIncidents or includeRootIncidents can be set.");
}
if (includeRootIncidents != null && includeIncidentsForType != null) {
throw new InvalidRequestException(Status.BAD_REQUEST, "Only one of the query parameter includeRootIncidents or includeIncidentsForType can be set.");
}
ManagementService mgmtService = getProcessEngine().getManagementService();
ProcessDefinitionStatisticsQuery query = mgmtService.createProcessDefinitionStatisticsQuery();
if (includeFailedJobs != null && includeFailedJobs) {
query.includeFailedJobs();
}
if (includeIncidents != null && includeIncidents) {
query.includeIncidents();
} else if (includeIncidentsForType != null) {
query.includeIncidentsForType(includeIncidentsForType);
} else if (includeRootIncidents != null && includeRootIncidents) {
query.includeRootIncidents();
}
List<ProcessDefinitionStatistics> queryResults = query.list();
List<StatisticsResultDto> results = new ArrayList<StatisticsResultDto>();
for (ProcessDefinitionStatistics queryResult : queryResults) {
StatisticsResultDto dto = ProcessDefinitionStatisticsResultDto.fromProcessDefinitionStatistics(queryResult);
results.add(dto);
}
return results;
}
Aggregations