How to invalidate a document from an event listener
I have a listener class that implements org.nuxeo.ecm.core.event.EventListener, and I want to invalidate the current document from there. Normally, in a bean, I use to inject NavigationContext, and then use its method to invalidate the document. But I don't know how can I inject NavigationContext to a listener (if it is possible), and I don't know if there is another way to invalidate the current document from there too.
Also, is there a way to inject a bean to a listener? Because that would also work for me.
Thank you very much in advance,
Hi, You can access EventContext, CoreSession, SourceDocument from DocumentEventContext where event is fired ( you can control process of firing event ), but not Navigation Context as listener is executed on background can't access navigation context. You also can get Services instances on listener, as for example Framework.getService(serviceClass), you can contribute your custom services (with your business logic) or use Document Adapter. Thanks
so does that mean that there is no way to invalidate the document from a listener?