public class DefaultAuditBackend extends AbstractAuditBackend implements AuditBackend
Modifier and Type | Field and Description |
---|---|
protected PersistenceProvider |
persistenceProvider |
component, expressionEvaluator, FORCE_AUDIT_FACET, log
Constructor and Description |
---|
DefaultAuditBackend() |
Modifier and Type | Method and Description |
---|---|
protected void |
activatePersistenceProvider() |
protected void |
addLogEntries(javax.persistence.EntityManager em,
List<LogEntry> entries) |
void |
addLogEntries(List<LogEntry> entries)
Adds given log entries.
|
void |
addLogEntry(javax.persistence.EntityManager em,
LogEntry entry) |
void |
addLogEntry(LogEntry entry) |
void |
deactivate() |
protected void |
deactivatePersistenceProvider() |
Long |
getEventsCount(javax.persistence.EntityManager em,
String eventId) |
Long |
getEventsCount(String eventId) |
protected List<LogEntry> |
getLogEntriesFor(javax.persistence.EntityManager em,
String uuid) |
protected List<LogEntry> |
getLogEntriesFor(javax.persistence.EntityManager em,
String uuid,
Map<String,FilterMapEntry> filterMap,
boolean doDefaultSort) |
List<LogEntry> |
getLogEntriesFor(String uuid)
Returns the logs given a doc uuid.
|
List<LogEntry> |
getLogEntriesFor(String uuid,
Map<String,FilterMapEntry> filterMap,
boolean doDefaultSort) |
protected LogEntry |
getLogEntryByID(javax.persistence.EntityManager em,
long id) |
LogEntry |
getLogEntryByID(long id)
Returns a given log entry given its id.
|
List<String> |
getLoggedEventIds() |
protected List<String> |
getLoggedEventIds(javax.persistence.EntityManager em) |
PersistenceProvider |
getOrCreatePersistenceProvider() |
protected void |
logEvent(javax.persistence.EntityManager em,
Event event) |
void |
logEvent(Event event)
Logs an Event.
|
protected void |
logEvents(javax.persistence.EntityManager em,
EventBundle eventBundle) |
void |
logEvents(EventBundle eventBundle)
Logs a bundle of events
|
protected List<?> |
nativeQuery(javax.persistence.EntityManager em,
String query,
int pageNb,
int pageSize) |
protected List<?> |
nativeQuery(javax.persistence.EntityManager em,
String query,
Map<String,Object> params,
int pageNb,
int pageSize) |
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.
|
protected List<LogEntry> |
nativeQueryLogs(javax.persistence.EntityManager em,
String whereClause,
int pageNb,
int pageSize) |
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() |
protected List<LogEntry> |
queryLogs(javax.persistence.EntityManager em,
String[] eventIds,
String dateRange) |
List<LogEntry> |
queryLogs(String[] eventIds,
String dateRange)
Returns the list of log entries.
|
protected List<LogEntry> |
queryLogsByPage(javax.persistence.EntityManager em,
String[] eventIds,
Date limit,
String[] category,
String path,
int pageNb,
int pageSize) |
protected List<LogEntry> |
queryLogsByPage(javax.persistence.EntityManager em,
String[] eventIds,
Date limit,
String category,
String path,
int pageNb,
int pageSize) |
protected List<LogEntry> |
queryLogsByPage(javax.persistence.EntityManager em,
String[] eventIds,
String dateRange,
String[] category,
String path,
int pageNb,
int pageSize) |
protected List<LogEntry> |
queryLogsByPage(javax.persistence.EntityManager em,
String[] eventIds,
String dateRange,
String category,
String path,
int pageNb,
int pageSize) |
List<LogEntry> |
queryLogsByPage(String[] eventIds,
Date limit,
String[] category,
String path,
int pageNb,
int pageSize) |
List<LogEntry> |
queryLogsByPage(String[] eventIds,
String dateRange,
String[] category,
String path,
int pageNb,
int pageSize) |
protected long |
syncLogCreationEntries(javax.persistence.EntityManager em,
String repoId,
String path,
Boolean recurs) |
long |
syncLogCreationEntries(String repoId,
String path,
Boolean recurs)
Forces log Synchronisation for a branch of the repository.
|
activate, buildEntryFromEvent, doCreateAndFillEntryFromDocument, doPutExtendedInfos, doSyncNode, getAuditableEventNames, guardedDocument, guardedDocumentChildren, newLogEntry, populateExtendedInfo, queryLogsByPage, queryLogsByPage, syncLogCreationEntries
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
activate
queryLogsByPage, queryLogsByPage
getAuditableEventNames, newLogEntry
protected PersistenceProvider persistenceProvider
public DefaultAuditBackend()
public PersistenceProvider getOrCreatePersistenceProvider()
protected void activatePersistenceProvider()
protected void deactivatePersistenceProvider()
public void deactivate()
deactivate
in interface AuditBackend
public void addLogEntries(List<LogEntry> entries)
AuditLogger
addLogEntries
in interface AuditLogger
entries
- the list of log entries.protected void addLogEntries(javax.persistence.EntityManager em, List<LogEntry> entries)
public List<LogEntry> getLogEntriesFor(String uuid)
AuditReader
getLogEntriesFor
in interface AuditReader
getLogEntriesFor
in class AbstractAuditBackend
uuid
- the document uuidprotected List<LogEntry> getLogEntriesFor(javax.persistence.EntityManager em, String uuid)
public List<LogEntry> getLogEntriesFor(String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
getLogEntriesFor
in interface AuditReader
protected List<LogEntry> getLogEntriesFor(javax.persistence.EntityManager em, String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
public LogEntry getLogEntryByID(long id)
AuditReader
getLogEntryByID
in interface AuditReader
id
- the log entry identifierprotected LogEntry getLogEntryByID(javax.persistence.EntityManager em, long id)
public List<LogEntry> nativeQueryLogs(String whereClause, int pageNb, int pageSize)
AuditReader
nativeQueryLogs
in interface AuditReader
nativeQueryLogs
in class AbstractAuditBackend
protected List<LogEntry> nativeQueryLogs(javax.persistence.EntityManager em, String whereClause, int pageNb, int pageSize)
public List<?> nativeQuery(String query, int pageNb, int pageSize)
AuditReader
nativeQuery
in interface AuditReader
nativeQuery
in class AbstractAuditBackend
protected List<?> nativeQuery(javax.persistence.EntityManager em, String query, int pageNb, int pageSize)
public 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 pageprotected List<?> nativeQuery(javax.persistence.EntityManager em, String query, Map<String,Object> params, int pageNb, int pageSize)
public List<LogEntry> queryLogs(String[] eventIds, String dateRange)
AuditReader
Note we will use NXQL in the future when the search engine will index history.
queryLogs
in interface AuditReader
queryLogs
in class AbstractAuditBackend
eventIds
- the event ids.dateRange
- a preset date range.DateRangeQueryConstants
protected List<LogEntry> queryLogs(javax.persistence.EntityManager em, String[] eventIds, String dateRange)
public List<LogEntry> queryLogsByPage(String[] eventIds, String dateRange, String[] category, String path, int pageNb, int pageSize)
queryLogsByPage
in interface AuditReader
protected List<LogEntry> queryLogsByPage(javax.persistence.EntityManager em, String[] eventIds, String dateRange, String[] category, String path, int pageNb, int pageSize)
public List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] category, String path, int pageNb, int pageSize)
queryLogsByPage
in interface AuditReader
protected List<LogEntry> queryLogsByPage(javax.persistence.EntityManager em, String[] eventIds, Date limit, String[] category, String path, int pageNb, int pageSize)
public long syncLogCreationEntries(String repoId, String path, Boolean recurs)
AuditAdmin
syncLogCreationEntries
in interface AuditAdmin
protected long syncLogCreationEntries(javax.persistence.EntityManager em, String repoId, String path, Boolean recurs)
public void addLogEntry(LogEntry entry)
public void addLogEntry(javax.persistence.EntityManager em, LogEntry entry)
public Long getEventsCount(String eventId)
getEventsCount
in interface AuditAdmin
public Long getEventsCount(javax.persistence.EntityManager em, String eventId)
public List<String> getLoggedEventIds()
protected List<String> getLoggedEventIds(javax.persistence.EntityManager em)
public void logEvent(Event event)
AuditLogger
logEvent
in interface AuditLogger
logEvent
in class AbstractAuditBackend
public void logEvents(EventBundle eventBundle)
AuditLogger
logEvents
in interface AuditLogger
logEvents
in class AbstractAuditBackend
protected void logEvents(javax.persistence.EntityManager em, EventBundle eventBundle)
protected List<LogEntry> queryLogsByPage(javax.persistence.EntityManager em, String[] eventIds, String dateRange, String category, String path, int pageNb, int pageSize)
protected List<LogEntry> queryLogsByPage(javax.persistence.EntityManager em, String[] eventIds, Date limit, String category, String path, int pageNb, int pageSize)
public void onApplicationStarted()
onApplicationStarted
in interface AuditBackend
public ExtendedInfo newExtendedInfo(Serializable value)
AuditLogger
newExtendedInfo
in interface AuditLogger
newExtendedInfo
in class AbstractAuditBackend
Copyright © 2015 Nuxeo SA. All rights reserved.