To implement a class that delegates the input and output variable mapping for a call activity, this class needs to implement the org.camunda.bpm.engine.delegate.DelegateVariableMapping interface.
But how can I attach this class to process? I should specify qualified class name in process definition (in Modeler)? Or programmatically in spring engine configuration?
If you use a Call Activity, you can specify the way you want to refer to your delegate. The example I use is implemented via delegate expression but you can also use the full class path.
Inside said class you just implement the org.camunda.bpm.engine.delegate.DelegateVariableMapping interface and override the input/output mapping methods. There you can manipulate the execution context and its variables.
is the “Delegate Variable Mapping” only available for call activities?
I have a CMMN instance which starts a BPM instance, and uses the variable in/out mapping available through the modeler. I’m wondering if writing Java code is an option here, too?
Hi @ilistes,
afaik the “Delegate Variable Mapping” is only available for Call Activities, as also shown in your link.
If you want to pass variables to the process to be instantiated, you may check the available listeners section. The Case Execution Listener allows to call a referenced Java class on certain events, such as case start, end etc.
Whether variables passed to the CMMNs execution scope via listener are available in the process’ execution scope is questionable, but you may give it a quick try.