aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/zusammen-tools/src
diff options
context:
space:
mode:
authorAvi Gaffa <avi.gaffa@amdocs.com>2017-10-24 06:08:24 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-24 06:08:24 +0000
commitf5f8b3db15f352c5bd8489de7b499bcba2ddd2ec (patch)
tree8fa70bd89cff8cdda1f411f71e592c35cac66c8e /openecomp-be/tools/zusammen-tools/src
parent7ef9ac0d813c9c2a029879a0137de1865d980b73 (diff)
parent94f67161c85936da0405c68017f2d7f1d5032b6d (diff)
Merge "Reset Tool throws an exception"
Diffstat (limited to 'openecomp-be/tools/zusammen-tools/src')
-rw-r--r--openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
index fbfde7431e..1d9d2d9774 100644
--- a/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
+++ b/openecomp-be/tools/zusammen-tools/src/main/java/org/openecomp/core/tools/store/VspGeneralLoader.java
@@ -2,6 +2,7 @@ package org.openecomp.core.tools.store;
import com.amdocs.zusammen.datatypes.Id;
import com.amdocs.zusammen.datatypes.SessionContext;
+import com.amdocs.zusammen.datatypes.item.Info;
import com.amdocs.zusammen.plugin.statestore.cassandra.dao.types.ElementEntityContext;
import org.openecomp.core.zusammen.plugin.dao.impl.CassandraElementRepository;
import org.openecomp.core.zusammen.plugin.dao.types.ElementEntity;
@@ -10,6 +11,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Objects;
public class VspGeneralLoader {
@@ -114,16 +116,20 @@ public class VspGeneralLoader {
if(changeRef!= null){
subElementContext.setChangeRef(changeRef);
}
- Optional<ElementEntity> subElementEntity =
+ Optional<ElementEntity> subElementEntityOptional =
cassandraElementRepository.get(context, subElementContext,
new ElementEntity(subelementId));
- if (subElementEntity.isPresent()) {
+ if (subElementEntityOptional.isPresent()) {
+ Info info = subElementEntityOptional.get().getInfo();
+ if (isValid(name, info)) {
+ return false;
+ }
if (NAME.equals(name)) {
- if (value.equals(subElementEntity.get().getInfo().getName())) {
+ if (value.equals(info.getName())) {
return true;
}
}
- if (value.equals(subElementEntity.get().getInfo().getProperty(name))) {
+ if (value.equals(info.getProperty(name))) {
return true;
}
}
@@ -136,5 +142,9 @@ public class VspGeneralLoader {
}
+ private static boolean isValid(String name, Info info) {
+ return Objects.isNull(info)|| Objects.isNull(info.getProperty(name));
+ }
+
}