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>
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 c3cb4b9..078b35a 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 @@
     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 2a76dab..c7cdb2f 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.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 @@
      * @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 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 d6d3e5e..6b48ad4 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 @@
 
 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 {