use of org.eclipse.winery.yaml.converter.yaml.visitors.ReferenceVisitor in project winery by eclipse.
the class Y2XConverter method convert.
/**
* Converts TOSCA YAML ServiceTemplates to TOSCA XML Definitions
*
* @return TOSCA XML Definitions
*/
@NonNull
public Definitions convert(org.eclipse.winery.model.tosca.yaml.TServiceTemplate node, String id, String target_namespace, Path path, Path outPath) {
if (node == null)
return new Definitions();
LOGGER.debug("Converting TServiceTemplate");
// Reset
this.reset();
this.referenceVisitor = new ReferenceVisitor(node, target_namespace, path);
this.namespace = target_namespace;
this.path = path;
this.outPath = outPath;
init(node);
Definitions definitions = new Definitions.Builder(id + "_Definitions", target_namespace).setImport(convert(node.getImports())).addTypes(convert(node.getDataTypes())).addTypes(convert(node.getGroupTypes())).addServiceTemplates(convertServiceTemplate(node, id, target_namespace)).addNodeTypes(convert(node.getNodeTypes())).addNodeTypeImplementations(this.nodeTypeImplementations).addRelationshipTypes(convert(node.getRelationshipTypes())).addCapabilityTypes(convert(node.getCapabilityTypes())).addArtifactTypes(convert(node.getArtifactTypes())).addArtifactTemplates(this.artifactTemplates.entrySet().stream().map(Map.Entry::getValue).collect(Collectors.toList())).addPolicyTypes(convert(node.getPolicyTypes())).setName(id).addImports(this.imports).addRequirementTypes(this.requirementTypes).addPolicyTemplates(this.policyTemplates).build();
WriterUtils.storeDefinitions(definitions, true, path);
return definitions;
}
Aggregations