aboutsummaryrefslogtreecommitdiffstats
path: root/common-be
diff options
context:
space:
mode:
authorMichael Lando <ml636r@att.com>2017-06-17 22:40:44 +0300
committerMichael Lando <ml636r@att.com>2017-06-18 07:20:49 +0300
commit4d97d5fac309ce0d66938e5ccd0349e2660d4e23 (patch)
tree3f921054f997d1962fa6f9db9a0119e31a851eea /common-be
parent89786d31f266a205857cae0177904c249ac6a512 (diff)
[sdc] update code of sdc
Change-Id: If9f37c80b659cb67b34d18e6c019defecca58b9a Signed-off-by: Michael Lando <ml636r@att.com>
Diffstat (limited to 'common-be')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ListDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/tosca/ToscaDataDefinition.java10
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));
}
}