I'm working on a Nuxeo plugin which implements an operation. So I'm using @Operation
, @OperationMethod
and @Context
annotations. The purpose of plugin is to get LiveEdit link, and the problem is I can't obtain conversationId which is needed for building a nxedit: URL. Nuxeo source code uses
Manager.instance().getCurrentConversationId()
but I can't obtain Manager instance in my plugin either. And it seems impossible to inject Manager instance via @Context, it returns just null value.
Thank you in advance.
Asked
Active
Viewed 252 times
1

Buhake Sindi
- 87,898
- 29
- 167
- 228

chernish2
- 113
- 1
- 9
1 Answers
0
Did you look at Seam.InitContext
and Seam.RunOperation
operations?
Both do a call to org.nuxeo.ecm.automation.seam.operations.SeamOperationFilter.handleBeforeRun(OperationContext, String)
and org.nuxeo.ecm.automation.seam.operations.SeamOperationFilter.initializeSeamContext(OperationContext, String, CoreSession)
. The conversationId should then be available:
ConversationPropagation.instance().setConversationId(conversationId);
Manager.instance().restoreConversation();

Julien Carsique
- 3,915
- 3
- 22
- 28
-
Yes, I did. Both methods requires a `conversationId` as String parameter, and my problem is I can't obtain it. They using `conversationId = (String) context.get("conversationId");` but it seems that there is no such key in plugin context. – chernish2 Jan 19 '15 at 12:28
-
You can still pass null. But if you run your operation in a chain after one of the above operations, then the seam context should have been initialized. – Julien Carsique Jan 19 '15 at 12:30
-
When I'm trying to call `Seam.InitContext` operation I get `Can not init Seam context: no HttpServletRequest was found`. I'm calling it like this: `OperationContext operationContext = new OperationContext(session); operationContext.setInput(doc); OperationChain chain = new OperationChain("chain"); chain.add("Seam.InitContext"); AutomationService automationService = Framework.getService(AutomationService.class); automationService.run(operationContext, chain);` – chernish2 Jan 19 '15 at 14:18