[AAF-21] Initial code import
[aaf/authz.git] / authz-cass / src / main / java / com / att / dao / aaf / cass / Status.java
diff --git a/authz-cass/src/main/java/com/att/dao/aaf/cass/Status.java b/authz-cass/src/main/java/com/att/dao/aaf/cass/Status.java
new file mode 100644 (file)
index 0000000..d275f3d
--- /dev/null
@@ -0,0 +1,89 @@
+/*******************************************************************************\r
+ * ============LICENSE_START====================================================\r
+ * * org.onap.aai\r
+ * * ===========================================================================\r
+ * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
+ * * Copyright © 2017 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
+ * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
+ * *\r
+ ******************************************************************************/\r
+package com.att.dao.aaf.cass;\r
+\r
+import com.att.authz.layer.Result;\r
+\r
+\r
+\r
+\r
+/**\r
+ * Add additional Behavior for Specific Applications for Results\r
+ * \r
+ * In this case, we add additional BitField information accessible by\r
+ * method (\r
+ *\r
+ * @param <RV>\r
+ */\r
+public class Status<RV> extends Result<RV> {\r
+       \r
+       // 10/1/2013:  Initially, I used enum, but it's not extensible.\r
+    public final static int ERR_NsNotFound = Result.ERR_General+1,\r
+                                               ERR_RoleNotFound = Result.ERR_General+2,\r
+                                               ERR_PermissionNotFound = Result.ERR_General+3, \r
+                                               ERR_UserNotFound = Result.ERR_General+4,\r
+                                               ERR_UserRoleNotFound = Result.ERR_General+5,\r
+                                               ERR_DelegateNotFound = Result.ERR_General+6,\r
+                                               ERR_InvalidDelegate = Result.ERR_General+7,\r
+                                               ERR_DependencyExists = Result.ERR_General+8,\r
+                                               ERR_NoApprovals = Result.ERR_General+9,\r
+                                               ACC_Now = Result.ERR_General+10,\r
+                                               ACC_Future = Result.ERR_General+11,\r
+                                               ERR_ChoiceNeeded = Result.ERR_General+12,\r
+                                               ERR_FutureNotRequested = Result.ERR_General+13;\r
+  \r
+       /**\r
+     * Constructor for Result set. \r
+     * @param data\r
+     * @param status\r
+     */\r
+    private Status(RV value, int status, String details, String[] variables ) {\r
+       super(value,status,details,variables);\r
+    }\r
+\r
+       public static String name(int status) {\r
+               switch(status) {\r
+                       case OK: return "OK";\r
+                       case ERR_NsNotFound: return "ERR_NsNotFound";\r
+                       case ERR_RoleNotFound: return "ERR_RoleNotFound";\r
+                       case ERR_PermissionNotFound: return "ERR_PermissionNotFound"; \r
+                       case ERR_UserNotFound: return "ERR_UserNotFound";\r
+                       case ERR_UserRoleNotFound: return "ERR_UserRoleNotFound";\r
+                       case ERR_DelegateNotFound: return "ERR_DelegateNotFound";\r
+                       case ERR_InvalidDelegate: return "ERR_InvalidDelegate";\r
+                       case ERR_ConflictAlreadyExists: return "ERR_ConflictAlreadyExists";\r
+                       case ERR_DependencyExists: return "ERR_DependencyExists";\r
+                       case ERR_ActionNotCompleted: return "ERR_ActionNotCompleted";\r
+                       case ERR_Denied: return "ERR_Denied";\r
+                       case ERR_Policy: return "ERR_Policy";\r
+                       case ERR_BadData: return "ERR_BadData";\r
+                       case ERR_NotImplemented: return "ERR_NotImplemented";\r
+                       case ERR_NotFound: return "ERR_NotFound";\r
+                       case ERR_ChoiceNeeded: return "ERR_ChoiceNeeded";\r
+               }\r
+               //case ERR_General:   or unknown... \r
+               return "ERR_General";\r
+       }\r
+    \r
+}\r