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.policy.appc;
23 import java.io.Serializable;
24 import java.util.HashMap;
27 public class Response implements Serializable {
29 private static final long serialVersionUID = 434953706339865151L;
31 public CommonHeader CommonHeader;
32 public ResponseStatus Status = new ResponseStatus();
33 public Map<String, Object> Payload = new HashMap<String, Object>();
39 public Response(Request request) {
40 this.CommonHeader = new CommonHeader(request.CommonHeader);
41 if (request.Payload != null) {
42 this.Payload.putAll(request.Payload);
46 public CommonHeader getCommonHeader() {
50 public void setCommonHeader(CommonHeader commonHeader) {
51 CommonHeader = commonHeader;
54 public ResponseStatus getStatus() {
58 public void setStatus(ResponseStatus status) {
62 public Map<String, Object> getPayload() {
66 public void setPayload(Map<String, Object> payload) {
71 public String toString() {
72 return "Response [CommonHeader=" + CommonHeader + ", Status=" + Status + ", Payload=" + Payload + "]";
75 public int hashCode() {
78 result = prime * result + ((CommonHeader == null) ? 0 : CommonHeader.hashCode());
79 result = prime * result + ((Payload == null) ? 0 : Payload.hashCode());
80 result = prime * result + ((Status == null) ? 0 : Status.hashCode());
84 public boolean equals(Object obj) {
89 if (getClass() != obj.getClass())
91 Response other = (Response) obj;
92 if (CommonHeader == null) {
93 if (other.CommonHeader != null)
95 } else if (!CommonHeader.equals(other.CommonHeader))
97 if (Payload == null) {
98 if (other.Payload != null)
100 } else if (!Payload.equals(other.Payload))
102 if (Status == null) {
103 if (other.Status != null)
105 } else if (!Status.equals(other.Status))