protected EventLoggerEventHandler getEventHandler ( ActivitiEvent event ) { Class < ? extends EventLoggerEventHandler > eventHandlerClass = null ; if ( event . getType ( ) . equals ( ActivitiEventType . ENTITY_INITIALIZED ) ) { Object entity = ( ( ActivitiEntityEvent ) event ) . getEntity ( ) ; if ( entity instanceof ExecutionEntity ) { ExecutionEntity executionEntity = ( ExecutionEntity ) entity ; if ( executionEntity . getProcessInstanceId ( ) . equals ( executionEntity . getId ( ) ) ) { eventHandlerClass = ProcessInstanceStartedEventHandler . class ; } } } else if ( event . getType ( ) . equals ( ActivitiEventType . ENTITY_DELETED ) ) { Object entity = ( ( ActivitiEntityEvent ) event ) . getEntity ( ) ; if ( entity instanceof ExecutionEntity ) { ExecutionEntity executionEntity = ( ExecutionEntity ) entity ; if ( executionEntity . getProcessInstanceId ( ) . equals ( executionEntity . getId ( ) ) ) { eventHandlerClass = ProcessInstanceEndedEventHandler . class ; } } } else { // Default: dedicated mapper for the type eventHandlerClass = eventHandlers . get ( event . getType ( ) ) ; } if ( eventHandlerClass != null ) { return instantiateEventHandler ( event , eventHandlerClass ) ; } return null ; }
Subclasses can override this if defaults are not ok