I am dynamically registering Executionlisteners to process-elements (camunda-bpm-reactor, but would also apply to camunda-engine-cdi).
Now when dealing with an “Transaction” element, I get a CCE when getting the elementTypename, because internal camunda code already assumes it is a FlowElement, which it is not:
see BpmnModelExecutionContext#getBpmnModelElementInstance -> internal cast to FlowElement.
How can I do this:
static String extractTypeName(DelegateExecution bpmnModelExecutionContext) {
ModelElementInstance bpmnModelElementInstance = bpmnModelExecutionContext.getBpmnModelElementInstance();
return bpmnModelElementInstance.getElementType().getTypeName();
}
when the executionListener is bound to a Transaction element?
Bug and test case: https://github.com/camunda/camunda-bpm-reactor/tree/bugfix/40_SupportTransaction/extension/core/src/test/java/org/camunda/bpm/extension/reactor/process