get BPMN Elements in order
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2016 11:51 AM
Hi,
I would like to get all Flow Elements in the same order as they appear in the diagram. Currently, I am retrieving list of flow elements like this:
However, the order of elements is not the same as it is in the BPMN Diagram.
I was thinking to write my own function and order the elements based on the value of source and target of sequence flows. But is there any way I can get elements in order using Activiti functions?
I would like to get all Flow Elements in the same order as they appear in the diagram. Currently, I am retrieving list of flow elements like this:
List<FlowElement> elements = model.getMainProcess().getFlowElements()
However, the order of elements is not the same as it is in the BPMN Diagram.
I was thinking to write my own function and order the elements based on the value of source and target of sequence flows. But is there any way I can get elements in order using Activiti functions?
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2016 03:00 AM
Hi,
I do not know about such a function.
Regards
Martin
I do not know about such a function.
Regards
Martin
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2016 08:12 AM
Hi,
we cannot talk always about a specific order of the elements in a diagram since there could have loops, gateways, etc..
It's like an algorithm and the execution order of the elements it's not a predictable one since a step could be skipped based on a logical condition.
Can you say which is the order of the elements for this diagram ?
https://upload.wikimedia.org/wikipedia/commons/c/c0/BPMN-DiscussionCycle.jpg
we cannot talk always about a specific order of the elements in a diagram since there could have loops, gateways, etc..
It's like an algorithm and the execution order of the elements it's not a predictable one since a step could be skipped based on a logical condition.
Can you say which is the order of the elements for this diagram ?
https://upload.wikimedia.org/wikipedia/commons/c/c0/BPMN-DiscussionCycle.jpg
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-29-2016 09:36 AM
Hi Dirla,
Thanks for your reply.
Yes, I understand that there can be gateways and loops in a process and that some elements can be skipped based on the logic.
I just wanted a function which goes through all elements of bpmn diagram in the order that they appear on canvas. The algorithm would iterate over all flow elements and if some branches comes up (like gateway), then algorithm will select one branch and will keep on iterating just like in depth first search.
So, I wrote my own function which gets all bpmn elements using following function:
<code> List<FlowElement> elements = model.getMainProcess().getFlowElements() </code>
And then I simply treat bpmn as a graph. I select the start element, then iterate over elements using 'Target Ref' value of elements. and if branches comes up then iterate over one branch and push rest of branches on stack.
Can I post code somewhere on Activiti forum in case it can help someone else?
Thanks for your reply.
Yes, I understand that there can be gateways and loops in a process and that some elements can be skipped based on the logic.
I just wanted a function which goes through all elements of bpmn diagram in the order that they appear on canvas. The algorithm would iterate over all flow elements and if some branches comes up (like gateway), then algorithm will select one branch and will keep on iterating just like in depth first search.
So, I wrote my own function which gets all bpmn elements using following function:
<code> List<FlowElement> elements = model.getMainProcess().getFlowElements() </code>
And then I simply treat bpmn as a graph. I select the start element, then iterate over elements using 'Target Ref' value of elements. and if branches comes up then iterate over one branch and push rest of branches on stack.
Can I post code somewhere on Activiti forum in case it can help someone else?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-01-2016 03:52 PM
Sure, you can post anything you like

