I am new on Alfresco community version 5.2
I tried to access document from service task java class using CMIS API
Document is attached to workflow on start by rule java script as:
var workflow = actions.create("start-workflow");
workflow.parameters.docnode = document;
In service task java class I access document
ActivitiScriptNode scriptNode = (ActivitiScriptNode) execution.getVariable("docnode");
NodeRef docref = scriptNode.getNodeRef();
ClientCmis client = new ClientCmis();
Document doc = (Document) client.searchDocument(scriptNode.getId());
I still had got NullPointerException but when I substitute scriptNode.getId()with string ID of existing document code works fine.
It seems to me that file does not exist in CMIS repository until rule code reaches end. Does it have something to do with transactions?