diff options
author | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2024-01-09 19:28:36 +0100 |
---|---|---|
committer | Michal Jagiello <michal.jagiello@t-mobile.pl> | 2024-01-10 14:07:41 +0100 |
commit | 1d77fc5b646f3c3a9a0f14dba5218d7f866e48ba (patch) | |
tree | ace6828cfa3d5b97a26a7df3584a0be6a7ae87c2 /aai-resources/src/main | |
parent | 8c73a2f4ebf8067e630ce7525183f75bbf8a9bce (diff) |
Return an index of invalid bulk operation if there are missing parameters on request
Catch AAIException on AAI Bulk poplulateIntrospectors method to prepare an exception body with failing operation number.
Issue-ID: AAI-3722
Change-Id: I38b2e1c802ae7f2843cda5c188365890a86f65af
Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl>
Diffstat (limited to 'aai-resources/src/main')
-rw-r--r-- | aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java index 1b274b9..900da96 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/bulk/BulkSingleTransactionConsumer.java @@ -213,7 +213,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { /** * Builds the response - * + * * @param transaction the input transactions * @param results the response of all of he operations * @return TansactionResponse obj representing the result of the transaction @@ -242,7 +242,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { /** * Generate one DBRequest per BulkOperation - * + * * @param headers request headers * @param transId transaction id * @param bulkOperations operations to convert @@ -268,7 +268,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { /** * Sets the uriquery for each bulk operation - * + * * @param bulkOperations operations to generate queries for * @param dbEngine engine for query builder generation * @throws AAIException thrown for issues with generating uri query @@ -289,7 +289,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { /** * Sets the introspector for each bulk operation. requires that uriquery is set per operation - * + * * @param bulkOperations operations to generate introspector for * @param loader Loader for generating introspector * @throws AAIException thrown for issues with generating introspector @@ -315,6 +315,8 @@ public class BulkSingleTransactionConsumer extends RESTAPI { } bulkOperation.setIntrospector(obj); } + } catch (AAIException e) { + throw new AAIException(e.getCode(), "Error with operation " + i + ": " + e.getMessage()); } catch (UnsupportedEncodingException e) { throw new AAIException("AAI_3000", String.format(objectUnMarshallMsg, i, bulkOperation.getRawReq())); } @@ -327,7 +329,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { * - Integer.MAX_VALUE if override limit is configured * - Property in aaiconfig * - 30 by default - * + * * @param headers request header */ private void setOperationCount(HttpHeaders headers) { @@ -348,7 +350,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { /** * Converts the request transaction into a list of bulk operations - * + * * @param transaction transaction to extract bulk operations from * @return list of bulk operations */ @@ -381,7 +383,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { /** * Map action to httpmethod - * + * * @param action action to be mapped * @param uri uri of the action * @return HttpMethod thats action/uri maps to @@ -415,7 +417,7 @@ public class BulkSingleTransactionConsumer extends RESTAPI { * - action is provided and correct. * - uri exists * - body exists - * + * * @param transaction parsed payload * @throws AAIException with the violations in the msg */ |