Search in sources :

Example 11 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricProcessInstanceQueryService method queryProcessInstances.

@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryProcessInstances(HistoricProcessInstanceQueryRequest queryRequest) {
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    HistoryService historyService = BPMNOSGIService.getHistoryService();
    org.activiti.engine.history.HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
    // Populate query based on request
    if (queryRequest.getProcessInstanceId() != null) {
        query.processInstanceId(queryRequest.getProcessInstanceId());
    }
    if (queryRequest.getProcessInstanceIds() != null && !queryRequest.getProcessInstanceIds().isEmpty()) {
        query.processInstanceIds(new HashSet<>(queryRequest.getProcessInstanceIds()));
    }
    if (queryRequest.getProcessDefinitionKey() != null) {
        query.processDefinitionKey(queryRequest.getProcessDefinitionKey());
    }
    if (queryRequest.getProcessDefinitionId() != null) {
        query.processDefinitionId(queryRequest.getProcessDefinitionId());
    }
    if (queryRequest.getProcessBusinessKey() != null) {
        query.processInstanceBusinessKey(queryRequest.getProcessBusinessKey());
    }
    if (queryRequest.getInvolvedUser() != null) {
        query.involvedUser(queryRequest.getInvolvedUser());
    }
    if (queryRequest.getSuperProcessInstanceId() != null) {
        query.superProcessInstanceId(queryRequest.getSuperProcessInstanceId());
    }
    if (queryRequest.getExcludeSubprocesses() != null) {
        query.excludeSubprocesses(queryRequest.getExcludeSubprocesses());
    }
    if (queryRequest.getFinishedAfter() != null) {
        query.finishedAfter(queryRequest.getFinishedAfter());
    }
    if (queryRequest.getFinishedBefore() != null) {
        query.finishedBefore(queryRequest.getFinishedBefore());
    }
    if (queryRequest.getStartedAfter() != null) {
        query.startedAfter(queryRequest.getStartedAfter());
    }
    if (queryRequest.getStartedBefore() != null) {
        query.startedBefore(queryRequest.getStartedBefore());
    }
    if (queryRequest.getStartedBy() != null) {
        query.startedBy(queryRequest.getStartedBy());
    }
    if (queryRequest.getFinished() != null) {
        if (queryRequest.getFinished()) {
            query.finished();
        } else {
            query.unfinished();
        }
    }
    if (queryRequest.getIncludeProcessVariables() != null) {
        if (queryRequest.getIncludeProcessVariables()) {
            query.includeProcessVariables();
        }
    }
    if (queryRequest.getVariables() != null) {
        addVariables(query, queryRequest.getVariables());
    }
    if (queryRequest.getTenantId() != null) {
        query.processInstanceTenantId(queryRequest.getTenantId());
    }
    if (queryRequest.getTenantIdLike() != null) {
        query.processInstanceTenantIdLike(queryRequest.getTenantIdLike());
    }
    if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
        query.processInstanceWithoutTenantId();
    }
    DataResponse dataResponse = new HistoricProcessInstancePaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, queryRequest, query, "processInstanceId", allowedSortProperties);
    return Response.ok().entity(dataResponse).build();
}
Also used : RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) HistoryService(org.activiti.engine.HistoryService) HistoricProcessInstancePaginateList(org.wso2.carbon.bpmn.rest.model.history.HistoricProcessInstancePaginateList) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces) Consumes(javax.ws.rs.Consumes)

Example 12 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricVariableInstanceQueryService method queryVariableInstances.

@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryVariableInstances(HistoricVariableInstanceQueryRequest queryRequest) {
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    DataResponse dataResponse = getQueryResponse(queryRequest, allRequestParams);
    return Response.ok().entity(dataResponse).build();
}
Also used : HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 13 with Property

use of org.wso2.carbon.identity.application.common.model.Property 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)

Example 14 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class HistoricDetailQueryService method queryHistoricDetail.

@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryHistoricDetail(HistoricDetailQueryRequest queryRequest) {
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    DataResponse dataResponse = getQueryResponse(queryRequest, allRequestParams, uriInfo);
    return Response.ok().entity(dataResponse).build();
}
Also used : HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 15 with Property

use of org.wso2.carbon.identity.application.common.model.Property in project carbon-business-process by wso2.

the class ModelService method getModels.

