[Resolved] Access to Node (documents) from a workflow
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2009 03:24 AM
Hello,
I would like to access the properties of the documents associated to a workflow. The problem is that I don't know how to retreive the nodes from the ExecutionContext…
The workflow load the java class :
The Java class :
How can I get the nodes that where attached at the beginning of the Workflow ?
Thanks
I would like to access the properties of the documents associated to a workflow. The problem is that I don't know how to retreive the nodes from the ExecutionContext…
The workflow load the java class :
<node name="notifyERP"> <event type="node-enter"> <action class="manageoffice.workflows.Demobase" /> </event> <transition to="end1"></transition> </node>
The Java class :
public class Demobase implements ActionHandler, configurationModule { private static final Logger logger = Logger.getLogger(Demobase.class); private BeanFactory factory; public Demobase() { super(); } @Override public void execute(ExecutionContext executionContext) throws Exception { if (logger.isDebugEnabled()) { logger.info("Will notified ERP Database"); }???…
How can I get the nodes that where attached at the beginning of the Workflow ?
Thanks

Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2009 06:32 PM
The nodes that were attached to the workflow are placed in a process variable called "bpm_package". You can iterate over the children of that node from JavaScript written as part of the process definition, or in Java code, which is the route you've chosen.
The code would look something like:
Jeff
The code would look something like:
ContextInstance contextInstance = executionContext.getContextInstance();JBPMNode jbpmNode = (JBPMNode) contextInstance.getVariable("bpm_package"); // there might be a constant that has this somewhereNodeRef packageNodeRef = jbpmNode.getNodeRef();List<ChildAssociationRef> childRefList = nodeService.getChildAssocs(packageNodeRef);for (ChildAssociationRef childAssocRef : childRefList) { // do something with each document in the workflow package NodeRef nodeRef = childAssocRef.getChildRef()}
Jeff
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2009 02:53 AM
Thank you Jeff


Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-19-2009 09:28 AM
Thanks Jeff…
I've been looking to manipulate the Nodes on the workflow too
I've been looking to manipulate the Nodes on the workflow too
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2012 07:33 AM
Hello,
Now I would to do the same with Activiti….
I have done this but I hope there is a better way… I have the workflowId
Could I get all documents more quickly ?
Now I would to do the same with Activiti….
I have done this but I hope there is a better way… I have the workflowId
List<WorkflowPath> paths = workflowService.getWorkflowPaths(workflowId); List<NodeRef> nodeAnnexes = new ArrayList<NodeRef>(); for (WorkflowPath path : paths) { List<WorkflowTask> tasks = workflowService.getTasksForWorkflowPath(path.getId()); for (WorkflowTask task : tasks){ List<NodeRef> nodeRefs = workflowService.getPackageContents(task.getId()); for (NodeRef nodeRef : nodeRefs){ boolean ignoreBecauseSame=false; for (NodeRef n : nodeAnnexes){ // Avoid to get same document if (n.getStoreRef().equals(nodeRef.getStoreRef())){ logger.debug("SAME"); ignoreBecauseSame=true; break; } } if (!ignoreBecauseSame){ nodeAnnexes.add(nodeRef); logger.debug(nameOfNode); // Can execute actions with the document attached to the workflow… // … } } } }
Could I get all documents more quickly ?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2012 07:41 AM
Just curious not much worked with Activii.
What is there in Activii equivalent to the execution context?
Or the same thing is available.
If so then we can use the same code posted earlier I guess.
Or you are trying to access it outside the action class?
What is there in Activii equivalent to the execution context?
Or the same thing is available.
If so then we can use the same code posted earlier I guess.
Or you are trying to access it outside the action class?
