02-06-2017 11:45 AM
Hi,
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;
workflow.execute(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?
02-16-2017 04:50 AM
I think that Activiti workflow cannot access repository internally through services. It has to use external APIs.
But just created file don't exist for external APIs.
I found solution in putting document into ASSOC_PACKAGE_CONTAINS as binary array.
Explore our Alfresco products with the links below. Use labels to filter content by product module.