2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2019 Nordix Foundation.
7 * ================================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END=========================================================
22 package org.onap.policy.sdnr;
24 import com.google.gson.annotations.SerializedName;
26 import java.io.Serializable;
28 public class PciResponse implements Serializable {
30 private static final long serialVersionUID = 8375708697287669750L;
32 @SerializedName(value = "CommonHeader")
33 private PciCommonHeader commonHeader;
35 @SerializedName(value = "Status")
36 private Status status = new Status();
38 @SerializedName(value = "Payload")
39 private String payload;
41 public PciResponse() {
46 * Constructs a response using the common header of the request since they will
50 * an sdnr Pci request object specified by the Pci api guide
52 public PciResponse(PciRequest request) {
53 this.commonHeader = new PciCommonHeader(request.getCommonHeader());
58 * Get the common header.
60 * @return the commonHeader
62 public PciCommonHeader getCommonHeader() {
67 * Set the common header.
70 * the commonHeader to set
72 public void setCommonHeader(PciCommonHeader commonHeader) {
73 this.commonHeader = commonHeader;
81 public Status getStatus() {
91 public void setStatus(Status status) {
101 public String getPayload() {
105 public void setPayload(String payload) {
106 this.payload = payload;
110 public String toString() {
111 return "PciResponse[CommonHeader=" + commonHeader + ", Status=" + status + ", Payload="
116 public int hashCode() {
117 final int prime = 31;
119 result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
120 result = prime * result + ((payload == null) ? 0 : payload.hashCode());
121 result = prime * result + ((status == null) ? 0 : status.hashCode());
126 public boolean equals(Object obj) {
133 if (getClass() != obj.getClass()) {
136 PciResponse other = (PciResponse) obj;
137 if (commonHeader == null) {
138 if (other.commonHeader != null) {
141 } else if (!commonHeader.equals(other.commonHeader)) {
144 if (payload == null) {
145 if (other.payload != null) {
148 } else if (!payload.equals(other.payload)) {
151 if (status == null) {
152 if (other.status != null) {
155 } else if (!status.equals(other.status)) {