Class AuditEntry

java.lang.Object
org.apache.juneau.petstore.service.AuditEntry

public class AuditEntry extends Object
One audit-trail record: who changed which petstore entity, how, and when.

PetStore appends one entry for every successful create, update or delete, whether it came from the /petstore API (actor "api") or from the console (actor "console:<user>"). Failed mutations append nothing. The Audit console page lists these entries.

Example:

PetStore store = new PetStore(); store.createPet(new Pet().setName("Rex"), "console:alice"); AuditEntry e = store.getAudit().get(0); // e.getEntity() = "Pet", e.getAction() = "CREATE", e.getDetail() = "Rex"

  • Constructor Details

  • Method Details

    • getId

      public long getId()
      Returns:
      The audit id, increasing in insertion order.
    • setId

      public AuditEntry setId(long value)
      Parameters:
      value - The audit id.
      Returns:
      This object.
    • getAt

      public Instant getAt()
      Returns:
      When the mutation happened, from the store's Clock.
    • setAt

      public AuditEntry setAt(Instant value)
      Parameters:
      value - The timestamp.
      Returns:
      This object.
    • getActor

      public String getActor()
      Returns:
      Who made the change, e.g. "api" or "console:alice".
    • setActor

      public AuditEntry setActor(String value)
      Parameters:
      value - The actor.
      Returns:
      This object.
    • getEntity

      public String getEntity()
      Returns:
      The entity kind: "Pet", "Order", "User" or "Change".
    • setEntity

      public AuditEntry setEntity(String value)
      Parameters:
      value - The entity kind.
      Returns:
      This object.
    • getEntityId

      public String getEntityId()
      Returns:
      The entity id (pet/order id, or username).
    • setEntityId

      public AuditEntry setEntityId(String value)
      Parameters:
      value - The entity id.
      Returns:
      This object.
    • getAction

      public String getAction()
      Returns:
      The action, e.g. "CREATE", "UPDATE", "DELETE".
    • setAction

      public AuditEntry setAction(String value)
      Parameters:
      value - The action.
      Returns:
      This object.
    • getDetail

      public String getDetail()
      Returns:
      A short human-readable detail (pet name, username, ...), or null.
    • setDetail

      public AuditEntry setDetail(String value)
      Parameters:
      value - The detail.
      Returns:
      This object.