diff options
Diffstat (limited to 'graph-inventory/aai-client/src/main/java')
-rw-r--r-- | graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryResultWrapper.java | 10 |
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()) { |