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;
34 public class Request implements Serializable {
35 private static final long serialVersionUID = -3912323643990646431L;
37 @SerializedName("CommonHeader")
38 private CommonHeader commonHeader;
40 @SerializedName("Action")
41 private String action;
43 @SerializedName("TargetID")
44 private String targetId;
46 @SerializedName("ObjectID")
47 private String objectId;
49 @SerializedName("Payload")
50 private Map<String, Object> payload = new HashMap<>();
53 // Initiate an empty Request instance
57 public int hashCode() {
60 result = prime * result + ((action == null) ? 0 : action.hashCode());
61 result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
62 result = prime * result + ((objectId == null) ? 0 : objectId.hashCode());
63 result = prime * result + ((payload == null) ? 0 : payload.hashCode());
64 result = prime * result + ((targetId == null) ? 0 : targetId.hashCode());
69 public boolean equals(Object obj) {
76 if (getClass() != obj.getClass()) {
80 Request other = (Request) obj;
82 if (other.action != null) {
85 } else if (!action.equals(other.action)) {
89 if (commonHeader == null) {
90 if (other.commonHeader != null) {
93 } else if (!commonHeader.equals(other.commonHeader)) {
97 if (objectId == null) {
98 if (other.objectId != null) {
101 } else if (!objectId.equals(other.objectId)) {
105 if (payload == null) {
106 if (other.payload != null) {
109 } else if (!payload.equals(other.payload)) {
113 if (targetId == null) {
114 if (other.targetId != null) {
117 } else if (!targetId.equals(other.targetId)) {
125 public String toString() {
126 return "Request [CommonHeader=" + commonHeader + ", Action=" + action + ", TargetId=" + targetId + ", ObjectId="
127 + objectId + ", Payload=" + payload + "]";