nikku / bpmn-js-copy-paste-example

An example how to copy and paste between multiple instances of bpmn-js
5 stars 0 forks source link

Question: copy and paste also camunda properties. Is It possible? #1

Closed rbatllet closed 6 years ago

rbatllet commented 6 years ago

I'm using the bpmn-js with the camunda moddle extensions but when I copy the userTask Task_03uibfp with the copy feature from bpmn-js, the camunda properties are not copied.

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL"
  xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
  xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
  id="Definitions_1"
  targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:process id="Process_1" isExecutable="false">
    <bpmn:userTask xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Task_03uibfp" camunda:modelerTemplate="my.own.test">
      <bpmn:extensionElements/>
    </bpmn:userTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="UserTask_11ed4hk_di" bpmnElement="Task_03uibfp"><dc:Bounds x="185" y="177" width="100" height="80"/></bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

The camunda property “modelerTemplate” is lost when I paste it into a new userTask UserTask_1s4e3bo:

<bpmn:userTask xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Task_03uibfp" camunda:modelerTemplate="my.own.test">
     <bpmn:extensionElements />
</bpmn:userTask>

The result diagram is:

<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
  <bpmn:process id="Process_1" isExecutable="false">
    <bpmn:userTask xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Task_03uibfp" camunda:modelerTemplate="my.own.test">
      <bpmn:extensionElements />
    </bpmn:userTask>
    <bpmn:userTask id="UserTask_1s4e3bo">
      <bpmn:extensionElements />
    </bpmn:userTask>
  </bpmn:process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
      <bpmndi:BPMNShape id="UserTask_11ed4hk_di" bpmnElement="Task_03uibfp">
        <dc:Bounds x="185" y="177" width="100" height="80" />
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape id="UserTask_1s4e3bo_di" bpmnElement="UserTask_1s4e3bo">
        <dc:Bounds x="361" y="199" width="100" height="80" />
      </bpmndi:BPMNShape>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</bpmn:definitions>

Then the camunda properties are missing:

<bpmn:userTask id="UserTask_1s4e3bo">
    <bpmn:extensionElements />
 </bpmn:userTask>
rbatllet commented 6 years ago

Solved successfully on https://forum.bpmn.io/t/how-to-copy-and-paste-all-the-defined-camunda-properties-from-a-bpmn-diagram/2205