Class ActivityAuditEventBuilder<T extends ActivityAuditEventBuilder<T>>

java.lang.Object
org.forgerock.audit.events.AuditEventBuilder<T>
org.forgerock.audit.events.ActivityAuditEventBuilder<T>
Type Parameters:
T - the type of the builder

public class ActivityAuditEventBuilder<T extends ActivityAuditEventBuilder<T>> extends AuditEventBuilder<T>
Builder for audit activity events.

This builder should not be used directly but be specialized for each product to allow to define new specific fields, e.g

 
 class OpenProductActivityAuditEventBuilder<T extends OpenProductActivityAuditEventBuilder<T>>
         extends ActivityAuditEventBuilder<T> {

     public static <T> OpenProductActivityAuditEventBuilder<?> productActivityEvent() {
         return new OpenProductActivityAuditEventBuilder();
     }

     public T someField(String v) {
         jsonValue.put("someField", v);
         return self();
     }

    ...
 }
 
 
  • Field Details

  • Constructor Details

    • ActivityAuditEventBuilder

      protected ActivityAuditEventBuilder()
      Creates the builder.
  • Method Details

    • activityEvent

      public static ActivityAuditEventBuilder<?> activityEvent()
      Starts to build an audit activity event.

      Note: it is preferable to use a specialized builder that allow to add fields specific to a product.

      Returns:
      an audit activity event builder
    • setDefaults

      protected void setDefaults()
      Called by AuditEventBuilder.toEvent() to allow any unset fields to be given their default value. When overriding this method, the super class implementation must be called.
      Overrides:
      setDefaults in class AuditEventBuilder<T extends org.forgerock.audit.events.StateChangeAuditEventBuilder<T>>
    • validate

      protected void validate()
      Called by AuditEventBuilder.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.
      Overrides:
      validate in class AuditEventBuilder<T extends org.forgerock.audit.events.StateChangeAuditEventBuilder<T>>
    • runAs

      public final T runAs(String id)
      Sets the provided runAs for the event.
      Parameters:
      id - the id of user this operation was performed as.
      Returns:
      this builder
    • objectId

      public final T objectId(String objectId)
      Sets the provided objectId for the event.
      Parameters:
      objectId - the resource identifier.
      Returns:
      this builder
    • operation

      public final T operation(String operation)
      Sets the provided operation for the event.
      Parameters:
      operation - the type of operation (e.g. CREATE, READ, UPDATE, DELETE, PATCH, QUERY, or the ACTION name).
      Returns:
      this builder
    • before

      public final T before(String state)
      Records the previous state of the modified object as a String.
      Parameters:
      state - A String representation of the object's previous state.
      Returns:
      this builder
    • before

      public final T before(JsonValue state)
      Records the previous state of the modified object as JSON.
      Parameters:
      state - A JSON representation of the object's previous state.
      Returns:
      this builder
    • after

      public final T after(String state)
      Records the new state of the modified object as a String.
      Parameters:
      state - A String representation of the object's new state.
      Returns:
      this builder
    • after

      public final T after(JsonValue state)
      Records the new state of the modified object as JSON.
      Parameters:
      state - A JSON representation of the object's new state.
      Returns:
      this builder
    • revision

      public final T revision(String newRevision)
      Sets the revision for the event.
      Parameters:
      newRevision - resulting revision of the affected object.
      Returns:
      this builder
    • changedFields

      public final T changedFields(String... fieldNames)
      Sets the list of fields that were changed by this update.
      Parameters:
      fieldNames - of the object that were updated.
      Returns:
      this builder
    • objectIdFromCrestRequest

      public final T objectIdFromCrestRequest(Request request)
      Sets objectId method from Request.
      Parameters:
      request - The CREST request.
      Returns:
      this builder
    • operationFromCrestRequest

      public final T operationFromCrestRequest(Request request)
      Sets operation method from Request.
      Parameters:
      request - The CREST request.
      Returns:
      this builder