Fix for radio buttons
[sdc.git] / common-app-api / src / main / java / org / openecomp / sdc / common / rest / api / RestResponse.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.openecomp.sdc.common.rest.api;
22
23 public class RestResponse {
24
25         private String response;
26
27         private String statusDescription;
28
29         private int httpStatusCode = 0;
30
31         public RestResponse(String response, String statusDescription, int httpStatusCode) {
32                 super();
33                 this.response = response;
34                 this.statusDescription = statusDescription;
35                 this.httpStatusCode = httpStatusCode;
36         }
37
38         /**
39          * @return the response
40          */
41         public String getResponse() {
42                 return response;
43         }
44
45         /**
46          * @param response
47          *            the response to set
48          */
49         public void setResponse(String response) {
50                 this.response = response;
51         }
52
53         /**
54          * @return the httpStatusCode
55          */
56         public int getHttpStatusCode() {
57                 return httpStatusCode;
58         }
59
60         /**
61          * @param httpStatusCode
62          *            the httpStatusCode to set
63          */
64         public void setHttpStatusCode(int httpStatusCode) {
65                 this.httpStatusCode = httpStatusCode;
66         }
67
68         /**
69          * @return the statusDescription
70          */
71         public String getStatusDescription() {
72                 return statusDescription;
73         }
74
75         /**
76          * @param statusDescription
77          *            the statusDescription to set
78          */
79         public void setStatusDescription(String statusDescription) {
80                 this.statusDescription = statusDescription;
81         }
82
83         /*
84          * (non-Javadoc)
85          * 
86          * @see java.lang.Object#toString()
87          * 
88          * ERROR: Error from Rest Server:Status: 400 Message: Bad Request Body:
89          * Invalid cell: Cell with cell name dmgrCell22 does not exist!
90          * 
91          */
92         public String toString() {
93
94                 StringBuilder stringBuilder = new StringBuilder();
95
96                 stringBuilder.append("Status: ");
97                 stringBuilder.append(httpStatusCode);
98                 stringBuilder.append("\n");
99                 stringBuilder.append("Message: ");
100                 stringBuilder.append(statusDescription);
101                 stringBuilder.append("\n");
102                 stringBuilder.append("Body: ");
103                 stringBuilder.append(response);
104
105                 return stringBuilder.toString();
106
107         }
108 }