Class AbstractAuditBackend
- java.lang.Object
-
- org.nuxeo.ecm.platform.audit.service.AbstractAuditBackend
-
- All Implemented Interfaces:
AuditAdmin
,AuditLogger
,AuditReader
,AuditStorage
,Logs
,AuditBackend
- Direct Known Subclasses:
DefaultAuditBackend
,ESAuditBackend
,MongoDBAuditBackend
public abstract class AbstractAuditBackend extends Object implements AuditBackend, AuditStorage
Abstract class to share code betweenAuditBackend
implementations- Author:
- tiry
-
-
Field Summary
Fields Modifier and Type Field Description protected NXAuditEventsService
component
protected AuditBackendDescriptor
config
protected ExpressionEvaluator
expressionEvaluator
static String
FORCE_AUDIT_FACET
protected static org.apache.logging.log4j.Logger
log
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractAuditBackend()
protected
AbstractAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
await(long time, TimeUnit unit)
LogEntry
buildEntryFromEvent(Event event)
Returns a log entry representation of an event.protected Predicate
convert(FilterMapEntry entry)
protected LogEntry
doCreateAndFillEntryFromDocument(DocumentModel doc, Principal principal)
protected void
doPutExtendedInfos(LogEntry entry, EventContext eventContext, DocumentModel source, Principal principal)
protected long
doSyncNode(BaseLogEntryProvider provider, CoreSession session, DocumentModel node, boolean recurs)
Set<String>
getAuditableEventNames()
Returns the list of auditable event names.long
getLatestLogId(String repositoryId, String... eventIds)
Returns the latest log id matching events and repository or 0 when no match found.List<LogEntry>
getLogEntriesAfter(long logIdOffset, int limit, String repositoryId, String... eventIds)
Returns up to limit log entries matching events and repository with log id greater or equal to logIdOffset.List<LogEntry>
getLogEntriesFor(String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
Deprecated.protected DocumentModel
guardedDocument(CoreSession session, DocumentRef reference)
protected DocumentModelList
guardedDocumentChildren(CoreSession session, DocumentRef reference)
protected boolean
isAuditable(EventBundle eventBundle)
void
logEvent(Event event)
Deprecated.void
logEvents(EventBundle bundle)
Deprecated.abstract ExtendedInfo
newExtendedInfo(Serializable value)
Create a new ExtendedInfo instanceLogEntry
newLogEntry()
Create a new LogEntry instance.protected void
populateExtendedInfo(LogEntry entry, DocumentModel source, ExpressionContext context, Collection<ExtendedInfoDescriptor> extInfos)
List<LogEntry>
queryLogsByPage(String[] eventIds, Date limit, String[] categories, String path, int pageNb, int pageSize)
void
restore(AuditStorage auditStorage, int batchSize, int keepAlive)
Restore the backend from the givenAuditStorage
protected long
syncLogCreationEntries(BaseLogEntryProvider provider, String repoId, String path, Boolean recurs)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditAdmin
getEventsCount, syncLogCreationEntries
-
Methods inherited from interface org.nuxeo.ecm.platform.audit.service.AuditBackend
getApplicationStartedOrder, onApplicationStarted, onApplicationStopped, onShutdown
-
Methods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditLogger
addLogEntries
-
Methods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditReader
getLogEntriesFor, getLogEntriesFor, getLogEntryByID, nativeQuery, nativeQuery, nativeQueryLogs, queryLogs, queryLogs, queryLogsByPage, queryLogsByPage, queryLogsByPage
-
Methods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditStorage
append, scroll, scroll
-
-
-
-
Field Detail
-
log
protected static final org.apache.logging.log4j.Logger log
-
FORCE_AUDIT_FACET
public static final String FORCE_AUDIT_FACET
- See Also:
- Constant Field Values
-
component
protected final NXAuditEventsService component
-
config
protected final AuditBackendDescriptor config
-
expressionEvaluator
protected final ExpressionEvaluator expressionEvaluator
-
-
Constructor Detail
-
AbstractAuditBackend
protected AbstractAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config)
-
AbstractAuditBackend
protected AbstractAuditBackend()
-
-
Method Detail
-
guardedDocument
protected DocumentModel guardedDocument(CoreSession session, DocumentRef reference)
-
guardedDocumentChildren
protected DocumentModelList guardedDocumentChildren(CoreSession session, DocumentRef reference)
-
doCreateAndFillEntryFromDocument
protected LogEntry doCreateAndFillEntryFromDocument(DocumentModel doc, Principal principal)
-
doPutExtendedInfos
protected void doPutExtendedInfos(LogEntry entry, EventContext eventContext, DocumentModel source, Principal principal)
-
populateExtendedInfo
protected void populateExtendedInfo(LogEntry entry, DocumentModel source, ExpressionContext context, Collection<ExtendedInfoDescriptor> extInfos)
- Since:
- 7.4
-
getAuditableEventNames
public Set<String> getAuditableEventNames()
Description copied from interface:AuditLogger
Returns the list of auditable event names.- Specified by:
getAuditableEventNames
in interfaceAuditLogger
- Returns:
- list of String representing event names.
-
buildEntryFromEvent
public LogEntry buildEntryFromEvent(Event event)
Description copied from interface:AuditLogger
Returns a log entry representation of an event.- Specified by:
buildEntryFromEvent
in interfaceAuditLogger
-
newLogEntry
public LogEntry newLogEntry()
Description copied from interface:AuditLogger
Create a new LogEntry instance.- Specified by:
newLogEntry
in interfaceAuditLogger
-
newExtendedInfo
public abstract ExtendedInfo newExtendedInfo(Serializable value)
Description copied from interface:AuditLogger
Create a new ExtendedInfo instance- Specified by:
newExtendedInfo
in interfaceAuditLogger
-
syncLogCreationEntries
protected long syncLogCreationEntries(BaseLogEntryProvider provider, String repoId, String path, Boolean recurs)
-
doSyncNode
protected long doSyncNode(BaseLogEntryProvider provider, CoreSession session, DocumentModel node, boolean recurs)
-
logEvents
@Deprecated public void logEvents(EventBundle bundle)
Deprecated.Description copied from interface:AuditLogger
Logs a bundle of events- Specified by:
logEvents
in interfaceAuditLogger
-
isAuditable
protected boolean isAuditable(EventBundle eventBundle)
-
logEvent
@Deprecated public void logEvent(Event event)
Deprecated.Description copied from interface:AuditLogger
Logs an Event.- Specified by:
logEvent
in interfaceAuditLogger
-
await
public boolean await(long time, TimeUnit unit) throws InterruptedException
- Specified by:
await
in interfaceAuditLogger
- Throws:
InterruptedException
-
getLogEntriesFor
@Deprecated public List<LogEntry> getLogEntriesFor(String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
Deprecated.Description copied from interface:AuditReader
Returns the logs given a doc uuid, a map of filters and a default sort.- Specified by:
getLogEntriesFor
in interfaceAuditReader
- Parameters:
uuid
- the document uuidfilterMap
- the map of filters to applydoDefaultSort
- the default sort to set (eventDate desc)- Returns:
- a list of log entries
-
convert
protected Predicate convert(FilterMapEntry entry)
-
queryLogsByPage
public List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] categories, String path, int pageNb, int pageSize)
- Specified by:
queryLogsByPage
in interfaceAuditReader
-
getLatestLogId
public long getLatestLogId(String repositoryId, String... eventIds)
Description copied from interface:AuditReader
Returns the latest log id matching events and repository or 0 when no match found.- Specified by:
getLatestLogId
in interfaceAuditReader
-
getLogEntriesAfter
public List<LogEntry> getLogEntriesAfter(long logIdOffset, int limit, String repositoryId, String... eventIds)
Description copied from interface:AuditReader
Returns up to limit log entries matching events and repository with log id greater or equal to logIdOffset.- Specified by:
getLogEntriesAfter
in interfaceAuditReader
-
restore
public void restore(AuditStorage auditStorage, int batchSize, int keepAlive)
Description copied from interface:AuditBackend
Restore the backend from the givenAuditStorage
- Specified by:
restore
in interfaceAuditBackend
- Parameters:
auditStorage
- the audit storagebatchSize
- the batch sizekeepAlive
- the keep alive duration
-
-