Does exist file in CMIS repository on workflow started by rule?

cancel
Showing results for 
Search instead for 
Did you mean: 
pnature
Established Member

Does exist file in CMIS repository on workflow started by rule?

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?

1 Reply
pnature
Established Member

Re: Does exist file in CMIS repository on workflow started by rule?

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.