Package org.forgerock.audit.events
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 Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class org.forgerock.audit.events.AuditEventBuilder
EVENT_NAME, ISO_OFFSET_DATE_TIME_FORMAT, jsonValue, TIMESTAMP, TRACKING_IDS, TRANSACTION_ID, USER_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ActivityAuditEventBuilder<?>
Starts to build an audit activity event.final T
Records the new state of the modified object as a String.final T
Records the new state of the modified object as JSON.final T
Records the previous state of the modified object as a String.final T
Records the previous state of the modified object as JSON.final T
changedFields
(String... fieldNames) Sets the list of fields that were changed by this update.final T
Sets the provided objectId for the event.final T
objectIdFromCrestRequest
(Request request) Sets objectId method fromRequest
.final T
Sets the provided operation for the event.final T
operationFromCrestRequest
(Request request) Sets operation method fromRequest
.final T
Sets the revision for the event.final T
Sets the provided runAs for the event.protected void
Called byAuditEventBuilder.toEvent()
to allow any unset fields to be given their default value.protected void
validate()
Called byAuditEventBuilder.toEvent()
to ensure that the audit event will be created in a valid state.Methods inherited from class org.forgerock.audit.events.AuditEventBuilder
eventName, requireField, self, timestamp, toEvent, trackingId, trackingIds, transactionId, transactionIdFromContext, userId
-
Field Details
-
RUN_AS
- See Also:
-
OBJECT_ID
- See Also:
-
OPERATION
- See Also:
-
BEFORE
- See Also:
-
AFTER
- See Also:
-
REVISION
- See Also:
-
CHANGED_FIELDS
- See Also:
-
-
Constructor Details
-
ActivityAuditEventBuilder
protected ActivityAuditEventBuilder()Creates the builder.
-
-
Method Details
-
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 byAuditEventBuilder.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 classAuditEventBuilder<T extends org.forgerock.audit.events.StateChangeAuditEventBuilder<T>>
-
validate
protected void validate()Called byAuditEventBuilder.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 classAuditEventBuilder<T extends org.forgerock.audit.events.StateChangeAuditEventBuilder<T>>
-
runAs
Sets the provided runAs for the event.- Parameters:
id
- the id of user this operation was performed as.- Returns:
- this builder
-
objectId
Sets the provided objectId for the event.- Parameters:
objectId
- the resource identifier.- Returns:
- this builder
-
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
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
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
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
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
Sets the revision for the event.- Parameters:
newRevision
- resulting revision of the affected object.- Returns:
- this builder
-
changedFields
Sets the list of fields that were changed by this update.- Parameters:
fieldNames
- of the object that were updated.- Returns:
- this builder
-
objectIdFromCrestRequest
Sets objectId method fromRequest
.- Parameters:
request
- The CREST request.- Returns:
- this builder
-
operationFromCrestRequest
Sets operation method fromRequest
.- Parameters:
request
- The CREST request.- Returns:
- this builder
-