Search in sources :

Example 1 with BatchQueryDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto in project camunda-bpm-platform by camunda.

the class BatchRestServiceImpl method getBatches.

public List<BatchDto> getBatches(UriInfo uriInfo, Integer firstResult, Integer maxResults) {
    BatchQueryDto queryDto = new BatchQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    BatchQuery query = queryDto.toQuery(getProcessEngine());
    List<Batch> matchingBatches;
    if (firstResult != null || maxResults != null) {
        matchingBatches = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingBatches = query.list();
    }
    List<BatchDto> batchResults = new ArrayList<BatchDto>();
    for (Batch matchingBatch : matchingBatches) {
        batchResults.add(BatchDto.fromBatch(matchingBatch));
    }
    return batchResults;
}
Also used : Batch(org.camunda.bpm.engine.batch.Batch) ArrayList(java.util.ArrayList) BatchDto(org.camunda.bpm.engine.rest.dto.batch.BatchDto) BatchQuery(org.camunda.bpm.engine.batch.BatchQuery) BatchQueryDto(org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto)

Example 2 with BatchQueryDto

use of org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto in project camunda-bpm-platform by camunda.

the class BatchRestServiceImpl method getBatchesCount.

public CountResultDto getBatchesCount(UriInfo uriInfo) {
    ProcessEngine processEngine = getProcessEngine();
    BatchQueryDto queryDto = new BatchQueryDto(getObjectMapper(), uriInfo.getQueryParameters());
    BatchQuery query = queryDto.toQuery(processEngine);
    long count = query.count();
    return new CountResultDto(count);
}
Also used : CountResultDto(org.camunda.bpm.engine.rest.dto.CountResultDto) BatchQuery(org.camunda.bpm.engine.batch.BatchQuery) BatchQueryDto(org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Aggregations

BatchQuery (org.camunda.bpm.engine.batch.BatchQuery)2 BatchQueryDto (org.camunda.bpm.engine.rest.dto.batch.BatchQueryDto)2 ArrayList (java.util.ArrayList)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 Batch (org.camunda.bpm.engine.batch.Batch)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 BatchDto (org.camunda.bpm.engine.rest.dto.batch.BatchDto)1