I extended the metamodel of the bpmn with some new elements. Modeling and outputting xml works perfect. However, if I try to import a previously saved xml-file, some elements are not getting drawn.
My code is located here: https://github.com/koseduhemak/bpmn-js-clinical-pathways
The metamodel extension is located in the file "app/clinical-pathways/ext-metamodel/CPMetamodel.json".
The problem occurs f.e. with "StructuredDocument". That element can hold multiple sub elements of type "Segment" (which can hold other "Segment"-elements recursively). It should work as bpmn's "SubProcess"-element, which can also hold sub-elements. During modeling everything seems to be working fine, even the xml output is correct. But if I import a saved diagram with nested elements like described above, only the first "StructuredDocument" (without sub elements) is drawn. I tried to derive it from "bpmn:FlowElementsContainer" (to match the "bpmn:SubProcess" definition), but had no luck.
But it also occurs with "CPResource", if i derive it only from "bpmn:Resource". If I derive it from "bpmn:Resource" AND "bpmn:FlowElement" it gets drawn correctly at the import.
My xml output of my test diagram: cp-import-problem.bpmn (3.5 KB)
My test diagram:
I digged a little further and recognized, that "bpmn-js/lib/import/BpmnTreeWalker.js" is responsible for importing elements... But it is very hard to understand that file... Maybe I have to write an custom TreeWalker which processes my elements and takes care of the sub-elements?
Do you have any tips how to solve this problem?