Search in sources :

Example 56 with Property

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

the class OpenJPAVendorAdapter method getJpaPropertyMap.

@Override
public Map<String, ?> getJpaPropertyMap(TransactionManager transactionManager) {
    // TODO: Inorder to support external transaction manager, need to fix these property map
    // properly.
    Map<String, Object> jpaProperties = new HashMap<String, Object>();
    if (getDataSource() != null) {
        jpaProperties.put("openjpa.ConnectionFactory", getDataSource());
        String dbDictionary = determineDbDictionary();
        if (dbDictionary != null) {
            log.info("[Attachment-Mgt OpenJPA] DB Dictionary: " + dbDictionary);
            jpaProperties.put("openjpa.jdbc.DBDictionary", dbDictionary);
        }
    // jpaProperties.put("openjpa.jdbc.TransactionIsolation", "read-committed");
    }
    if (isGenerateDDL()) {
        log.info("[Attachment-Mgt OpenJPA] Generate DDL Enabled.");
        jpaProperties.put("openjpa.jdbc.SynchronizeMappings", "buildSchema(ForeignKeys=true)");
    }
    if (isShowSQL()) {
        log.info("[Attachment-Mgt OpenJPA] Show SQL enabled.");
        jpaProperties.put("openjpa.Log", "DefaultLevel=WARN, Runtime=INFO, Tool=INFO, SQL=TRACE");
        jpaProperties.put("openjpa.ConnectionFactoryProperties", "PrettyPrint=true, PrettyPrintLineLength=72");
    }
    if (transactionManager != null) {
        // Using managed transactions
        jpaProperties.put("openjpa.ConnectionFactoryMode", "managed");
        jpaProperties.put("openjpa.ManagedRuntime", new TransactionManagerProvider(transactionManager));
    }
    jpaProperties.put("openjpa.Id", "Attachment-Mgt-PU");
    jpaProperties.put("openjpa.QueryCache", "false");
    jpaProperties.put("openjpa.DataCache", "false");
    jpaProperties.put("openjpa.jdbc.QuerySQLCache", "false");
    return jpaProperties;
}
Also used : HashMap(java.util.HashMap) TransactionManagerProvider(org.wso2.carbon.attachment.mgt.core.dao.impl.TransactionManagerProvider)

Example 57 with Property

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

the class FormDataService method submitForm.

@POST
@Path("/")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response submitForm(SubmitFormRequest submitRequest) {
    if (submitRequest == null) {
        throw new ActivitiException("A request body was expected when executing the form submit.");
    }
    if (submitRequest.getTaskId() == null && submitRequest.getProcessDefinitionId() == null) {
        throw new ActivitiIllegalArgumentException("The taskId or processDefinitionId property has to be provided");
    }
    Map<String, String> propertyMap = new HashMap<String, String>();
    if (submitRequest.getProperties() != null) {
        for (RestFormProperty formProperty : submitRequest.getProperties()) {
            propertyMap.put(formProperty.getId(), formProperty.getValue());
        }
    }
    FormService formService = BPMNOSGIService.getFormService();
    Response.ResponseBuilder response = Response.ok();
    if (submitRequest.getTaskId() != null) {
        formService.submitTaskFormData(submitRequest.getTaskId(), propertyMap);
        response.status(Response.Status.NO_CONTENT);
        return response.build();
    } else {
        ProcessInstance processInstance = null;
        if (submitRequest.getBusinessKey() != null) {
            processInstance = formService.submitStartFormData(submitRequest.getProcessDefinitionId(), submitRequest.getBusinessKey(), propertyMap);
        } else {
            processInstance = formService.submitStartFormData(submitRequest.getProcessDefinitionId(), propertyMap);
        }
        ProcessInstanceResponse processInstanceResponse = new RestResponseFactory().createProcessInstanceResponse(processInstance, uriInfo.getBaseUri().toString());
        return response.entity(processInstanceResponse).build();
    }
}
Also used : ProcessInstanceResponse(org.wso2.carbon.bpmn.rest.model.runtime.ProcessInstanceResponse) Response(javax.ws.rs.core.Response) ActivitiException(org.activiti.engine.ActivitiException) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HashMap(java.util.HashMap) ActivitiIllegalArgumentException(org.activiti.engine.ActivitiIllegalArgumentException) FormService(org.activiti.engine.FormService) ProcessInstanceResponse(org.wso2.carbon.bpmn.rest.model.runtime.ProcessInstanceResponse) RestFormProperty(org.wso2.carbon.bpmn.rest.model.form.RestFormProperty) ProcessInstance(org.activiti.engine.runtime.ProcessInstance) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 58 with Property

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

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

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

Aggregations

ArrayList (java.util.ArrayList)114 HashMap (java.util.HashMap)114 Property (org.wso2.carbon.identity.application.common.model.Property)103 Map (java.util.Map)62 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.IdentityProviderProperty)50 Test (org.testng.annotations.Test)41 UserStoreException (org.wso2.carbon.user.api.UserStoreException)38 IOException (java.io.IOException)37 Property (org.wso2.carbon.identity.application.common.model.idp.xsd.Property)36 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)33 APIManagementException (org.wso2.carbon.apimgt.api.APIManagementException)32 RegistryException (org.wso2.carbon.registry.core.exceptions.RegistryException)31 List (java.util.List)30 FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig)29 Resource (org.wso2.carbon.registry.core.Resource)29 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)27 OMElement (org.apache.axiom.om.OMElement)24 PreparedStatement (java.sql.PreparedStatement)23 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)23 Property (org.wso2.carbon.identity.application.common.model.xsd.Property)23