Search in sources :

Example 66 with Parameter

use of org.wso2.transport.http.netty.config.Parameter in project carbon-business-process by wso2.

the class BPELBindingContextImpl method deactivateMyRoleEndpoint.

public void deactivateMyRoleEndpoint(QName processID, Endpoint endpoint) {
    if (log.isDebugEnabled()) {
        log.debug("Deactivating my role endpoint for process: " + processID + " service: " + endpoint.serviceName + " and port: " + endpoint.portName);
    }
    Integer tenantId = bpelServer.getMultiTenantProcessStore().getTenantId(processID);
    BPELProcessProxy processProxy = getBPELProcessProxy(tenantId.toString(), endpoint.serviceName, endpoint.portName);
    if (processProxy != null) {
        ProcessConfigurationImpl processConf = (ProcessConfigurationImpl) processProxy.getProcessConfiguration();
        if (processConf.isUndeploying()) {
            AxisService service = processProxy.getAxisService();
            Parameter param = service.getParameter(CarbonConstants.PRESERVE_SERVICE_HISTORY_PARAM);
            param.setValue("false");
        }
        removeBPELProcessProxyAndAxisService(tenantId.toString(), endpoint.serviceName, endpoint.portName);
        updateServiceList(((ProcessConfigurationImpl) processProxy.getProcessConfiguration()).getTenantId(), endpoint, STATE.REMOVE);
        serviceEprMap.remove(processProxy);
    }
// else this method also get called for the retired processes where there could be an
// active version of the same process type. Since there is only one service for a
// particular process type, processProxy will be null for all the endpoints except for 1.
}
Also used : AxisService(org.apache.axis2.description.AxisService) Parameter(org.apache.axis2.description.Parameter) ProcessConfigurationImpl(org.wso2.carbon.bpel.core.ode.integration.store.ProcessConfigurationImpl)

Example 67 with Parameter

use of org.wso2.transport.http.netty.config.Parameter in project carbon-business-process by wso2.

the class AttachmentMgtDAOConnectionFactoryImpl method init.

@Override
public void init() {
    if (transactionManager == null) {
        log.debug("Transaction-Manager is not initialized before initializing entityManager. So internal " + "transaction-manager in entity manager will be used.");
    }
    JPAVendorAdapter vendorAdapter = getJPAVendorAdapter();
    // Here we pass a "null" valued transaction manager,
    // as we enforce the entity-manager-factory to use its local transactions. In future,
    // if required to use external JTA transactions, a transaction reference should be passed
    // as the input parameter.
    this.entityManagerFactory = Persistence.createEntityManagerFactory("Attachment-Mgt-PU", vendorAdapter.getJpaPropertyMap(null));
}
Also used : JPAVendorAdapter(org.wso2.carbon.attachment.mgt.core.dao.impl.jpa.JPAVendorAdapter)

Example 68 with Parameter

use of org.wso2.transport.http.netty.config.Parameter in project carbon-business-process by wso2.

the class UserSubstitutionService method getSubstitute.

/**
 * Return the substitute info for the given user in path parameter
 * @param user
 * @return SubstituteInfoResponse
 * @throws URISyntaxException
 */
@GET
@Path("/{user}")
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response getSubstitute(@PathParam("user") String user) throws UserStoreException {
    if (!subsFeatureEnabled) {
        return Response.status(405).build();
    }
    user = getTenantAwareUser(user);
    int tenantId = PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId();
    String loggedInUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
    if (!loggedInUser.equals(user) && !isUserAuthorizedForSubstitute(loggedInUser)) {
        throw new BPMNForbiddenException("Not allowed to view others substitution details. No sufficient permission");
    }
    SubstitutesDataModel model = UserSubstitutionUtils.getSubstituteOfUser(user, tenantId);
    if (model != null) {
        SubstituteInfoResponse response = new SubstituteInfoResponse();
        response.setSubstitute(model.getSubstitute());
        response.setAssignee(model.getUser());
        response.setEnabled(model.isEnabled());
        response.setStartTime(model.getSubstitutionStart());
        response.setEndTime(model.getSubstitutionEnd());
        return Response.ok(response).build();
    } else {
        return Response.status(404).build();
    }
}
Also used : SubstitutesDataModel(org.wso2.carbon.bpmn.core.mgt.model.SubstitutesDataModel) BPMNForbiddenException(org.wso2.carbon.bpmn.rest.common.exception.BPMNForbiddenException)

Example 69 with Parameter

use of org.wso2.transport.http.netty.config.Parameter 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 70 with Parameter

use of org.wso2.transport.http.netty.config.Parameter 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)26 ArrayList (java.util.ArrayList)19 BLangEndpoint (org.wso2.ballerinalang.compiler.tree.BLangEndpoint)14 JSONDecoder (org.wso2.charon3.core.encoder.JSONDecoder)11 BadRequestException (org.wso2.charon3.core.exceptions.BadRequestException)11 CharonException (org.wso2.charon3.core.exceptions.CharonException)11 InternalErrorException (org.wso2.charon3.core.exceptions.InternalErrorException)11 NotFoundException (org.wso2.charon3.core.exceptions.NotFoundException)11 SCIMResponse (org.wso2.charon3.core.protocol.SCIMResponse)11 SCIMResourceTypeSchema (org.wso2.charon3.core.schema.SCIMResourceTypeSchema)11 Test (org.testng.annotations.Test)8 BInvokableSymbol (org.wso2.ballerinalang.compiler.semantics.model.symbols.BInvokableSymbol)8 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)8 JSONEncoder (org.wso2.charon3.core.encoder.JSONEncoder)8 List (java.util.List)7 BLangFunction (org.wso2.ballerinalang.compiler.tree.BLangFunction)7 ConstantExpressionExecutor (org.wso2.siddhi.core.executor.ConstantExpressionExecutor)7 SiddhiAppValidationException (org.wso2.siddhi.query.api.exception.SiddhiAppValidationException)7 Parameter (org.apache.axis2.description.Parameter)6 BInvokableType (org.wso2.ballerinalang.compiler.semantics.model.types.BInvokableType)6