I'm trying to add a listener on ProcessEventListener and catch all nodes my process run through. I managed to do it pretty easily with the 'beforeNodeTriggered' method, and within the ProcessNodeTriggeredEvent that I receive, I found the useful getNodeInstance().getNodeId() method that allowed my to track my process's flow.
I'd like to correlate that with the structure of the process itself (as defined in the bpmn file). I saw that I can get the Process class for my process and through it, get to the 'BPMN.Connections' key in the metadata. That returned my a list of SequenceFlow objects, from which I could extract SourceRef and TargetRef which basically draws my workflow graph (regardless of what was actually executed).
My 2 questions are:
1. Is there a better way to inspect a Process design, other than using the metadata and the 'BPMN.Connections'? It sound to me like a basic requirement from a Process to have methods like getNodes and/or getConnections but I couldn't find one. Perhaps there is another class representing the structure of the process?
2. If I use SourceRef/TargetRef to build my graph. How do I map between that and the node IDs that I get from the ProcessNodeTriggeredEvent?
Hopefully my question was clear enough, if not - I'll be more than happy to elaborate.