Class AuditLog


public final class AuditLog extends IdentifiableEntity
Represents an audit log entry in the system. Used to record actions performed by users, along with metadata such as the IP address and timestamp of the action.

This entity extends IdentifiableEntity, which provides a unique id for each log entry.

The table audit_logs has the following indexes for performance optimization:

  • idx_audit_created - Indexed on created_at to speed up time-based queries.

Fields include:

  • action - A description of the action performed.
  • ipAddress - IP address of the user who performed the action.
  • createdAt - Timestamp when the action was performed.
  • user - The User who performed the action.

Note: This class is declared final to prevent inheritance and ensure session integrity.

Since:
2026-02-03
Version:
1.0
Author:
@ZouariOmar (zouariomar20@gmail.com)
See Also:
  • Constructor Details

    • AuditLog

      public AuditLog()
      Creates an empty audit log entity.
  • Method Details

    • getAction

      public String getAction()
      Returns the action associated with this log entry.
      Returns:
      action value for this audit record
    • setAction

      public void setAction(String action)
      Sets the action associated with this log entry.
      Parameters:
      action - audit action value to persist
    • getOsName

      public String getOsName()
      Returns the operating system name captured at creation time.
      Returns:
      operating system name
    • getHostname

      public String getHostname()
      Returns the hostname captured at creation time.
      Returns:
      host name
    • getPrivateIpAddress

      public String getPrivateIpAddress()
      Returns the private IP address captured at creation time.
      Returns:
      private IP address
    • getMacAddress

      public String getMacAddress()
      Returns the MAC address captured at creation time.
      Returns:
      MAC address
    • getLocation

      public String getLocation()
      Returns the location metadata captured at creation time.
      Returns:
      location metadata
    • getCreatedAt

      public Instant getCreatedAt()
      Returns the audit creation timestamp.
      Returns:
      creation timestamp
    • getSession

      public AuthSession getSession()
      Returns the linked authentication session.
      Returns:
      linked authentication session
    • setSession

      public void setSession(AuthSession session)
      Sets the linked authentication session.
      Parameters:
      session - authentication session related to this audit entry