diff options
author | katy.rotman <katy.rotman@amdocs.com> | 2018-05-16 11:42:00 +0300 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2018-05-17 07:47:07 +0000 |
commit | b3e6cef09aac0221854916a2146c6cd9f75db8a6 (patch) | |
tree | 07da7cc8bcdee9ebbdd46c3491497853cb607066 /catalog-be/src | |
parent | 193fc178482e684c2838b070f7ad8e73c159b071 (diff) |
fixed interfaces + interface_types when no op
Issue-ID: SDC-1337
Change-Id: I0038b29e7cb667efb53dee5cbc1192cfd74e387a
Signed-off-by: katy.rotman <katy.rotman@amdocs.com>
Diffstat (limited to 'catalog-be/src')
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/tosca/utils/InterfacesOperationsToscaUtil.java | 13 |
1 files changed, 8 insertions, 5 deletions
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<String, InterfaceDefinition> 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<String, InterfaceDefinition> 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<String, Object> operationsMap) { |