aboutsummaryrefslogtreecommitdiffstats
path: root/aai-resources/src/main/java/org
diff options
context:
space:
mode:
authorMaharajh, Robby (rx2202) <rx2202@us.att.com>2017-12-04 15:55:46 -0500
committerMaharajh, Robby (rx2202) <rx2202@us.att.com>2017-12-04 15:55:56 -0500
commit4febf4b4c10d435e2a12e4df34d590254263e38b (patch)
treeee63b920e49c33a4fb7ddd62765034a9b97f7b49 /aai-resources/src/main/java/org
parentcdc1733ce7f53902d551a7d38c65dc23210d0b70 (diff)
Update error messages to say bulkprocess instead
of bulkadd Issue-ID: AAI-537 Change-Id: Ib9efa0b0a1da72506b5c247c610ba6826e3e3aeb Signed-off-by: Maharajh, Robby (rx2202) <rx2202@us.att.com>
Diffstat (limited to 'aai-resources/src/main/java/org')
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/BulkAddConsumer.java5
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/BulkConsumer.java19
-rw-r--r--aai-resources/src/main/java/org/onap/aai/rest/BulkProcessConsumer.java5
3 files changed, 21 insertions, 8 deletions
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<BulkOperation> bulkOperations, JsonObject item, Loader loader, TransactionalGraphEngine dbEngine, String inputMediaType, HttpMethod method) throws AAIException, JsonSyntaxException, UnsupportedEncodingException{
-
+ String module = getModule();
for (int i=0; i<item.size(); i++) {
BulkOperation bulkOperation = new BulkOperation();
try {
if (!(item.isJsonObject())) {
- 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));
}
JsonElement actionElement = null;
@@ -323,7 +324,7 @@ public abstract class BulkConsumer extends RESTAPI {
}
if ((actionElement == null) || !actionElement.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 httpArray = actionElement.getAsJsonArray();
@@ -365,11 +366,11 @@ public abstract class BulkConsumer extends RESTAPI {
JsonElement bodyObj = new JsonObject();
if (!bulkOperation.getHttpMethod().equals(HttpMethod.DELETE)) {
if (!(it.has("body"))){
- throw new AAIException("AAI_6118", "input payload does not follow bulk interface - missing \"body\"");
+ throw new AAIException("AAI_6118", String.format("input payload does not follow %s interface - missing \"body\"", module));
}
bodyObj = it.get("body");
if (!(bodyObj.isJsonObject())) {
- throw new AAIException("AAI_6111", "input payload does not follow bulk interface");
+ throw new AAIException("AAI_6111", String.format("input payload does not follow %s interface", module));
}
}
@@ -529,6 +530,8 @@ public abstract class BulkConsumer extends RESTAPI {
tResps.add(uriResp);
}
}
+
+ protected abstract String getModule();
protected abstract boolean functionAllowed(HttpMethod method);
diff --git a/aai-resources/src/main/java/org/onap/aai/rest/BulkProcessConsumer.java b/aai-resources/src/main/java/org/onap/aai/rest/BulkProcessConsumer.java
index cd2cf82..bffeac3 100644
--- a/aai-resources/src/main/java/org/onap/aai/rest/BulkProcessConsumer.java
+++ b/aai-resources/src/main/java/org/onap/aai/rest/BulkProcessConsumer.java
@@ -35,6 +35,11 @@ public class BulkProcessConsumer extends BulkConsumer {
}
@Override
+ protected String getModule(){
+ return "bulk process";
+ }
+
+ @Override
protected boolean enableResourceVersion() {
// TODO Auto-generated method stub
return true;