use of org.wso2.carbon.apimgt.impl.template.ConfigContext 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;
}
Aggregations