From 9e43b160bde937c32151c8ce5a3d07701bd31924 Mon Sep 17 00:00:00 2001 From: "andre.schmid" Date: Wed, 20 May 2020 14:24:40 +0100 Subject: Fix interface types creation Interface types creation logic was not interpreting some allowed TOSCA entries, that, when declared, were breaking the interface type creation. Every entry under the interface type was being considered as an interface operation, but it is possible to have "derived_from", "version", "metadata" and "description". Also it is not considering the Interface Type entries "inputs", "operations" and "notifications". Another thing is that TOSCA 1.3 changes the way operations should be declared, deprecating the previous way. Now there should be an entry "operations" with the operations entries under it, instead of having the operations entries direct under the interface type. The change allows both types, following the TOSCA rule: if operations entry is not present, then the deprecated way is considered. Change-Id: I13218bda60b29d19b9c5565cbfd63ae3250a78bf Issue-ID: SDC-3075 Signed-off-by: andre.schmid --- .../org/openecomp/sdc/be/model/InterfaceDefinition.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'catalog-model') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java index 3afd422e0c..e3b5d08bc1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/InterfaceDefinition.java @@ -21,6 +21,7 @@ package org.openecomp.sdc.be.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import org.apache.commons.collections.MapUtils; import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition; import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition; @@ -68,11 +69,13 @@ public class InterfaceDefinition extends InterfaceDataDefinition implements IOpe } @JsonIgnore - public void setOperationsMap(Map operations) { - Map convertedOperation = operations.entrySet() - .stream() - .collect(Collectors.toMap(Map.Entry::getKey, e -> new OperationDataDefinition(e - .getValue()))); + public void setOperationsMap(final Map operations) { + if (MapUtils.isEmpty(operations)) { + return; + } + final Map convertedOperation = operations.entrySet() + .stream() + .collect(Collectors.toMap(Map.Entry::getKey, e -> new OperationDataDefinition(e.getValue()))); setOperations(convertedOperation); } -- cgit 1.2.3-korg