T
- the type of the builderpublic abstract class AuditEventBuilder<T extends AuditEventBuilder<T>> extends Object
Modifier and Type | Field and Description |
---|---|
static String |
EVENT_NAME
Event name event payload field name.
|
protected JsonValue |
jsonValue
Represents the event as a JSON value.
|
static String |
TIMESTAMP
Timestamp event payload field name.
|
static String |
TRACKING_IDS
Tracking IDs event payload field name.
|
static String |
TRANSACTION_ID
Transaction ID event payload field name.
|
static String |
USER_ID
User ID event payload field name.
|
Modifier | Constructor and Description |
---|---|
protected |
AuditEventBuilder()
Creates the builder.
|
Modifier and Type | Method and Description |
---|---|
T |
eventName(String name)
Sets the provided name for the event.
|
protected void |
requireField(String rootFieldName)
Helper method to be used when overriding
validate() . |
protected T |
self()
Returns this object, as its actual type.
|
protected void |
setDefaults()
Called by
toEvent() to allow any unset fields to be given their default value. |
T |
timestamp(long timestamp)
Sets the provided time stamp for the event.
|
AuditEvent |
toEvent()
Generates the audit event.
|
T |
trackingId(String trackingIdValue)
Adds an entry to trackingIds for the event.
|
T |
trackingIds(Set<String> trackingIdValues)
Adds the specified entries to trackingIds for the event.
|
T |
transactionId(String id)
Sets the provided transactionId for the event.
|
T |
transactionIdFromContext(Context context)
Sets transactionId from ID of
TransactionIdContext , if the provided
Context contains a TransactionIdContext . |
T |
userId(String id)
Sets the provided userId for the event.
|
protected void |
validate()
Called by
toEvent() to ensure that the audit event will be created in a valid state. |
public static final String EVENT_NAME
public static final String TIMESTAMP
public static final String TRANSACTION_ID
public static final String USER_ID
public static final String TRACKING_IDS
protected JsonValue jsonValue
protected final T self()
public final AuditEvent toEvent()
protected void setDefaults()
toEvent()
to allow any unset fields to be given their default value.
When overriding this method, the super class implementation must be called.protected void validate()
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.IllegalStateException
- if a required field has not been populated.protected void requireField(String rootFieldName)
validate()
.rootFieldName
- The name of the field that must be populated.IllegalStateException
- if the required field has not been populated.public final T eventName(String name)
name
- the event's name.public final T timestamp(long timestamp)
timestamp
- the time stamp.public final T transactionId(String id)
id
- the transaction id.public final T userId(String id)
id
- the user id.public final T trackingId(String trackingIdValue)
trackingIdValue
- the unique value associated with the object being tracked.public final T trackingIds(Set<String> trackingIdValues)
trackingIdValues
- the set of trackingId entries to be recorded (see trackingId(java.lang.String)
.public final T transactionIdFromContext(Context context)
TransactionIdContext
, if the provided
Context
contains a TransactionIdContext
.context
- The CREST context.Copyright © 2025 Open Identity Platform Community. All rights reserved.