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 |
static String |
DEFAULT_COLLECTION_NAME |
protected MongoDBAuditBackend.MongoDBLogEntryProvider |
provider |
static String |
SEQ_NAME |
component, config, expressionEvaluator, FORCE_AUDIT_FACET
Constructor and Description |
---|
MongoDBAuditBackend(NXAuditEventsService component,
AuditBackendDescriptor config) |
Modifier and Type | Method and Description |
---|---|
void |
addLogEntries(List<LogEntry> entries)
Adds given log entries.
|
org.bson.conversions.Bson |
buildFilter(String query,
Map<String,Object> params) |
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) |
List<LogEntry> |
getLogEntriesFor(String uuid,
Map<String,FilterMapEntry> filterMap,
boolean doDefaultSort)
Returns the logs given a doc uuid, a map of filters and a default sort.
|
List<LogEntry> |
getLogEntriesFor(String uuid,
String repositoryId)
Returns the logs given a doc uuid and a repository id.
|
LogEntry |
getLogEntryByID(long id)
Returns a given log entry given its id.
|
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 |
onShutdown() |
List<LogEntry> |
queryLogsByPage(String[] eventIds,
Date limit,
String[] categories,
String path,
int pageNb,
int pageSize) |
List<LogEntry> |
queryLogsByPage(String[] eventIds,
String dateRange,
String[] categories,
String path,
int pageNb,
int pageSize) |
long |
syncLogCreationEntries(String repoId,
String path,
Boolean recurs)
Forces log Synchronisation for a branch of the repository.
|
await, buildEntryFromEvent, doCreateAndFillEntryFromDocument, doPutExtendedInfos, doSyncNode, getAuditableEventNames, getLogEntriesFor, guardedDocument, guardedDocumentChildren, isAuditable, logEvent, logEvents, nativeQuery, nativeQueryLogs, newLogEntry, populateExtendedInfo, queryLogs, queryLogsByPage, queryLogsByPage, syncLogCreationEntries
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onApplicationStopped
getLogEntriesFor, nativeQuery, nativeQueryLogs, queryLogs, queryLogsByPage, queryLogsByPage
await, getAuditableEventNames, logEvent, logEvents, newLogEntry
public 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
protected com.mongodb.client.MongoCollection<org.bson.Document> collection
protected MongoDBAuditBackend.MongoDBLogEntryProvider provider
public MongoDBAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config)
public int getApplicationStartedOrder()
getApplicationStartedOrder
in interface AuditBackend
public void onApplicationStarted()
onApplicationStarted
in interface AuditBackend
public void onShutdown()
onShutdown
in interface AuditBackend
public com.mongodb.client.MongoCollection<org.bson.Document> getAuditCollection()
MongoCollection
configured with audit settings.public List<LogEntry> getLogEntriesFor(String uuid, String repositoryId)
AbstractAuditBackend
getLogEntriesFor
in interface AuditReader
getLogEntriesFor
in class AbstractAuditBackend
uuid
- the document uuidrepositoryId
- the repository idpublic List<LogEntry> getLogEntriesFor(String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
AuditReader
getLogEntriesFor
in interface AuditReader
uuid
- the document uuidfilterMap
- the map of filters to applydoDefaultSort
- the default sort to setpublic LogEntry getLogEntryByID(long id)
AuditReader
getLogEntryByID
in interface AuditReader
id
- the log entry identifierpublic List<?> nativeQuery(String query, Map<String,Object> params, int pageNb, int pageSize)
AuditReader
nativeQuery
in interface AuditReader
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 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 AuditReader
public List<LogEntry> queryLogsByPage(String[] eventIds, String dateRange, String[] categories, String path, int pageNb, int pageSize)
queryLogsByPage
in interface AuditReader
public void addLogEntries(List<LogEntry> entries)
AuditLogger
addLogEntries
in interface AuditLogger
entries
- the list of log entries.public Long getEventsCount(String eventId)
getEventsCount
in interface AuditAdmin
public long syncLogCreationEntries(String repoId, String path, Boolean recurs)
AuditAdmin
syncLogCreationEntries
in interface AuditAdmin
public ExtendedInfo newExtendedInfo(Serializable value)
AuditLogger
newExtendedInfo
in interface AuditLogger
newExtendedInfo
in class AbstractAuditBackend
Copyright © 2017 Nuxeo. All rights reserved.