09-15-2023 07:27 AM
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;
});
}
09-24-2023 08:12 PM
Hi, i am having same issue. Did you find a solution for this?
Explore our Alfresco products with the links below. Use labels to filter content by product module.