use of org.eclipse.winery.model.tosca.yaml.YTInterfaceType in project winery by eclipse.
the class FromCanonical method convert.
public Map<String, YTInterfaceType> convert(TInterfaceType node) {
if (Objects.isNull(node)) {
return null;
}
Map<String, YTOperationDefinition> ops = new HashMap<>();
node.getOperations().forEach((key, value) -> ops.putAll(convert(value)));
YTInterfaceType.Builder interfaceBuilder = new YTInterfaceType.Builder().setDescription(node.getDescription()).setOperations(ops).setDerivedFrom(convert(node.getDerivedFrom(), node.getClass()));
String typeName = node.getName();
if (Objects.nonNull(node.getTargetNamespace()) && !node.getTargetNamespace().isEmpty()) {
Metadata metadata = new Metadata();
metadata.put("targetNamespace", node.getTargetNamespace());
interfaceBuilder.addMetadata(metadata);
if (Objects.nonNull(typeName)) {
typeName = node.getTargetNamespace().concat(".").concat(typeName);
}
}
return Collections.singletonMap(typeName, interfaceBuilder.build());
}
Aggregations