access documents attached with workflow from java code

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2015 08:38 AM
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!
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!
Labels:
- Labels:
-
Archive
alfresco_1.jpg
30 KB
2 REPLIES 2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2015 07:38 AM
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(){—-—-}

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2015 12:01 AM
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");
}
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");
}
