Merge "AppMessages.java - Sonar Fixes"
[music.git] / src / main / java / org / onap / music / eelf / logging / format / AppMessages.java
1 /*
2  * ============LICENSE_START==========================================
3  * org.onap.music
4  * ===================================================================
5  *  Copyright (c) 2017 AT&T Intellectual Property
6  *  Copyright (c) 2019 IBM Intellectual Property
7  * ===================================================================
8  *  Licensed under the Apache License, Version 2.0 (the "License");
9  *  you may not use this file except in compliance with the License.
10  *  You may obtain a copy of the License at
11  * 
12  *     http://www.apache.org/licenses/LICENSE-2.0
13  * 
14  *  Unless required by applicable law or agreed to in writing, software
15  *  distributed under the License is distributed on an "AS IS" BASIS,
16  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  *  See the License for the specific language governing permissions and
18  *  limitations under the License.
19  * 
20  * ============LICENSE_END=============================================
21  * ====================================================================
22  */
23
24 package org.onap.music.eelf.logging.format;
25
26 /**
27  * @author inam
28  *
29  */
30 public enum AppMessages {
31         
32         
33         
34         /*
35          * 100-199 Security/Permission Related - Authentication problems
36          * [ERR100E] Missing Information 
37          * [ERR101E] Authentication error occured
38          * 
39          * 200-299 Availability/Timeout Related/IO - connectivity error - connection timeout
40          *  [ERR200E] Connectivity
41          *  [ERR201E] Host not available 
42          *      [ERR202E] Error while connecting to Cassandra cluster
43          *  [ERR203E] IO Error has occured
44          *  [ERR204E] Execution Interrupted
45          *      [ERR205E] Session Expired
46          *  [ERR206E] Cache not authenticated
47          * 
48          * 
49          * 300-399 Data Access/Integrity Related
50          * [ERR300E] Incorrect data  
51          * 
52          * 400-499 - Cassandra Query Related
53          * [ERR400E] Error while processing prepared query object
54          * [ERR401E] Executing Session Failure for Request
55          * [ERR402E] Ill formed queryObject for the request
56          * [ERR403E] Error processing Prepared Query Object  
57          * 
58          * 500-599 - Zookeepr/Locking Related
59          * [ERR500E] Invalid lock
60          * [ERR501E] Locking Error has occured
61          * [ERR502E] Zookeeper error has occured
62          * [ERR503E] Failed to aquire lock store handle  
63          * [ERR504E] Failed to create Lock Reference
64          * [ERR505E] Lock does not exist
65          * [ERR506E] Failed to aquire lock
66          * [ERR507E] Lock not aquired 
67          * [ERR508E] Lock state not set 
68          * [ERR509E] Lock not destroyed 
69          * [ERR510E] Lock not released 
70          * [ERR511E] Lock not deleted 
71          * [ERR512E] Failed to get ZK Lock Handle
72          * 
73          * 
74          * 600 - 699 - Music Service Errors
75          * [ERR600E] Error initializing the cache 
76          * 
77          * 700-799 Schema Interface Type/Validation - received Pay-load checksum is
78          * invalid - received JSON is not valid
79          * 
80          * 800-899 Business/Flow Processing Related - check out to service is not
81          * allowed - Roll-back is done - failed to generate heat file
82          * 
83          * 
84          * 900-999 Unknown Errors - Unexpected exception
85          * [ERR900E] Unexpected error occured
86          * [ERR901E] Number format exception  
87          * 
88          * 
89          * 1000-1099 Reserved - do not use
90          * 
91          */
92
93
94
95         
96         MISSINGINFO("[ERR100E]", "Missing Information ","Details: NA", "Please check application credentials and/or headers"),
97         AUTHENTICATIONERROR("[ERR101E]", "Authentication error occured ","Details: NA", "Please verify application credentials"),
98         CONNCECTIVITYERROR("[ERR200E]"," Connectivity error","Details: NA ","Please check connectivity to external resources"),
99         HOSTUNAVAILABLE("[ERR201E]","Host not available","Details: NA","Please verify the host details"),
100         CASSANDRACONNECTIVITY("[ERR202E]","Error while connecting to Cassandra cluster",""," Please check cassandra cluster details"),
101         IOERROR("[ERR203E]","IO Error has occured","","Please check IO"),
102         EXECUTIONINTERRUPTED("[ERR204E]"," Execution Interrupted","",""),
103         SESSIONEXPIRED("[ERR205E]"," Session Expired","","Session has expired."),
104         CACHEAUTHENTICATION("[ERR206E]","Cache not authenticated",""," Cache not authenticated"),
105         
106         INCORRECTDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"),
107         MULTIPLERECORDS("[ERR301E]"," Multiple records found",""," Please verify the request payload and try again"),
108         ALREADYEXIST("[ERR302E]"," Record already exist",""," Please verify the request payload and try again"),
109         MISSINGDATA("[ERR300E]"," Incorrect data",""," Please verify the request payload and try again"),
110         
111         QUERYERROR("[ERR400E]","Error while processing prepared query object",""," Please verify the query"),
112         SESSIONFAILED("[ERR401E]","Executing Session Failure for Request","","Please verify the session and request"),
113         
114         INVALIDLOCK("[ERR500E]"," Invalid lock or acquire failed",""," Lock is not valid to aquire"),
115         LOCKINGERROR("[ERR501E]"," Locking Error has occured",""," Locking Error has occured"),
116         KEEPERERROR("[ERR502E]"," Zookeeper error has occured","","Please check zookeeper details"),
117         LOCKHANDLE("[ERR503E]","Failed to aquire lock store handle",""," Failed to aquire lock store handle"),
118         CREATELOCK("[ERR504E]","Failed to aquire lock store handle  ","","Failed to aquire lock store handle  "),
119         LOCKSTATE("[ERR508E]"," Lock state not set",""," Lock state not set"),
120         DESTROYLOCK("[ERR509E]"," Lock not destroyed",""," Lock not destroyed"),
121         RELEASELOCK("[ERR510E]"," Lock not released",""," Lock not released"),
122         DELTELOCK("[ERR511E]",""," Lock not deleted "," Lock not deleted "),
123         CACHEERROR("[ERR600E]"," Error initializing the cache",""," Error initializing the cache"),
124         
125         UNKNOWNERROR("[ERR900E]"," Unexpected error occured",""," Please check logs for details");
126
127
128
129
130     private ErrorTypes eType;
131     private ErrorSeverity alarmSeverity;
132     private ErrorSeverity errorSeverity;
133         private String errorCode;
134         private String errorDescription;
135         private String details;
136         private String resolution;
137
138
139         AppMessages(String errorCode, String errorDescription, String details,String resolution) {
140         
141                 this.errorCode = errorCode;
142                 this.errorDescription = errorDescription;
143                 this.details = details;
144                 this.resolution = resolution;
145         }
146
147
148         public ErrorTypes getEType() {
149         return eType;
150     }
151
152     public ErrorSeverity getAlarmSeverity() {
153         return alarmSeverity;
154     }
155     public ErrorSeverity getErrorSeverity() {
156         return errorSeverity;
157     }
158     
159         public void setDetails(String details){ this.details=details; }
160
161         public String getDetails() {
162                 return this.details;
163         }
164
165         public void setResolution(String resolution){ this.resolution=resolution; }
166
167         public String getResolution() {
168                 return this.resolution;
169         }
170
171         public void setErrorCode(String errorCode){ this.errorCode=errorCode; }
172
173         public String getErrorCode() {
174                 return this.errorCode;
175         }
176
177         public void setErrorDescription(String errorDescription){ this.errorDescription=errorDescription; }
178
179         public String getErrorDescription() {
180                 return this.errorDescription;
181         }
182
183         
184
185         
186         
187         
188
189 }