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?
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.
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.