Class AuditEventBuilder<T extends AuditEventBuilder<T>>

    • Field Detail

      • ISO_OFFSET_DATE_TIME_FORMAT

        public static final DateTimeFormatter ISO_OFFSET_DATE_TIME_FORMAT
        ISO 8601 date-time formatter '2011-12-03T10:15:30.000Z' specifically for UTC/GMT time zone.
      • jsonValue

        protected JsonValue jsonValue
        Represents the event as a JSON value.
    • Constructor Detail

      • AuditEventBuilder

        protected AuditEventBuilder()
        Creates the builder.
    • Method Detail

      • self

        protected final T self()
        Returns this object, as its actual type.
        Returns:
        this object
      • toEvent

        public final AuditEvent toEvent()
        Generates the audit event. As a side-effect of calling this method, this builder is reset to its starting state.
        Returns:
        the audit event
      • setDefaults

        protected void setDefaults()
        Called by toEvent() to allow any unset fields to be given their default value. When overriding this method, the super class implementation must be called.
      • validate

        protected void validate()
        Called by toEvent() to ensure that the audit event will be created in a valid state. When overriding this method, the super class implementation must be called.
        Throws:
        IllegalStateException - if a required field has not been populated.
      • requireField

        protected void requireField​(String rootFieldName)
        Helper method to be used when overriding validate().
        Parameters:
        rootFieldName - The name of the field that must be populated.
        Throws:
        IllegalStateException - if the required field has not been populated.
      • eventName

        public final T eventName​(String name)
        Sets the provided name for the event. An event's name will usually be of the form {product}-{component}-{operation}. For example, AM-SESSION-CREATED, AM-CREST-SUCCESSFUL, etc.
        Parameters:
        name - the event's name.
        Returns:
        this builder
      • timestamp

        public final T timestamp​(long timestamp)
        Sets the provided time stamp for the event.
        Parameters:
        timestamp - the time stamp.
        Returns:
        this builder
      • transactionId

        public final T transactionId​(String id)
        Sets the provided transactionId for the event.
        Parameters:
        id - the transaction id.
        Returns:
        this builder
      • userId

        public final T userId​(String id)
        Sets the provided userId for the event.
        Parameters:
        id - the user id.
        Returns:
        this builder
      • trackingId

        public final T trackingId​(String trackingIdValue)
        Adds an entry to trackingIds for the event.
        Parameters:
        trackingIdValue - the unique value associated with the object being tracked.
        Returns:
        this builder
      • trackingIds

        public final T trackingIds​(Set<String> trackingIdValues)
        Adds the specified entries to trackingIds for the event.
        Parameters:
        trackingIdValues - the set of trackingId entries to be recorded (see trackingId(java.lang.String).
        Returns:
        this builder
      • transactionIdFromContext

        public final T transactionIdFromContext​(org.forgerock.services.context.Context context)
        Sets transactionId from ID of TransactionIdContext, if the provided Context contains a TransactionIdContext.
        Parameters:
        context - The CREST context.
        Returns:
        this builder