Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-12831

DMN model API: exception when adding second inputData element

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Unresolved
    • Icon: L3 - Default L3 - Default
    • None
    • 7.14.0
    • dmn model api
    • None

      I'm trying to use the DMN model API to create a conversion from modelling platform logic to DMN. I use the DMN and XML model plugins of version 7.14. I found out that an exception occurs when adding a second inputData element to a modelInstance.

      See https://github.com/oneton/camunda-inputDataReference for my basic reproduction.

      See the (partial) stack trace below. The error message is confusing, since InputData is a subclass of DrgElement. When digging further, I noticed that the existing inputData element actually gets converted to the InputDataReference class in ModelUtil.getModelElementCollection. This call ends up in ModelUtil.getModelElement which skips creation of the element instance when the reference is set on the DOM element (this provides a workaround - see second unit test). The actual problem  occurs in ModelImpl.getTypeForName, because InputData and InputDataReference share the same XML element name. The Map used therefore contains the last defined element which is the InputDataReference. Looking at the DmnModelConstants, the same problem seems to exist for itemDefinition. 

      org.camunda.bpm.model.xml.ModelException: New child is not a valid child element type: inputData; valid types are: [description, extensionElements, import, itemDefinition, drgElement, artifact, elementCollection, businessContextElement]
      	at org.camunda.bpm.model.xml.impl.util.ModelUtil.getIndexOfElementType(ModelUtil.java:203)
      	at org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl.findElementToInsertAfter(ModelElementInstanceImpl.java:330)
      	at org.camunda.bpm.model.xml.impl.instance.ModelElementInstanceImpl.addChildElement(ModelElementInstanceImpl.java:288)
      	at org.camunda.bpm.unittest.DmnCreateMultipleInputDataTestCase.shouldCreateMultipleInputData(DmnCreateMultipleInputDataTestCase.java:73) 

      I am willing to contribute a pull request, but I'm not sure how to address this since it seems to be quite a fundamental issue. If the problem (of duplicate XML names) is limited to reference/non-reference elements, using a secondary map for reference elements (based on the presence of the href attribute) could be a direction to investigate. 

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              oneton Anton Tieleman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: