AnsweredAssumed Answered

Policies and Working Copies

Question asked by darryl_staflund on Dec 3, 2010
Hi there,

I have written three policy classes that I use to audit when content files in a given folder have changed over a given time period (NB:  I don't worry about changes to metadata or the copying/moving of files):

  • CreationAuditor (implements OnCreateNodePolicy)

  • DeletionAuditor (implements BeforeDeleteNodePolicy)

  • UpdateAuditor (implements OnContentUpdatePolicy)
The auditors really work well and I couldn't be happier with Alfresco's new auditing framework.

I have run into a problem, however.  If I choose to edit a file by clicking on the 'Edit' icon, Alfresco creates a working copy of the file for me to work with.  Problem is, the creation of this file triggers my CreationAuditor which then records an audit event.  But I don't consider creation of a working copy an auditable event since the file is transitory until checked in and it may be abandoned by the author.

I thought I'd be able to get around this problem by only auditing creation events on nodes that don't have the 'cm:workingcopy' aspect applied to them.  But this doesn't work since the 'OnCreateNodePolicy' event is triggered after the working copy file is created but before the 'cm:workingcopy' aspect is applied.

I don't know how to get around this problem.  Any ideas?  Is there a way to do this with the existing policy types?