public class MongoDBAuditBackend extends AbstractAuditBackend implements AuditBackend
AuditBackend interface using MongoDB persistence.| Modifier and Type | Class and Description | 
|---|---|
| class  | MongoDBAuditBackend.MongoDBLogEntryProvider | 
| Modifier and Type | Field and Description | 
|---|---|
| static String | AUDIT_DATABASE_ID | 
| protected com.mongodb.client.MongoCollection<org.bson.Document> | collection | 
| static String | COLLECTION_NAME_PROPERTY | 
| protected CursorService<com.mongodb.client.MongoCursor<org.bson.Document>,org.bson.Document,String> | cursorService | 
| static String | DEFAULT_COLLECTION_NAME | 
| static com.fasterxml.jackson.databind.ObjectMapper | OBJECT_MAPPER | 
| protected MongoDBAuditBackend.MongoDBLogEntryProvider | provider | 
| static String | SEQ_NAME | 
component, config, expressionEvaluator, FORCE_AUDIT_FACET| Constructor and Description | 
|---|
| MongoDBAuditBackend() | 
| MongoDBAuditBackend(NXAuditEventsService component,
                   AuditBackendDescriptor config) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | addLogEntries(List<LogEntry> entries)Adds given log entries. | 
| void | append(List<String> jsonEntries) | 
| org.bson.conversions.Bson | buildFilter(String query,
           Map<String,Object> params) | 
| protected org.bson.conversions.Bson | createFilter(Predicate andPredicate) | 
| protected org.bson.conversions.Bson | createSort(OrderByList orders) | 
| String | expandQueryVariables(String query,
                    Map<String,Object> params) | 
| String | expandQueryVariables(String query,
                    Object[] params) | 
| int | getApplicationStartedOrder() | 
| com.mongodb.client.MongoCollection<org.bson.Document> | getAuditCollection() | 
| Long | getEventsCount(String eventId) | 
| LogEntry | getLogEntryByID(long id)Returns a given log entry given its id. | 
| protected String | getMongoDBKey(String key) | 
| List<?> | nativeQuery(String query,
           Map<String,Object> params,
           int pageNb,
           int pageSize)Returns a batched list of entries. | 
| ExtendedInfo | newExtendedInfo(Serializable value)Create a new ExtendedInfo instance | 
| void | onApplicationStarted() | 
| void | onApplicationStopped() | 
| List<LogEntry> | queryLogs(AuditQueryBuilder builder)Returns the logs given a collection of predicates and a default sort. | 
| List<LogEntry> | queryLogsByPage(String[] eventIds,
               Date limit,
               String[] categories,
               String path,
               int pageNb,
               int pageSize) | 
| ScrollResult<String> | scroll(AuditQueryBuilder builder,
      int batchSize,
      int keepAliveSeconds) | 
| ScrollResult<String> | scroll(String scrollId) | 
| long | syncLogCreationEntries(String repoId,
                      String path,
                      Boolean recurs)Forces log Synchronisation for a branch of the repository. | 
await, buildEntryFromEvent, convert, doCreateAndFillEntryFromDocument, doPutExtendedInfos, doSyncNode, getAuditableEventNames, getLatestLogId, getLogEntriesAfter, getLogEntriesFor, guardedDocument, guardedDocumentChildren, isAuditable, logEvent, logEvents, newLogEntry, populateExtendedInfo, restore, syncLogCreationEntriesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonShutdown, restoregetLatestLogId, getLogEntriesAfter, getLogEntriesFor, getLogEntriesFor, getLogEntriesFor, nativeQuery, nativeQueryLogs, queryLogs, queryLogsByPage, queryLogsByPage, queryLogsByPageawait, buildEntryFromEvent, getAuditableEventNames, logEvent, logEvents, newLogEntrypublic static final String AUDIT_DATABASE_ID
public static final String COLLECTION_NAME_PROPERTY
public static final String DEFAULT_COLLECTION_NAME
public static final String SEQ_NAME
public static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
protected com.mongodb.client.MongoCollection<org.bson.Document> collection
protected MongoDBAuditBackend.MongoDBLogEntryProvider provider
protected CursorService<com.mongodb.client.MongoCursor<org.bson.Document>,org.bson.Document,String> cursorService
public MongoDBAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config)
public MongoDBAuditBackend()
public int getApplicationStartedOrder()
getApplicationStartedOrder in interface AuditBackendpublic void onApplicationStarted()
onApplicationStarted in interface AuditBackendpublic void onApplicationStopped()
onApplicationStopped in interface AuditBackendpublic com.mongodb.client.MongoCollection<org.bson.Document> getAuditCollection()
MongoCollection configured with audit settings.public List<LogEntry> queryLogs(AuditQueryBuilder builder)
AuditReaderqueryLogs in interface AuditReaderbuilder - the query builder to fetch log entriesprotected org.bson.conversions.Bson createFilter(Predicate andPredicate)
protected org.bson.conversions.Bson createSort(OrderByList orders)
protected String getMongoDBKey(String key)
public LogEntry getLogEntryByID(long id)
AuditReadergetLogEntryByID in interface AuditReaderid - the log entry identifierpublic List<?> nativeQuery(String query, Map<String,Object> params, int pageNb, int pageSize)
AuditReadernativeQuery in interface AuditReaderquery - 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 pagepublic org.bson.conversions.Bson buildFilter(String query, Map<String,Object> params)
public String expandQueryVariables(String query, Object[] params)
public List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] categories, String path, int pageNb, int pageSize)
queryLogsByPage in interface AuditReaderqueryLogsByPage in class AbstractAuditBackendpublic void addLogEntries(List<LogEntry> entries)
AuditLoggeraddLogEntries in interface AuditLoggerentries - the list of log entries.public Long getEventsCount(String eventId)
getEventsCount in interface AuditAdminpublic long syncLogCreationEntries(String repoId, String path, Boolean recurs)
AuditAdminsyncLogCreationEntries in interface AuditAdminpublic ExtendedInfo newExtendedInfo(Serializable value)
AuditLoggernewExtendedInfo in interface AuditLoggernewExtendedInfo in class AbstractAuditBackendpublic void append(List<String> jsonEntries)
append in interface AuditStoragepublic ScrollResult<String> scroll(AuditQueryBuilder builder, int batchSize, int keepAliveSeconds)
scroll in interface AuditStoragepublic ScrollResult<String> scroll(String scrollId)
scroll in interface AuditStorageCopyright © 2018 Nuxeo. All rights reserved.