Search in sources :

Example 1 with JobDto

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

the class JobRestServiceImpl method queryJobs.

@Override
public List<JobDto> queryJobs(JobQueryDto queryDto, Integer firstResult, Integer maxResults) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    JobQuery query = queryDto.toQuery(engine);
    List<Job> matchingJobs;
    if (firstResult != null || maxResults != null) {
        matchingJobs = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingJobs = query.list();
    }
    List<JobDto> jobResults = new ArrayList<JobDto>();
    for (Job job : matchingJobs) {
        JobDto resultJob = JobDto.fromJob(job);
        jobResults.add(resultJob);
    }
    return jobResults;
}
Also used : JobDto(org.camunda.bpm.engine.rest.dto.runtime.JobDto) ArrayList(java.util.ArrayList) JobQuery(org.camunda.bpm.engine.runtime.JobQuery) Job(org.camunda.bpm.engine.runtime.Job) ProcessEngine(org.camunda.bpm.engine.ProcessEngine)

Aggregations

ArrayList (java.util.ArrayList)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 JobDto (org.camunda.bpm.engine.rest.dto.runtime.JobDto)1 Job (org.camunda.bpm.engine.runtime.Job)1 JobQuery (org.camunda.bpm.engine.runtime.JobQuery)1