use of org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed in project so by onap.
the class AAISingleTransactionClient method execute.
/*
* (non-Javadoc)
*
* @see org.onap.aaiclient.client.aai.GraphInventoryTransactionClient#execute()
*/
@Override
public void execute() throws BulkProcessFailed {
try {
if (!this.request.getOperations().isEmpty()) {
RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.SINGLE_TRANSACTION));
SingleTransactionResponse response = client.post(this.request, SingleTransactionResponse.class);
if (response != null) {
final Optional<String> errorMessage = this.locateErrorMessages(response);
if (errorMessage.isPresent()) {
throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
}
} else {
throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
}
}
} finally {
this.request.getOperations().clear();
this.actionCount = 0;
}
}
use of org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed in project so by onap.
the class AAITransactionalClient method execute.
/*
* (non-Javadoc)
*
* @see org.onap.aaiclient.client.aai.GraphInventoryTransactionalClient#execute()
*/
@Override
public void execute() throws BulkProcessFailed {
try {
if (!this.transactions.getTransactions().isEmpty()) {
RestClient client = aaiClient.createClient(AAIUriFactory.createResourceUri(AAIObjectType.BULK_PROCESS));
Response response = client.put(this.transactions);
if (response.hasEntity()) {
final Optional<String> errorMessage = this.locateErrorMessages(response.readEntity(String.class));
if (errorMessage.isPresent()) {
throw new BulkProcessFailed("One or more transactions failed in A&AI. Check logs for payloads.\nMessages:\n" + errorMessage.get());
}
} else {
throw new BulkProcessFailed("Transactions acccepted by A&AI, but there was no response. Unsure of result.");
}
}
} finally {
this.transactions.getTransactions().clear();
this.currentTransaction = null;
this.actionCount = 0;
}
}
Aggregations