diff options
author | Max Benjamin <max.benjamin@att.com> | 2019-06-14 19:55:06 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-06-14 19:55:06 +0000 |
commit | 72d66044e6eb6e999e96e31fad9360022ed76135 (patch) | |
tree | c0b7e595ea450da3cb78a2512b7950dabafcc131 | |
parent | 5d7aef853baaf554a2392fe5dc394f77bdbe4214 (diff) | |
parent | 822925cc3c7a30c21d70ea4b3b0db3d380811d5f (diff) |
Merge "use count format and limit one for exists"
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 { |