diff options
Diffstat (limited to 'common-be/src/main/java/org/openecomp')
3 files changed, 3 insertions, 11 deletions
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<T extends ToscaDataDefinition> extends ToscaData Map<String, T> mapByName = listToMapByName(listToscaDataDefinition); List<T> 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 extends ToscaDataDefinition> 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 extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride){ other.setOwnerId(getOwnerId()); @@ -86,6 +78,6 @@ public abstract class ToscaDataDefinition { public static <T extends ToscaDataDefinition> Map<String, T> listToMapByName(List<T> 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)); } } |