Search in sources :

Example 1 with DeploymentsPaginateList

use of org.wso2.carbon.bpmn.rest.model.repository.DeploymentsPaginateList in project carbon-business-process by wso2.

the class DeploymentService method getDeployments.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getDeployments() {
    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    DeploymentQuery deploymentQuery = repositoryService.createDeploymentQuery();
    // Apply filters
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    String name = uriInfo.getQueryParameters().getFirst("name");
    if (name != null) {
        deploymentQuery.deploymentName(name);
    }
    String nameLike = uriInfo.getQueryParameters().getFirst("nameLike");
    if (nameLike != null) {
        deploymentQuery.deploymentNameLike(nameLike);
    }
    String category = uriInfo.getQueryParameters().getFirst("category");
    if (category != null) {
        deploymentQuery.deploymentCategory(category);
    }
    String categoryNotEquals = uriInfo.getQueryParameters().getFirst("categoryNotEquals");
    if (categoryNotEquals != null) {
        deploymentQuery.deploymentCategoryNotEquals(categoryNotEquals);
    }
    String tenantId = uriInfo.getQueryParameters().getFirst("tenantId");
    if (tenantId != null) {
        deploymentQuery.deploymentTenantId(tenantId);
    }
    String tenantIdLike = uriInfo.getQueryParameters().getFirst("tenantIdLike");
    if (tenantIdLike != null) {
        deploymentQuery.deploymentTenantIdLike(tenantIdLike);
    }
    String sWithoutTenantId = uriInfo.getQueryParameters().getFirst("withoutTenantId");
    if (sWithoutTenantId != null) {
        Boolean withoutTenantId = Boolean.valueOf(sWithoutTenantId);
        if (withoutTenantId) {
            deploymentQuery.deploymentWithoutTenantId();
        }
    }
    DeploymentsPaginateList deploymentsPaginateList = new DeploymentsPaginateList(new RestResponseFactory(), uriInfo);
    DataResponse dataResponse = deploymentsPaginateList.paginateList(allRequestParams, deploymentQuery, "id", allowedSortProperties);
    return Response.ok().entity(dataResponse).build();
}
Also used : DeploymentQuery(org.activiti.engine.repository.DeploymentQuery) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) DeploymentsPaginateList(org.wso2.carbon.bpmn.rest.model.repository.DeploymentsPaginateList) RepositoryService(org.activiti.engine.RepositoryService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Aggregations

HashMap (java.util.HashMap)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 RepositoryService (org.activiti.engine.RepositoryService)1 DeploymentQuery (org.activiti.engine.repository.DeploymentQuery)1 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)1 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)1 DeploymentsPaginateList (org.wso2.carbon.bpmn.rest.model.repository.DeploymentsPaginateList)1