I’ve created a DataObjectReference, automatically, a DataObject is created, but it is NOT in the list returned by elementRegistry.getAll() to be accessed.
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" 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"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI">
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:startEvent id="StartEvent_1"/>
<bpmn:dataObjectReference dataObjectRef="DataObject_0rwipda" id="DataObjectReference_0w6bim9"/>
<bpmn:dataObject id="DataObject_0rwipda"/>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane bpmnElement="Process_1" id="BPMNPlane_1">
<bpmndi:BPMNShape bpmnElement="StartEvent_1" id="_BPMNShape_StartEvent_2"><dc:Bounds height="36" width="36" x="173" y="102"/></bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="DataObjectReference_0w6bim9" id="DataObjectReference_0w6bim9_di"><dc:Bounds height="50" width="36" x="628" y="188"/>
<bpmndi:BPMNLabel><dc:Bounds height="20" width="90" x="601" y="238"/></bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
I tried to get the DataObject though dataElement.businessObject.dataObjectRef.id but as I said before, it is not in the list returned by elementRegistry.getAll().
I need to access it in order to create an ExtensionElement but the businessObject info must be present in the DataObject to do so.