Search in sources :

Example 1 with ProcessDefinitionDto

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

the class ProcessDefinitionResourceImpl method getProcessDefinition.

@Override
public ProcessDefinitionDto getProcessDefinition() {
    RepositoryService repoService = engine.getRepositoryService();
    ProcessDefinition definition;
    try {
        definition = repoService.getProcessDefinition(processDefinitionId);
    } catch (ProcessEngineException e) {
        throw new InvalidRequestException(Status.NOT_FOUND, e, "No matching definition with id " + processDefinitionId);
    }
    ProcessDefinitionDto result = ProcessDefinitionDto.fromProcessDefinition(definition);
    return result;
}
Also used : ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) InvalidRequestException(org.camunda.bpm.engine.rest.exception.InvalidRequestException) ProcessDefinitionDto(org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionDto) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) RepositoryService(org.camunda.bpm.engine.RepositoryService)

Example 2 with ProcessDefinitionDto

use of org.camunda.bpm.engine.rest.dto.repository.ProcessDefinitionDto 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

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