summaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
authorojasdubey <ojas.dubey@amdocs.com>2019-06-27 12:33:35 +0530
committerAvi Gaffa <avi.gaffa@amdocs.com>2019-06-30 07:20:57 +0000
commitdc58ff4151e8a10364ede31ba25f3a0e49344c20 (patch)
tree5fae74fce7283003ac7e7b2982529e21c6eac444 /catalog-be/src/main
parentcf070aeaadd055f38dd32a6121c42f6b10a6937b (diff)
Fix artifact implementation proxy node type
Removing the operation implementation from proxy node type in parent service tosca as it will be present in the proxy node template Change-Id: Id414d6cdd5f5f4ccb1d7c235fbc8b7cdf1ec4147 Issue-ID: SDC-2395 Signed-off-by: ojasdubey <ojas.dubey@amdocs.com>
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ToscaExportUtils.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ToscaExportUtils.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ToscaExportUtils.java
index 9cce43ccd3..85f1095dfb 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ToscaExportUtils.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/ToscaExportUtils.java
@@ -27,10 +27,12 @@ import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
+import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.Component;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.InputDefinition;
+import org.openecomp.sdc.be.model.InterfaceDefinition;
import org.openecomp.sdc.be.tosca.PropertyConvertor;
import org.openecomp.sdc.be.tosca.model.ToscaProperty;
@@ -45,8 +47,12 @@ public class ToscaExportUtils {
if (Objects.isNull(proxyComponent) || MapUtils.isEmpty(proxyComponent.getInterfaces())) {
return Optional.empty();
}
+ Map<String, InterfaceDefinition> proxyComponentInterfaces = proxyComponent.getInterfaces();
+ //Unset artifact path for operation implementation for proxy node types as for operations with artifacts it is
+ // always available in the proxy node template
+ removeOperationImplementationForProxyNodeType(proxyComponentInterfaces);
return Optional.ofNullable(InterfacesOperationsToscaUtil
- .getInterfacesMap(proxyComponent, null, proxyComponent.getInterfaces(), dataTypes, false, false));
+ .getInterfacesMap(proxyComponent, null, proxyComponentInterfaces, dataTypes, false, false));
}
public static Optional<Map<String, ToscaProperty>> getProxyNodeTypeProperties(Component proxyComponent,
@@ -68,7 +74,6 @@ public class ToscaExportUtils {
return MapUtils.isNotEmpty(proxyProperties) ? Optional.of(proxyProperties) : Optional.empty();
}
-
public static void addInputsToProperties(Map<String, DataTypeDefinition> dataTypes,
List<InputDefinition> componentInputs,
Map<String, ToscaProperty> mergedProperties) {
@@ -82,4 +87,15 @@ public class ToscaExportUtils {
}
}
+ private static void removeOperationImplementationForProxyNodeType(Map<String, InterfaceDefinition>
+ proxyComponentInterfaces) {
+ if (MapUtils.isEmpty(proxyComponentInterfaces)) {
+ return;
+ }
+ proxyComponentInterfaces.values().stream()
+ .map(InterfaceDataDefinition::getOperations)
+ .filter(MapUtils::isNotEmpty)
+ .forEach(operations -> operations.values()
+ .forEach(operation -> operation.setImplementation(null)));
+ }
}