I would like to offer users the possibility to start a diagram by picking examples from a list of predefined templates, and wonder what is the best way to implement this.
What I am thinking of:
- I would create a few templates (like a dozen, which I find relevant for this project) by myself, and would save them in 12 XML files
- I would then offer a menu from which the user can pick one of the 12 templates, in order to create his diagram in 1 click (behind the scene, my code would call
importXMLto initialize the diagram).
- he/she would then be able to modify it with the BPMN editor, as usual.
- the diagrams would then be executed by Camunda
a) as the same template could be used multiple times to create multiple diagrams (which would then be possibly executed in parallel by Camunda), I think I have to modify the IDs of the activities, once they are read from the XML file, to make sure they are unique across the various created diagrams. Otherwise, this could result in duplicate IDs within the Camunda engine.
→ question 1: is it an issue if activities/links have shared IDs across various process definitions? (e.g. process definition X contains a task with ID activity_123, and process definition Y also contains a task with ID activity_123)
→ question 2: how can I modify all the IDs of my XML templates, and ensure unicity?
b) I could alternatively use copy/paste features and iterate over all the elements of the diagram, but it seems that it would be a huge amount of work, and I guess there are higher level features in BPMNjs to avoid this. Also, I don’t know how the IDs of activities/links are changed when copying/pasting.
Could you please help me by telling what would be the best way to achieve all this?