Class AuditEvent.AuditEventBuilder

java.lang.Object
com.sodius.oslc.server.audit.model.AuditEvent.AuditEventBuilder
Enclosing class:
AuditEvent

public static class AuditEvent.AuditEventBuilder extends Object
A builder of audit events.
Since:
3.7.0
See Also:
  • Method Details

    • level

      public AuditEvent.AuditEventBuilder level(CoverageLevel coverageLevel)
      Uses the given coverage level for the event to generate. Default coverage level used by the builder is CoverageLevel.BASE.
      Parameters:
      coverageLevel - the event coverage level
      Returns:
      this builder
      Throws:
      NullPointerException - if coverageLevel is null
    • attribute

      public AuditEvent.AuditEventBuilder attribute(String title, Object value)
      Adds an attribute for the event to generate, to help at identifying the context of the event.
      Parameters:
      title - the attribute title
      value - the attribute value (to convert to a String), which may be null
      Returns:
      this builder
      Throws:
      NullPointerException - if title is null
    • changedValue

      public AuditEvent.AuditEventBuilder changedValue(String title, Object from, Object to)
      Adds a value that was changed along the event, to trace the previous and new values.
      Parameters:
      title - the title associated to the value
      from - the previous value (to convert to a String), which may be null
      to - the new value (to convert to a String), which may be null
      Returns:
      this builder
      Throws:
      NullPointerException - if title is null
    • affects

      public AuditEvent.AuditEventBuilder affects(Link affectedResource)
      Adds a resource that is affected by the event. The resource must have a label and may have a URI, which the administrator can navigate to, when event is displayed in audit page.
      Parameters:
      affectedResource - the resource affected by the event
      Returns:
      this builder
      Throws:
      NullPointerException - if affectedResource or its label is null
    • build

      public AuditEvent build()
      Builds the configured audit event.
      Returns:
      an audit event