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