Hi,
im reading in my BPMN2 model
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">
<process id="process_IDTXSPKVNUK4G2HQM5CJHZCD2SPMWSSBDIFBVOCIHRDZKH0KDVYRRD" name="Pool 1">
<startEvent id="shape_IDHM1NDZCXAS2ZEIIENLWZJN4SJBN3A0T3OCC4E0BEWRNHFG1OAON" name="">
<eventDefinitionRef>myTimerID</eventDefinitionRef>
</startEvent>
</process>
<timerEventDefinition id="myTimerID"/>
</definitions>
via the following snipplet:
Resource resource = new Bpmn2ResourceFactoryImpl().createResource(URI.createFileURI(fileUri));
HashMap<Object, Object> options = new HashMap<>();
options.put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, true);
try {
resource.load(options);
} catch (Exception featureNotFoundException) {
featureNotFoundException.printStackTrace();
}
DocumentRoot documentRoot = (DocumentRoot) resource.getContents().get(0);
for (RootElement rootElement : documentRoot.getDefinitions().getRootElements()) {
if (rootElement instanceof org.eclipse.bpmn2.Process) {
org.eclipse.bpmn2.Process targetProcess = (org.eclipse.bpmn2.Process) rootElement;
for (FlowElement flowElement : targetProcess.getFlowElements()) {
if (flowElement instanceof StartEvent) {
StartEvent startEvent = (StartEvent) flowElement;
if (startEvent.getEventDefinitionRefs().get(0) instanceof TimerEventDefinition) {
System.out.println("all good!");
} else {
System.out.println("why?");
}
}
}
}
}
then, my code prints "why?", from my point of view it looks like a semantic loss or (more likely) what exactly Im doing wrong? From the BPMN2 spec, it seems to be valid to define an eventDefinition as a reference in <definitions> as well as to define it by value (nested) in the StartEvent in eventDefinitions.
brgds,
Bert