Renaming vid-automation #6
[vid.git] / vid-automation / src / test / java / org / opencomp / vid / model / mso / ExceptionResponse.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2017 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 package org.opencomp.vid.model.mso;
22
23 /**
24  * The Class ExceptionResponse.
25  */
26 public class ExceptionResponse {
27
28         public ExceptionResponse() {
29         }
30
31         /** The exception. */
32         private String exception;
33         
34         /** The message. */
35         private String message;
36
37         public ExceptionResponse(String exception, String message) {
38                 this.exception = exception;
39                 this.message = message;
40         }
41
42         public ExceptionResponse(Exception exception) {
43                 setException(exception);
44         }
45
46         /**
47          * Gets the exception.
48          *
49          * @return the exception
50          */
51         public String getException() {
52                 return exception;
53         }
54
55         /**
56          * Sets the exception.
57          *
58          * @param exception the new exception
59          */
60         public void setException(String exception) {
61                 this.exception = exception;
62         }
63
64         public void setException(Exception exception) {
65                 setException(exception.getClass().toString().replaceFirst("^.*[\\.$]", ""));
66                 setMessage(exception.getMessage());
67         }
68
69         /**
70          * Gets the message.
71          *
72          * @return the message
73          */
74         public String getMessage() {
75                 return message;
76         }
77
78         /**
79          * Sets the message.
80          *
81          * @param message the new message
82          */
83         public void setMessage(String message) {
84                 this.message = message;
85         }
86
87 }