aboutsummaryrefslogtreecommitdiffstats
path: root/graph-inventory/aai-client/src/main
diff options
context:
space:
mode:
authorBenjamin, Max <max.benjamin@att.com>2020-10-21 10:52:20 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-10-21 10:52:21 -0400
commitac680dd59dc046d25bd7fa406e003c32b0f08608 (patch)
tree976e6e53eab1d171af06fe75f136a2e0cecaa44d /graph-inventory/aai-client/src/main
parent623dbe5cf31cec13c3c6eec7b74791682eb3b731 (diff)
add hasRelationships method to wrapper
add hasRelationships method to wrapper Issue-ID: SO-3323 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I8b7b43f8fa367ce2cddf32a5716de11b6238decf
Diffstat (limited to 'graph-inventory/aai-client/src/main')
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java
index 9e6572388b..ae32107339 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java
@@ -28,6 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
import org.onap.so.jsonpath.JsonPathUtil;
import org.slf4j.Logger;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -63,6 +64,15 @@ public abstract class GraphInventoryResultWrapper<R extends GraphInventoryRelati
}
}
+ public boolean hasRelationshipsTo(GraphInventoryObjectName name) {
+ Optional<R> rOpt = this.getRelationships();
+ if (rOpt.isPresent()) {
+ return rOpt.get().getRelatedLinks(name).size() > 0;
+ } else {
+ return false;
+ }
+ }
+
public Optional<R> getRelationships() {
final String path = "$.relationship-list";
if (isEmpty()) {