Merge the POMBA code to ONAP AAI data router
[aai/data-router.git] / src / main / java / org / onap / aai / datarouter / exception / POAAuditException.java
diff --git a/src/main/java/org/onap/aai/datarouter/exception/POAAuditException.java b/src/main/java/org/onap/aai/datarouter/exception/POAAuditException.java
new file mode 100644 (file)
index 0000000..6d99640
--- /dev/null
@@ -0,0 +1,87 @@
+/**\r
+ * ============LICENSE_START=======================================================\r
+ * org.onap.aai\r
+ * ================================================================================\r
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.\r
+ * Copyright © 2017-2018 Amdocs\r
+ * ================================================================================\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *       http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ============LICENSE_END=========================================================\r
+ */\r
+package org.onap.aai.datarouter.exception;\r
+\r
+import javax.ws.rs.core.Response.Status;\r
+import org.onap.aai.datarouter.logging.DataRouterMsgs;\r
+\r
+/**\r
+ * This class is to handle the POMBA specific exception\r
+ *\r
+ */\r
+public class POAAuditException extends Exception {\r
+\r
+    private static final long serialVersionUID = 8162385108397238865L;\r
+\r
+    private Status httpStatus;\r
+    private DataRouterMsgs logCode;\r
+    private String[] logArguments;\r
+\r
+    public POAAuditException(String messageForResponse, Status httpStatus) {\r
+        super(messageForResponse);\r
+        this.setHttpStatus(httpStatus);\r
+    }\r
+\r
+    public POAAuditException(String message, Status httpStatus, Throwable cause) {\r
+        super(message, cause);\r
+        this.setHttpStatus(httpStatus);\r
+    }\r
+\r
+    public POAAuditException(Throwable cause) {\r
+        super(cause);\r
+    }\r
+\r
+    public POAAuditException(String message, Throwable cause) {\r
+        super(message, cause);\r
+    }\r
+\r
+    public POAAuditException(String message, Throwable cause, boolean enableSuppression,\r
+            boolean writableStackTrace) {\r
+        super(message, cause, enableSuppression, writableStackTrace);\r
+    }\r
+\r
+    public POAAuditException(String message, Status httpStatus, DataRouterMsgs logCode, String... logArgs) {\r
+        super(message);\r
+        this.setHttpStatus(httpStatus);\r
+        this.logCode = logCode;\r
+        logArguments = new String[logArgs.length];\r
+        int i = 0;\r
+        for(String arg : logArgs) {\r
+            logArguments[i++] = arg;\r
+        }\r
+    }\r
+\r
+    public Status getHttpStatus() {\r
+        return httpStatus;\r
+    }\r
+\r
+    public void setHttpStatus(Status httpStatus) {\r
+        this.httpStatus = httpStatus;\r
+    }\r
+\r
+    public DataRouterMsgs getLogCode() {\r
+        return logCode;\r
+    }\r
+\r
+    public String[] getLogArguments() {\r
+        return logArguments;\r
+    }\r
+}\r