2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 AT&T 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.appc;
24 import com.google.gson.annotations.SerializedName;
26 import java.io.Serializable;
27 import java.util.HashMap;
30 public class Request implements Serializable {
31 private static final long serialVersionUID = -3912323643990646431L;
33 @SerializedName("CommonHeader")
34 private CommonHeader commonHeader;
36 @SerializedName("Action")
37 private String action;
39 @SerializedName("TargetID")
40 private String targetId;
42 @SerializedName("ObjectID")
43 private String objectId;
45 @SerializedName("Payload")
46 private HashMap<String, Object> payload = new HashMap<>();
49 // Initiate an empty Request instance
52 public CommonHeader getCommonHeader() {
56 public Map<String, Object> getPayload() {
60 public String getAction() {
64 public void setAction(String action) {
68 public String getTargetId() {
72 public void setTargetId(String targetId) {
73 this.targetId = targetId;
76 public String getObjectId() {
80 public void setObjectId(String objectId) {
81 this.objectId = objectId;
84 public void setCommonHeader(CommonHeader commonHeader) {
85 this.commonHeader = commonHeader;
88 public void setPayload(Map<String, Object> payload) {
89 this.payload = new HashMap<>(payload);
93 public int hashCode() {
96 result = prime * result + ((action == null) ? 0 : action.hashCode());
97 result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
98 result = prime * result + ((objectId == null) ? 0 : objectId.hashCode());
99 result = prime * result + ((payload == null) ? 0 : payload.hashCode());
100 result = prime * result + ((targetId == null) ? 0 : targetId.hashCode());
105 public boolean equals(Object obj) {
112 if (getClass() != obj.getClass()) {
116 Request other = (Request) obj;
117 if (action == null) {
118 if (other.action != null) {
121 } else if (!action.equals(other.action)) {
125 if (commonHeader == null) {
126 if (other.commonHeader != null) {
129 } else if (!commonHeader.equals(other.commonHeader)) {
133 if (objectId == null) {
134 if (other.objectId != null) {
137 } else if (!objectId.equals(other.objectId)) {
141 if (payload == null) {
142 if (other.payload != null) {
145 } else if (!payload.equals(other.payload)) {
149 if (targetId == null) {
150 if (other.targetId != null) {
153 } else if (!targetId.equals(other.targetId)) {
161 public String toString() {
162 return "Request [CommonHeader=" + commonHeader + ", Action=" + action + ", TargetId=" + targetId + ", ObjectId="
163 + objectId + ", Payload=" + payload + "]";