@GET
@Path("/")
@Produces(MediaType.APPLICATION_JSON)
public Response getModels() {
    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    // 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);
        }
    }
    ModelQuery modelQuery = repositoryService.createModelQuery();
    String id = uriInfo.getQueryParameters().getFirst("id");
    if (id != null) {
        modelQuery.modelId(id);
    }
    String category = uriInfo.getQueryParameters().getFirst("category");
    if (category != null) {
        modelQuery.modelCategory(category);
    }
    String categoryLike = uriInfo.getQueryParameters().getFirst("categoryLike");
    if (categoryLike != null) {
        modelQuery.modelCategoryLike(categoryLike);
    }
    String categoryNotEquals = uriInfo.getQueryParameters().getFirst("categoryNotEquals");
    if (categoryNotEquals != null) {
        modelQuery.modelCategoryNotEquals(categoryNotEquals);
    }
    String name = uriInfo.getQueryParameters().getFirst("name");
    if (name != null) {
        modelQuery.modelName(name);
    }
    String nameLike = uriInfo.getQueryParameters().getFirst("nameLike");
    if (nameLike != null) {
        modelQuery.modelNameLike(nameLike);
    }
    String key = uriInfo.getQueryParameters().getFirst("key");
    if (key != null) {
        modelQuery.modelKey(key);
    }
    String version = uriInfo.getQueryParameters().getFirst("version");
    if (version != null) {
        modelQuery.modelVersion(Integer.valueOf(version));
    }
    String latestVersion = uriInfo.getQueryParameters().getFirst("latestVersion");
    if (latestVersion != null) {
        boolean isLatestVersion = Boolean.valueOf(latestVersion);
        if (isLatestVersion) {
            modelQuery.latestVersion();
        }
    }
    String deploymentId = uriInfo.getQueryParameters().getFirst("deploymentId");
    if (deploymentId != null) {
        modelQuery.deploymentId(deploymentId);
    }
    String deployed = uriInfo.getQueryParameters().getFirst("deployed");
    if (deployed != null) {
        boolean isDeployed = Boolean.valueOf(deployed);
        if (isDeployed) {
            modelQuery.deployed();
        } else {
            modelQuery.notDeployed();
        }
    }
    String tenantId = uriInfo.getQueryParameters().getFirst("tenantId");
    if (tenantId != null) {
        modelQuery.modelTenantId(tenantId);
    }
    String tenantIdLike = uriInfo.getQueryParameters().getFirst("tenantIdLike");
    if (tenantIdLike != null) {
        modelQuery.modelTenantIdLike(tenantIdLike);
    }
    String sWithoutTenantId = uriInfo.getQueryParameters().getFirst("withoutTenantId");
    if (sWithoutTenantId != null) {
        boolean withoutTenantId = Boolean.valueOf(sWithoutTenantId);
        if (withoutTenantId) {
            modelQuery.modelWithoutTenantId();
        }
    }
    DataResponse response = new ModelsPaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, modelQuery, "id", allowedSortProperties);
    List<ModelResponse> modelResponseList = (List<ModelResponse>) response.getData();
    if (log.isDebugEnabled()) {
        log.debug("modelResponseList: " + modelResponseList.size());
    }
    return Response.ok().entity(response).build();
}
Also used : ModelsPaginateList(org.wso2.carbon.bpmn.rest.model.repository.ModelsPaginateList) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) ModelResponse(org.wso2.carbon.bpmn.rest.model.repository.ModelResponse) ModelQuery(org.activiti.engine.repository.ModelQuery) ModelsPaginateList(org.wso2.carbon.bpmn.rest.model.repository.ModelsPaginateList) ArrayList(java.util.ArrayList) List(java.util.List) 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)17 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)17 Path (javax.ws.rs.Path)14 Produces (javax.ws.rs.Produces)14 ArrayList (java.util.ArrayList)7 GET (javax.ws.rs.GET)7 POST (javax.ws.rs.POST)7 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)7 Map (java.util.Map)6 QName (javax.xml.namespace.QName)6 File (java.io.File)5 List (java.util.List)5 IOException (java.io.IOException)4 APIManagementException (org.wso2.carbon.apimgt.core.exception.APIManagementException)4 ActivitiIllegalArgumentException (org.activiti.engine.ActivitiIllegalArgumentException)3 RepositoryService (org.activiti.engine.RepositoryService)3 Iterator (java.util.Iterator)2 Set (java.util.Set)2 Consumes (javax.ws.rs.Consumes)2 FormService (org.activiti.engine.FormService)2