33e6d9faad416346ccca6ddf50a75c21285a4d23
[vfc/nfvo/catalog.git] /
1 /**
2  * Copyright 2016 [ZTE] and others.
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.openo.commontosca.catalog.db.exception;
17
18
19 /**
20  * *@author 10159474
21  * 
22  */
23 public class ErrorCodeException extends Exception {
24
25     private static final long serialVersionUID = 3220072444842529499L;
26     private int categoryCode = 0;
27     private int errorCode = 1;
28     private String[] arguments = null;
29
30     private static String defaultText = null;
31
32
33     public static void setDefaultText(String text) {
34         defaultText = text;
35     }
36
37
38     public static String getDefaultText() {
39         return defaultText;
40     }
41
42
43     public ErrorCodeException(int code, String debugMessage) {
44         this(code, debugMessage, null);
45     }
46
47
48     public ErrorCodeException(int code, String debugMessage, String[] arguments) {
49         super(debugMessage);
50         this.errorCode = code;
51         this.arguments = arguments;
52     }
53
54
55     public ErrorCodeException(Throwable source, int code) {
56         this(source, code, (String[]) null);
57     }
58
59
60     public ErrorCodeException(Throwable source, int code, String[] arguments) {
61         super(source);
62         this.errorCode = code;
63         this.arguments = arguments;
64     }
65
66
67     public ErrorCodeException(Throwable source, int code, String debugMessage) {
68         this(source, code, debugMessage, null);
69     }
70
71
72     public ErrorCodeException(Throwable source, int code, String debugMessage, String[] arguments) {
73         super(debugMessage, source);
74         this.errorCode = code;
75         this.arguments = arguments;
76     }
77
78
79     public ErrorCodeException(int category, int code, String debugMessage) {
80         this(category, code, debugMessage, null);
81     }
82
83
84     public ErrorCodeException(int category, int code, String debugMessage, String[] arguments) {
85         super(debugMessage);
86         this.categoryCode = category;
87         this.errorCode = code;
88         this.arguments = arguments;
89     }
90
91
92     public ErrorCodeException(Throwable source, int category, int code) {
93         this(source, category, code, (String[]) null);
94     }
95
96
97     public ErrorCodeException(Throwable source, int category, int code, String[] arguments) {
98         super(source);
99         this.categoryCode = category;
100         this.errorCode = code;
101         this.arguments = arguments;
102     }
103
104
105     public ErrorCodeException(Throwable source, int category, int code, String debugMessage) {
106         this(source, category, code, debugMessage, null);
107     }
108
109
110     public ErrorCodeException(Throwable source, int category, int code, String debugMessage,
111             String[] arguments) {
112         super(debugMessage, source);
113         this.categoryCode = category;
114         this.errorCode = code;
115         this.arguments = arguments;
116     }
117
118
119     public int getCategory() {
120         return categoryCode;
121     }
122
123     public int getErrorCode() {
124         return errorCode;
125     }
126
127
128     public String[] getArguments() {
129         return arguments;
130     }
131
132 }