Package com.day.cq.audit
Interface AuditLog
public interface AuditLog
The
AuditLog defines an interface to retrieve audit event
information from the respective audit log.
The audit log is path based: the content path in the repository is
used as a unique identifier to group all entries.
The audit framework is still subject to change and will be improved.
Adding entries to the audit log can be done by sending a job event
with the job topic AuditLogEvent.JOB_TOPIC and the AuditLogEvent stored
in the property AuditLogEvent.AUDIT_EVENT_PROPERTY or by directly calling
add(AuditLogEntry) or add(List).
-
Method Summary
Modifier and TypeMethodDescriptionvoidadd(AuditLogEntry entry) Add a new audit log entry.voidadd(List<AuditLogEntry> entries) Add new audit log entriesString[]Return an array containing all audit log categories (that have entries)getLatestEvent(String category, String path) Deprecated.getLatestEvent(String category, String path, String type) Deprecated.since 6.3, usegetLatestEvent(org.apache.sling.api.resource.ResourceResolver, String, String, String)insteadgetLatestEvent(ResourceResolver resolver, String category, String path) Returns the latest event for the path and category.getLatestEvent(ResourceResolver resolver, String category, String path, String type) Returns the latest event for the path, type and category.getLatestEvents(String[] categories, String path, int max) Deprecated.since 6.3, usegetLatestEvents(org.apache.sling.api.resource.ResourceResolver, String[], String, int)insteadgetLatestEvents(String category, String path, int max) Deprecated.since 6.3, usegetLatestEvents(org.apache.sling.api.resource.ResourceResolver, String, String, int)insteadgetLatestEvents(ResourceResolver resolver, String[] categories, String path, int max) Returns the latest events for the path and category.getLatestEvents(ResourceResolver resolver, String category, String path, int max) Returns the latest events for the path and category.getLatestEventsFromTree(String[] categories, String pathPrefix, int max) Deprecated.getLatestEventsFromTree(ResourceResolver resolver, String[] categories, String pathPrefix, int max) Returns the latest events for all paths which will start with theprefix.voidMove audit log entries from one place to another.
-
Method Details
-
getLatestEvent
Deprecated.since 6.3, usegetLatestEvent(org.apache.sling.api.resource.ResourceResolver, String, String)insteadReturns the latest event for the path and category.- Parameters:
category- the event categorypath- the path of the event- Returns:
- the latest event with the given path or
null. throwsIllegalArgumentExceptionIf category or path are null.
-
getLatestEvent
Returns the latest event for the path and category.- Parameters:
resolver- ResourceResolver instancecategory- the event categorypath- the path of the event- Returns:
- the latest event with the given path or
null. throwsIllegalArgumentExceptionIf category or path are null.
-
getLatestEvent
Deprecated.since 6.3, usegetLatestEvent(org.apache.sling.api.resource.ResourceResolver, String, String, String)insteadReturns the latest event for the path, type and category.- Parameters:
category- the event categorypath- the path of the eventtype- the type of the event- Returns:
- the latest event with the given path or
null. throwsIllegalArgumentExceptionIf category, type or path are null.
-
getLatestEvent
Returns the latest event for the path, type and category.- Parameters:
resolver- ResourceResolver instancecategory- the event categorypath- the path of the eventtype- the type of the event- Returns:
- the latest event with the given path or
null. throwsIllegalArgumentExceptionIf category, type or path are null.
-
getLatestEvents
Deprecated.since 6.3, usegetLatestEvents(org.apache.sling.api.resource.ResourceResolver, String, String, int)insteadReturns the latest events for the path and category.- Parameters:
category- the event categorypath- the path of the eventsmax- the maximum number of events to return or -1 for all.- Returns:
- an array of AuditEvents
throws
IllegalArgumentExceptionIf category or path are null.
-
getLatestEvents
Returns the latest events for the path and category.- Parameters:
resolver- ResourceResolver instancecategory- the event categorypath- the path of the eventsmax- the maximum number of events to return or -1 for all.- Returns:
- an array of AuditEvents
throws
IllegalArgumentExceptionIf category or path are null.
-
getLatestEvents
Deprecated.since 6.3, usegetLatestEvents(org.apache.sling.api.resource.ResourceResolver, String[], String, int)insteadReturns the latest events for the path and category.- Parameters:
categories- the event categoriespath- the path of the eventsmax- the maximum number of events to return or -1 for all.- Returns:
- an array of AuditEvents
throws
IllegalArgumentExceptionIf category or path are null.
-
getLatestEvents
AuditLogEntry[] getLatestEvents(ResourceResolver resolver, String[] categories, String path, int max) Returns the latest events for the path and category.- Parameters:
resolver- ResourceResolver instancecategories- the event categoriespath- the path of the eventsmax- the maximum number of events to return or -1 for all.- Returns:
- an array of AuditEvents
throws
IllegalArgumentExceptionIf category or path are null.
-
getCategories
String[] getCategories()Return an array containing all audit log categories (that have entries)- Returns:
- An array with the categories or
null
-
getLatestEventsFromTree
@Deprecated AuditLogEntry[] getLatestEventsFromTree(String[] categories, String pathPrefix, int max) Deprecated.Returns the latest events for all paths which will start with theprefix.- Parameters:
categories- the event categoriespathPrefix- the pattern to matchmax- the maximum number of events per path to return or -1 for all.- Returns:
- an array of AuditEvents
throws
IllegalArgumentExceptionIf category or pathPrefix are null.
-
getLatestEventsFromTree
AuditLogEntry[] getLatestEventsFromTree(ResourceResolver resolver, String[] categories, String pathPrefix, int max) Returns the latest events for all paths which will start with theprefix.- Parameters:
resolver- ResourceResolver instancecategories- the event categoriespathPrefix- the pattern to matchmax- the maximum number of events per path to return or -1 for all.- Returns:
- an array of AuditEvents
throws
IllegalArgumentExceptionIf category or pathPrefix are null.
-
add
Add a new audit log entry.- Parameters:
entry- The audit log entry.
-
add
Add new audit log entries- Parameters:
entries- The audit log entries.
-
move
Move audit log entries from one place to another.
-
getLatestEvent(org.apache.sling.api.resource.ResourceResolver, String, String)instead