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