Search in sources :

Example 1 with IncidentQueryDto

use of org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto in project camunda-bpm-platform by camunda.

the class IncidentRestServiceImpl method getIncidentsCount.

@Override
public CountResultDto getIncidentsCount(UriInfo uriInfo) {
    IncidentQueryDto queryDto = new IncidentQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    IncidentQuery query = queryDto.toQuery(processEngine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) IncidentQueryDto(org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto)

Example 2 with IncidentQueryDto

use of org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto in project camunda-bpm-platform by camunda.

the class IncidentRestServiceImpl method getIncidents.

@Override
public List<IncidentDto> getIncidents(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    IncidentQueryDto queryDto = new IncidentQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    IncidentQuery query = queryDto.toQuery(processEngine);
    List<Incident> queryResult;
    if (firstResult != null || maxResults != null) {
        queryResult = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        queryResult = query.list();
    }
    List<IncidentDto> result = new ArrayList<IncidentDto>();
    for (Incident incident : queryResult) {
        IncidentDto dto = IncidentDto.fromIncident(incident);
        result.add(dto);
    }
    return result;
}
Also used : IncidentQuery(org.camunda.bpm.engine.runtime.IncidentQuery) ArrayList(java.util.ArrayList) IncidentDto(org.camunda.bpm.engine.rest.dto.runtime.IncidentDto) IncidentQueryDto(org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto) Incident(org.camunda.bpm.engine.runtime.Incident)

Aggregations

IncidentQueryDto (org.camunda.bpm.engine.rest.dto.runtime.IncidentQueryDto)2 IncidentQuery (org.camunda.bpm.engine.runtime.IncidentQuery)2 ArrayList (java.util.ArrayList)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 IncidentDto (org.camunda.bpm.engine.rest.dto.runtime.IncidentDto)1 Incident (org.camunda.bpm.engine.runtime.Incident)1