Class AuditLog

java.lang.Object
org.deltava.beans.AuditLog
All Implemented Interfaces:
Comparable<AuditLog>, AuditEntry, AuthoredBean, RemoteAddressBean

public class AuditLog extends Object implements AuditEntry, RemoteAddressBean, Comparable<AuditLog>
A bean to store an audit log record.
Since:
7.4
Version:
11.1
Author:
Luke
  • Field Details

  • Constructor Details

    • AuditLog

      public AuditLog(String type, String id, int authorID)
      Creates the log entry.
      Parameters:
      type - the entry type
      id - the entry ID
      authorID - the author's database ID
    • AuditLog

      public AuditLog(Auditable a, int authorID)
      Creates the log entry.
      Parameters:
      a - the Auditable object
      authorID - the author's database ID
  • Method Details

    • create

      public static AuditLog create(Auditable a, Collection<BeanUtils.PropertyChange> delta, int authorID)
      Creates an audit log from a list of bean property changes.
      Parameters:
      a - the Auditable object
      delta - the list of changes
      authorID - the author's database ID
      Returns:
      an AuditLog, or null if no changes
    • getAuthorID

      public int getAuthorID()
      Description copied from interface: AuthoredBean
      Returns the Author of this bean.
      Specified by:
      getAuthorID in interface AuthoredBean
      Returns:
      the author's database ID
      See Also:
    • getAuditType

      public String getAuditType()
      Description copied from interface: AuditEntry
      Returns the audit object type.
      Specified by:
      getAuditType in interface AuditEntry
      Returns:
      the type
    • getAuditID

      public String getAuditID()
      Description copied from interface: AuditEntry
      Returns the audit object ID.
      Specified by:
      getAuditID in interface AuditEntry
      Returns:
      the ID
    • getDate

      public Instant getDate()
      Description copied from interface: AuditEntry
      Returns the date the entry was created.
      Specified by:
      getDate in interface AuditEntry
      Returns:
      the creation date/time
    • getApplication

      public String getApplication()
      Returns the application name.
      Returns:
      the application name, or COMMON for shared objects
    • getDescription

      public String getDescription()
      Description copied from interface: AuditEntry
      Returns the entry description.
      Specified by:
      getDescription in interface AuditEntry
      Returns:
      the description
    • getRemoteAddr

      public String getRemoteAddr()
      Description copied from interface: RemoteAddressBean
      Returns the remote IP address.
      Specified by:
      getRemoteAddr in interface RemoteAddressBean
      Returns:
      an IPv4 or IPv6 address
    • getRemoteHost

      public String getRemoteHost()
      Description copied from interface: RemoteAddressBean
      Returns the remote host name.
      Specified by:
      getRemoteHost in interface RemoteAddressBean
      Returns:
      the host name, or address if unresolved
    • setAuthorID

      public void setAuthorID(int id)
      Description copied from interface: AuthoredBean
      Updates the author of this bean.
      Specified by:
      setAuthorID in interface AuthoredBean
      Parameters:
      id - the author's database ID.
      See Also:
    • setDescription

      public void setDescription(String desc)
      Updates the entry description.
      Parameters:
      desc - the description
    • setDate

      public void setDate(Instant i)
      Updates the entry creation date.
      Parameters:
      i - the date/time
    • setApplication

      public void setApplication(String appName)
      Updates the application name.
      Parameters:
      appName - the name, or COMMON for shared objects
    • setRemoteAddr

      public void setRemoteAddr(String addr)
      Updates the IP address for this audit entry.
      Parameters:
      addr - the address
    • setRemoteHost

      public void setRemoteHost(String host)
      Updates the host name for this audit entry.
      Parameters:
      host - the host name
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • compareTo

      public int compareTo(AuditLog ae2)
      Specified by:
      compareTo in interface Comparable<AuditLog>