Search in sources :

Example 86 with Property

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

the class QueryExecutionService method queryProcessInstances.

@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response queryProcessInstances(ExecutionQueryRequest queryRequest, @Context UriInfo uriInfo) {
    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 87 with Property

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

the class ProcessDefinitionService method getProcessDefinitions.

@GET
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getProcessDefinitions() {
    RepositoryService repositoryService = BPMNOSGIService.getRepositoryService();
    Map<String, String> allRequestParams = new HashMap<>();
    for (String property : allPropertiesList) {
        String value = uriInfo.getQueryParameters().getFirst(property);
        if (value != null) {
            allRequestParams.put(property, value);
        }
    }
    ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
    // Populate filter-parameters
    if (allRequestParams.containsKey("category")) {
        processDefinitionQuery.processDefinitionCategory(allRequestParams.get("category"));
    }
    if (allRequestParams.containsKey("categoryLike")) {
        processDefinitionQuery.processDefinitionCategoryLike(allRequestParams.get("categoryLike"));
    }
    if (allRequestParams.containsKey("categoryNotEquals")) {
        processDefinitionQuery.processDefinitionCategoryNotEquals(allRequestParams.get("categoryNotEquals"));
    }
    if (allRequestParams.containsKey("key")) {
        processDefinitionQuery.processDefinitionKey(allRequestParams.get("key"));
    }
    if (allRequestParams.containsKey("keyLike")) {
        processDefinitionQuery.processDefinitionKeyLike(allRequestParams.get("keyLike"));
    }
    if (allRequestParams.containsKey("name")) {
        processDefinitionQuery.processDefinitionName(allRequestParams.get("name"));
    }
    if (allRequestParams.containsKey("nameLike")) {
        processDefinitionQuery.processDefinitionNameLike(allRequestParams.get("nameLike"));
    }
    if (allRequestParams.containsKey("resourceName")) {
        processDefinitionQuery.processDefinitionResourceName(allRequestParams.get("resourceName"));
    }
    if (allRequestParams.containsKey("resourceNameLike")) {
        processDefinitionQuery.processDefinitionResourceNameLike(allRequestParams.get("resourceNameLike"));
    }
    if (allRequestParams.containsKey("version")) {
        processDefinitionQuery.processDefinitionVersion(Integer.valueOf(allRequestParams.get("version")));
    }
    if (allRequestParams.containsKey("suspended")) {
        Boolean suspended = Boolean.valueOf(allRequestParams.get("suspended"));
        if (suspended != null) {
            if (suspended) {
                processDefinitionQuery.suspended();
            } else {
                processDefinitionQuery.active();
            }
        }
    }
    if (allRequestParams.containsKey("latest")) {
        Boolean latest = Boolean.valueOf(allRequestParams.get("latest"));
        if (latest != null && latest) {
            processDefinitionQuery.latestVersion();
        }
    }
    if (allRequestParams.containsKey("deploymentId")) {
        processDefinitionQuery.deploymentId(allRequestParams.get("deploymentId"));
    }
    if (allRequestParams.containsKey("startableByUser")) {
        processDefinitionQuery.startableByUser(allRequestParams.get("startableByUser"));
    }
    if (allRequestParams.containsKey("tenantId")) {
        processDefinitionQuery.processDefinitionTenantId(allRequestParams.get("tenantId"));
    }
    if (allRequestParams.containsKey("tenantIdLike")) {
        processDefinitionQuery.processDefinitionTenantIdLike(allRequestParams.get("tenantIdLike"));
    }
    DataResponse response = new ProcessDefinitionsPaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, processDefinitionQuery, "name", properties);
    return Response.ok().entity(response).build();
}
Also used : RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HashMap(java.util.HashMap) DataResponse(org.wso2.carbon.bpmn.rest.model.common.DataResponse) ProcessDefinitionQuery(org.activiti.engine.repository.ProcessDefinitionQuery) ProcessDefinitionsPaginateList(org.wso2.carbon.bpmn.rest.model.repository.ProcessDefinitionsPaginateList) RepositoryService(org.activiti.engine.RepositoryService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 88 with Property

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

the class UserSubstitutionUtils method getPaginatedModelFromRequest.

/**
 * Prepare the paginated data model for a substitution query
 * @param propertiesMap
 * @param tenantId
 * @return PaginatedSubstitutesDataModel
 */
private static PaginatedSubstitutesDataModel getPaginatedModelFromRequest(Map<String, String> propertiesMap, int tenantId) {
    PaginatedSubstitutesDataModel model = new PaginatedSubstitutesDataModel();
    if (propertiesMap.get(SubstitutionQueryProperties.SUBSTITUTE) != null) {
        model.setSubstitute(propertiesMap.get(SubstitutionQueryProperties.SUBSTITUTE));
    }
    if (propertiesMap.get(SubstitutionQueryProperties.USER) != null) {
        model.setUser(propertiesMap.get(SubstitutionQueryProperties.USER));
    }
    String enabled = propertiesMap.get(SubstitutionQueryProperties.ENABLED);
    if (enabled != null) {
        if (enabled.equalsIgnoreCase("true")) {
            model.setEnabled(true);
        } else if (enabled.equalsIgnoreCase("false")) {
            model.setEnabled(false);
        } else {
            throw new ActivitiIllegalArgumentException("Invalid parameter " + enabled + " for enabled property.");
        }
    }
    model.setTenantId(tenantId);
    int start = Integer.parseInt(propertiesMap.get(SubstitutionQueryProperties.START));
    int size = Integer.parseInt(propertiesMap.get(SubstitutionQueryProperties.SIZE));
    model.setStart(start);
    model.setSize(size);
    model.setOrder(propertiesMap.get(SubstitutionQueryProperties.ORDER));
    model.setSort(propertiesMap.get(SubstitutionQueryProperties.SORT));
    return model;
}
Also used : PaginatedSubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.PaginatedSubstitutesDataModel)

