diff options
author | Benjamin, Max <max.benjamin@att.com> | 2019-06-14 09:42:00 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-06-14 09:42:06 -0400 |
commit | 822925cc3c7a30c21d70ea4b3b0db3d380811d5f (patch) | |
tree | 9a34502dbad9e9216db501dba9b459537b3978b9 | |
parent | 1f8aa8ef6deade96a53fa57c28d1aacab6cf7e5e (diff) |
use count format and limit one for exists
use count format and limit one for exists
Change-Id: If15ccf0a63bf6fd5e732eb150bfdbed22c5a3f1d
Issue-ID: SO-2017
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
3 files changed, 5 insertions, 17 deletions
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/Format.java b/common/src/main/java/org/onap/so/client/graphinventory/Format.java index c3cb4b9eaf..078b35aaf4 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/Format.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/Format.java @@ -29,7 +29,8 @@ public enum Format { CONSOLE("console"), PATHED("pathed"), GRAPHSON("graphson"), - ID("id"); + ID("id"), + COUNT("count"); private final String name; diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java index 2a76dab107..c7cdb2ff58 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryResourcesClient.java @@ -32,9 +32,7 @@ import org.onap.so.client.RestClient; import org.onap.so.client.RestProperties; import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel; import org.onap.so.client.graphinventory.entities.GraphInventoryResultWrapper; -import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.client.graphinventory.entities.uri.GraphInventoryResourceUri; -import org.onap.so.client.graphinventory.entities.uri.GraphInventoryUri; public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInventoryResourceUri, EdgeLabel extends GraphInventoryEdgeLabel, Wrapper extends GraphInventoryResultWrapper, TransactionalClient, SingleTransactionClient> { @@ -74,7 +72,9 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven * @return */ public boolean exists(Uri uri) { - GraphInventoryUri forceMinimal = this.addParams(Optional.of(Depth.ZERO), true, uri); + GraphInventoryResourceUri forceMinimal = uri.clone(); + forceMinimal.format(Format.COUNT); + forceMinimal.limit(1); try { RestClient giRC = client.createClient(forceMinimal); @@ -314,18 +314,6 @@ public abstract class GraphInventoryResourcesClient<Self, Uri extends GraphInven */ public abstract SingleTransactionClient beginSingleTransaction(); - private GraphInventoryUri addParams(Optional<Depth> depth, boolean nodesOnly, GraphInventoryUri uri) { - GraphInventoryUri clone = uri.clone(); - if (depth.isPresent()) { - clone.depth(depth.get()); - } - if (nodesOnly) { - clone.nodesOnly(nodesOnly); - } - - return clone; - } - public <T extends RestProperties> T getRestProperties() { return client.getRestProperties(); } diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java index d6d3e5eaa2..6b48ad44ef 100644 --- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java +++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/GraphInventoryUri.java @@ -22,7 +22,6 @@ package org.onap.so.client.graphinventory.entities.uri; import java.net.URI; import java.util.Map; -import org.onap.so.client.graphinventory.entities.uri.Depth; import org.onap.so.client.graphinventory.GraphInventoryObjectType; public interface GraphInventoryUri { |