If you use Delegation Code, you can access the CMMN model instance and current element of the executed case. If a CMMN model is accessed, it will be cached to avoid redundant database queries.

Case Execution Listener

If your class implements the org.camunda.bpm.engine.delegate.CaseExecutionListener interface, you can access the CMMN model instanceand the plan item element. As a Case Execution Listener can be added to several elements like case plan model, human task, etc., it cannot be guaranteed which type the flow element will be.

  1. public class ExampleCaseExecutionListener implements CaseExecutionListener {
  2. public void notify(DelegateCaseExecution caseExecution) throws Exception {
  3. CmmnModelInstance modelInstance = execution.getCmmnModelInstance();
  4. CmmnElement cmmnElement = execution.getCmmnModelElementInstance();
  5. }
  6. }

原文: https://docs.camunda.org/manual/7.9/user-guide/model-api/cmmn-model-api/delegation-code/