migrate model-impl from drools-applications
[policy/models.git] / models-interactions / model-impl / appclcm / src / main / java / org / onap / policy / appclcm / LcmRequest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * appclcm
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
11  * 
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  * 
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=========================================================
20  */
21
22 package org.onap.policy.appclcm;
23
24 import com.google.gson.annotations.SerializedName;
25
26 import java.io.Serializable;
27 import java.util.Map;
28
29 public class LcmRequest implements Serializable {
30
31     private static final long serialVersionUID = 219375564922846624L;
32
33     @SerializedName(value = "common-header")
34     private LcmCommonHeader commonHeader;
35
36     @SerializedName(value = "action")
37     private String action;
38
39     @SerializedName(value = "action-identifiers")
40     private Map<String, String> actionIdentifiers;
41
42     @SerializedName(value = "payload")
43     private String payload;
44
45     public LcmRequest() {
46         // Create a default LCM request
47     }
48
49     public LcmCommonHeader getCommonHeader() {
50         return commonHeader;
51     }
52
53     /**
54      * Get the action.
55      * 
56      * @return the action
57      */
58     public String getAction() {
59         return action;
60     }
61
62     /**
63      * Set the action.
64      * 
65      * @param action the action to set
66      */
67     public void setAction(String action) {
68         this.action = action;
69     }
70
71     /**
72      * Get the action identifiers.
73      * 
74      * @return the actionIdentifiers
75      */
76     public Map<String, String> getActionIdentifiers() {
77         return actionIdentifiers;
78     }
79
80     /**
81      * Set the action identifiers.
82      * 
83      * @param actionIdentifiers the actionIdentifiers to set
84      */
85     public void setActionIdentifiers(Map<String, String> actionIdentifiers) {
86         this.actionIdentifiers = actionIdentifiers;
87     }
88
89     /**
90      * Get the payload.
91      * 
92      * @return the payload
93      */
94     public String getPayload() {
95         return payload;
96     }
97
98     /**
99      * Set the payload.
100      * 
101      * @param payload the payload to set
102      */
103     public void setPayload(String payload) {
104         this.payload = payload;
105     }
106
107     /**
108      * Get the common header.
109      * 
110      * @param commonHeader the commonHeader to set
111      */
112     public void setCommonHeader(LcmCommonHeader commonHeader) {
113         this.commonHeader = commonHeader;
114     }
115
116     @Override
117     public String toString() {
118         return "Request [commonHeader=" + commonHeader + ", action=" + action + ", actionIdentifiers="
119                 + actionIdentifiers + ", payload=" + payload + "]";
120     }
121
122     @Override
123     public int hashCode() {
124         final int prime = 31;
125         int result = 1;
126         result = prime * result + ((commonHeader == null) ? 0 : commonHeader.hashCode());
127         result = prime * result + ((action == null) ? 0 : action.hashCode());
128         result = prime * result + ((actionIdentifiers == null) ? 0 : actionIdentifiers.hashCode());
129         result = prime * result + ((payload == null) ? 0 : payload.hashCode());
130         return result;
131     }
132
133     @Override
134     public boolean equals(Object obj) {
135         if (this == obj) {
136             return true;
137         }
138         if (obj == null) {
139             return false;
140         }
141         if (getClass() != obj.getClass()) {
142             return false;
143         }
144         LcmRequest other = (LcmRequest) obj;
145         if (commonHeader == null) {
146             if (other.commonHeader != null) {
147                 return false;
148             }
149         } else if (!commonHeader.equals(other.commonHeader)) {
150             return false;
151         }
152         if (action == null) {
153             if (other.action != null) {
154                 return false;
155             }
156         } else if (!action.equals(other.action)) {
157             return false;
158         }
159         if (actionIdentifiers == null) {
160             if (other.actionIdentifiers != null) {
161                 return false;
162             }
163         } else if (!actionIdentifiers.equals(other.actionIdentifiers)) {
164             return false;
165         }
166         if (payload == null) {
167             if (other.payload != null) {
168                 return false;
169             }
170         } else if (!payload.equals(other.payload)) {
171             return false;
172         }
173         return true;
174     }
175
176 }