diff options
author | talio <tali.orenbach@amdocs.com> | 2019-06-02 16:15:10 +0300 |
---|---|---|
committer | Oren Kleks <orenkle@amdocs.com> | 2019-06-03 05:55:00 +0000 |
commit | f4f6b1407a836266ce7d98f33ee899d8a2377d83 (patch) | |
tree | 189f7bd4b92badcbc690d7342538243db8ebe3f0 | |
parent | 4f514b1c3f1c688345c750281097925ac22417ca (diff) |
fix inputs declaration on complex type
Change-Id: I86172caf032f4936f98525830ed8aac2ea30567f
Issue-ID: SDC-2347
Signed-off-by: talio <tali.orenbach@amdocs.com>
3 files changed, 17 insertions, 2 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java index 49dd3d6c01..643b9462bc 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/BaseBusinessLogic.java @@ -764,7 +764,7 @@ public abstract class BaseBusinessLogic { for (PropertyDefinition propertyDefinition : propertyDefinitions) { if (propertyDefinition.getName().equals(anInputPathArr)) { if (ToscaType.isPrimitiveType(propertyDefinition.getType())) { - constraints.addAll(propertyDefinition.getConstraints()); + constraints.addAll(propertyDefinition.safeGetConstraints()); } else { type = propertyDefinition.getType(); } diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java index 7336859fd7..15bef3b23b 100644 --- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java +++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/utils/CollectionUtils.java @@ -20,13 +20,23 @@ package org.openecomp.sdc.be.dao.utils; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; public final class CollectionUtils { private CollectionUtils() { } + public static <T> List<T> safeGetList(List<T> listToCheck) { + return org.apache.commons.collections.CollectionUtils.isNotEmpty(listToCheck) ? listToCheck : Collections.emptyList(); + } + /** * Add the content of the 'source' Set to the 'target' set and return the * union set. diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java index e09fe41b05..6d37cc365f 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PropertyDefinition.java @@ -20,6 +20,7 @@ package org.openecomp.sdc.be.model; +import org.openecomp.sdc.be.dao.utils.CollectionUtils; import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition; import java.util.List; @@ -119,6 +120,10 @@ public class PropertyDefinition extends PropertyDataDefinition return constraints; } + public List<PropertyConstraint> safeGetConstraints() { + return CollectionUtils.safeGetList(constraints); + } + public void setConstraints(List<PropertyConstraint> constraints) { this.constraints = constraints; } |