04-10-2014 12:10 PM
Hi,
I have a class called MissionEventHandler, that is called by an event of the delete button in the listing in page.
Here is a part of my code:
public void handleEvent(Event event) throws ClientException {
EventContext ctx = event.getContext();
if (!(ctx instanceof DocumentEventContext)) {
return;
}
DocumentModel doc = ((DocumentEventContext) ctx).getSourceDocument();
if (doc == null) {
return;
}
String type = doc.getType();
if ("Mission".equalsIgnoreCase(type)
&& event.getName().equalsIgnoreCase("documentRemoved")){
processMediaRemove(doc, ctx.getCoreSession());
}
}
private void processMediaRemove(DocumentModel doc, CoreSession session)
throws ClientException {
DocumentModel docTest = session.getDocument(doc.getRef()); <<<----------
Serializable sml = docTest.getPropertyValue("mission:medias");
}
When I try to retrieve the document from session it returns me the following Exception
2014-04-09 10:34:17,917 ERROR [http-bio-0.0.0.0-8080-exec-44] [org.nuxeo.ecm.core.event.impl.EventServiceImpl] Error during updateMissionRelatedAssets sync listener execution, transaction won't be rolled back since event.markRollBack() was not called by the Listener org.nuxeo.ecm.core.api.ClientException: Failed to get document 8d6c5833-830c-4b9b-9ec6-eb8667dead15 at org.nuxeo.ecm.core.api.AbstractSession.getDocument(AbstractSession.java:1234) at org.br.ezute.mission.event.MissionEventHandler.processMediaRemove(MissionEventHandler.java:54) at org.br.ezute.mission.event.MissionEventHandler.handleEvent(MissionEventHandler.java:45) at org.nuxeo.ecm.core.event.impl.EventServiceImpl.fireEvent(EventServiceImpl.java:215) at org.nuxeo.ecm.core.api.AbstractSession.fireEvent(AbstractSession.java:385) at org.nuxeo.ecm.core.api.AbstractSession.notifyEvent(AbstractSession.java:437) at org.nuxeo.ecm.core.api.AbstractSession.removeNotifyOneDoc(AbstractSession.java:1839) at org.nuxeo.ecm.core.api.AbstractSession.removeDocument(AbstractSession.java:1786) at org.nuxeo.ecm.core.api.AbstractSession.removeDocument(AbstractSession.java:1772)
How do I recover my document and at what time the session is updated with CurrentDocument?
Can someone help me?
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.