Package org.nuxeo.mongodb.audit
Class MongoDBAuditBackend
java.lang.Object
org.nuxeo.ecm.platform.audit.service.AbstractAuditBackend
org.nuxeo.mongodb.audit.MongoDBAuditBackend
- All Implemented Interfaces:
AuditAdmin,AuditLogger,AuditReader,AuditStorage,Logs,AuditBackend
Implementation of the
AuditBackend interface using MongoDB persistence.- Since:
- 9.1
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected com.mongodb.client.MongoCollection<org.bson.Document>static final Stringprotected CursorService<com.mongodb.client.MongoCursor<org.bson.Document>,org.bson.Document, String> static final Stringstatic final com.fasterxml.jackson.databind.ObjectMapperstatic final StringFields inherited from class org.nuxeo.ecm.platform.audit.service.AbstractAuditBackend
component, config, expressionEvaluator, FORCE_AUDIT_FACET -
Constructor Summary
ConstructorsConstructorDescriptionMongoDBAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLogEntries(List<LogEntry> entries) Adds given log entries.voidorg.bson.conversions.BsonbuildFilter(String query, Map<String, Object> params) protected org.bson.conversions.BsoncreateFilter(MultiExpression andPredicate) protected org.bson.conversions.BsoncreateSort(OrderByList orders) expandQueryVariables(String query, Object[] params) expandQueryVariables(String query, Map<String, Object> params) intcom.mongodb.client.MongoCollection<org.bson.Document>getEventsCount(String eventId) getLogEntryByID(long id) Returns a given log entry given its id.protected StringgetMongoDBKey(String key) List<?>nativeQuery(String query, Map<String, Object> params, int pageNb, int pageSize) Returns a batched list of entries.newExtendedInfo(Serializable value) Create a new ExtendedInfo instancevoidvoidqueryLogs(QueryBuilder builder) Returns the logs given a collection of predicates and a default sort.queryLogsByPage(String[] eventIds, Date limit, String[] categories, 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, getLatestLogId, getLogEntriesAfter, 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.service.AuditBackend
restoreMethods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditLogger
await, buildEntryFromEvent, getAuditableEventNames, logEvent, logEvents, newLogEntryMethods inherited from interface org.nuxeo.ecm.platform.audit.api.AuditReader
getLatestLogId, getLogEntriesAfter, getLogEntriesFor, nativeQuery, nativeQueryLogs, queryLogs, queryLogsByPage, queryLogsByPage, queryLogsByPage
-
Field Details
-
AUDIT_DATABASE_ID
- See Also:
-
COLLECTION_NAME_PROPERTY
- See Also:
-
DEFAULT_COLLECTION_NAME
- See Also:
-
SEQ_NAME
- See Also:
-
OBJECT_MAPPER
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER -
collection
protected com.mongodb.client.MongoCollection<org.bson.Document> collection -
provider
-
cursorService
protected CursorService<com.mongodb.client.MongoCursor<org.bson.Document>,org.bson.Document, cursorServiceString>
-
-
Constructor Details
-
MongoDBAuditBackend
-
MongoDBAuditBackend
public MongoDBAuditBackend()- Since:
- 9.3
-
-
Method Details
-
getApplicationStartedOrder
public int getApplicationStartedOrder()- Specified by:
getApplicationStartedOrderin interfaceAuditBackend
-
onApplicationStarted
public void onApplicationStarted()- Specified by:
onApplicationStartedin interfaceAuditBackend
-
onApplicationStopped
public void onApplicationStopped()- Specified by:
onApplicationStoppedin interfaceAuditBackend
-
getAuditCollection
public com.mongodb.client.MongoCollection<org.bson.Document> getAuditCollection()- Returns:
- the
MongoCollectionconfigured with audit settings.
-
queryLogs
Description copied from interface:AuditReaderReturns the logs given a collection of predicates and a default sort.- Specified by:
queryLogsin interfaceAuditReader- Parameters:
builder- the query builder to fetch log entries- Returns:
- a list of log entries
-
createFilter
-
createSort
-
getMongoDBKey
-
getLogEntryByID
Description copied from interface:AuditReaderReturns a given log entry given its id.- Specified by:
getLogEntryByIDin interfaceAuditReader- Parameters:
id- the log entry identifier- Returns:
- a LogEntry instance
-
nativeQuery
Description copied from interface:AuditReaderReturns a batched list of entries.- Specified by:
nativeQueryin interfaceAuditReader- 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
-
buildFilter
-
expandQueryVariables
-
expandQueryVariables
-
queryLogsByPage
public List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] categories, String path, int pageNb, int pageSize) - Specified by:
queryLogsByPagein interfaceAuditReader- Overrides:
queryLogsByPagein classAbstractAuditBackend
-
addLogEntries
Description copied from interface:AuditLoggerAdds given log entries.- Specified by:
addLogEntriesin interfaceAuditLogger- Parameters:
entries- the list of log entries.
-
getEventsCount
- Specified by:
getEventsCountin interfaceAuditAdmin
-
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.- Specified by:
syncLogCreationEntriesin interfaceAuditAdmin
-
newExtendedInfo
Description copied from interface:AuditLoggerCreate a new ExtendedInfo instance- Specified by:
newExtendedInfoin interfaceAuditLogger- Specified by:
newExtendedInfoin classAbstractAuditBackend
-
append
- Specified by:
appendin interfaceAuditStorage
-
scroll
- Specified by:
scrollin interfaceAuditStorage
-
scroll
- Specified by:
scrollin interfaceAuditStorage
-