Search in sources :

Example 51 with ProcessDefinitionQuery

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

Example 52 with ProcessDefinitionQuery

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);
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery)

Example 53 with ProcessDefinitionQuery

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
    }
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 54 with ProcessDefinitionQuery

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
    }
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 55 with ProcessDefinitionQuery

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
    }
}
Also used : ProcessDefinitionQuery(org.camunda.bpm.engine.repository.ProcessDefinitionQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Aggregations

ProcessDefinitionQuery (org.camunda.bpm.engine.repository.ProcessDefinitionQuery)112 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)27 ProcessApplicationDeployment (org.camunda.bpm.engine.repository.ProcessApplicationDeployment)25 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)23 Test (org.junit.Test)23 Deployment (org.camunda.bpm.engine.repository.Deployment)19 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)14 Resource (org.camunda.bpm.engine.repository.Resource)9 DeploymentQuery (org.camunda.bpm.engine.repository.DeploymentQuery)8 Job (org.camunda.bpm.engine.runtime.Job)6 RepositoryService (org.camunda.bpm.engine.RepositoryService)5 ProcessEngine (org.camunda.bpm.engine.ProcessEngine)4 Incident (org.camunda.bpm.engine.runtime.Incident)4 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)4 Map (java.util.Map)3 ReadOnlyProcessDefinition (org.camunda.bpm.engine.impl.pvm.ReadOnlyProcessDefinition)3 Response (com.jayway.restassured.response.Response)2 HashMap (java.util.HashMap)2 Authorization (org.camunda.bpm.engine.authorization.Authorization)2 Group (org.camunda.bpm.engine.identity.Group)2