Hello,
I have a requirement to be able to update a property on access of a document. I could not use the onContentRead behavior as it is called only when I read the content of the document. My requirement is a behavior or any other way I can update a property when the document is even accessed from the Share.
Thank you.
There is only one behavior in alfresco ,which is onContentRead , which is getting called when you read the content property of the document.This will even get called from share when you open document details of view in alfresco.
What i did not get is you need an event which gets fired when document is accessed from share.I think onContentRead should full fill your requirement.Can you explain the reason why it is not suitable for your requirement.
Hello Krutik,
Thanks for your time.
My requirement is to be able to update a property on document access. I tried using the onContentRead behavior, it is getting called only when I am viewing the whole content from browser and not just browsing the properties. My code is like this
this.onContentRead = new JavaBehaviour(this, OnContentReadPolicy.QNAME.getLocalName(), NotificationFrequency.TRANSACTION_COMMIT);
this.policyComponentImpl.bindClassBehaviour(OnContentReadPolicy.QNAME, QName.createQName(MODEL_URI, MODEL_NAME), this.onContentRead);
The public void onContentRead(NodeRef nodeRef) is not getting called while accessing the properties. Is there any other configuration that I am missing?
Thank you.
In that case , you don't have choice, other writing the Spring method interceptor.
Using this you can intercept the method, meaning you can call your own method whenever the specified method in specified object is called.
In your case you need to intercept method of nodeService.Method names are getProperty and getProperties.Below link contains more information on Spring method interceptor.You can google it for more details.
Spring MVC Interceptor HandlerInterceptorAdapter, HandlerInterceptor Example - JournalDev
Oh thank you Krutik, I will try that.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.