Release a node under review

Hi. We hava a process that is listening an event. When the event occurs the process receive a JSON with information that we need to update in differents nodes. Until now we have been using

WorkflowDocumentVariantImportTask importTask = importTask.createOrUpdateDocumentFromVariantContentNode(ContentNode contentNode, String primaryTypeName, String documentLocation, String locale, String localizedName)

But we have detected that some users are blocking the Content activating the Review option in the GUI interface

In console we can see a new node when review is active

image

So when we process the node programatically, we obtain a "“Failed to obtain editable instance on document.” exception.

Is there any way to remove this review, process the node as we have been doing until now, activate the review again programatically??

Thank you

@katmandu25
You can programmatically obtain the DocumentWorkflow on related node and use that workflow instance to reject the request
It may look like below

final WorkflowManager workflowManager = ((HippoWorkspace) session.getWorkspace()).getWorkflowManager();
final DocumentWorkflow documentWorkflow =
                        (DocumentWorkflow) workflowManager.getWorkflow("default", session.getNode(jcrNode);
documentWorkflow.cancelRequest(jcrNode);

Thank for your answer ThoLe.

A question. When you say jcrNode as param of cancelRequest is a String containing the full path to the node???

If I do that I receive an exception like this

“Cannot invoke workflow reviewworkflow action cancelRequest: request /content/documents/santander/santander-common-apis/en_gb/content/producercontainers/common-apis/apicontainers/apis/test_request_1.1.0.0 not found”

Thank you again.

According to the specification, jcrNode is the request node identification not the path :slight_smile:

Great !!! I made it using theUUID

You are the Oracle :wink:

Can I ask you another one??? I can´t find information about the methods you have given to me, perphaps because I am very clumsy.

I need to leave the node the same before deleted the request. Can you help me with this???

Thanks a lot.

P.D. If you come to Spain call me. I owe you a beer.

Hey, I read about DocumentWorkflow from here. About the method’s specification of course you can read from the class’s Javadoc :grinning: