001package ca.cdr.api.model.json; 002 003/* 004 * #%L 005 * Smile CDR - CDR 006 * %% 007 * Copyright (C) 2016 - 2026 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 ca.cdr.api.model.json.jackson2deprecated.JsonDateDeserializerJacksonV2Deprecated; 017import ca.cdr.api.model.json.jackson2deprecated.JsonDateSerializerJacksonV2Deprecated; 018import ca.cdr.api.model.json.jackson2deprecated.RawJsonDeserializerJacksonV2Deprecated; 019import ca.uhn.fhir.model.api.IModelJson; 020import com.fasterxml.jackson.annotation.JsonProperty; 021import com.fasterxml.jackson.annotation.JsonPropertyOrder; 022import com.fasterxml.jackson.annotation.JsonRawValue; 023import io.swagger.v3.oas.annotations.media.Schema; 024import tools.jackson.databind.annotation.JsonDeserialize; 025import tools.jackson.databind.annotation.JsonSerialize; 026 027import java.sql.Timestamp; 028import java.util.ArrayList; 029import java.util.Date; 030import java.util.List; 031 032@JsonPropertyOrder({ 033 "moduleId", 034 "from", 035 "to", 036 "transactionId", 037 "userName", 038 "completeUrl", 039 "endpoint", 040 "eventType", 041 "eventSubType", 042 "outcome", 043 "pageIndex", 044 "pageSize", 045 "totalRecords", 046 "events" 047}) 048public class TransactionLogEventsJson implements IModelJson { 049 050 @Schema(description = "The list of transaction log events for the current page.") 051 @JsonProperty("events") 052 private List<TransactionLogEventJson> myEvents; 053 054 @Schema(description = "The start of the date range filter applied to the query.") 055 @JsonProperty("from") 056 @com.fasterxml.jackson.databind.annotation.JsonSerialize(using = JsonDateSerializerJacksonV2Deprecated.class) 057 @JsonSerialize(using = JsonDateSerializer.class) 058 @com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = JsonDateDeserializerJacksonV2Deprecated.class) 059 @JsonDeserialize(using = JsonDateDeserializer.class) 060 private Date myFrom; 061 062 @Schema(description = "The number of records per page.") 063 @JsonProperty("pageSize") 064 private int myPageSize; 065 066 @Schema(description = "The end of the date range filter applied to the query.") 067 @JsonProperty("to") 068 @com.fasterxml.jackson.databind.annotation.JsonSerialize(using = JsonDateSerializerJacksonV2Deprecated.class) 069 @JsonSerialize(using = JsonDateSerializer.class) 070 @com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = JsonDateDeserializerJacksonV2Deprecated.class) 071 @JsonDeserialize(using = JsonDateDeserializer.class) 072 private Date myTo; 073 074 @Schema(description = "The zero-based page index.") 075 @JsonProperty("pageIndex") 076 private int myPageIndex; 077 078 @Schema(description = "Total number of transaction log records matching the query.") 079 @JsonProperty("totalRecords") 080 private long myTotalRecords; 081 082 @Schema( 083 description = "Module Id of the Module that stores the transaction records.", 084 example = "transaction", 085 requiredMode = Schema.RequiredMode.NOT_REQUIRED) 086 @JsonProperty("moduleId") 087 private String myModuleId; 088 089 @Schema(description = "The transaction ID filter applied to the query.") 090 @JsonProperty("transactionId") 091 private String myTransactionId; 092 093 @Schema(description = "The username filter applied to the query.") 094 @JsonProperty("userName") 095 private String myUserName; 096 097 @Schema(description = "The complete URL filter applied to the query.") 098 @JsonProperty("completeUrl") 099 private String myCompleteUrl; 100 101 @Schema(description = "The endpoint filter applied to the query.") 102 @JsonProperty("endpoint") 103 private String myEndpoint; 104 105 @Schema(description = "The event type filter applied to the query.") 106 @JsonProperty("eventType") 107 private String myEventType; 108 109 @Schema(description = "The event sub-type filter applied to the query.") 110 @JsonProperty("eventSubType") 111 private String myEventSubType; 112 113 @Schema(description = "The outcome filter applied to the query.") 114 @JsonProperty("outcome") 115 private String myOutcome; 116 117 public List<TransactionLogEventJson> getEvents() { 118 if (myEvents == null) { 119 myEvents = new ArrayList<>(); 120 } 121 return myEvents; 122 } 123 124 public Date getFrom() { 125 return myFrom; 126 } 127 128 public void setFrom(Date theFrom) { 129 myFrom = theFrom; 130 } 131 132 public int getPageSize() { 133 return myPageSize; 134 } 135 136 public void setPageSize(int thePageSize) { 137 myPageSize = thePageSize; 138 } 139 140 public Date getTo() { 141 return myTo; 142 } 143 144 public void setTo(Date theTo) { 145 myTo = theTo; 146 } 147 148 public int getPageIndex() { 149 return myPageIndex; 150 } 151 152 public void setPageIndex(int thePageIndex) { 153 myPageIndex = thePageIndex; 154 } 155 156 public long getTotalRecords() { 157 return myTotalRecords; 158 } 159 160 public void setTotalRecords(long theTotalRecords) { 161 myTotalRecords = theTotalRecords; 162 } 163 164 public String getModuleId() { 165 return myModuleId; 166 } 167 168 public void setModuleId(String theModuleId) { 169 myModuleId = theModuleId; 170 } 171 172 public String getTransactionId() { 173 return myTransactionId; 174 } 175 176 public void setTransactionId(String theTransactionId) { 177 myTransactionId = theTransactionId; 178 } 179 180 public String getUserName() { 181 return myUserName; 182 } 183 184 public void setUserName(String theUserName) { 185 myUserName = theUserName; 186 } 187 188 public String getCompleteUrl() { 189 return myCompleteUrl; 190 } 191 192 public void setCompleteUrl(String theCompleteUrl) { 193 myCompleteUrl = theCompleteUrl; 194 } 195 196 public String getEndpoint() { 197 return myEndpoint; 198 } 199 200 public void setEndpoint(String theEndpoint) { 201 myEndpoint = theEndpoint; 202 } 203 204 public String getEventType() { 205 return myEventType; 206 } 207 208 public void setEventType(String theEventType) { 209 myEventType = theEventType; 210 } 211 212 public String getEventSubType() { 213 return myEventSubType; 214 } 215 216 public void setEventSubType(String theEventSubType) { 217 myEventSubType = theEventSubType; 218 } 219 220 public String getOutcome() { 221 return myOutcome; 222 } 223 224 public void setOutcome(String theOutcome) { 225 myOutcome = theOutcome; 226 } 227 228 @JsonPropertyOrder({ 229 "id", 230 "initialTimestamp", 231 "type", 232 "subType", 233 "outcome", 234 "endpointNodeId", 235 "endpointModuleId", 236 "processingTime", 237 "endpointLocalHost", 238 "endpointLocalPort", 239 "endpointRemoteHost", 240 "endpointRemotePort", 241 "requestId", 242 "events", 243 "additionalJson" 244 }) 245 // TODO KHS move toplevel 246 public static class TransactionLogEventJson implements IModelJson { 247 248 @Schema(description = "Local host of the endpoint that processed the request.") 249 @JsonProperty("endpointLocalHost") 250 private String myEndpointLocalHost; 251 252 @Schema(description = "Local port of the endpoint that processed the request.") 253 @JsonProperty("endpointLocalPort") 254 private Integer myEndpointLocalPort; 255 256 @Schema( 257 description = "Module Id of the Endpoint Module that received the request generated the record.", 258 example = "fhir_endpoint", 259 requiredMode = Schema.RequiredMode.NOT_REQUIRED) 260 @JsonProperty("endpointModuleId") 261 private String myEndpointModuleId; 262 263 @Schema(description = "Node Id of the endpoint that processed the request.") 264 @JsonProperty("endpointNodeId") 265 private String myEndpointNodeId; 266 267 @Schema(description = "Remote host of the client that made the request.") 268 @JsonProperty("endpointRemoteHost") 269 private String myEndpointRemoteHost; 270 271 @Schema(description = "Remote port of the client that made the request.") 272 @JsonProperty("endpointRemotePort") 273 private Integer myEndpointRemotePort; 274 275 @Schema(description = "The individual steps within this transaction log event.") 276 @JsonProperty("events") 277 private List<TransactionLogStepJson> myEvents; 278 279 @Schema(description = "The unique identifier of this transaction log event.") 280 @JsonProperty("id") 281 private Long myId; 282 283 @Schema(description = "The timestamp when this transaction was initiated.") 284 @JsonProperty("initialTimestamp") 285 @com.fasterxml.jackson.databind.annotation.JsonSerialize(using = JsonDateSerializerJacksonV2Deprecated.class) 286 @JsonSerialize(using = JsonDateSerializer.class) 287 @com.fasterxml.jackson.databind.annotation.JsonDeserialize( 288 using = JsonDateDeserializerJacksonV2Deprecated.class) 289 @JsonDeserialize(using = JsonDateDeserializer.class) 290 private Date myInitialTimestamp; 291 292 @Schema(description = "The outcome of the transaction.") 293 @JsonProperty("outcome") 294 private TransactionLogOutcomeEnum myOutcome; 295 296 @Schema(description = "The processing time in milliseconds.") 297 @JsonProperty("processingTime") 298 private long myProcessingTime; 299 300 @Schema(description = "The event sub-type.") 301 @JsonProperty("subType") 302 private TransactionLogEventSubTypeEnum mySubType; 303 304 @Schema(description = "The event type.") 305 @JsonProperty("type") 306 private TransactionLogEventTypeEnum myType; 307 308 @Schema(description = "The request identifier.") 309 @JsonProperty("requestId") 310 private String myRequestId; 311 312 @Schema(description = "The user PID.") 313 @JsonProperty("userId") 314 private Long myUserId; 315 316 @Schema( 317 description = 318 "Module Id of the Module that manages the security for the user that generated the record.", 319 example = "local_security", 320 requiredMode = Schema.RequiredMode.NOT_REQUIRED) 321 @JsonProperty("userModuleId") 322 private String myUserModuleId; 323 324 @Schema(description = "Node Id of the user's security module.") 325 @JsonProperty("userNodeId") 326 private String myUserNodeId; 327 328 @Schema(description = "The username of the user who initiated the transaction.") 329 @JsonProperty("userName") 330 private String username; 331 332 @Schema(description = "The family name of the user who initiated the transaction.") 333 @JsonProperty("userFamilyName") 334 private String myUserFamilyName; 335 336 @Schema(description = "The given name of the user who initiated the transaction.") 337 @JsonProperty("userGivenName") 338 private String myUserGivenName; 339 340 @Schema(description = "The OAuth2 client Id that initiated the transaction.") 341 @JsonProperty("clientId") 342 private String myClientId; 343 344 @Schema(description = "The node Id of the client's security module.") 345 @JsonProperty("clientNodeId") 346 private String myClientNodeId; 347 348 @Schema(description = "The module Id of the client's security module.") 349 @JsonProperty("clientModuleId") 350 private String myClientModuleId; 351 352 @Schema(description = "The client PID.") 353 @JsonProperty("clientPid") 354 private Long myClientPid; 355 356 @Schema(description = "The display name of the OAuth2 client.") 357 @JsonProperty("clientName") 358 private String myClientName; 359 360 @Schema(description = "The transaction GUID linking related events.") 361 @JsonProperty("transactionGuid") 362 private String myTransactionGuid; 363 364 @Schema(description = "Additional JSON data associated with this event.") 365 @com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = RawJsonDeserializerJacksonV2Deprecated.class) 366 @JsonDeserialize(using = RawJsonDeserializer.class) 367 @JsonRawValue 368 @JsonProperty("additionalJson") 369 private String myAdditionalJson; 370 371 public String getEndpointLocalHost() { 372 return myEndpointLocalHost; 373 } 374 375 public void setEndpointLocalHost(String theEndpointLocalHost) { 376 myEndpointLocalHost = theEndpointLocalHost; 377 } 378 379 public Integer getEndpointLocalPort() { 380 return myEndpointLocalPort; 381 } 382 383 public void setEndpointLocalPort(Integer theEndpointLocalPort) { 384 myEndpointLocalPort = theEndpointLocalPort; 385 } 386 387 public String getEndpointModuleId() { 388 return myEndpointModuleId; 389 } 390 391 public void setEndpointModuleId(String theEntpointId) { 392 myEndpointModuleId = theEntpointId; 393 } 394 395 public String getEndpointNodeId() { 396 return myEndpointNodeId; 397 } 398 399 public void setEndpointNodeId(String theNodeId) { 400 myEndpointNodeId = theNodeId; 401 } 402 403 public String getEndpointRemoteHost() { 404 return myEndpointRemoteHost; 405 } 406 407 public void setEndpointRemoteHost(String theEndpointRemoteHost) { 408 myEndpointRemoteHost = theEndpointRemoteHost; 409 } 410 411 public Integer getEndpointRemotePort() { 412 return myEndpointRemotePort; 413 } 414 415 public void setEndpointRemotePort(Integer theEndpointRemotePort) { 416 myEndpointRemotePort = theEndpointRemotePort; 417 } 418 419 public List<TransactionLogStepJson> getEvents() { 420 if (myEvents == null) { 421 myEvents = new ArrayList<>(); 422 } 423 return myEvents; 424 } 425 426 public Long getId() { 427 return myId; 428 } 429 430 public void setId(Long thePid) { 431 myId = thePid; 432 } 433 434 public Date getInitialTimestamp() { 435 return myInitialTimestamp; 436 } 437 438 public void setInitialTimestamp(Date theTimestamp) { 439 myInitialTimestamp = theTimestamp; 440 if (myInitialTimestamp instanceof Timestamp) { 441 myInitialTimestamp = new Date(myInitialTimestamp.getTime()); 442 } 443 } 444 445 public TransactionLogOutcomeEnum getOutcome() { 446 return myOutcome; 447 } 448 449 public void setOutcome(TransactionLogOutcomeEnum theOutcome) { 450 myOutcome = theOutcome; 451 } 452 453 public long getProcessingTime() { 454 return myProcessingTime; 455 } 456 457 public void setProcessingTime(long theProcessingTime) { 458 myProcessingTime = theProcessingTime; 459 } 460 461 public TransactionLogEventSubTypeEnum getSubType() { 462 return mySubType; 463 } 464 465 public void setSubType(TransactionLogEventSubTypeEnum theSubType) { 466 mySubType = theSubType; 467 } 468 469 public TransactionLogEventTypeEnum getType() { 470 return myType; 471 } 472 473 public void setType(TransactionLogEventTypeEnum theTransactionLogEventTypeEnum) { 474 myType = theTransactionLogEventTypeEnum; 475 } 476 477 public String getRequestId() { 478 return myRequestId; 479 } 480 481 public void setRequestId(String theRequestId) { 482 myRequestId = theRequestId; 483 } 484 485 public Long getUserId() { 486 return myUserId; 487 } 488 489 public void setUserId(Long userId) { 490 this.myUserId = userId; 491 } 492 493 public String getUserModuleId() { 494 return myUserModuleId; 495 } 496 497 public void setUserModuleId(String userModuleId) { 498 this.myUserModuleId = userModuleId; 499 } 500 501 public String getUserNodeId() { 502 return myUserNodeId; 503 } 504 505 public void setUserNodeId(String userNodeId) { 506 this.myUserNodeId = userNodeId; 507 } 508 509 public String getUsername() { 510 return username; 511 } 512 513 public void setUsername(String username) { 514 this.username = username; 515 } 516 517 public String getUserFamilyName() { 518 return myUserFamilyName; 519 } 520 521 public void setUserFamilyName(String userFamilyName) { 522 this.myUserFamilyName = userFamilyName; 523 } 524 525 public String getUserGivenName() { 526 return myUserGivenName; 527 } 528 529 public void setUserGivenName(String userGivenName) { 530 this.myUserGivenName = userGivenName; 531 } 532 533 public String getClientId() { 534 return myClientId; 535 } 536 537 public void setClientId(String clientId) { 538 this.myClientId = clientId; 539 } 540 541 public String getClientModuleId() { 542 return myClientModuleId; 543 } 544 545 public void setClientModuleId(String clientModuleId) { 546 this.myClientModuleId = clientModuleId; 547 } 548 549 public String getClientNodeId() { 550 return myClientNodeId; 551 } 552 553 public void setClientNodeId(String clientNodeId) { 554 this.myClientNodeId = clientNodeId; 555 } 556 557 public Long getClientPid() { 558 return myClientPid; 559 } 560 561 public void setClientPid(Long clientPid) { 562 this.myClientPid = clientPid; 563 } 564 565 public String getClientName() { 566 return myClientName; 567 } 568 569 public void setClientName(String clientName) { 570 this.myClientName = clientName; 571 } 572 573 public String getTransactionGuid() { 574 return myTransactionGuid; 575 } 576 577 public void setTransactionGuid(String theTransactionGuid) { 578 myTransactionGuid = theTransactionGuid; 579 } 580 581 public String getAdditionalJson() { 582 return myAdditionalJson; 583 } 584 585 public void setAdditionalJson(String theAdditionalJson) { 586 this.myAdditionalJson = theAdditionalJson; 587 } 588 } 589}