2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Wipro Limited 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.policy.sdnr;
23 import com.google.gson.annotations.SerializedName;
25 import java.io.Serializable;
27 public class PciResponse implements Serializable {
29 private static final long serialVersionUID = 8375708697287669750L;
31 @SerializedName(value = "CommonHeader")
32 private PciCommonHeader commonHeader;
34 @SerializedName(value = "Status")
35 private Status status = new Status();
37 @SerializedName(value = "Payload")
38 private String payload;
40 public PciResponse() {
45 * Constructs a response using the common header of the request since they will
49 * an sdnr Pci request object specified by the Pci api guide
51 public PciResponse(PciRequest request) {
52 this.commonHeader = new PciCommonHeader(request.getCommonHeader());
57 * Get the common header.
59 * @return the commonHeader
61 public PciCommonHeader getCommonHeader() {
66 * Set the common header.
69 * the commonHeader to set
71 public void setCommonHeader(PciCommonHeader commonHeader) {
72 this.commonHeader = commonHeader;
80 public Status getStatus() {
90 public void setStatus(Status status) {
100 public String getPayload() {
104 public void setPayload(String payload) {
105 this.payload = payload;
109 public String toString() {
110 return "PciResponse[CommonHeader=" + commonHeader + ", Status=" + status + ", Payload="
115 public int hashCode() {
116 final int prime = 31;
118 result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
119 result = prime * result + ((payload == null) ? 0 : payload.hashCode());
120 result = prime * result + ((status == null) ? 0 : status.hashCode());
125 public boolean equals(Object obj) {
132 if (getClass() != obj.getClass()) {
135 PciResponse other = (PciResponse) obj;
136 if (commonHeader == null) {
137 if (other.commonHeader != null) {
140 } else if (!commonHeader.equals(other.commonHeader)) {
143 if (payload == null) {
144 if (other.payload != null) {
147 } else if (!payload.equals(other.payload)) {
150 if (status == null) {
151 if (other.status != null) {
154 } else if (!status.equals(other.status)) {