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.
public class ExampleCaseExecutionListener implements CaseExecutionListener {
public void notify(DelegateCaseExecution caseExecution) throws Exception {
CmmnModelInstance modelInstance = execution.getCmmnModelInstance();
CmmnElement cmmnElement = execution.getCmmnModelElementInstance();
}
}
原文: https://docs.camunda.org/manual/7.9/user-guide/model-api/cmmn-model-api/delegation-code/