Example 89 with Property

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

the class BPMNDeployer method isWorkerNode.

/**
 * Whether a bps node is worker ( a node that does not participate in archive deployment and only handles
 * input/output . This is determined by looking at the registry read/only property
 * @return
 */
private boolean isWorkerNode() {
    RegistryService registryService = BPMNServerHolder.getInstance().getRegistryService();
    boolean isWorker = true;
    try {
        isWorker = (registryService.getConfigSystemRegistry().getRegistryContext().isReadOnly());
    } catch (RegistryException e) {
        log.error("Error accessing the configuration registry");
    }
    return isWorker;
}
Also used : RegistryService(org.wso2.carbon.registry.core.service.RegistryService) RegistryException(org.wso2.carbon.registry.core.exceptions.RegistryException)

Example 90 with Property

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

the class ActivitiDAO method querySubstituteInfoWithoutEnabled.

/**
 * Return the list of substitute info based on query parameters except enabled property.
 * @param model data model with only required query parameter values. Leave others as null.
 * @return List<PaginatedSubstitutesDataModel> Result set of substitute info
 */
public List<SubstitutesDataModel> querySubstituteInfoWithoutEnabled(final PaginatedSubstitutesDataModel model) {
    final RowBounds rw = new RowBounds(model.getStart(), model.getSize());
    CustomSqlExecution<SubstitutesMapper, List<SubstitutesDataModel>> customSqlExecution = new AbstractCustomSqlExecution<SubstitutesMapper, List<SubstitutesDataModel>>(SubstitutesMapper.class) {

        public List<SubstitutesDataModel> execute(SubstitutesMapper substitutesMapper) {
            return substitutesMapper.querySubstitutesWithoutEnabled(rw, model);
        }
    };
    return managementService.executeCustomSql(customSqlExecution);
}
Also used : PaginatedSubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.PaginatedSubstitutesDataModel) SubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.SubstitutesDataModel) AbstractCustomSqlExecution(org.activiti.engine.impl.cmd.AbstractCustomSqlExecution) RowBounds(org.apache.ibatis.session.RowBounds) List(java.util.List) SubstitutesMapper(org.wso2.carbon.bpmn.core.internal.mapper.SubstitutesMapper)

Aggregations

HashMap (java.util.HashMap)42 ArrayList (java.util.ArrayList)32 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)32 Resource (org.wso2.carbon.registry.core.Resource)23 Map (java.util.Map)21 Test (org.junit.Test)21 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)21 DataResponse (org.wso2.carbon.bpmn.rest.model.common.DataResponse)17 API (org.wso2.carbon.apimgt.api.model.API)16 UserStoreException (org.wso2.carbon.user.api.UserStoreException)16 Path (javax.ws.rs.Path)14 Produces (javax.ws.rs.Produces)14 JSONObject (org.json.simple.JSONObject)14 APIIdentifier (org.wso2.carbon.apimgt.api.model.APIIdentifier)14 List (java.util.List)13 IOException (java.io.IOException)11 QName (javax.xml.namespace.QName)11 APIProductResource (org.wso2.carbon.apimgt.api.model.APIProductResource)11 Properties (java.util.Properties)10 GovernanceException (org.wso2.carbon.governance.api.exception.GovernanceException)10