Replaced all tabs with spaces in java and pom.xml
[so.git] / adapters / mso-vfc-adapter / src / main / java / org / onap / so / adapters / vfc / exceptions / ApplicationException.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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 package org.onap.so.adapters.vfc.exceptions;
22
23 import javax.ws.rs.core.Response;
24
25 public class ApplicationException extends Exception {
26
27     /**
28      * Serial number.
29      */
30     private static final long serialVersionUID = 1L;
31
32     private int errorCode;
33
34     private String errorMsg;
35
36     /**
37      * Constructor<br/>
38      * <p>
39      * </p>
40      * 
41      * @param errorCode error status
42      * @param errorMsg error detail
43      * @since ONAP Amsterdam Release 2017-9-6
44      */
45     public ApplicationException(int errorCode, String errorMsg) {
46         this.errorCode = errorCode;
47         this.errorMsg = errorMsg;
48     }
49
50     public int getErrorCode() {
51         return errorCode;
52     }
53
54     public void setErrorCode(int errorCode) {
55         this.errorCode = errorCode;
56     }
57
58     public String getErrorMsg() {
59         return errorMsg;
60     }
61
62     public void setErrorMsg(String errorMsg) {
63         this.errorMsg = errorMsg;
64     }
65
66     /**
67      * build error Response <br>
68      * 
69      * @return
70      * @since ONAP Amsterdam Release
71      */
72     public Response buildErrorResponse() {
73         return Response.status(errorCode).entity(errorMsg).build();
74     }
75 }