From 4febf4b4c10d435e2a12e4df34d590254263e38b Mon Sep 17 00:00:00 2001 From: "Maharajh, Robby (rx2202)" Date: Mon, 4 Dec 2017 15:55:46 -0500 Subject: Update error messages to say bulkprocess instead of bulkadd Issue-ID: AAI-537 Change-Id: Ib9efa0b0a1da72506b5c247c610ba6826e3e3aeb Signed-off-by: Maharajh, Robby (rx2202) --- .../main/java/org/onap/aai/rest/BulkAddConsumer.java | 5 +++++ .../src/main/java/org/onap/aai/rest/BulkConsumer.java | 19 +++++++++++-------- .../java/org/onap/aai/rest/BulkProcessConsumer.java | 5 +++++ 3 files changed, 21 insertions(+), 8 deletions(-) (limited to 'aai-resources/src/main/java') diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkAddConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkAddConsumer.java index 82e179d..831b9cc 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/BulkAddConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkAddConsumer.java @@ -34,6 +34,11 @@ public class BulkAddConsumer extends BulkConsumer { return method.equals(HttpMethod.PUT); } + + @Override + protected String getModule(){ + return "bulk add"; + } @Override protected boolean enableResourceVersion() { diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java index a973250..5591ae3 100644 --- a/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java +++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java @@ -239,14 +239,15 @@ public abstract class BulkConsumer extends RESTAPI { JsonParser parser = new JsonParser(); JsonObject input = parser.parse(content).getAsJsonObject(); - + String module = getModule(); + if (!(input.has("transactions"))) { - throw new AAIException("AAI_6118", "input payload does not follow bulk add interface - missing \"transactions\""); + throw new AAIException("AAI_6118", String.format("input payload does not follow %s interface - missing \"transactions\"", module)); } JsonElement transactionsObj = input.get("transactions"); if (!(transactionsObj.isJsonArray())){ - throw new AAIException("AAI_6111", "input payload does not follow bulk add interface"); + throw new AAIException("AAI_6111", String.format("input payload does not follow %s interface", module)); } JsonArray transactions = transactionsObj.getAsJsonArray(); if (transactions.size() == 0) { @@ -303,13 +304,13 @@ public abstract class BulkConsumer extends RESTAPI { private void populateBulkOperations(List bulkOperations, JsonObject item, Loader loader, TransactionalGraphEngine dbEngine, String inputMediaType, HttpMethod method) throws AAIException, JsonSyntaxException, UnsupportedEncodingException{ - + String module = getModule(); for (int i=0; i