Search in sources :

Example 1 with CaseDefinitionQueryDto

use of org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto in project camunda-bpm-platform by camunda.

the class CaseDefinitionRestServiceImpl method getCaseDefinitionsCount.

@Override
public CountResultDto getCaseDefinitionsCount(UriInfo uriInfo) {
    CaseDefinitionQueryDto queryDto = new CaseDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    ProcessEngine engine = getProcessEngine();
    CaseDefinitionQuery query = queryDto.toQuery(engine);
    long count = query.count();
    CountResultDto result = new CountResultDto();
    result.setCount(count);
    return result;
}
Also used : CaseDefinitionQueryDto(org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto) CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Example 2 with CaseDefinitionQueryDto

use of org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto in project camunda-bpm-platform by camunda.

the class CaseDefinitionRestServiceImpl method getCaseDefinitions.

@Override
public List<CaseDefinitionDto> getCaseDefinitions(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    CaseDefinitionQueryDto queryDto = new CaseDefinitionQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    List<CaseDefinitionDto> definitions = new ArrayList<CaseDefinitionDto>();
    ProcessEngine engine = getProcessEngine();
    CaseDefinitionQuery query = queryDto.toQuery(engine);
    List<CaseDefinition> matchingDefinitions = null;
    if (firstResult != null || maxResults != null) {
        matchingDefinitions = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingDefinitions = query.list();
    }
    for (CaseDefinition definition : matchingDefinitions) {
        CaseDefinitionDto def = CaseDefinitionDto.fromCaseDefinition(definition);
        definitions.add(def);
    }
    return definitions;
}
Also used : CaseDefinitionQueryDto(org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto) CaseDefinition(org.camunda.bpm.engine.repository.CaseDefinition) ArrayList(java.util.ArrayList) CaseDefinitionDto(org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) CaseDefinitionQuery(org.camunda.bpm.engine.repository.CaseDefinitionQuery)

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 CaseDefinitionQuery (org.camunda.bpm.engine.repository.CaseDefinitionQuery)2 CaseDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionQueryDto)2 ArrayList (java.util.ArrayList)1 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 CaseDefinitionDto (org.camunda.bpm.engine.rest.dto.repository.CaseDefinitionDto)1