2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.vid.mso;
23 import com.fasterxml.jackson.annotation.JsonIgnore;
24 import com.fasterxml.jackson.annotation.JsonInclude;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.fasterxml.jackson.annotation.JsonPropertyOrder;
27 import org.apache.commons.lang.builder.ToStringBuilder;
29 import javax.ws.rs.core.Response;
32 * This wrapper encapsulates the MSO response in the format expected by the pages.
34 @JsonInclude(JsonInclude.Include.NON_NULL)
40 public class MsoResponseWrapper implements MsoResponseWrapperInterface {
43 public MsoResponseWrapper() {
46 public MsoResponseWrapper(Response response) {
47 setEntity(response.readEntity(String.class));
48 setStatus(response.getStatus());
53 @JsonProperty("status")
57 @JsonProperty("entity")
58 private String entity;
66 @JsonProperty("entity")
67 public String getEntity() {
77 @JsonProperty("status")
78 public int getStatus() {
85 * @param v the new status
87 @JsonProperty("status")
88 public void setStatus(int v) {
95 * @param v the new entity
97 @JsonProperty("entity")
98 public void setEntity(String v) {
103 * @see java.lang.Object#toString()
106 public String toString() {
107 return ToStringBuilder.reflectionToString(this);
113 * @return the response
116 public String getResponse () {
118 StringBuilder b = new StringBuilder ("{ \"status\": ");
119 b.append(getStatus()).append(", \"entity\": " );
120 if (this.getEntity() == null || this.getEntity().isEmpty()) {
123 b.append(this.getEntity());
126 return (b.toString());