Example usage for org.springframework.boot.actuate.audit AuditEvent AuditEvent

List of usage examples for org.springframework.boot.actuate.audit AuditEvent AuditEvent

Introduction

In this page you can find the example usage for org.springframework.boot.actuate.audit AuditEvent AuditEvent.

Prototype

public AuditEvent(Instant timestamp, String principal, String type, Map<String, Object> data) 

Source Link

Document

Create a new audit event.

Usage

From source file:fi.helsinki.opintoni.config.audit.AuditEventConverter.java

/**
 * Convert a list of PersistentAuditEvent to a list of AuditEvent
 *
 * @param persistentAuditEvents the list to convert
 * @return the converted list.//from  ww w  . j a  v  a2  s. co m
 */
public List<AuditEvent> convertToAuditEvent(Iterable<PersistentAuditEvent> persistentAuditEvents) {
    if (persistentAuditEvents == null) {
        return Collections.emptyList();
    }

    List<AuditEvent> auditEvents = new ArrayList<>();

    for (PersistentAuditEvent persistentAuditEvent : persistentAuditEvents) {
        AuditEvent auditEvent = new AuditEvent(persistentAuditEvent.getAuditEventDate().toDate(),
                persistentAuditEvent.getPrincipal(), persistentAuditEvent.getAuditEventType(),
                convertDataToObjects(persistentAuditEvent.getData()));
        auditEvents.add(auditEvent);
    }

    return auditEvents;
}