code: protected BpmnModel extractBpmnModelFromEvent(ActivitiEvent event) {
      BpmnModel result = null;
      
      if (result == null && event.getProcessDefinitionId() != null) {
        ProcessDefinition processDefinition = ProcessDefinitionUtil.getProcessDefinition(event.getProcessDefinitionId(), true);
        if (processDefinition != null) {
          result = Context.getProcessEngineConfiguration().getDeploymentManager().resolveProcessDefinition(processDefinition).getBpmnModel();
        }
      }
      
      return result;
    }
docs: In case no process-context is active, this method attempts to extract a process-definition based on the event. In case it's an event related to an entity, this can be deducted by inspecting the
  entity, without additional queries to the database.
  
  If not an entity-related event, the process-definition will be retrieved based on the processDefinitionId (if filled in). This requires an additional query to the database in case not already
  cached. However, queries will only occur when the definition is not yet in the cache, which is very unlikely to happen, unless evicted.
  
  @param event
  @return