Search in sources :

Example 1 with GraphInventoryResourceUri

use of org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri in project so by onap.

the class GraphInventoryResourcesClient method exists.

/**
 * returns false if the object does not exist in GraphInventory
 *
 * @param uri
 * @return
 */
public boolean exists(Uri uri) {
    GraphInventoryResourceUri<?, ?> forceMinimal = (Uri) uri.clone();
    forceMinimal.format(Format.COUNT);
    forceMinimal.limit(1);
    try {
        RestClient giRC = client.createClient(forceMinimal);
        return giRC.get().getStatus() == Status.OK.getStatusCode();
    } catch (NotFoundException e) {
        return false;
    }
}
Also used : RestClient(org.onap.so.client.RestClient) NotFoundException(javax.ws.rs.NotFoundException) HttpAwareUri(org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri) GraphInventorySingleResourceUri(org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri) GraphInventoryPluralResourceUri(org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri) GraphInventoryResourceUri(org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri)

Aggregations

NotFoundException (javax.ws.rs.NotFoundException)1 GraphInventoryPluralResourceUri (org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryPluralResourceUri)1 GraphInventoryResourceUri (org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryResourceUri)1 GraphInventorySingleResourceUri (org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventorySingleResourceUri)1 HttpAwareUri (org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri)1 RestClient (org.onap.so.client.RestClient)1