246df6ae2034396d538dfbaea18c6096a8edc8f5
[aaf/authz.git] / authz-cass / src / main / java / org / onap / aaf / dao / aaf / cass / Status.java
1 /*******************************************************************************\r
2  * ============LICENSE_START====================================================\r
3  * * org.onap.aaf\r
4  * * ===========================================================================\r
5  * * Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * * ===========================================================================\r
7  * * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * * you may not use this file except in compliance with the License.\r
9  * * You may obtain a copy of the License at\r
10  * * \r
11  *  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  * * \r
13  *  * Unless required by applicable law or agreed to in writing, software\r
14  * * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * * See the License for the specific language governing permissions and\r
17  * * limitations under the License.\r
18  * * ============LICENSE_END====================================================\r
19  * *\r
20  * * ECOMP is a trademark and service mark of AT&T Intellectual Property.\r
21  * *\r
22  ******************************************************************************/\r
23 package org.onap.aaf.dao.aaf.cass;\r
24 \r
25 import org.onap.aaf.authz.layer.Result;\r
26 \r
27 \r
28 \r
29 \r
30 /**\r
31  * Add additional Behavior for Specific Applications for Results\r
32  * \r
33  * In this case, we add additional BitField information accessible by\r
34  * method (\r
35  *\r
36  * @param <RV>\r
37  */\r
38 public class Status<RV> extends Result<RV> {\r
39         \r
40         // 10/1/2013:  Initially, I used enum, but it's not extensible.\r
41     public final static int ERR_NsNotFound = Result.ERR_General+1,\r
42                                                 ERR_RoleNotFound = Result.ERR_General+2,\r
43                                                 ERR_PermissionNotFound = Result.ERR_General+3, \r
44                                                 ERR_UserNotFound = Result.ERR_General+4,\r
45                                                 ERR_UserRoleNotFound = Result.ERR_General+5,\r
46                                                 ERR_DelegateNotFound = Result.ERR_General+6,\r
47                                                 ERR_InvalidDelegate = Result.ERR_General+7,\r
48                                                 ERR_DependencyExists = Result.ERR_General+8,\r
49                                                 ERR_NoApprovals = Result.ERR_General+9,\r
50                                                 ACC_Now = Result.ERR_General+10,\r
51                                                 ACC_Future = Result.ERR_General+11,\r
52                                                 ERR_ChoiceNeeded = Result.ERR_General+12,\r
53                                                 ERR_FutureNotRequested = Result.ERR_General+13;\r
54   \r
55         /**\r
56      * Constructor for Result set. \r
57      * @param data\r
58      * @param status\r
59      */\r
60     private Status(RV value, int status, String details, String[] variables ) {\r
61         super(value,status,details,variables);\r
62     }\r
63 \r
64         public static String name(int status) {\r
65                 switch(status) {\r
66                         case OK: return "OK";\r
67                         case ERR_NsNotFound: return "ERR_NsNotFound";\r
68                         case ERR_RoleNotFound: return "ERR_RoleNotFound";\r
69                         case ERR_PermissionNotFound: return "ERR_PermissionNotFound"; \r
70                         case ERR_UserNotFound: return "ERR_UserNotFound";\r
71                         case ERR_UserRoleNotFound: return "ERR_UserRoleNotFound";\r
72                         case ERR_DelegateNotFound: return "ERR_DelegateNotFound";\r
73                         case ERR_InvalidDelegate: return "ERR_InvalidDelegate";\r
74                         case ERR_ConflictAlreadyExists: return "ERR_ConflictAlreadyExists";\r
75                         case ERR_DependencyExists: return "ERR_DependencyExists";\r
76                         case ERR_ActionNotCompleted: return "ERR_ActionNotCompleted";\r
77                         case ERR_Denied: return "ERR_Denied";\r
78                         case ERR_Policy: return "ERR_Policy";\r
79                         case ERR_BadData: return "ERR_BadData";\r
80                         case ERR_NotImplemented: return "ERR_NotImplemented";\r
81                         case ERR_NotFound: return "ERR_NotFound";\r
82                         case ERR_ChoiceNeeded: return "ERR_ChoiceNeeded";\r
83                 }\r
84                 //case ERR_General:   or unknown... \r
85                 return "ERR_General";\r
86         }\r
87     \r
88 }\r