52fd566c4d94aba11c41d6c34a3a9d761a8597ac
[appc.git] / appc-config / appc-flow-controller / provider / src / main / java / org / onap / appc / flow / controller / data / Transaction.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP : APP-C
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.appc.flow.controller.data;
22
23 import java.io.IOException;
24 import java.util.ArrayList;
25 import java.util.List;
26
27 import com.fasterxml.jackson.annotation.JsonProperty;
28 import com.fasterxml.jackson.core.JsonGenerationException;
29 import com.fasterxml.jackson.databind.JsonMappingException;
30 import com.fasterxml.jackson.databind.ObjectMapper;
31
32 public class Transaction {
33
34     @JsonProperty("transaction-id")
35     private int transactionId ;
36
37     @JsonProperty("action")
38     private String action ;
39
40     @JsonProperty("action-level")
41     private String actionLevel ;
42
43     @JsonProperty("action-identifier")
44     private ActionIdentifier actionIdentifier ;
45     
46     @JsonProperty("parameters")
47     private List<Parameters> parameters ;
48
49     private String executionType;
50     
51     private String uId;
52     
53     private String statusCode;
54
55     private String pswd;
56     
57     private String executionEndPoint;
58     
59     private String executionModule;
60     
61     private String executionRPC;
62     
63     @JsonProperty("state")
64     private String state;
65     
66     @JsonProperty("precheck")
67     private PreCheck precheck;
68
69     @JsonProperty("payload")
70     private String payload ;
71
72     @JsonProperty("responses")
73     private List<Response> responses ;
74     
75     
76     private String status = "PENDING";
77     
78     public String getuId() {
79         return uId;
80     }
81
82     public void setuId(String uId) {
83         this.uId = uId;
84     }
85
86     public String getPswd() {
87         return pswd;
88     }
89
90     public void setPswd(String pswd) {
91         this.pswd = pswd;
92     }
93     
94     public String getExecutionEndPoint() {
95         return executionEndPoint;
96     }
97
98     public void setExecutionEndPoint(String executionEndPoint) {
99         this.executionEndPoint = executionEndPoint;
100     }
101
102
103     public String getExecutionType() {
104         return executionType;
105     }
106
107     public void setExecutionType(String executionType) {
108         this.executionType = executionType;
109     }
110
111     public String getExecutionModule() {
112         return executionModule;
113     }
114
115
116     public void setExecutionModule(String executionModule) {
117         this.executionModule = executionModule;
118     }
119
120
121     public String getExecutionRPC() {
122         return executionRPC;
123     }
124
125
126     public void setExecutionRPC(String executionRPC) {
127         this.executionRPC = executionRPC;
128     }
129
130
131     public List<Parameters> getParameters() {
132         return parameters;
133     }
134
135
136     public void setParameters(List<Parameters> parameters) {
137         this.parameters = parameters;
138     }
139     
140     public String getState() {
141         return state;
142     }
143
144     public void setState(String state) {
145         this.state = state;
146     }
147
148     public PreCheck getPrecheck() {
149         return precheck;
150     }
151
152     public void setPrecheck(PreCheck precheck) {
153         this.precheck = precheck;
154     }
155
156     public String getStatus() {
157         return status;
158     }
159
160
161     public void setStatus(String status) {
162         this.status = status;
163     }
164
165     public List<Response> getResponses() {
166         return responses;
167     }
168
169
170     public void setResponses(List<Response> responses) {
171         this.responses = responses;
172     }
173
174     public int getTransactionId() {
175         return transactionId;
176     }
177
178
179     public void setTransactionId(int transactionId) {
180         this.transactionId = transactionId;
181     }
182
183
184     public String getAction() {
185         return action;
186     }
187
188
189     public void setAction(String action) {
190         this.action = action;
191     }
192
193
194     public String getActionLevel() {
195         return actionLevel;
196     }
197
198
199     public void setActionLevel(String actionLevel) {
200         this.actionLevel = actionLevel;
201     }
202
203
204
205     public String getPayload() {
206         return payload;
207     }
208
209
210     public void setPayload(String payload) {
211         this.payload = payload;
212     }
213
214
215     public ActionIdentifier getActionIdentifier() {
216         return actionIdentifier;
217     }
218
219
220     public void setActionIdentifier(ActionIdentifier actionIdentifier) {
221         this.actionIdentifier = actionIdentifier;
222     }
223     
224     public String getStatusCode() {
225         return statusCode;
226     }
227
228     public void setStatusCode(String statusCode) {
229         this.statusCode = statusCode;
230     }
231
232     @Override
233     public String toString() {
234         return "Transaction [transactionId=" + transactionId + ", action=" + action + ", actionLevel=" + actionLevel
235                 + ", actionIdentifier=" + actionIdentifier + ", parameters=" + parameters + ", executionType="
236                 + executionType + ", uId=" + uId + ", statusCode=" + statusCode + ", pswd=" + pswd
237                 + ", executionEndPoint=" + executionEndPoint + ", executionModule=" + executionModule
238                 + ", executionRPC=" + executionRPC + ", state=" + state + ", precheck=" + precheck + ", payload="
239                 + payload + ", responses=" + responses + ", status=" + status + "]";
240     }
241
242     @Override
243     public int hashCode() {
244         final int prime = 31;
245         int result = 1;
246         result = prime * result + ((action == null) ? 0 : action.hashCode());
247         result = prime * result + ((actionIdentifier == null) ? 0 : actionIdentifier.hashCode());
248         result = prime * result + ((actionLevel == null) ? 0 : actionLevel.hashCode());
249         result = prime * result + ((executionEndPoint == null) ? 0 : executionEndPoint.hashCode());
250         result = prime * result + ((executionModule == null) ? 0 : executionModule.hashCode());
251         result = prime * result + ((executionRPC == null) ? 0 : executionRPC.hashCode());
252         result = prime * result + ((executionType == null) ? 0 : executionType.hashCode());
253         result = prime * result + ((parameters == null) ? 0 : parameters.hashCode());
254         result = prime * result + ((payload == null) ? 0 : payload.hashCode());
255         result = prime * result + ((precheck == null) ? 0 : precheck.hashCode());
256         result = prime * result + ((pswd == null) ? 0 : pswd.hashCode());
257         result = prime * result + ((responses == null) ? 0 : responses.hashCode());
258         result = prime * result + ((state == null) ? 0 : state.hashCode());
259         result = prime * result + ((status == null) ? 0 : status.hashCode());
260         result = prime * result + ((statusCode == null) ? 0 : statusCode.hashCode());
261         result = prime * result + transactionId;
262         result = prime * result + ((uId == null) ? 0 : uId.hashCode());
263         return result;
264     }
265
266     @Override
267     public boolean equals(Object obj) {
268         if (this == obj)
269             return true;
270         if (obj == null)
271             return false;
272         if (getClass() != obj.getClass())
273             return false;
274         Transaction other = (Transaction) obj;
275         if (action == null) {
276             if (other.action != null)
277                 return false;
278         } else if (!action.equals(other.action))
279             return false;
280         if (actionIdentifier == null) {
281             if (other.actionIdentifier != null)
282                 return false;
283         } else if (!actionIdentifier.equals(other.actionIdentifier))
284             return false;
285         if (actionLevel == null) {
286             if (other.actionLevel != null)
287                 return false;
288         } else if (!actionLevel.equals(other.actionLevel))
289             return false;
290         if (executionEndPoint == null) {
291             if (other.executionEndPoint != null)
292                 return false;
293         } else if (!executionEndPoint.equals(other.executionEndPoint))
294             return false;
295         if (executionModule == null) {
296             if (other.executionModule != null)
297                 return false;
298         } else if (!executionModule.equals(other.executionModule))
299             return false;
300         if (executionRPC == null) {
301             if (other.executionRPC != null)
302                 return false;
303         } else if (!executionRPC.equals(other.executionRPC))
304             return false;
305         if (executionType == null) {
306             if (other.executionType != null)
307                 return false;
308         } else if (!executionType.equals(other.executionType))
309             return false;
310         if (parameters == null) {
311             if (other.parameters != null)
312                 return false;
313         } else if (!parameters.equals(other.parameters))
314             return false;
315         if (payload == null) {
316             if (other.payload != null)
317                 return false;
318         } else if (!payload.equals(other.payload))
319             return false;
320         if (precheck == null) {
321             if (other.precheck != null)
322                 return false;
323         } else if (!precheck.equals(other.precheck))
324             return false;
325         if (pswd == null) {
326             if (other.pswd != null)
327                 return false;
328         } else if (!pswd.equals(other.pswd))
329             return false;
330         if (responses == null) {
331             if (other.responses != null)
332                 return false;
333         } else if (!responses.equals(other.responses))
334             return false;
335         if (state == null) {
336             if (other.state != null)
337                 return false;
338         } else if (!state.equals(other.state))
339             return false;
340         if (status == null) {
341             if (other.status != null)
342                 return false;
343         } else if (!status.equals(other.status))
344             return false;
345         if (statusCode == null) {
346             if (other.statusCode != null)
347                 return false;
348         } else if (!statusCode.equals(other.statusCode))
349             return false;
350         if (transactionId != other.transactionId)
351             return false;
352         if (uId == null) {
353             if (other.uId != null)
354                 return false;
355         } else if (!uId.equals(other.uId))
356             return false;
357         return true;
358     }
359
360
361 }
362
363
364