Search in sources :

Example 1 with CaseExecutionDto

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

the class CaseExecutionRestServiceImpl method queryCaseExecutions.

public List<CaseExecutionDto> queryCaseExecutions(CaseExecutionQueryDto queryDto, Integer firstResult, Integer maxResults) {
    ProcessEngine engine = getProcessEngine();
    queryDto.setObjectMapper(getObjectMapper());
    CaseExecutionQuery query = queryDto.toQuery(engine);
    List<CaseExecution> matchingExecutions;
    if (firstResult != null || maxResults != null) {
        matchingExecutions = executePaginatedQuery(query, firstResult, maxResults);
    } else {
        matchingExecutions = query.list();
    }
    List<CaseExecutionDto> executionResults = new ArrayList<CaseExecutionDto>();
    for (CaseExecution execution : matchingExecutions) {
        CaseExecutionDto resultExecution = CaseExecutionDto.fromCaseExecution(execution);
        executionResults.add(resultExecution);
    }
    return executionResults;
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseExecutionDto(org.camunda.bpm.engine.rest.dto.runtime.CaseExecutionDto) ArrayList(java.util.ArrayList) ProcessEngine(org.camunda.bpm.engine.ProcessEngine) CaseExecutionQuery(org.camunda.bpm.engine.runtime.CaseExecutionQuery)

Example 2 with CaseExecutionDto

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

the class CaseExecutionResourceImpl method getCaseExecution.

public CaseExecutionDto getCaseExecution() {
    CaseService caseService = engine.getCaseService();
    CaseExecution execution = caseService.createCaseExecutionQuery().caseExecutionId(caseExecutionId).singleResult();
    if (execution == null) {
        throw new InvalidRequestException(Status.NOT_FOUND, "Case execution with id " + caseExecutionId + " does not exist.");
    }
    CaseExecutionDto result = CaseExecutionDto.fromCaseExecution(execution);
    return result;
}
Also used : CaseExecution(org.camunda.bpm.engine.runtime.CaseExecution) CaseExecutionDto(org.camunda.bpm.engine.rest.dto.runtime.CaseExecutionDto) CaseService(org.camunda.bpm.engine.CaseService) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException)

Aggregations

CaseExecutionDto (org.camunda.bpm.engine.rest.dto.runtime.CaseExecutionDto)2 CaseExecution (org.camunda.bpm.engine.runtime.CaseExecution)2 ArrayList (java.util.ArrayList)1 CaseService (org.camunda.bpm.engine.CaseService)1 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)1 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)1 CaseExecutionQuery (org.camunda.bpm.engine.runtime.CaseExecutionQuery)1