From 4d97d5fac309ce0d66938e5ccd0349e2660d4e23 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Sat, 17 Jun 2017 22:40:44 +0300 Subject: [sdc] update code of sdc Change-Id: If9f37c80b659cb67b34d18e6c019defecca58b9a Signed-off-by: Michael Lando --- .../sdc/be/datatypes/elements/ListDataDefinition.java | 2 +- .../sdc/be/datatypes/elements/PropertyDataDefinition.java | 2 +- .../openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java | 10 +--------- 3 files changed, 3 insertions(+), 11 deletions(-) (limited to 'common-be/src/main/java/org/openecomp') diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java index c9bf851e17..825e65ea18 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java @@ -61,7 +61,7 @@ public class ListDataDefinition extends ToscaData Map mapByName = listToMapByName(listToscaDataDefinition); List otherList = ((ListDataDefinition)other).getListToscaDataDefinition(); for(T item : otherList){ - mapByName.merge(item.getName(), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); + mapByName.merge((String)item.getToscaPresentationValue(JsonPresentationFields.NAME), item, (thisItem, otherItem) -> thisItem.mergeFunction(otherItem, allowDefaultValueOverride)); } ((ListDataDefinition)other).listToscaDataDefinition = mapByName.values().stream().collect(Collectors.toList()); return other; diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java index 4c798521c5..e669d66c50 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java @@ -354,7 +354,7 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria @Override public T mergeFunction(T other, boolean allowDefaultValueOverride){ - if(this.getType().equals(other.getType()) && compareSchemaType(other)){ + if(this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)){ other.setOwnerId(getOwnerId()); if(allowDefaultValueOverride) other.setToscaPresentationValue(JsonPresentationFields.DEFAULT_VALUE, getDefaultValue()); diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java index bf51ba4e28..70eaa700aa 100644 --- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java +++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java @@ -55,14 +55,6 @@ public abstract class ToscaDataDefinition { } - public String getType(){ - return (String) getToscaPresentationValue(JsonPresentationFields.TYPE); - } - - public String getName(){ - return (String) getToscaPresentationValue(JsonPresentationFields.NAME); - } - //default merge function for merging data maps - implement where needed and use mergeDataMaps method where applicable instead of map1.putAll(map2) public T mergeFunction(T other, boolean allowDefaultValueOverride){ other.setOwnerId(getOwnerId()); @@ -86,6 +78,6 @@ public abstract class ToscaDataDefinition { public static Map listToMapByName(List dataList) { return null == dataList? new HashMap<>() : dataList.stream() - .collect(Collectors.toMap(p -> p.getName(), p -> p)); + .collect(Collectors.toMap(p -> (String)p.getToscaPresentationValue(JsonPresentationFields.NAME), p -> p)); } } -- cgit 1.2.3-korg