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;
}
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;
}
Aggregations