/** * 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; } }
LogEntry entry = logger.newLogEntry(); entry.setCategory("NuxeoTechnicalEvent"); entry.setEventId(ESAuditBackend.MIGRATION_DONE_EVENT); entry.setPrincipalName(SecurityConstants.SYSTEM_USERNAME); entry.setEventDate(Calendar.getInstance(TimeZone.getTimeZone("UTC")).getTime());
protected LogEntry doCreateAndFillEntryFromDocument(DocumentModel doc, Principal principal) { LogEntry entry = newLogEntry(); entry.setDocPath(doc.getPathAsString()); entry.setDocType(doc.getType()); entry.setDocUUID(doc.getId()); entry.setRepositoryId(doc.getRepositoryName()); entry.setPrincipalName(SecurityConstants.SYSTEM_USERNAME); entry.setCategory("eventDocumentCategory"); entry.setEventId(DocumentEventTypes.DOCUMENT_CREATED); // why hard-code it if we have the document life cycle? entry.setDocLifeCycle("project"); Calendar creationDate = (Calendar) doc.getProperty("dublincore", "created"); if (creationDate != null) { entry.setEventDate(creationDate.getTime()); } doPutExtendedInfos(entry, null, doc, principal); return entry; }
entry.setEventId(eventName); entry.setEventDate(eventDate);