I created a custom behaviour that extends the onContentRead policy so that i couls execute an action every time an especific type of document is requested.
The thing is that this behaviour is being executed atomatically for all the documents that matches the type but without the necesity of actually requesting the document or documents.
How can i limit the execution of this behaviour to the scenario in which the action of requesting the document to be displayed in share is executed.
This is my code:
private PolicyComponent eventManager;
private ServiceRegistry serviceRegistry;
public void registerEventHandlers() {
eventManager.bindClassBehaviour(
ContentServicePolicies.OnContentReadPolicy.QNAME,
MNContentModel.TYPE_MN_GENERAL,
new JavaBehaviour(this, "onContentRead",
Behaviour.NotificationFrequency.FIRST_EVENT));
}
public void onContentRead(NodeRef docNodeRef) {
AuthenticationUtil.runAsSystem(()-> {
try{
updateCount(docNodeRef);
}catch (Exception e){
System.out.println(e.getMessage());
}
return null;
});
}
Hi, i am having same issue. Did you find a solution for this?
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.