From b3e6cef09aac0221854916a2146c6cd9f75db8a6 Mon Sep 17 00:00:00 2001 From: "katy.rotman" Date: Wed, 16 May 2018 11:42:00 +0300 Subject: fixed interfaces + interface_types when no op Issue-ID: SDC-1337 Change-Id: I0038b29e7cb667efb53dee5cbc1192cfd74e387a Signed-off-by: katy.rotman --- .../sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'catalog-be/src/main/java') diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java index f14164b36c..85b2d17029 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java @@ -16,12 +16,13 @@ package org.openecomp.sdc.be.tosca.utils; +import com.fasterxml.jackson.databind.ObjectMapper; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; - +import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition; import org.openecomp.sdc.be.model.Component; @@ -35,8 +36,6 @@ import org.openecomp.sdc.be.tosca.model.ToscaLifecycleOperationDefinition; import org.openecomp.sdc.be.tosca.model.ToscaNodeType; import org.openecomp.sdc.be.tosca.model.ToscaProperty; -import com.fasterxml.jackson.databind.ObjectMapper; - /** * @author KATYR * @since March 20, 2018 @@ -68,6 +67,10 @@ public class InterfacesOperationsToscaUtil { } final Map interfaces = ((Resource) component).getInterfaces(); + if ( MapUtils.isEmpty(interfaces)) { + return null; + } + for (InterfaceDefinition interfaceDefinition : interfaces.values()) { ToscaInterfaceNodeType toscaInterfaceType = new ToscaInterfaceNodeType(); toscaInterfaceType.setDerived_from(DERIVED_FROM_STANDARD_INTERFACE); @@ -105,7 +108,7 @@ public class InterfacesOperationsToscaUtil { } final Map interfaces = ((Resource) component).getInterfaces(); - if (Objects.isNull(interfaces)) { + if ( MapUtils.isEmpty(interfaces)) { return; } for (InterfaceDefinition interfaceDefinition : interfaces.values()) { @@ -143,7 +146,7 @@ public class InterfacesOperationsToscaUtil { /*** * workaround for : currently "defaultp" is not being converted to "default" by the relevant code in ToscaExportHandler - * any string key named "defaultp" will have its named changed to "default" + * so, any string Map key named "defaultp" will have its named changed to "default" * @param operationsMap the map to update */ private static void handleDefaults(Map operationsMap) { -- cgit 1.2.3-korg