use of org.eclipse.winery.model.tosca.xml.XTServiceTemplate in project winery by eclipse.
the class ToCanonical method convert.
private TServiceTemplate convert(XTServiceTemplate xml) {
TTopologyTemplate topologyTemplate = convert(xml.getTopologyTemplate());
TServiceTemplate.Builder builder = new TServiceTemplate.Builder(xml.getId(), topologyTemplate);
builder.setName(xml.getName());
builder.setTargetNamespace(xml.getTargetNamespace());
if (xml.getTags() != null) {
xml.getTags().stream().filter(// filter group definitions
t -> !t.getName().startsWith("group:")).filter(// filter participants
t -> !t.getName().startsWith("participant:")).map(this::convert).forEach(builder::addTag);
}
if (xml.getBoundaryDefinitions() != null) {
builder.setBoundaryDefinitions(convert(xml.getBoundaryDefinitions()));
}
if (xml.getPlans() != null) {
builder.setPlans(xml.getPlans().stream().map(this::convert).collect(Collectors.toList()));
}
builder.setSubstitutableNodeType(xml.getSubstitutableNodeType());
fillExtensibleElementsProperties(builder, xml);
// map group-related tags back to topology template
if (topologyTemplate != null && xml.getTags() != null) {
topologyTemplate.setGroups(convertList(xml.getTags(), this::convertToGroup));
}
// handle participant extension
if (topologyTemplate != null && xml.getTags() != null) {
topologyTemplate.setParticipants(convertList(xml.getTags(), this::convertToParticipant));
}
return builder.build();
}
Aggregations