Search in sources :

Example 1 with SOAPToRESTAPIConfigContext

use of org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.SOAPToRESTAPIConfigContext in project carbon-apimgt by wso2.

the class SequenceUtils method getSequenceTemplateConfigContext.

/**
 * Gets the velocity template config context with sequence data populated
 *
 * @param soapToRestMediationDtoList registry resource path
 * @param seqType                    sequence type whether in or out sequence
 * @param configContext              velocity template config context
 * @return {@link ConfigContext} sequences populated velocity template config context
 */
public static ConfigContext getSequenceTemplateConfigContext(List<SoapToRestMediationDto> soapToRestMediationDtoList, String seqType, ConfigContext configContext) {
    if (soapToRestMediationDtoList.size() > 0) {
        JSONObject pathObj = new JSONObject();
        for (SoapToRestMediationDto soapToRestMediationDto : soapToRestMediationDtoList) {
            String method = soapToRestMediationDto.getMethod();
            String resourceName = soapToRestMediationDto.getResource();
            JSONObject contentObj = new JSONObject();
            contentObj.put(method, soapToRestMediationDto.getContent());
            pathObj.put(SOAPToRESTConstants.SequenceGen.PATH_SEPARATOR.concat(resourceName), contentObj);
        }
        configContext = new SOAPToRESTAPIConfigContext(configContext, pathObj, seqType);
    }
    return configContext;
}
Also used : SOAPToRESTAPIConfigContext(org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.SOAPToRESTAPIConfigContext) JSONObject(org.json.simple.JSONObject) SoapToRestMediationDto(org.wso2.carbon.apimgt.impl.dto.SoapToRestMediationDto)

Aggregations

JSONObject (org.json.simple.JSONObject)1 SoapToRestMediationDto (org.wso2.carbon.apimgt.impl.dto.SoapToRestMediationDto)1 SOAPToRESTAPIConfigContext (org.wso2.carbon.apimgt.rest.api.publisher.v1.common.template.SOAPToRESTAPIConfigContext)1