Records Management has a really useful feature which is audit. Out of the box it supports many actions and also provides very good ui to view the audit. But the most interesting action - read content is not supported. So let’s turn it on.
In alfresco actions are audited by behaviour. To a have a closer look on it you can clone Records Management project from RM git repository and then have a look on some default events. They are located in
org.alfresco.module.org_alfresco_module_rm.audit.event package. Here you can find very good tutorial about Alfresco behaviour from Jeff Potts.
In few words behaviour should implement some policy which is in our case would be
ContentServicePolicies.OnContentReadPolicy and also extend
Audit event. The behaviour itself would register read event of noderef and pass it to RM audit service. Here is the implementation of this behaviour:
Next step is register this behaviour in
Event name localisation
Localise the event name, which will be shown in the report. Let’s say you need to support English and French languages. You’ll need to extend localisation properties file. To do this create folder under
extension/module/org_alfresco_module_rm/messages with following files:locallo
Now let’s test it. Create some record and view it. Then open Audit log for this document and you’ll see the registered event: