Class DefaultAuditBackend
java.lang.Object
org.nuxeo.ecm.platform.audit.service.AbstractAuditBackend
org.nuxeo.ecm.platform.audit.service.DefaultAuditBackend
- All Implemented Interfaces:
AuditAdmin,AuditLogger,AuditReader,AuditStorage,Logs,AuditBackend
Contains the Hibernate based (legacy) implementation
- Author:
- tiry
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CursorService<Iterator<LogEntry>,LogEntry, String> protected static final com.fasterxml.jackson.databind.ObjectMapperprotected PersistenceProviderFields inherited from class org.nuxeo.ecm.platform.audit.service.AbstractAuditBackend
component, config, expressionEvaluator, FORCE_AUDIT_FACET, log -
Constructor Summary
ConstructorsConstructorDescriptionDefaultAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaccept(boolean needActivateSession, Consumer<LogEntryProvider> consumer) protected voidvoidaddLogEntries(List<LogEntry> entries) Adds given log entries.voidprotected <T> Tapply(boolean needActivateSession, Function<LogEntryProvider, T> function) intgetEventsCount(String eventId) longgetLatestLogId(String repositoryId, String... eventIds) Returns the latest log id matching events and repository or 0 when no match found.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.getLogEntriesFor(String uuid, String repositoryId) Returns the logs given a doc uuid and a repository id.getLogEntryByID(long id) Returns a given log entry given its id.protected StringgetParamNames(String[] eventId) List<?>nativeQuery(String query, int pageNb, int pageSize) Returns a batched list of entries. query string is a native query clause for the backend : here EJBQL 3.0 must be used if implementation of audit backend is JPA (< 7.3 or audit.elasticsearch.enabled=false) and JSON if implementation is Elasticsearch.List<?>nativeQuery(String query, Map<String, Object> params, int pageNb, int pageSize) Returns a batched list of entries.nativeQueryLogs(String whereClause, int pageNb, int pageSize) Returns a batched list of log entries.newExtendedInfo(Serializable value) Create a new ExtendedInfo instancevoidvoidReturns the list of log entries.queryLogs(QueryBuilder builder) Returns the logs given a collection of predicates and a default sort.queryLogsByPage(String[] eventIds, Date limit, String[] category, String path, int pageNb, int pageSize) scroll(QueryBuilder builder, int batchSize, int keepAliveSeconds) longsyncLogCreationEntries(String repoId, String path, Boolean recurs) Forces log Synchronisation for a branch of the repository.Methods inherited from class org.nuxeo.ecm.platform.audit.service.AbstractAuditBackend
await, buildEntryFromEvent, doCreateAndFillEntryFromDocument, doPutExtendedInfos, doSyncNode, getAuditableEventNames, guardedDocument, guardedDocumentChildren, isAuditable, logEvent, logEvents, newLogEntry, populateExtendedInfo, restore, syncLogCreationEntriesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditReader
queryLogsByPage, queryLogsByPage, queryLogsByPage
-
Field Details
-
OBJECT_MAPPER
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER -
persistenceProvider
-
cursorService
-
-
Constructor Details
-
DefaultAuditBackend
-
DefaultAuditBackend
public DefaultAuditBackend()- Since:
- 9.3
-
-
Method Details
-
getApplicationStartedOrder
public int getApplicationStartedOrder() -
onApplicationStarted
public void onApplicationStarted() -
onApplicationStopped
public void onApplicationStopped() -
getOrCreatePersistenceProvider
-
activatePersistenceProvider
protected void activatePersistenceProvider() -
apply
-
accept
-
addLogEntries
Description copied from interface:AuditLoggerAdds given log entries.- Parameters:
entries- the list of log entries.
-
getLogEntriesFor
Description copied from interface:AuditReaderReturns the logs given a doc uuid and a repository id.- Parameters:
uuid- the document uuidrepositoryId- the repository id- Returns:
- a list of log entries
-
getLogEntryByID
Description copied from interface:AuditReaderReturns a given log entry given its id.- Parameters:
id- the log entry identifier- Returns:
- a LogEntry instance
-
nativeQueryLogs
Description copied from interface:AuditReaderReturns a batched list of log entries. WhereClause is a native where clause for the backend: here EJBQL 3.0 must be used if implementation of audit backend is JPA (< 7.3 or audit.elasticsearch.enabled=false) and JSON if implementation is Elasticsearch. -
nativeQuery
Description copied from interface:AuditReaderReturns a batched list of entries. query string is a native query clause for the backend : here EJBQL 3.0 must be used if implementation of audit backend is JPA (< 7.3 or audit.elasticsearch.enabled=false) and JSON if implementation is Elasticsearch. -
nativeQuery
Description copied from interface:AuditReaderReturns a batched list of entries.- Parameters:
query- a JPA query language query if implementation of audit backend is JPA (< 7.3 or audit.elasticsearch.enabled=false) and JSON if implementation is Elasticsearchparams- parameters for the querypageNb- the page number (starts at 1)pageSize- the number of results per page
-
queryLogs
Description copied from interface:AuditReaderReturns the logs given a collection of predicates and a default sort.- Parameters:
builder- the query builder to fetch log entries- Returns:
- a list of log entries
-
queryLogs
Description copied from interface:AuditReaderReturns the list of log entries.Note we will use NXQL in the future when the search engine will index history.
- Parameters:
eventIds- the event ids.dateRange- a preset date range.- Returns:
- a list of log entries.
- See Also:
-
queryLogsByPage
public List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] category, String path, int pageNb, int pageSize) - Specified by:
queryLogsByPagein interfaceAuditReader- Overrides:
queryLogsByPagein classAbstractAuditBackend
-
syncLogCreationEntries
Description copied from interface:AuditAdminForces log Synchronisation for a branch of the repository. This can be useful to add the create entries if DB was initialized from a bulk import. -
getEventsCount
-
getLoggedEventIds
-
newExtendedInfo
Description copied from interface:AuditLoggerCreate a new ExtendedInfo instance- Specified by:
newExtendedInfoin interfaceAuditLogger- Specified by:
newExtendedInfoin classAbstractAuditBackend
-
getLatestLogId
Description copied from interface:AuditReaderReturns the latest log id matching events and repository or 0 when no match found.- Specified by:
getLatestLogIdin interfaceAuditReader- Overrides:
getLatestLogIdin classAbstractAuditBackend
-
getLogEntriesAfter
public List<LogEntry> getLogEntriesAfter(long logIdOffset, int limit, String repositoryId, String... eventIds) Description copied from interface:AuditReaderReturns up to limit log entries matching events and repository with log id greater or equal to logIdOffset.- Specified by:
getLogEntriesAfterin interfaceAuditReader- Overrides:
getLogEntriesAfterin classAbstractAuditBackend
-
getParamNames
-
getParams
-
append
-
scroll
-
scroll
-