Here the code :
InputStream inputStream = ModelController.class.getResourceAsStream(“/test2.cmmn”);
CmmnModelInstance modelInstance = Cmmn.readModelFromStream(inputStream);
ModelElementType stageType = modelInstance.getModel().getType(Stage.class);
Collection stages = modelInstance.getModelElementsByType(stageType);
The problem is that the order of stage in stages collection is not respected according to model (workflow). How to be able to have a list of stages which respects the order?
My CMMN model starts with a stage, then once it is finished, another one starts, then another, etc.
I could name my stages with number:
- Stage X
- Stage Y
- Stage Z
- …
And then order the collection according to the name, but it is not what i want.
Thanks for your help
Hi @nestolalu,
can you please share your CMMN model?
Best regards,
Philipp
I actually changed the project and decided to continue with BPMN model. So instead of stage i have Sub processes which are interconnected. The question remains the same.
How to retrieve the list of all sub processes (children of main process not sub sub processes) ? I would like to list the name of the sub processes
And how to retrieve the active sub process ?
Hi @nestolalu,
you can use the Model API to read the BPMN model and find the sub-processes.
If you want to know if the sub-process is active (i.e. if an execution is at the activity) then you can use the Execution Query of the RuntimeService.
Does this help you?
Best regards,
Philipp
Is there a way to find the correct order of subprocesses ?
subProcess1 --> subProcess2 --> subProcess3
When reading the BPMN model, the order is not guaranteed.