use of org.nuxeo.ecm.core.event.EventContext in project nuxeo-drive-server by nuxeo.
the class NuxeoDriveVirtualEventLogger method handleEvent.
@Override
public void handleEvent(EventBundle events) {
AuditLogger logger = Framework.getService(AuditLogger.class);
if (logger != null) {
for (Event event : events) {
EventContext ctx = event.getContext();
Object[] args = ctx.getArguments();
if (ArrayUtils.isEmpty(args)) {
return;
}
List<LogEntry> logEntries = new ArrayList<>();
for (int i = 0; i < args.length; i++) {
Object arg = args[i];
if (arg instanceof LogEntry) {
logEntries.add((LogEntry) arg);
}
}
if (!logEntries.isEmpty()) {
logger.addLogEntries(logEntries);
}
}
} else {
log.error("Can not reach AuditLogger");
}
}
Aggregations