001package ca.cdr.api.model.json;
002
003/*
004 * #%L
005 * Smile CDR - CDR
006 * %%
007 * Copyright (C) 2016 - 2025 Smile CDR, Inc.
008 * %%
009 * All rights reserved.
010 * #L%
011 */
012
013import ca.cdr.api.model.enm.TransactionLogEventSubTypeEnum;
014import ca.cdr.api.model.enm.TransactionLogEventTypeEnum;
015import ca.cdr.api.model.enm.TransactionLogOutcomeEnum;
016import com.fasterxml.jackson.annotation.JsonProperty;
017import com.fasterxml.jackson.annotation.JsonPropertyOrder;
018import com.fasterxml.jackson.annotation.JsonRawValue;
019import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
020import com.fasterxml.jackson.databind.annotation.JsonSerialize;
021
022import java.sql.Timestamp;
023import java.util.ArrayList;
024import java.util.Date;
025import java.util.List;
026
027@JsonPropertyOrder({"from", "to", "pageIndex", "pageSize", "events"})
028public class TransactionLogEventsJson implements IModelJson {
029
030        @JsonProperty("events")
031        private List<TransactionLogEventJson> myEvents;
032
033        @JsonProperty("from")
034        @JsonSerialize(using = JsonDateSerializer.class)
035        @JsonDeserialize(using = JsonDateDeserializer.class)
036        private Date myFrom;
037
038        @JsonProperty("pageSize")
039        private int myPageSize;
040
041        @JsonProperty("to")
042        @JsonSerialize(using = JsonDateSerializer.class)
043        @JsonDeserialize(using = JsonDateDeserializer.class)
044        private Date myTo;
045
046        @JsonProperty("pageIndex")
047        private int myPageIndex;
048
049        public List<TransactionLogEventJson> getEvents() {
050                if (myEvents == null) {
051                        myEvents = new ArrayList<>();
052                }
053                return myEvents;
054        }
055
056        public Date getFrom() {
057                return myFrom;
058        }
059
060        public void setFrom(Date theFrom) {
061                myFrom = theFrom;
062        }
063
064        public int getPageSize() {
065                return myPageSize;
066        }
067
068        public void setPageSize(int thePageSize) {
069                myPageSize = thePageSize;
070        }
071
072        public Date getTo() {
073                return myTo;
074        }
075
076        public void setTo(Date theTo) {
077                myTo = theTo;
078        }
079
080        public int getPageIndex() {
081                return myPageIndex;
082        }
083
084        public void setPageIndex(int thePageIndex) {
085                myPageIndex = thePageIndex;
086        }
087
088        @JsonPropertyOrder({
089                "id",
090                "initialTimestamp",
091                "type",
092                "subType",
093                "outcome",
094                "endpointNodeId",
095                "endpointModuleId",
096                "processingTime",
097                "endpointLocalHost",
098                "endpointLocalPort",
099                "endpointRemoteHost",
100                "endpointRemotePort",
101                "requestId",
102                "events",
103                "additionalJson"
104        })
105        // TODO KHS move toplevel
106        public static class TransactionLogEventJson implements IModelJson {
107
108                @JsonProperty("endpointLocalHost")
109                private String myEndpointLocalHost;
110
111                @JsonProperty("endpointLocalPort")
112                private Integer myEndpointLocalPort;
113
114                @JsonProperty("endpointModuleId")
115                private String myEndpointModuleId;
116
117                @JsonProperty("endpointNodeId")
118                private String myEndpointNodeId;
119
120                @JsonProperty("endpointRemoteHost")
121                private String myEndpointRemoteHost;
122
123                @JsonProperty("endpointRemotePort")
124                private Integer myEndpointRemotePort;
125
126                @JsonProperty("events")
127                private List<TransactionLogStepJson> myEvents_;
128
129                @JsonProperty("id")
130                private Long myId;
131
132                @JsonProperty("initialTimestamp")
133                @JsonSerialize(using = JsonDateSerializer.class)
134                @JsonDeserialize(using = JsonDateDeserializer.class)
135                private Date myInitialTimestamp;
136
137                @JsonProperty("outcome")
138                private TransactionLogOutcomeEnum myOutcome;
139
140                @JsonProperty("processingTime")
141                private long myProcessingTime;
142
143                @JsonProperty("subType")
144                private TransactionLogEventSubTypeEnum mySubType;
145
146                @JsonProperty("type")
147                private TransactionLogEventTypeEnum myType;
148
149                @JsonProperty("requestId")
150                private String myRequestId;
151
152                private Long myUserId;
153
154                @JsonProperty("userModuleId")
155                private String myUserModuleId;
156
157                @JsonProperty("userNodeId")
158                private String myUserNodeId;
159
160                @JsonProperty("userName")
161                private String username;
162
163                @JsonProperty("userFamilyName")
164                private String myUserFamilyName;
165
166                @JsonProperty("userGivenName")
167                private String myUserGivenName;
168
169                @JsonProperty("clientId")
170                private String myClientId;
171
172                @JsonProperty("clientNodeId")
173                private String myClientNodeId;
174
175                @JsonProperty("clientModuleId")
176                private String myClientModuleId;
177
178                private Long myClientPid;
179
180                @JsonProperty("clientName")
181                private String myClientName;
182
183                @JsonProperty("transactionGuid")
184                private String myTransactionGuid;
185
186                @JsonDeserialize(using = RawJsonDeserializer.class)
187                @JsonRawValue
188                @JsonProperty("additionalJson")
189                private String myAdditionalJson;
190
191                public String getEndpointLocalHost() {
192                        return myEndpointLocalHost;
193                }
194
195                public void setEndpointLocalHost(String theEndpointLocalHost) {
196                        myEndpointLocalHost = theEndpointLocalHost;
197                }
198
199                public Integer getEndpointLocalPort() {
200                        return myEndpointLocalPort;
201                }
202
203                public void setEndpointLocalPort(Integer theEndpointLocalPort) {
204                        myEndpointLocalPort = theEndpointLocalPort;
205                }
206
207                public String getEndpointModuleId() {
208                        return myEndpointModuleId;
209                }
210
211                public void setEndpointModuleId(String theEntpointId) {
212                        myEndpointModuleId = theEntpointId;
213                }
214
215                public String getEndpointNodeId() {
216                        return myEndpointNodeId;
217                }
218
219                public void setEndpointNodeId(String theNodeId) {
220                        myEndpointNodeId = theNodeId;
221                }
222
223                public String getEndpointRemoteHost() {
224                        return myEndpointRemoteHost;
225                }
226
227                public void setEndpointRemoteHost(String theEndpointRemoteHost) {
228                        myEndpointRemoteHost = theEndpointRemoteHost;
229                }
230
231                public Integer getEndpointRemotePort() {
232                        return myEndpointRemotePort;
233                }
234
235                public void setEndpointRemotePort(Integer theEndpointRemotePort) {
236                        myEndpointRemotePort = theEndpointRemotePort;
237                }
238
239                public List<TransactionLogStepJson> getEvents() {
240                        if (myEvents_ == null) {
241                                myEvents_ = new ArrayList<>();
242                        }
243                        return myEvents_;
244                }
245
246                public Long getId() {
247                        return myId;
248                }
249
250                public void setId(Long thePid) {
251                        myId = thePid;
252                }
253
254                public Date getInitialTimestamp() {
255                        return myInitialTimestamp;
256                }
257
258                public void setInitialTimestamp(Date theTimestamp) {
259                        myInitialTimestamp = theTimestamp;
260                        if (myInitialTimestamp instanceof Timestamp) {
261                                myInitialTimestamp = new Date(myInitialTimestamp.getTime());
262                        }
263                }
264
265                public TransactionLogOutcomeEnum getOutcome() {
266                        return myOutcome;
267                }
268
269                public void setOutcome(TransactionLogOutcomeEnum theOutcome) {
270                        myOutcome = theOutcome;
271                }
272
273                public long getProcessingTime() {
274                        return myProcessingTime;
275                }
276
277                public void setProcessingTime(long theProcessingTime) {
278                        myProcessingTime = theProcessingTime;
279                }
280
281                public TransactionLogEventSubTypeEnum getSubType() {
282                        return mySubType;
283                }
284
285                public void setSubType(TransactionLogEventSubTypeEnum theSubType) {
286                        mySubType = theSubType;
287                }
288
289                public TransactionLogEventTypeEnum getType() {
290                        return myType;
291                }
292
293                public void setType(TransactionLogEventTypeEnum theTransactionLogEventTypeEnum) {
294                        myType = theTransactionLogEventTypeEnum;
295                }
296
297                public String getRequestId() {
298                        return myRequestId;
299                }
300
301                public void setRequestId(String theRequestId) {
302                        myRequestId = theRequestId;
303                }
304
305                public Long getUserId() {
306                        return myUserId;
307                }
308
309                public void setUserId(Long userId) {
310                        this.myUserId = userId;
311                }
312
313                public String getUserModuleId() {
314                        return myUserModuleId;
315                }
316
317                public void setUserModuleId(String userModuleId) {
318                        this.myUserModuleId = userModuleId;
319                }
320
321                public String getUserNodeId() {
322                        return myUserNodeId;
323                }
324
325                public void setUserNodeId(String userNodeId) {
326                        this.myUserNodeId = userNodeId;
327                }
328
329                public String getUsername() {
330                        return username;
331                }
332
333                public void setUsername(String username) {
334                        this.username = username;
335                }
336
337                public String getUserFamilyName() {
338                        return myUserFamilyName;
339                }
340
341                public void setUserFamilyName(String userFamilyName) {
342                        this.myUserFamilyName = userFamilyName;
343                }
344
345                public String getUserGivenName() {
346                        return myUserGivenName;
347                }
348
349                public void setUserGivenName(String userGivenName) {
350                        this.myUserGivenName = userGivenName;
351                }
352
353                public String getClientId() {
354                        return myClientId;
355                }
356
357                public void setClientId(String clientId) {
358                        this.myClientId = clientId;
359                }
360
361                public String getClientModuleId() {
362                        return myClientModuleId;
363                }
364
365                public void setClientModuleId(String clientModuleId) {
366                        this.myClientModuleId = clientModuleId;
367                }
368
369                public String getClientNodeId() {
370                        return myClientNodeId;
371                }
372
373                public void setClientNodeId(String clientNodeId) {
374                        this.myClientNodeId = clientNodeId;
375                }
376
377                public Long getClientPid() {
378                        return myClientPid;
379                }
380
381                public void setClientPid(Long clientPid) {
382                        this.myClientPid = clientPid;
383                }
384
385                public String getClientName() {
386                        return myClientName;
387                }
388
389                public void setClientName(String clientName) {
390                        this.myClientName = clientName;
391                }
392
393                public String getTransactionGuid() {
394                        return myTransactionGuid;
395                }
396
397                public void setTransactionGuid(String theTransactionGuid) {
398                        myTransactionGuid = theTransactionGuid;
399                }
400
401                public String getAdditionalJson() {
402                        return myAdditionalJson;
403                }
404
405                public void setAdditionalJson(String theAdditionalJson) {
406                        this.myAdditionalJson = theAdditionalJson;
407                }
408        }
409}