public class AuditEvent extends Object implements Serializable
Users can inject a AuditEventRepository
to publish their own events or
alternatively use Spring's ApplicationEventPublisher
(usually obtained by
implementing ApplicationEventPublisherAware
) to publish AuditApplicationEvents
(wrappers for AuditEvent).
AuditEventRepository
,
Serialized FormConstructor and Description |
---|
AuditEvent(Instant timestamp,
String principal,
String type,
Map<String,Object> data)
Create a new audit event.
|
AuditEvent(String principal,
String type,
Map<String,Object> data)
Create a new audit event for the current time.
|
AuditEvent(String principal,
String type,
String... data)
Create a new audit event for the current time from data provided as name-value
pairs.
|
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getData()
Returns the event data.
|
String |
getPrincipal()
Returns the user principal responsible for the event or an empty String if the
principal is not available.
|
Instant |
getTimestamp()
Returns the date/time that the event was logged.
|
String |
getType()
Returns the type of event.
|
String |
toString() |
public AuditEvent(String principal, String type, Map<String,Object> data)
principal
- the user principal responsibletype
- the event typedata
- the event datapublic AuditEvent(String principal, String type, String... data)
principal
- the user principal responsibletype
- the event typedata
- the event data in the form 'key=value' or simply 'key'public Instant getTimestamp()
public String getPrincipal()
public String getType()
Copyright © 2021 Pivotal Software, Inc.. All rights reserved.