instantiate and terminate servce
[usecase-ui/server.git] / src / main / java / org / onap / usecaseui / server / exception / ErrorCodeException.java
1 /*
2  * Copyright (C) 2017 CMCC, Inc. and others. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.onap.usecaseui.server.exception;
17
18
19 public class ErrorCodeException extends Exception
20 {
21     private static final long serialVersionUID = 3220072444842529499L;
22     
23     private int categoryCode = 0;
24     
25     private int errorCode = 1;
26     
27     private String[] arguments = null;
28     
29     private static String defaultText = null;
30     
31     public static void setDefaultText(String text)
32     {
33         defaultText = text;
34     }
35     
36     public static String getDefaultText()
37     {
38         return defaultText;
39     }
40     
41     public ErrorCodeException(int code, String debugMessage)
42     {
43         this(code, debugMessage, null);
44     }
45     
46     public ErrorCodeException(int code, String debugMessage, String[] arguments)
47     {
48         super(debugMessage);
49         this.errorCode = code;
50         this.arguments = arguments;
51     }
52     
53     public ErrorCodeException(Throwable source, int code)
54     {
55         this(source, code, (String[])null);
56     }
57     
58     public ErrorCodeException(Throwable source, int code, String[] arguments)
59     {
60         super(source);
61         this.errorCode = code;
62         this.arguments = arguments;
63     }
64     
65     public ErrorCodeException(Throwable source, int code, String debugMessage)
66     {
67         this(source, code, debugMessage, null);
68     }
69     
70     public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments)
71     {
72         super(debugMessage, source);
73         this.errorCode = code;
74         this.arguments = arguments;
75     }
76     
77     public ErrorCodeException(int category, int code, String debugMessage)
78     {
79         this(category, code, debugMessage, null);
80     }
81     
82     public ErrorCodeException(int category, int code, String debugMessage, String[] arguments)
83     {
84         super(debugMessage);
85         this.categoryCode = category;
86         this.errorCode = code;
87         this.arguments = arguments;
88     }
89     
90     public ErrorCodeException(Throwable source, int category, int code)
91     {
92         this(source, category, code, (String[])null);
93     }
94     
95     public ErrorCodeException(Throwable source, int category, int code, String[] arguments)
96     {
97         super(source);
98         this.categoryCode = category;
99         this.errorCode = code;
100         this.arguments = arguments;
101     }
102     
103     public ErrorCodeException(Throwable source, int category, int code, String debugMessage)
104     {
105         this(source, category, code, debugMessage, null);
106     }
107     
108     public ErrorCodeException(Throwable source, int category, int code, String debugMessage,
109         String[] arguments)
110     {
111         super(debugMessage, source);
112         this.categoryCode = category;
113         this.errorCode = code;
114         this.arguments = arguments;
115     }
116     
117     public int getCategory()
118     {
119         return categoryCode;
120     }
121     
122     public int getErrorCode()
123     {
124         return errorCode;
125     }
126     
127     public String[] getArguments()
128     {
129         return arguments;
130     }
131 }