aboutsummaryrefslogtreecommitdiffstats
path: root/common-be/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'common-be/src/main/java/org')
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java5
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java34
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PropertyDataDefinition.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java3
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java4
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java3
10 files changed, 38 insertions, 23 deletions
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
index 9499529f03..a7f8152645 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ComponentMetadataDataDefinition.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.be.datatypes.components;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -159,13 +160,13 @@ public abstract class ComponentMetadataDataDefinition extends ToscaDataDefinitio
this.lastUpdateDate = other.getLastUpdateDate();
this.description = other.getDescription();
this.state = other.getState();
- this.tags = new ArrayList<>(other.getTags());
+ this.tags = new ArrayList<>(other.getTags() != null ? other.getTags() : new LinkedList<>());
this.icon = other.getIcon();
this.contactId = other.getContactId();
this.UUID = other.getUUID();
this.normalizedName = other.getNormalizedName();
this.systemName = other.getSystemName();
- this.allVersions = new HashMap<>(other.getAllVersions());
+ this.allVersions = new HashMap<>(other.getAllVersions() != null ? other.getAllVersions() : new HashMap<>());
this.isDeleted = other.isDeleted();
this.projectCode = other.getProjectCode();
this.csarUUID = other.getCsarUUID();
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java
index c36c7f053d..7fbce574a9 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/components/ServiceMetadataDataDefinition.java
@@ -172,7 +172,7 @@ public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefiniti
@Override
public String getActualComponentType() {
- return componentType.getValue();
+ return componentType != null ? componentType.getValue() : "";
}
}
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java
index 57270f6eaa..384796b965 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ComponentInstanceDataDefinition.java
@@ -137,7 +137,7 @@ public class ComponentInstanceDataDefinition extends ToscaDataDefinition impleme
}
public void setName(String name) {
- if (this.getInvariantName() == null) {
+ if (this.getInvariantName() == null && name != null) {
this.setInvariantName(ValidationUtils.normalizeComponentInstanceName(name));
}
setToscaPresentationValue(JsonPresentationFields.NAME, name);
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java
index 1ca067e047..66b51ed805 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/MapDataDefinition.java
@@ -94,26 +94,32 @@ public class MapDataDefinition <T extends ToscaDataDefinition> extends ToscaDa
}
@Override
public <T extends ToscaDataDefinition> T removeByOwnerId(Set<String> ownerIdList) {
- Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet().stream().filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue)));
-
- MapDataDefinition collectMap = new MapDataDefinition<>(collect);
-
- mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId()));
-
- return (T) collectMap;
+ if(mapToscaDataDefinition != null) {
+ Map<String, T > collect = (Map<String, T >)mapToscaDataDefinition.entrySet()
+ .stream()
+ .filter(e -> ownerIdList.contains(e.getValue().getOwnerId())).collect(Collectors.toMap(Map.Entry::getKey, (Map.Entry::getValue)));
+
+ MapDataDefinition collectMap = new MapDataDefinition<>(collect);
+
+ mapToscaDataDefinition.entrySet().removeIf(e -> ownerIdList.contains(e.getValue().getOwnerId()));
+
+ return (T) collectMap;
+ }
+ return (T) new MapDataDefinition(new HashMap<>());
}
@Override
public <T extends ToscaDataDefinition> T updateIfExist(T other, boolean allowDefaultValueOverride) {
Map<String, T > map = ((MapDataDefinition)other).getMapToscaDataDefinition();
-
- map.entrySet().forEach(e ->{
- String key = e.getKey();
- if ( mapToscaDataDefinition.containsKey(key) ){
- e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride);
- }
- });
+ if(map != null) {
+ map.entrySet().forEach(e ->{
+ String key = e.getKey();
+ if ( mapToscaDataDefinition.containsKey(key) ){
+ e.getValue().mergeFunction(mapToscaDataDefinition.get(key), allowDefaultValueOverride);
+ }
+ });
+ }
return other;
}
@Override
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java
index 3cf8ce1266..d3637c25e5 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/PolicyTargetType.java
@@ -1,7 +1,5 @@
package org.openecomp.sdc.be.datatypes.elements;
-import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-
public enum PolicyTargetType {
GROUPS("GROUPS"),
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java
index d3855b5b1d..62ae62edab 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/ProductMetadataDataDefinition.java
@@ -126,6 +126,6 @@ public class ProductMetadataDataDefinition extends ComponentMetadataDataDefiniti
@Override
public String getActualComponentType() {
- return getComponentType().getValue();
+ return getComponentType() != null ? getComponentType().getValue() : null;
}
}
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 1092b8f24e..482933e399 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
@@ -402,7 +402,9 @@ public class PropertyDataDefinition extends ToscaDataDefinition implements Seria
@Override
public <T extends ToscaDataDefinition> T mergeFunction(T other, boolean allowDefaultValueOverride) {
- if (this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) && compareSchemaType(other)) {
+ if (this.getType() != null &&
+ this.getType().equals(other.getToscaPresentationValue(JsonPresentationFields.TYPE)) &&
+ compareSchemaType(other)) {
other.setOwnerId(getOwnerId());
if (allowDefaultValueOverride) {
if (getDefaultValue() != null && !getDefaultValue().isEmpty()) {
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
index e8bd775e78..e6c1469233 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/SchemaDefinition.java
@@ -23,6 +23,7 @@ package org.openecomp.sdc.be.datatypes.elements;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import java.io.Serializable;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -46,7 +47,7 @@ public class SchemaDefinition extends ToscaDataDefinition implements Serializabl
public SchemaDefinition() {
super();
-
+ properties = new HashMap<>();
}
public SchemaDefinition(String derivedFrom, List<String> constraints,
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
index dbaab71c53..45fb003734 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/ComponentTypeEnum.java
@@ -90,6 +90,10 @@ public enum ComponentTypeEnum {
public static String findParamByType(ComponentTypeEnum type) {
String ret = null;
+ if (type == null) {
+ return ret;
+ }
+
switch (type) {
case RESOURCE:
ret = RESOURCE_PARAM_NAME;
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
index 38d297a893..f9bb92eade 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/enums/FilterKeyEnum.java
@@ -42,6 +42,9 @@ public enum FilterKeyEnum {
}
public static List<String> getValidFiltersByAssetType(ComponentTypeEnum assetType) {
+ if(assetType == null) {
+ return null;
+ }
switch (assetType) {
case RESOURCE:
return getAllFilters().subList(0, 3);