use of io.apicurio.datamodels.asyncapi.models.AaiOperation in project carbon-apimgt by wso2.
the class AsyncApiParser method buildWSUriMapping.
public Map<String, String> buildWSUriMapping(String apiDefinition) {
Map<String, String> wsUriMapping = new HashMap<>();
Aai20Document document = (Aai20Document) Library.readDocumentFromJSONString(apiDefinition);
for (Map.Entry<String, AaiChannelItem> entry : document.channels.entrySet()) {
AaiOperation publishOperation = entry.getValue().publish;
if (publishOperation != null) {
Extension xUriMapping = publishOperation.getExtension("x-uri-mapping");
if (xUriMapping != null) {
wsUriMapping.put("PUBLISH_" + entry.getKey(), xUriMapping.value.toString());
}
}
AaiOperation subscribeOperation = entry.getValue().subscribe;
if (subscribeOperation != null) {
Extension xUriMapping = subscribeOperation.getExtension("x-uri-mapping");
if (xUriMapping != null) {
wsUriMapping.put("SUBSCRIBE_" + entry.getKey(), xUriMapping.value.toString());
}
}
}
return wsUriMapping;
}
Aggregations