/** * Could be overridden to get other (additional) data. * * @param logEntryElement */ protected static LogEntry readLogEntry(AuditLogger audit, Element logEntryElement) { LogEntry logEntry = audit.newLogEntry(); logEntry.setCategory(logEntryElement.attributeValue("category")); logEntry.setComment(logEntryElement.attributeValue("comment")); logEntry.setDocLifeCycle(logEntryElement.attributeValue("docLifeCycle")); logEntry.setDocPath(logEntryElement.attributeValue("docPath")); logEntry.setDocType(logEntryElement.attributeValue("docType")); logEntry.setDocUUID(logEntryElement.attributeValue("docUUID")); logEntry.setRepositoryId(logEntryElement.attributeValue("repoId")); try { Date creationDate = getDateFormat().parse(logEntryElement.attributeValue("creationDate")); logEntry.setEventDate(creationDate); } catch (ParseException e) { log.error(e, e); } logEntry.setEventId(logEntryElement.attributeValue("eventId")); logEntry.setPrincipalName(logEntryElement.attributeValue("principalName")); return logEntry; }
protected List<LogEntry> preprocessAuditEntries(List<LogEntry> auditEntries, CoreSession session, String lang) throws MissingResourceException { CommentProcessorHelper helper = new CommentProcessorHelper(session); for (LogEntry entry : auditEntries) { String comment = helper.getLogComment(entry); if (comment == null) { comment = ""; } else { String i18nComment = I18NUtils.getMessageString("messages", comment, null, new Locale(lang)); if (i18nComment != null) { comment = i18nComment; } } String eventId = entry.getEventId(); String i18nEventId = I18NUtils.getMessageString("messages", eventId, null, new Locale(lang)); if (i18nEventId != null) { entry.setEventId(i18nEventId); } entry.setComment(comment); } return auditEntries; } }
log.warn("received event {} with null principal", eventName); entry.setComment((String) properties.get("comment")); if (document instanceof DeletedDocumentModel) { entry.setComment("Document does not exist anymore!"); } else { if (document.isLifeCycleLoaded()) { entry.setPrincipalName(principal.getActingUser()); entry.setComment((String) properties.get("comment"));