Class AuditDto

java.lang.Object
com.qfs.snl.dtos.AuditDto
All Implemented Interfaces:
IAudit, IIdentifiable, Serializable

public class AuditDto extends Object implements IAudit, Serializable
The audit data transfer object.
Author:
ActiveViam
See Also:
  • Constructor Details Link icon

    • AuditDto Link icon

      public AuditDto()
      Constructor.
    • AuditDto Link icon

      public AuditDto(long id, long timestamp, String username, String ip, String hostname)
      Constructor.
      Parameters:
      id - audit id
      timestamp - time in milliseconds at which the action occurred
      username - the user performing the action
      ip - the ip address
      hostname - name of the host
    • AuditDto Link icon

      public AuditDto(IAudit audit)
      Constructor.
      Parameters:
      audit - to duplicate
  • Method Details Link icon

    • create Link icon

      public static AuditDto create(IAudit audit)
      Creates a DTO from an existing audit.

      If the audit is null, the equivalent DTO is null as well.

      Parameters:
      audit - audit to convert
      Returns:
      the DTO or null
    • getId Link icon

      public long getId()
      Description copied from interface: IIdentifiable
      Gets the resource id.
      Specified by:
      getId in interface IIdentifiable
      Returns:
      the id
    • setId Link icon

      public AuditDto setId(long id)
      Sets this audit unique id.
      Returns:
      this
    • getTimestamp Link icon

      public long getTimestamp()
      Description copied from interface: IAudit
      Return the timestamp in milliseconds when the action occurred.
      Specified by:
      getTimestamp in interface IAudit
      Returns:
      the timestamp in milliseconds
    • setTimestamp Link icon

      public AuditDto setTimestamp(long timestamp)
      Sets the timestamp of this audit entry.
      Parameters:
      timestamp - date time in milliseconds
      Returns:
      this
    • getUsername Link icon

      public String getUsername()
      Description copied from interface: IAudit
      Return the name of the user.
      Specified by:
      getUsername in interface IAudit
      Returns:
      the users's name
    • setUsername Link icon

      public AuditDto setUsername(String username)
      Sets the name of the user.
      Returns:
      this
    • getIp Link icon

      public String getIp()
      Description copied from interface: IAudit
      Return the ip of the computer that created the action.
      Specified by:
      getIp in interface IAudit
      Returns:
      the ip
    • setIp Link icon

      public AuditDto setIp(String ip)
      Sets the host ip address.
      Returns:
      this
    • getHostname Link icon

      public String getHostname()
      Description copied from interface: IAudit
      The hostname of the computer that created the action.
      Specified by:
      getHostname in interface IAudit
      Returns:
      the hostname
    • setHostname Link icon

      public AuditDto setHostname(String hostname)
      Sets the hostname of the host machine.
      Returns:
      this
    • toString Link icon

      public String toString()
      Overrides:
      toString in class Object
    • toString Link icon

      public static String toString(IAudit obj)
      Returns the string representation of the given audit.
    • hashCode Link icon

      public int hashCode()
      Overrides:
      hashCode in class Object
    • hashCode Link icon

      public static int hashCode(IAudit obj)
      Returns the hashcode of the given audit.
    • equals Link icon

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equals Link icon

      public static boolean equals(IAudit audit, Object obj)
      Tests the equality between a IAudit and an object.

      Two audit entries are equals if they come from the same user, using the same ip on the same host simultaneously.
      This is consistent for an append-only resource.

      Parameters:
      audit - the reference audit
      obj - the object to test
      Returns:
      true for equality