Search in sources :

Example 1 with ProcessDefinitionQueryDto

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

the class ProcessDefinitionRestServiceImpl method getProcessDefinitionsCount.

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

Example 2 with ProcessDefinitionQueryDto

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

the class ProcessDefinitionRestServiceImpl method getProcessDefinitions.

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

Aggregations

ProcessEngine (org.camunda.bpm.engine.ProcessEngine)2 ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)2 ProcessDefinitionQueryDto (org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionQueryDto)2 ArrayList (java.util.ArrayList)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 ProcessDefinitionDto (org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionDto)1