lyuxiaobo / lemon-workflow

A Business Process Management (BPM) platform based on flowable 6, vue 2, bpmn-js.
Apache License 2.0
38 stars 10 forks source link

A UUID is not a valid ID for a BPMN element #1

Open diegonc opened 3 years ago

diegonc commented 3 years ago

https://github.com/lyuxiaobo/lemon-workflow/blob/cb057e517f7dac1c083da9f2fad3e81d207bb2cc/lemon-workflow-frontend/package/process-designer/ProcessDesigner.vue#L362

When creating a new BPMN model the code above will use the model id (newId, a UUID) as the key parameter to the blank xml function. It in turns uses it as an id for the bpmn2:process element and its reference from BPMNPlane.

This results in a modeller that doesn't allow to drop elements to its canvas.

The patch below makes the modeller work again.

diff --git a/lemon-workflow-frontend/package/process-designer/plugins/defaultEmpty.js b/lemon-workflow-frontend/package/process-designer/plugins/defaultEmpty.js
index 21c6343..bf4c9b9 100644
--- a/lemon-workflow-frontend/package/process-designer/plugins/defaultEmpty.js
+++ b/lemon-workflow-frontend/package/process-designer/plugins/defaultEmpty.js
@@ -15,10 +15,10 @@ export default (key, name, type) => {
   xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
   id="diagram_${key}"
   targetNamespace="${TYPE_TARGET[type]}">
-  <bpmn2:process id="${key}" name="${name}" isExecutable="true">
+  <bpmn2:process id="process_${key}" name="${name}" isExecutable="true">
   </bpmn2:process>
   <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="${key}">
+    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="process_${key}">
     </bpmndi:BPMNPlane>
   </bpmndi:BPMNDiagram>
 </bpmn2:definitions>`;

But I don't know if UUID are used elsewhere.

Here is the relevant ticket in bpmn-io ( https://github.com/bpmn-io/moddle-xml/issues/41 )

lyuxiaobo commented 3 years ago

@diegonc Since the notification email from GitHub is in my spam list, I did not receive the issue notification in time. I use UUID as the key of the process to keep it consistent with the id of the model, but this is just an idea of mine. This is currently a bug. You can completely customize the key and name in the process.