use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery 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;
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class ProcessDefinitionQueryTest method testQueryByInvalidNameLike.
public void testQueryByInvalidNameLike() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionNameLike("%invalid%");
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class ProcessDefinitionQueryTest method testQueryByInvalidVersion.
public void testQueryByInvalidVersion() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionVersion(3);
verifyQueryResults(query, 0);
try {
repositoryService.createProcessDefinitionQuery().processDefinitionVersion(-1).list();
fail();
} catch (ProcessEngineException e) {
// Expected Exception
}
try {
repositoryService.createProcessDefinitionQuery().processDefinitionVersion(null).list();
fail();
} catch (ProcessEngineException e) {
// Expected Exception
}
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class ProcessDefinitionQueryTest method testQueryByInvalidKey.
public void testQueryByInvalidKey() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery().processDefinitionKey("invalid");
verifyQueryResults(query, 0);
try {
repositoryService.createProcessDefinitionQuery().processDefinitionKey(null);
fail();
} catch (ProcessEngineException e) {
// Expected Exception
}
}
use of org.camunda.bpm.engine.repository.ProcessDefinitionQuery in project camunda-bpm-platform by camunda.
the class ProcessDefinitionQueryTest method testQueryByInvalidIncidentMessage.
public void testQueryByInvalidIncidentMessage() {
ProcessDefinitionQuery query = repositoryService.createProcessDefinitionQuery();
verifyQueryResults(query.incidentMessage("invalid"), 0);
try {
query.incidentMessage(null);
fail();
} catch (ProcessEngineException e) {
// Expected Exception
}
}
Aggregations