[POLICY-22] Reorganizing drools-apps
[policy/drools-applications.git] / controlloop / common / model-impl / appc / src / main / java / org / onap / policy / appc / Request.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * appc
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.policy.appc;
22
23 import java.io.Serializable;
24 import java.util.HashMap;
25 import java.util.Map;
26
27 public class Request implements Serializable{
28
29         private static final long serialVersionUID = -3912323643990646431L;
30
31         public CommonHeader             CommonHeader;
32         public String                           Action;
33         public String                           TargetID;
34         public String                           ObjectID;
35         public Map<String, Object>      Payload = new HashMap<String, Object>();
36         
37         public Request() {
38                 
39         }
40         
41         public CommonHeader getCommonHeader() {
42                 return CommonHeader;
43         }
44         
45         public Map<String, Object> getPayload() {
46                 return Payload;
47         }
48         
49         @Override
50         public int hashCode() {
51                 final int prime = 31;
52                 int result = 1;
53                 result = prime * result + ((Action == null) ? 0 : Action.hashCode());
54                 result = prime * result + ((CommonHeader == null) ? 0 : CommonHeader.hashCode());
55                 result = prime * result + ((ObjectID == null) ? 0 : ObjectID.hashCode());
56                 result = prime * result + ((Payload == null) ? 0 : Payload.hashCode());
57                 result = prime * result + ((TargetID == null) ? 0 : TargetID.hashCode());
58                 return result;
59         }
60
61         @Override
62         public boolean equals(Object obj) {
63                 if (this == obj)
64                         return true;
65                 if (obj == null)
66                         return false;
67                 if (getClass() != obj.getClass())
68                         return false;
69                 Request other = (Request) obj;
70                 if (Action == null) {
71                         if (other.Action != null)
72                                 return false;
73                 } else if (!Action.equals(other.Action))
74                         return false;
75                 if (CommonHeader == null) {
76                         if (other.CommonHeader != null)
77                                 return false;
78                 } else if (!CommonHeader.equals(other.CommonHeader))
79                         return false;
80                 if (ObjectID == null) {
81                         if (other.ObjectID != null)
82                                 return false;
83                 } else if (!ObjectID.equals(other.ObjectID))
84                         return false;
85                 if (Payload == null) {
86                         if (other.Payload != null)
87                                 return false;
88                 } else if (!Payload.equals(other.Payload))
89                         return false;
90                 if (TargetID == null) {
91                         if (other.TargetID != null)
92                                 return false;
93                 } else if (!TargetID.equals(other.TargetID))
94                         return false;
95                 return true;
96         }
97
98         @Override
99         public String toString() {
100                 return "Request [CommonHeader=" + CommonHeader + ", Action=" + Action + ", TargetID=" + TargetID + ", ObjectID="
101                                 + ObjectID + ", Payload=" + Payload + "]";
102         }
103
104 }