AnsweredAssumed Answered

Problem with onContentRead

Question asked by ramsdal on Aug 27, 2008
Latest reply on Dec 29, 2016 by kevinchen
Hello there

I am currently working on a system that has to be able to catch CRUD events from Alfresco.
To do this I have used the built in PolicyComponent and the code which causes problems looks like this:

this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onContentRead"), ContentModel.ASPECT_AUDITABLE, new JavaBehaviour(this, "onContentRead", NotificationFrequency.TRANSACTION_COMMIT));
What happens is that this function is triggered every time a piece of content (with the auditable aspect) is read.
However for some reason this does not apply to images, that means that it works perfectly fine for
*.doc, *.pdf, *.txt and so on - it even works for *.exe files.
But when it comes to images mime-types like *.jpg, *.png and other image files the trigger is only fired
once and then never again (not even if I log out and back into the alfresco web).

EDIT:
I have tried the following aswell ;)
this.policyComponent.bindClassBehaviour(QName.createQName(NamespaceService.ALFRESCO_URI, "onContentRead"), QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "cmobject"), new JavaBehaviour(this, "onContentRead", NotificationFrequency.EVERY_EVENT));

Can someone please help me back on track here? Perhaps there is some mime-type configuration I have been
unable to find, or some special function i have not made use of? :)

I am using Alfresco 2.1 Community…

Any help would much appreciated.

Best Regards
Peter Nielsen

Outcomes