How to obtain conversationId from within Operation plugin?

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 expose a LiveEdit link for a given document to some outer service, and the problem is I can't obtain conversationId which is required 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. How can I get proper LiveEdit URL (and especially conversationId)? Thank you in advance.

0 votes

0 answers

1284 views

ANSWER

Have you looked at ConversationIdGenerator.java ? Maybe it is easier to create a new one.
01/20/2015

The problem is LiveEdit URL should contain EXISTING conversationId. I can create a new one, but such an nxedit: URL wouldn't work.
01/20/2015

Hello,

My 2 cents,

You can find the seam context into Operation context: context.get("seamActionContext");

But you have to fill the parameter require of the annotation Operation as for instance:

@Operation(id = AddInfoMessage.ID, category = Constants.CAT_UI, requires = Constants.SEAM_CONTEXT, label = "Add Info Message")

Into this seam context you could maybe find the conversation id. You can find it also in context.get("conversationId") in fact, you have to verify.

And don't hesitate to see org.nuxeo.ecm.automation.seam.operations.InitSeamContext. You have maybe to run this operation before running yours.

01/30/2015