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