Search in sources :

Example 1 with ExternalTaskDto

use of org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskDto in project camunda-bpm-platform by camunda.

the class ExternalTaskRestServiceImpl method queryExternalTasks.

@Override
public List<ExternalTaskDto> queryExternalTasks(ExternalTaskQueryDto queryDto, Integer firstResult, Integer maxResults) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    ExternalTaskQuery query = queryDto.toQuery(engine);
    List<ExternalTask> matchingTasks;
    if (firstResult != null || maxResults != null) {
        matchingTasks = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingTasks = query.list();
    }
    List<ExternalTaskDto> taskResults = new ArrayList<ExternalTaskDto>();
    for (ExternalTask task : matchingTasks) {
        ExternalTaskDto resultInstance = ExternalTaskDto.fromExternalTask(task);
        taskResults.add(resultInstance);
    }
    return taskResults;
}
Also used : ExternalTaskQuery(org.camunda.bpm.engine.externaltask.ExternalTaskQuery) ExternalTaskDto(org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskDto) LockedExternalTaskDto(org.camunda.bpm.engine.rest.dto.externaltask.LockedExternalTaskDto) ArrayList(java.util.ArrayList) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) ExternalTask(org.camunda.bpm.engine.externaltask.ExternalTask) LockedExternalTask(org.camunda.bpm.engine.externaltask.LockedExternalTask)

Aggregations

ArrayList (java.util.ArrayList)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 ExternalTask (org.camunda.bpm.engine.externaltask.ExternalTask)1 ExternalTaskQuery (org.camunda.bpm.engine.externaltask.ExternalTaskQuery)1 LockedExternalTask (org.camunda.bpm.engine.externaltask.LockedExternalTask)1 ExternalTaskDto (org.camunda.bpm.engine.rest.dto.externaltask.ExternalTaskDto)1 LockedExternalTaskDto (org.camunda.bpm.engine.rest.dto.externaltask.LockedExternalTaskDto)1