cancel
Showing results for 
Search instead for 
Did you mean: 

access documents attached with workflow from java code

alinawab
Champ in-the-making
Champ in-the-making
Hi,
I want to access attached documents with my workflow from my class that extends tasklistener class. I want to set their properties. I have done same in javascript.

bpm_package.children[0].properties["rtwf:documenttype"] = execution.getVariable('rtwf_documenttype');
            bpm_package.children[0].properties["rtwf:status"] = "Closed";   
            bpm_package.children[0].save();




I want **Java** version of this.

Thanks in advance!
2 REPLIES 2

bhavikp
Champ on-the-rise
Champ on-the-rise
Java version:

Map<String, Object> variableMap = delegateTask.getVariables();

ActivitiScriptNode scriptnode = (ActivitiScriptNode) variableMap.get("bpm_package");

final NodeRef workflowPackageNodeRef = scriptnode.getNodeRef();
         
final List<ChildAssociationRef> lResources = nodeService.getChildAssocs(workflowPackageNodeRef);

//Get the content noderef from activiti package items.
for(){

—-
—-
}

alinawab
Champ in-the-making
Champ in-the-making
finnaly I have access the documents that are attached with workflow using the following code.

ActivitiScriptNode scriptNode = (ActivitiScriptNode)execution.getVariable(WorkflowNotificationUtils.PROP_PACKAGE);              
NodeRef packagenode = scriptNode.getNodeRef();
NodeRef docRef= Configuration.serviceRegistry.getNodeService().getChildAssocs(packagenode).get(0).getChildRef();

And to update the aspects attached with this documents I have used.

if(docRef !=null)
{
         // Setting aspects of documents.
         nodeService.setProperty (docRef,QName.createQName("http://rolustech.com/model/default", "Property Name"),(Serializable) "Value");
                                  
}