Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BPMN 2.0 Modeler » Loss of type information?
Loss of type information? [message #1773838] Thu, 05 October 2017 11:29
Bert Brecht is currently offline Bert BrechtFriend
Messages: 7
Registered: July 2016
Junior Member
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
Previous Topic:Pop-up sub-process
Next Topic:Extend Annotation
Goto Forum:
  


Current Time: Fri Oct 19 10:43:48 GMT 2018

Powered by FUDForum. Page generated in 0.02340 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top