onContentReadPolicy is being executed automatically withouth actually reading any node or document.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 10: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;
});
}
Labels:
- Labels:
-
Alfresco Content Services
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-24-2023 11:12 PM
Hi, i am having same issue. Did you find a solution for this?
