Search in sources :

Example 11 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByNameLike.

public void testQueryByNameLike() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentNameLike("%activiti%");
    assertEquals(2, query.list().size());
    assertEquals(2, query.count());
    try {
        query.singleResult();
        fail();
    } catch (ActivitiException e) {
    }
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ActivitiException(org.activiti.engine.ActivitiException)

Example 12 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByInvalidName.

public void testQueryByInvalidName() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().deploymentName("invalid");
    assertNull(query.singleResult());
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
    try {
        repositoryService.createDeploymentQuery().deploymentName(null);
        fail();
    } catch (ActivitiIllegalArgumentException e) {
    }
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException)

Example 13 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByInvalidProcessDefinitionKeyLike.

public void testQueryByInvalidProcessDefinitionKeyLike() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKeyLike("invalid");
    assertEquals(0, query.list().size());
    assertEquals(0, query.count());
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery)

Example 14 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentQueryTest method testQueryByProcessDefinitionKey.

public void testQueryByProcessDefinitionKey() {
    DeploymentQuery query = repositoryService.createDeploymentQuery().processDefinitionKey("one");
    assertEquals(1, query.list().size());
    assertEquals(1, query.count());
    assertNotNull(query.singleResult());
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery)

Example 15 with DeploymentQuery

use of org.activiti.engine.repository.DeploymentQuery in project Activiti by Activiti.

the class DeploymentCollectionResource method getDeployments.

@RequestMapping(value = "/repository/deployments", method = RequestMethod.GET, produces = "application/json")
public DataResponse getDeployments(@RequestParam Map<String, String> allRequestParams, HttpServletRequest request) {
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    // Apply filters
    if (allRequestParams.containsKey("name")) {
        deploymentQuery.deploymentName(allRequestParams.get("name"));
    }
    if (allRequestParams.containsKey("nameLike")) {
        deploymentQuery.deploymentNameLike(allRequestParams.get("nameLike"));
    }
    if (allRequestParams.containsKey("category")) {
        deploymentQuery.deploymentCategory(allRequestParams.get("category"));
    }
    if (allRequestParams.containsKey("categoryNotEquals")) {
        deploymentQuery.deploymentCategoryNotEquals(allRequestParams.get("categoryNotEquals"));
    }
    if (allRequestParams.containsKey("tenantId")) {
        deploymentQuery.deploymentTenantId(allRequestParams.get("tenantId"));
    }
    if (allRequestParams.containsKey("tenantIdLike")) {
        deploymentQuery.deploymentTenantIdLike(allRequestParams.get("tenantIdLike"));
    }
    if (allRequestParams.containsKey("withoutTenantId")) {
        Boolean withoutTenantId = Boolean.valueOf(allRequestParams.get("withoutTenantId"));
        if (withoutTenantId) {
            deploymentQuery.deploymentWithoutTenantId();
        }
    }
    DataResponse response = new DeploymentsPaginateList(restResponseFactory).paginateList(allRequestParams, deploymentQuery, "id", allowedSortProperties);
    return response;
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) DataResponse(org.activiti.rest.common.api.DataResponse) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)17 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)3 ActivitiException (org.activiti.engine.ActivitiException)2 HashSet (java.util.HashSet)1 Deployment (org.activiti.engine.repository.Deployment)1 ProcessDefinitionQuery (org.activiti.engine.repository.ProcessDefinitionQuery)1 DataResponse (org.activiti.rest.common.api.DataResponse)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1