@Override
public Object getExtension(DocumentModel currentDocument, DocumentWrapper wrapper, Map<String, Object> ctx) {
DocumentHistoryReader historyReader = Framework.getService(DocumentHistoryReader.class);
List<LogEntry> auditEntries = null;
if (historyReader != null) {
auditEntries = historyReader.getDocumentHistory(currentDocument, 0, 1000);
} else {
if (Framework.isTestModeSet() && testAuditEntries != null) {
auditEntries = testAuditEntries;
} else {
auditEntries = new ArrayList<LogEntry>();
log.warn("Can not add Audit info to rendering context");
}
}
if (auditEntries != null) {
try {
auditEntries = preprocessAuditEntries(auditEntries, currentDocument.getCoreSession(), "en");
} catch (MissingResourceException e) {
log.warn("Unable to preprocess Audit entries : " + e.getMessage());
}
ctx.put("auditEntries", wrapper.wrap(auditEntries));
}
return null;
}