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