use of org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException in project so by onap.
the class HttpLookupUri method getObjectById.
protected String getObjectById(Object id) throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
if (!this.getCachedValue().isPresent()) {
AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(aaiType, id).format(Format.PATHED);
String resultJson;
try {
resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson();
} catch (BadRequestException e) {
throw new GraphInventoryUriNotFoundException(aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build());
}
try {
cachedValue = extractRelatedLink(resultJson);
if (!cachedValue.isPresent()) {
throw new GraphInventoryUriNotFoundException(aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build());
}
} catch (IOException e) {
throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e);
}
}
return cachedValue.get();
}
use of org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException in project so by onap.
the class HttpLookupUri method build.
@Override
public URI build() {
try {
if (this.values.length == 1) {
String uri = getObjectById(this.values[0]);
Map<String, String> map = super.getURIKeys(uri);
this.values = map.values().toArray(values);
return super.build(values);
}
} catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
throw new GraphInventoryUriComputationException(e);
}
return super.build();
}
use of org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException in project so by onap.
the class HttpLookupUri method locateAndBuild.
@Override
public URI locateAndBuild() {
try {
if (this.values.length == 1) {
String uri = getObjectById(this.values[0]);
Map<String, String> map = super.getURIKeys(uri);
this.values = map.values().toArray(values);
return super.build(values);
}
} catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
throw new GraphInventoryUriComputationException(e);
}
return super.build();
}
use of org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPayloadException in project so by onap.
the class GraphInventoryPayloadExceptionTest method callConstructorTest.
@Test
public void callConstructorTest() throws Exception {
GraphInventoryPayloadException test1 = new GraphInventoryPayloadException("testing");
GraphInventoryPayloadException test2 = new GraphInventoryPayloadException("testing", t);
GraphInventoryPayloadException test3 = new GraphInventoryPayloadException(t);
}
Aggregations