summaryrefslogtreecommitdiffstats
path: root/controlloop/common/model-impl
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2017-10-18 17:02:33 +0000
committerGerrit Code Review <gerrit@onap.org>2017-10-18 17:02:33 +0000
commit0f4579198b531a38cdef06bbeb4f51302730e4ba (patch)
treeaacfee9bfe6dde471f36e813667705d33350ebb3 /controlloop/common/model-impl
parentf7f46f9c7ddbd7918b428649a766366d6c912b89 (diff)
parent506267bf7e9d961f1a6b2a989ee8a23ca67b9d61 (diff)
Merge "Add support for AAI Named Query error handling"
Diffstat (limited to 'controlloop/common/model-impl')
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java3
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java33
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java3
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java39
-rw-r--r--controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java48
5 files changed, 124 insertions, 2 deletions
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
index e373c1200..b295a0635 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAIManager.java
@@ -56,7 +56,7 @@ public final class AAIManager {
logger.info(url);
logger.info(httpDetails.a.toString());
logger.info(httpDetails.b);
- if (httpDetails.a == 200) {
+ if (httpDetails.b != null) {
try {
AAINQResponse response = Serialization.gsonPretty.fromJson(httpDetails.b, AAINQResponse.class);
return response;
@@ -64,7 +64,6 @@ public final class AAIManager {
logger.error("postQuery threw: ", e);
}
}
-
return null;
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java
new file mode 100644
index 000000000..f6439cc4a
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQRequestError.java
@@ -0,0 +1,33 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.aai;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class AAINQRequestError implements Serializable {
+
+ private static final long serialVersionUID = -7742674155387022932L;
+
+ @SerializedName("serviceException")
+ public AAINQServiceException serviceException;
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java
index 09f983094..527a12089 100644
--- a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQResponse.java
@@ -36,6 +36,9 @@ public class AAINQResponse implements Serializable {
@SerializedName("inventory-response-item")
public List<AAINQInventoryResponseItem> inventoryResponseItems = new LinkedList<>();
+
+ @SerializedName("requestError")
+ public AAINQRequestError requestError;
public AAINQResponse() {
}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java
new file mode 100644
index 000000000..64d407de4
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/AAINQServiceException.java
@@ -0,0 +1,39 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.aai;
+
+import java.io.Serializable;
+
+import com.google.gson.annotations.SerializedName;
+
+public class AAINQServiceException implements Serializable {
+
+ private static final long serialVersionUID = 2858343404484338546L;
+
+ @SerializedName("messageId")
+ public String messageId;
+
+ @SerializedName("text")
+ public String text;
+
+ @SerializedName("variables")
+ public String[] variables;
+}
diff --git a/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java
new file mode 100644
index 000000000..7e65ece22
--- /dev/null
+++ b/controlloop/common/model-impl/aai/src/main/java/org/onap/policy/aai/util/AAIException.java
@@ -0,0 +1,48 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * aai
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.aai.util;
+
+public class AAIException extends Exception {
+
+ private static final long serialVersionUID = 9220983727706207465L;
+
+ public AAIException() {
+ super();
+ }
+
+ public AAIException(String message, Throwable cause, boolean enableSuppression,
+ boolean writableStackTrace) {
+ super(message, cause, enableSuppression, writableStackTrace);
+ }
+
+ public AAIException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public AAIException(String message) {
+ super(message);
+ }
+
+ public AAIException(Throwable cause) {
+ super(cause);
+ }
+
+}