cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate BPMNDI entries after elements ID change

pkromolowski
Champ in-the-making
Champ in-the-making
Hi,

When deploying a process definition an error it thrown when you have changed some element ids. The problem is that the plugin saves BOTH old and new element definitions, but since the old bpmndi shape definition no longer refers to any element on the diagram - the following error is thrown:
Invalid reference in 'bpmnElement' attribute, activity usertask1 not found | ZZZMyProcess2.bpmn20.xml | line 15 | column 74

Before ID change I have:

      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="330.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>

After ID change I have both:

      <bpmndi:BPMNShape bpmnElement="usertask1" id="BPMNShape_usertask1">
        <omgdc:Bounds height="55.0" width="105.0" x="330.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="testingIdChange" id="BPMNShape_testingIdChange">
        <omgdc:Bounds height="55.0" width="105.0" x="330.0" y="240.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>

I am using the latest Designer 5.12.1 SNAPSHOT release fetched from github.

I think that the may be due to the following code in org.activiti.bpmn.converter.export.BPMNDIExport.writeBPMNDI(BpmnModel, XMLStreamWriter)

        FlowElement flowElement = model.getFlowElement(elementId);
        if (flowElement != null && flowElement instanceof SubProcess) {
          xtw.writeAttribute(ATTRIBUTE_DI_IS_EXPANDED, String.valueOf(graphicInfo.isExpanded()));
        }

        xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE);
        xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, "" + graphicInfo.getHeight());
        xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, "" + graphicInfo.getWidth());
        xtw.writeAttribute(ATTRIBUTE_DI_X, "" + graphicInfo.getX());
        xtw.writeAttribute(ATTRIBUTE_DI_Y, "" + graphicInfo.getY());

which should be replaced to:

        if (flowElement != null)
        {
            if (flowElement instanceof SubProcess) {
                 xtw.writeAttribute(ATTRIBUTE_DI_IS_EXPANDED, String.valueOf(graphicInfo.isExpanded()));
            }

            xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE);
            xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, "" + graphicInfo.getHeight());
           ….
        }


Thanks,
Przemek
1 REPLY 1

trademak
Star Contributor
Star Contributor
Hi Przemek,

Thanks for reporting this. It should now fixed in Github.

Best regards,