Nuxeo Enterprise Platform 5.3

org.nuxeo.ecm.platform.audit.ejb
Class LogsBean

java.lang.Object
  extended by org.nuxeo.ecm.platform.audit.ejb.LogsBean
All Implemented Interfaces:
AuditAdmin, AuditLogger, AuditReader, Logs

public class LogsBean
extends Object
implements Logs

Stateless bean allowing to query the logs.

This class takes advantage of EJBQL. :XXX: http://jira.nuxeo.org/browse/NXP-514

Author:
Julien Anguenot, Thierry Delprat

Constructor Summary
LogsBean()
           
 
Method Summary
 void addLogEntries(List<LogEntry> entries)
          Adds given log entries.
 List<LogEntry> getLogEntriesFor(String uuid)
          Returns the logs given a doc uuid.
 List<LogEntry> getLogEntriesFor(String uuid, Map<String,FilterMapEntry> filterMap, boolean doDefaultSort)
           
 LogEntry getLogEntryByID(long id)
          Returns a given log entry given its id.
 void logEvent(Event event)
          Logs an Event.
 void logEvents(EventBundle eventBundle)
          Logs a bundle of events
protected  List<LogEntry> mkSerializable(List<LogEntry> entries)
           
protected  LogEntry mkSerializable(LogEntry entry)
           
 List<?> nativeQuery(String query, int pageNb, int pageSize)
          Returns a batched list of entries. query string is a native query clause for the backend : here EJBQL 3.0 can be used
 List<LogEntry> nativeQueryLogs(String whereClause, int pageNb, int pageSize)
          Returns a batched list of log entries.
 List<LogEntry> queryLogs(String[] eventIds, String dateRange)
          Returns the list of log entries.
 List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String[] categories, String path, int pageNb, int pageSize)
           
 List<LogEntry> queryLogsByPage(String[] eventIds, Date limit, String category, String path, int pageNb, int pageSize)
          Returns the batched list of log entries.
 List<LogEntry> queryLogsByPage(String[] eventIds, String dateRange, String[] categories, String path, int pageNb, int pageSize)
           
 List<LogEntry> queryLogsByPage(String[] eventIds, String dateRange, String category, String path, int pageNb, int pageSize)
          Returns the batched list of log entries.
protected  NXAuditEventsService service()
           
 long syncLogCreationEntries(String repoId, String path, Boolean recurs)
          Forces log Synchronisation for a branch of the repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogsBean

public LogsBean()
Method Detail

service

protected NXAuditEventsService service()

addLogEntries

public void addLogEntries(List<LogEntry> entries)
Description copied from interface: AuditLogger
Adds given log entries.

Specified by:
addLogEntries in interface AuditLogger
Parameters:
entries - the list of log entries.

getLogEntriesFor

public List<LogEntry> getLogEntriesFor(String uuid)
Description copied from interface: AuditReader
Returns the logs given a doc uuid.

:XXX: add parameters to this method for paging.

Specified by:
getLogEntriesFor in interface AuditReader
Parameters:
uuid - the document uuid
Returns:
a list of log entries

getLogEntriesFor

public List<LogEntry> getLogEntriesFor(String uuid,
                                       Map<String,FilterMapEntry> filterMap,
                                       boolean doDefaultSort)
Specified by:
getLogEntriesFor in interface AuditReader

nativeQueryLogs

public List<LogEntry> nativeQueryLogs(String whereClause,
                                      int pageNb,
                                      int pageSize)
Description copied from interface: AuditReader
Returns a batched list of log entries. WhereClause is a native where clause for the backend : here EJBQL 3.0 can be used

Specified by:
nativeQueryLogs in interface AuditReader
Returns:

nativeQuery

public List<?> nativeQuery(String query,
                           int pageNb,
                           int pageSize)
Description copied from interface: AuditReader
Returns a batched list of entries. query string is a native query clause for the backend : here EJBQL 3.0 can be used

Specified by:
nativeQuery in interface AuditReader
Returns:

queryLogsByPage

public List<LogEntry> queryLogsByPage(String[] eventIds,
                                      Date limit,
                                      String category,
                                      String path,
                                      int pageNb,
                                      int pageSize)
Description copied from interface: AuditReader
Returns the batched list of log entries.

Note we will use NXQL in the future when the search engine will index history.

Specified by:
queryLogsByPage in interface AuditReader
Parameters:
eventIds - the event ids.
limit - filter events by date from limit to now
category - add filter on events category
path - add filter on document path
pageNb - page number (ignore if <=1)
pageSize - number of results per page
Returns:
a list of log entries.
See Also:
DateRangeQueryConstants

queryLogsByPage

public List<LogEntry> queryLogsByPage(String[] eventIds,
                                      String dateRange,
                                      String category,
                                      String path,
                                      int pageNb,
                                      int pageSize)
Description copied from interface: AuditReader
Returns the batched list of log entries.

Note we will use NXQL in the future when the search engine will index history.

Specified by:
queryLogsByPage in interface AuditReader
Parameters:
eventIds - the event ids.
dateRange - a preset date range.
category - add filter on events category
path - add filter on document path
pageNb - page number (ignore if <=1)
pageSize - number of results per page
Returns:
a list of log entries.
See Also:
DateRangeQueryConstants

queryLogs

public List<LogEntry> queryLogs(String[] eventIds,
                                String dateRange)
Description copied from interface: AuditReader
Returns the list of log entries.

Note we will use NXQL in the future when the search engine will index history.

Specified by:
queryLogs in interface AuditReader
Parameters:
eventIds - the event ids.
dateRange - a preset date range.
Returns:
a list of log entries.
See Also:
DateRangeQueryConstants

getLogEntryByID

public LogEntry getLogEntryByID(long id)
Description copied from interface: AuditReader
Returns a given log entry given its id.

Specified by:
getLogEntryByID in interface AuditReader
Parameters:
id - the log entry identifier
Returns:
a LogEntry instance

syncLogCreationEntries

public long syncLogCreationEntries(String repoId,
                                   String path,
                                   Boolean recurs)
Description copied from interface: AuditAdmin
Forces 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:
syncLogCreationEntries in interface AuditAdmin

logEvent

public void logEvent(Event event)
              throws AuditException
Description copied from interface: AuditLogger
Logs an Event.

Specified by:
logEvent in interface AuditLogger
Throws:
AuditException

logEvents

public void logEvents(EventBundle eventBundle)
               throws AuditException
Description copied from interface: AuditLogger
Logs a bundle of events

Specified by:
logEvents in interface AuditLogger
Throws:
AuditException

mkSerializable

protected List<LogEntry> mkSerializable(List<LogEntry> entries)

mkSerializable

protected LogEntry mkSerializable(LogEntry entry)

queryLogsByPage

public List<LogEntry> queryLogsByPage(String[] eventIds,
                                      String dateRange,
                                      String[] categories,
                                      String path,
                                      int pageNb,
                                      int pageSize)
Specified by:
queryLogsByPage in interface AuditReader

queryLogsByPage

public List<LogEntry> queryLogsByPage(String[] eventIds,
                                      Date limit,
                                      String[] categories,
                                      String path,
                                      int pageNb,
                                      int pageSize)
Specified by:
queryLogsByPage in interface AuditReader

Nuxeo Enterprise Platform 5.3

Copyright © 2010 Nuxeo SAS. All Rights Reserved.