cancel
Showing results for 
Search instead for 
Did you mean: 

Add new event to Audit log

streetturtle
Confirmed Champ
Confirmed Champ
I need to add custom event to the audit log in Alfresco Records Management.
I want to see who and when opened the document, which is almost the same as Audit View but for documents.
Could you please help
1 ACCEPTED ANSWER

streetturtle
Confirmed Champ
Confirmed Champ
I have finally solved my problem!
Basically to enable read content you need to create custom behaviour which will call rm audit service and audit the event each time content has been read.

To do this create a behaviour bean:

<java>
@BehaviourBean
public class ReadAuditEvent extends AuditEvent implements ContentServicePolicies.OnContentReadPolicy {
  @Override
  @Behaviour
    (
      kind = BehaviourKind.CLASS,
      type = "rma:filePlanComponent"
    )
  public void onContentRead(NodeRef nodeRef) {
    recordsManagementAuditService.auditEvent(nodeRef, getName());
  }
}
</java>

And register it in some of context xmls:


<bean id="audit-event.content-read" parent="audit-event" class="cern.efiles.behavior.ReadAuditEvent">
  <property name="name" value="Read RM Object"/>
  <property name="label" value="rm.audit.content-read"/>
</bean>


Then restart everything and hope that the Force is with you, young padawan 😃

You can find more details in this post: http://pavelmakhov.com/2015/02/19/enable-read-event-for-rm-audit/

View answer in original post

4 REPLIES 4

rwetherall
Confirmed Champ
Confirmed Champ
Which version of Alfresco RM are you using?

Sorry, forget to mention.
I'm using RM version 2.3.a.1 with Alfresco version 5.0.a.

streetturtle
Confirmed Champ
Confirmed Champ
I have finally solved my problem!
Basically to enable read content you need to create custom behaviour which will call rm audit service and audit the event each time content has been read.

To do this create a behaviour bean:

<java>
@BehaviourBean
public class ReadAuditEvent extends AuditEvent implements ContentServicePolicies.OnContentReadPolicy {
  @Override
  @Behaviour
    (
      kind = BehaviourKind.CLASS,
      type = "rma:filePlanComponent"
    )
  public void onContentRead(NodeRef nodeRef) {
    recordsManagementAuditService.auditEvent(nodeRef, getName());
  }
}
</java>

And register it in some of context xmls:


<bean id="audit-event.content-read" parent="audit-event" class="cern.efiles.behavior.ReadAuditEvent">
  <property name="name" value="Read RM Object"/>
  <property name="label" value="rm.audit.content-read"/>
</bean>


Then restart everything and hope that the Force is with you, young padawan 😃

You can find more details in this post: http://pavelmakhov.com/2015/02/19/enable-read-event-for-rm-audit/

The link in the last line seems to be broken now.

Here is the right URL: http://pavelmakhov.com/2015/02/enable-read-event-for-rm-audit 

Cheers!

Nicolas Raoul