From d7ea8d7938fd358857a1f448ca4ba91536c78d2f Mon Sep 17 00:00:00 2001 From: mbeisel Date: Tue, 21 Nov 2023 21:09:48 +0100 Subject: [PATCH] enable selfserviceapplicationurls in servicetemplates fix id scheme for relations during completion --- .../adaptation/placement/PlacementUtils.java | 43 +++++----- .../model/tosca/TBoundaryDefinitions.java | 15 +++- .../tosca/TSelfServiceApplicationUrl.java | 68 +++++++++++++++ .../winery/model/tosca/visitor/Visitor.java | 5 ++ .../tosca/xml/XTBoundaryDefinitions.java | 13 ++- .../xml/XTSelfServiceApplicationUrl.java | 86 +++++++++++++++++++ .../model/tosca/xml/visitor/Visitor.java | 5 ++ .../TopologyTemplateResource.java | 4 +- .../repository/splitting/Splitting.java | 7 +- .../xml/converter/FromCanonical.java | 13 +++ .../repository/xml/converter/ToCanonical.java | 13 +++ 11 files changed, 247 insertions(+), 25 deletions(-) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TSelfServiceApplicationUrl.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTSelfServiceApplicationUrl.java diff --git a/org.eclipse.winery.model.adaptation/src/main/java/org/eclipse/winery/model/adaptation/placement/PlacementUtils.java b/org.eclipse.winery.model.adaptation/src/main/java/org/eclipse/winery/model/adaptation/placement/PlacementUtils.java index 009abc1e55..d64452e538 100644 --- a/org.eclipse.winery.model.adaptation/src/main/java/org/eclipse/winery/model/adaptation/placement/PlacementUtils.java +++ b/org.eclipse.winery.model.adaptation/src/main/java/org/eclipse/winery/model/adaptation/placement/PlacementUtils.java @@ -37,6 +37,7 @@ import org.eclipse.winery.model.tosca.TPolicy; import org.eclipse.winery.model.tosca.TPropertyMapping; import org.eclipse.winery.model.tosca.TRelationshipTemplate; +import org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTag; import org.eclipse.winery.model.tosca.TTopologyTemplate; @@ -642,24 +643,26 @@ private static String getNextProvider(HashMap> provi /** * Completes the model based on given nodetype requirements. * - * @param serviceTemplateId the ID of the ServiceTemplate to complete + * @param incompleteServiceTemplateId the ID of the ServiceTemplate to complete * @param topology the incomplete TopologyTemplate to complete * @return the completed TopologyTemplate if completion is successful, the cleared and blacklisted TopologyTemplate * otherwise */ - public static ServiceTemplateId completeModelBasedOnReqs(ServiceTemplateId serviceTemplateId, TTopologyTemplate topology, List blacklist, Map policies) { + public static ServiceTemplateId completeModelBasedOnReqs(ServiceTemplateId incompleteServiceTemplateId, TTopologyTemplate topology, List blacklist, Map policies) throws Exception { Splitting splitting = new Splitting(); IRepository repo = RepositoryFactory.getRepository(); try { ServiceTemplateId newId = null; // create new temporary ServiceTemplate as working copy - ServiceTemplateId placementId = new ServiceTemplateId(serviceTemplateId.getNamespace().getDecoded(), - VersionSupport.getNewComponentVersionId(serviceTemplateId, "placement"), false); + TServiceTemplate incompleteServiceTemplate = repo.getElement(incompleteServiceTemplateId); + ServiceTemplateId placementId = new ServiceTemplateId(incompleteServiceTemplateId.getNamespace().getDecoded(), + VersionSupport.getNewComponentVersionId(incompleteServiceTemplateId, "placement"), false); repo.forceDelete(placementId); TServiceTemplate placementServiceTemplate = new TServiceTemplate.Builder(placementId.getXmlId().getDecoded(), topology) .setName(placementId.getXmlId().getDecoded()) - .setTargetNamespace(serviceTemplateId.getNamespace().getDecoded()) + .setTargetNamespace(incompleteServiceTemplateId.getNamespace().getDecoded()) +// .setBoundaryDefinitions(incompleteServiceTemplate.getBoundaryDefinitions()) .build(); // resolve open requirements until the topology is completed @@ -678,27 +681,27 @@ public static ServiceTemplateId completeModelBasedOnReqs(ServiceTemplateId servi placementId = newServiceTemplateId; } - // Set selfserviceUrl for completed Templates - + // Set selfserviceUrl for completed Templates that DO SPECIFY BOUNDARYDEFINITIONS required for selfserviceurl TServiceTemplate completedST = repo.getElement(placementId); - + final List allowedPortNames = List.of("VMOpenPorts"); final List allowedIPNames = List.of("VMIP"); TBoundaryDefinitions definitions = new TBoundaryDefinitions(); TBoundaryDefinitions.Properties properties = new TBoundaryDefinitions.Properties(); List propertyMappings = new ArrayList<>(); - + assert completedST.getTopologyTemplate() != null; - for (TEntityTemplate nt: completedST.getTopologyTemplate().getNodeTemplateOrRelationshipTemplate()) { + for (TEntityTemplate nt : completedST.getTopologyTemplate().getNodeTemplateOrRelationshipTemplate()) { String suitableIPKey = null; String suitablePortKey = null; - if( nt.getProperties() != null){ + if (nt.getProperties() != null) { LinkedHashMap kvProperties = ((TEntityTemplate.WineryKVProperties) nt.getProperties()).getKVProperties(); - for ( Map.Entry entry : kvProperties.entrySet()) { - if (allowedIPNames.contains(entry.getKey())){ + for (Map.Entry entry : kvProperties.entrySet()) { + if (allowedIPNames.contains(entry.getKey())) { suitableIPKey = entry.getKey(); - } if (allowedPortNames.contains(entry.getKey())){ + } + if (allowedPortNames.contains(entry.getKey())) { suitablePortKey = entry.getKey(); } } @@ -707,14 +710,15 @@ public static ServiceTemplateId completeModelBasedOnReqs(ServiceTemplateId servi TPropertyMapping selfserviceProperty = new TPropertyMapping("/*[local-name()='selfserviceApplicationUrl']", nt, targetPropertyRef); propertyMappings.add(selfserviceProperty); properties.setPropertyMappings(propertyMappings); + + properties.setSelfServiceApplicationUrl(new TSelfServiceApplicationUrl("http://www.eclipse.org/winery/model/selfservice")); definitions.setProperties(properties); completedST.setBoundaryDefinitions(definitions); -// repo.setElement(placementId, completedST); - + //save completed ServiceTemplate using originalname + completed newId = new ServiceTemplateId( - serviceTemplateId.getNamespace().getDecoded(), - VersionSupport.getNewComponentVersionId(serviceTemplateId, "completed"), + incompleteServiceTemplateId.getNamespace().getDecoded(), + VersionSupport.getNewComponentVersionId(incompleteServiceTemplateId, "completed"), false); completedST.setId(newId.getXmlId().getDecoded()); completedST.setName(newId.getXmlId().getDecoded()); @@ -724,12 +728,11 @@ public static ServiceTemplateId completeModelBasedOnReqs(ServiceTemplateId servi } } } - // returned completed topologyId return newId; } catch (Exception e) { LOGGER.error("Exception while completing topology: {}", e.getMessage()); - return null; + throw new Exception(e); } } diff --git a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TBoundaryDefinitions.java b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TBoundaryDefinitions.java index fdb743ec7f..9fde3b160b 100644 --- a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TBoundaryDefinitions.java +++ b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TBoundaryDefinitions.java @@ -150,7 +150,8 @@ public void accept(Visitor visitor) { @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "any", - "propertyMappings" + "propertyMappings", + "selfServiceApplicationUrl" }) public static class Properties implements Serializable { @@ -159,6 +160,18 @@ public static class Properties implements Serializable { @XmlElementWrapper(name = "PropertyMappings") @XmlElement(name = "PropertyMapping", required = true) protected List propertyMappings; + @XmlElement(name = "SelfServiceApplicationUrl") + protected TSelfServiceApplicationUrl selfServiceApplicationUrl; + + @Nullable + public TSelfServiceApplicationUrl getSelfServiceApplicationUrl() { + return selfServiceApplicationUrl; + } + + public void setSelfServiceApplicationUrl(TSelfServiceApplicationUrl selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } + @Nullable public Object getAny() { diff --git a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TSelfServiceApplicationUrl.java b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TSelfServiceApplicationUrl.java new file mode 100644 index 0000000000..dfe5834f03 --- /dev/null +++ b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TSelfServiceApplicationUrl.java @@ -0,0 +1,68 @@ +/******************************************************************************* + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +package org.eclipse.winery.model.tosca; + +import java.io.Serializable; +import java.util.Objects; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + +import org.eclipse.winery.model.tosca.visitor.Visitor; + +import org.eclipse.jdt.annotation.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "tSelfServiceApplicationUrl") +public class TSelfServiceApplicationUrl implements Serializable { + + public String getSelfServiceApplicationUrl() { + return selfServiceApplicationUrl; + } + + public void setSelfServiceApplicationUrl(String selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } + + @XmlAttribute(name = "xmlns") + protected String selfServiceApplicationUrl; + + @Deprecated // used for XML deserialization of API request content + public TSelfServiceApplicationUrl() { + } + + public TSelfServiceApplicationUrl(@NonNull String selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl)) return false; + org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl that = (org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl) o; + return Objects.equals(selfServiceApplicationUrl, that.selfServiceApplicationUrl); + } + + @Override + public int hashCode() { + return Objects.hash(selfServiceApplicationUrl); + } + + public void accept(Visitor visitor) { + visitor.visit(this); + } +} diff --git a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/visitor/Visitor.java b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/visitor/Visitor.java index c619d52415..848ce519a9 100644 --- a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/visitor/Visitor.java +++ b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/visitor/Visitor.java @@ -44,6 +44,7 @@ import org.eclipse.winery.model.tosca.TRelationshipTemplate; import org.eclipse.winery.model.tosca.TRequirement; import org.eclipse.winery.model.tosca.TRequirementRef; +import org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTag; import org.eclipse.winery.model.tosca.TTopologyTemplate; @@ -326,6 +327,10 @@ public void visit(TBoundaryDefinitions.Properties properties) { } } + public void visit(TSelfServiceApplicationUrl applicationUrl) { + // this is a leaf, so no action to take + } + public void visit(TPropertyMapping propertyMapping) { // this is a leaf, so no action to take } diff --git a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTBoundaryDefinitions.java b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTBoundaryDefinitions.java index 180f0737a2..bdef99d8fd 100644 --- a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTBoundaryDefinitions.java +++ b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTBoundaryDefinitions.java @@ -150,7 +150,8 @@ public void accept(Visitor visitor) { @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "any", - "propertyMappings" + "propertyMappings", + "selfServiceApplicationUrl" }) public static class Properties implements Serializable { @@ -159,7 +160,17 @@ public static class Properties implements Serializable { @XmlElementWrapper(name = "PropertyMappings") @XmlElement(name = "PropertyMapping", required = true) protected List propertyMappings; + @XmlElement(name = "SelfServiceApplicationUrl") + protected XTSelfServiceApplicationUrl selfServiceApplicationUrl; + @Nullable + public XTSelfServiceApplicationUrl getSelfServiceApplicationUrl() { + return selfServiceApplicationUrl; + } + + public void setSelfServiceApplicationUrl(XTSelfServiceApplicationUrl selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } @Nullable public Object getAny() { return any; diff --git a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTSelfServiceApplicationUrl.java b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTSelfServiceApplicationUrl.java new file mode 100644 index 0000000000..068aa008e3 --- /dev/null +++ b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTSelfServiceApplicationUrl.java @@ -0,0 +1,86 @@ +package org.eclipse.winery.model.tosca.xml; /******************************************************************************* + * Copyright (c) 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + + +import java.io.Serializable; +import java.util.Objects; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlType; + +import org.eclipse.winery.model.tosca.xml.visitor.Visitor; + +import org.eclipse.jdt.annotation.NonNull; + +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "tSelfServiceApplicationUrl") +public class XTSelfServiceApplicationUrl implements Serializable { + + public String getSelfServiceApplicationUrl() { + return selfServiceApplicationUrl; + } + + public void setSelfServiceApplicationUrl(String selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } + + @XmlAttribute(name = "xmlns") + protected String selfServiceApplicationUrl; + + @Deprecated // used for XML deserialization of API request content + public XTSelfServiceApplicationUrl() { + } + + public XTSelfServiceApplicationUrl(@NonNull String selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } + + private XTSelfServiceApplicationUrl(XTSelfServiceApplicationUrl.Builder builder) { + this.selfServiceApplicationUrl = builder.selfServiceApplicationUrl; + } + + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (!(o instanceof org.eclipse.winery.model.tosca.xml.XTSelfServiceApplicationUrl)) return false; + org.eclipse.winery.model.tosca.xml.XTSelfServiceApplicationUrl that = (org.eclipse.winery.model.tosca.xml.XTSelfServiceApplicationUrl) o; + return Objects.equals(selfServiceApplicationUrl, that.selfServiceApplicationUrl); + } + + @Override + public int hashCode() { + return Objects.hash(selfServiceApplicationUrl); + } + + + public static class Builder { + + private final String selfServiceApplicationUrl; + + public Builder(String selfServiceApplicationUrl) { + this.selfServiceApplicationUrl = selfServiceApplicationUrl; + } + + public XTSelfServiceApplicationUrl build() { + return new XTSelfServiceApplicationUrl(this); + } + } + + public void accept(Visitor visitor) { + visitor.visit(this); + } +} diff --git a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/visitor/Visitor.java b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/visitor/Visitor.java index f927f5a5be..b5abe88e96 100644 --- a/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/visitor/Visitor.java +++ b/org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/visitor/Visitor.java @@ -42,6 +42,7 @@ import org.eclipse.winery.model.tosca.xml.XTRelationshipTemplate; import org.eclipse.winery.model.tosca.xml.XTRequirement; import org.eclipse.winery.model.tosca.xml.XTRequirementRef; +import org.eclipse.winery.model.tosca.xml.XTSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.xml.XTServiceTemplate; import org.eclipse.winery.model.tosca.xml.XTTag; import org.eclipse.winery.model.tosca.xml.XTTopologyTemplate; @@ -312,6 +313,10 @@ public void visit(XTBoundaryDefinitions.Properties properties) { } } + public void visit(XTSelfServiceApplicationUrl selfServiceApplicationUrl) { + // this is a leaf, so no action to take + } + public void visit(XTPropertyMapping propertyMapping) { // this is a leaf, so no action to take } diff --git a/org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/servicetemplates/topologytemplates/TopologyTemplateResource.java b/org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/servicetemplates/topologytemplates/TopologyTemplateResource.java index 916dd2eadf..25882249c0 100644 --- a/org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/servicetemplates/topologytemplates/TopologyTemplateResource.java +++ b/org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/servicetemplates/topologytemplates/TopologyTemplateResource.java @@ -610,7 +610,7 @@ public Response completeModel(@Context UriInfo uriInfo, CompletionInputData comp PlacementUtils.completeModelBasedOnReqs((ServiceTemplateId) this.parent.getId(), this.topologyTemplate, blacklist, policies); URI url = uriInfo.getBaseUri().resolve(RestUtils.getAbsoluteURL(newServiceTemplateId)); return Response.created(url).build(); - } catch (InvalidParameterException e) { + } catch (Exception e) { LOGGER.debug("Error while completing model: {}", e.getMessage()); return Response.serverError().entity(e.getMessage()).build(); } @@ -633,7 +633,7 @@ public Response checkEquivalency(@Context UriInfo uriInfo) { @POST @Path("iscomplete") - @Produces(MediaType.APPLICATION_JSON) + @Produces(MediaType.TEXT_PLAIN) public Response isComplete(@Context UriInfo uriInfo) { try { Boolean isComplete = diff --git a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/splitting/Splitting.java b/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/splitting/Splitting.java index 1087f5c5f3..652fd33af6 100644 --- a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/splitting/Splitting.java +++ b/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/splitting/Splitting.java @@ -1822,6 +1822,10 @@ public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, L }).toList(); } + if (compatibleNodeTemplates.size() == 0){ + LOGGER.error("All matched nodetemplates were filtered - hence the completion had to be aborted"); + throw new SplittingException("All matched nodetemplates were filtered - hence the completion had to be aborted"); + } TNodeTemplate selectedTemplate = compatibleNodeTemplates.get(0); // check if suitable nodetemplate already exists in topology, if so reuse it instead of creating new one. @@ -1838,7 +1842,8 @@ public TTopologyTemplate getMatchingTopology(TServiceTemplate serviceTemplate, L } TRelationshipTemplate newHostedOnRelationship = new TRelationshipTemplate(); - String id = UUID.randomUUID().toString(); + int idNumber = (int) (Math.random() * 200000000) + 1; + String id = "con_HostedOn_" + idNumber; newHostedOnRelationship.setId(id); newHostedOnRelationship.setName("hostedOn"); diff --git a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/FromCanonical.java b/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/FromCanonical.java index f4b50adaa2..b26dc2bf41 100644 --- a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/FromCanonical.java +++ b/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/FromCanonical.java @@ -66,6 +66,7 @@ import org.eclipse.winery.model.tosca.TRequirementDefinition; import org.eclipse.winery.model.tosca.TRequirementRef; import org.eclipse.winery.model.tosca.TRequirementType; +import org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTag; import org.eclipse.winery.model.tosca.TTopologyTemplate; @@ -133,6 +134,7 @@ import org.eclipse.winery.model.tosca.xml.XTRequirementDefinition; import org.eclipse.winery.model.tosca.xml.XTRequirementRef; import org.eclipse.winery.model.tosca.xml.XTRequirementType; +import org.eclipse.winery.model.tosca.xml.XTSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.xml.XTServiceTemplate; import org.eclipse.winery.model.tosca.xml.XTTag; import org.eclipse.winery.model.tosca.xml.XTTopologyTemplate; @@ -710,6 +712,11 @@ private XTBoundaryDefinitions convert(@Nullable TBoundaryDefinitions canonical) if (canonical.getProperties() != null) { XTBoundaryDefinitions.Properties props = new XTBoundaryDefinitions.Properties(); props.setAny(canonical.getProperties().getAny()); + if (canonical.getProperties().getSelfServiceApplicationUrl() != null){ + props.setSelfServiceApplicationUrl( + convert(canonical.getProperties().getSelfServiceApplicationUrl()) + ); + } if (canonical.getProperties().getPropertyMappings() != null) { props.setPropertyMappings( canonical.getProperties().getPropertyMappings().stream() @@ -851,6 +858,12 @@ private XTPropertyMapping convert(TPropertyMapping canonical) { ).build(); } + private XTSelfServiceApplicationUrl convert(TSelfServiceApplicationUrl canonical) { + return new XTSelfServiceApplicationUrl.Builder( + canonical.getSelfServiceApplicationUrl() + ).build(); + } + @Nullable private XTTopologyTemplate convert(@Nullable TTopologyTemplate canonical) { if (canonical == null) { diff --git a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/ToCanonical.java b/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/ToCanonical.java index fa9d80d759..01ca860295 100644 --- a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/ToCanonical.java +++ b/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/ToCanonical.java @@ -70,6 +70,7 @@ import org.eclipse.winery.model.tosca.TRequirementDefinition; import org.eclipse.winery.model.tosca.TRequirementRef; import org.eclipse.winery.model.tosca.TRequirementType; +import org.eclipse.winery.model.tosca.TSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTag; import org.eclipse.winery.model.tosca.TTopologyTemplate; @@ -137,6 +138,7 @@ import org.eclipse.winery.model.tosca.xml.XTRequirementDefinition; import org.eclipse.winery.model.tosca.xml.XTRequirementRef; import org.eclipse.winery.model.tosca.xml.XTRequirementType; +import org.eclipse.winery.model.tosca.xml.XTSelfServiceApplicationUrl; import org.eclipse.winery.model.tosca.xml.XTServiceTemplate; import org.eclipse.winery.model.tosca.xml.XTTag; import org.eclipse.winery.model.tosca.xml.XTTopologyTemplate; @@ -810,6 +812,11 @@ private TBoundaryDefinitions convert(XTBoundaryDefinitions xml) { if (xml.getProperties() != null) { TBoundaryDefinitions.Properties props = new TBoundaryDefinitions.Properties(); props.setAny(xml.getProperties().getAny()); + if (xml.getProperties().getSelfServiceApplicationUrl() != null) { + props.setSelfServiceApplicationUrl( + convert(xml.getProperties().getSelfServiceApplicationUrl()) + ); + } if (xml.getProperties().getPropertyMappings() != null) { props.setPropertyMappings( convertList(xml.getProperties().getPropertyMappings(), this::convert) @@ -944,6 +951,12 @@ private TPropertyMapping convert(XTPropertyMapping xml) { ); } + private TSelfServiceApplicationUrl convert(XTSelfServiceApplicationUrl xml) { + return new TSelfServiceApplicationUrl( + xml.getSelfServiceApplicationUrl() + ); + } + @Nullable private TTopologyTemplate convert(XTTopologyTemplate xml) { if (xml == null) {