public class DefaultAuditBackend extends AbstractAuditBackend
Modifier and Type | Class and Description |
---|---|
class |
DefaultAuditBackend.SQLAuditCursorResult |
Modifier and Type | Field and Description |
---|---|
protected CursorService<Iterator<LogEntry>,LogEntry,String> |
cursorService |
protected static com.fasterxml.jackson.databind.ObjectMapper |
OBJECT_MAPPER |
protected PersistenceProvider |
persistenceProvider |
component, config, expressionEvaluator, FORCE_AUDIT_FACET, log
Constructor and Description |
---|
DefaultAuditBackend() |
DefaultAuditBackend(NXAuditEventsService component,
AuditBackendDescriptor config) |
Modifier and Type | Method and Description |
---|---|
protected void |
accept(boolean needActivateSession,
Consumer<LogEntryProvider> consumer) |
protected void |
activatePersistenceProvider() |
void |
addLogEntries(List<LogEntry> entries)
Adds given log entries.
|
void |
append(List<String> jsonEntries) |
protected <T> T |
apply(boolean needActivateSession,
Function<LogEntryProvider,T> function) |
int |
getApplicationStartedOrder() |
Long |
getEventsCount(String eventId) |
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)
Returns the logs given a doc uuid.
|
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<String> |
getLoggedEventIds() |
PersistenceProvider |
getOrCreatePersistenceProvider() |
protected String |
getParamNames(String[] eventId) |
protected Map<String,Object> |
getParams(String[] eventId) |
List<?> |
nativeQuery(String query,
int pageNb,
int pageSize)
Returns a batched list of entries.
|
List<?> |
nativeQuery(String query,
Map<String,Object> params,
int pageNb,
int pageSize)
Returns a batched list of entries.
|
List<LogEntry> |
nativeQueryLogs(String whereClause,
int pageNb,
int pageSize)
Returns a batched list of log 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> |
queryLogs(String[] eventIds,
String dateRange)
Returns the list of log entries.
|
List<LogEntry> |
queryLogsByPage(String[] eventIds,
Date limit,
String[] category,
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, guardedDocument, guardedDocumentChildren, isAuditable, logEvent, logEvents, newLogEntry, populateExtendedInfo, restore, syncLogCreationEntries
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
onShutdown
queryLogsByPage, queryLogsByPage, queryLogsByPage
protected static final com.fasterxml.jackson.databind.ObjectMapper OBJECT_MAPPER
protected PersistenceProvider persistenceProvider
protected CursorService<Iterator<LogEntry>,LogEntry,String> cursorService
public DefaultAuditBackend(NXAuditEventsService component, AuditBackendDescriptor config)
public DefaultAuditBackend()
public int getApplicationStartedOrder()
public void onApplicationStarted()
public void onApplicationStopped()
public PersistenceProvider getOrCreatePersistenceProvider()
protected void activatePersistenceProvider()
protected <T> T apply(boolean needActivateSession, Function<LogEntryProvider,T> function)
protected void accept(boolean needActivateSession, Consumer<LogEntryProvider> consumer)
public void addLogEntries(List<LogEntry> entries)
AuditLogger
entries
- the list of log entries.public List<LogEntry> getLogEntriesFor(String uuid, String repositoryId)
AuditReader
uuid
- the document uuidrepositoryId
- the repository idpublic List<LogEntry> getLogEntriesFor(String uuid)
AuditReader
uuid
- the document uuidpublic List<LogEntry> getLogEntriesFor(String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
AuditReader
getLogEntriesFor
in interface AuditReader
getLogEntriesFor
in class AbstractAuditBackend
uuid
- the document uuidfilterMap
- the map of filters to applydoDefaultSort
- the default sort to set (eventDate desc)public LogEntry getLogEntryByID(long id)
AuditReader
id
- the log entry identifierpublic List<LogEntry> nativeQueryLogs(String whereClause, int pageNb, int pageSize)
AuditReader
public List<?> nativeQuery(String query, int pageNb, int pageSize)
AuditReader
public List<?> nativeQuery(String query, Map<String,Object> params, int pageNb, int pageSize)
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 List<LogEntry> queryLogs(AuditQueryBuilder builder)
AuditReader
builder
- the query builder to fetch log entriespublic List<LogEntry> queryLogs(String[] eventIds, String dateRange)
AuditReader
Note we will use NXQL in the future when the search engine will index history.
eventIds
- the event ids.dateRange
- a preset date range.DateRangeQueryConstants
public List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] category, String path, int pageNb, int pageSize)
queryLogsByPage
in interface AuditReader
queryLogsByPage
in class AbstractAuditBackend
public long syncLogCreationEntries(String repoId, String path, Boolean recurs)
AuditAdmin
public Long getEventsCount(String eventId)
public List<String> getLoggedEventIds()
public ExtendedInfo newExtendedInfo(Serializable value)
AuditLogger
newExtendedInfo
in interface AuditLogger
newExtendedInfo
in class AbstractAuditBackend
public long getLatestLogId(String repositoryId, String... eventIds)
AuditReader
getLatestLogId
in interface AuditReader
getLatestLogId
in class AbstractAuditBackend
public List<LogEntry> getLogEntriesAfter(long logIdOffset, int limit, String repositoryId, String... eventIds)
AuditReader
getLogEntriesAfter
in interface AuditReader
getLogEntriesAfter
in class AbstractAuditBackend
protected String getParamNames(String[] eventId)
public ScrollResult<String> scroll(AuditQueryBuilder builder, int batchSize, int keepAliveSeconds)
public ScrollResult<String> scroll(String scrollId)
Copyright © 2018 Nuxeo. All rights reserved.