public void addEvent ( final EventType _eventtype , final EventDefinition _eventdef ) throws CacheReloadException { List < EventDefinition > evenList = this . events . get ( _eventtype ) ; if ( evenList == null ) { evenList = new ArrayList <> ( ) ; this . events . put ( _eventtype , evenList ) ; } if ( ! evenList . contains ( _eventdef ) ) { evenList . add ( _eventdef ) ; } // if there are more than one event they must be sorted by their index // position if ( evenList . size ( ) > 1 ) { Collections . sort ( evenList , new Comparator < EventDefinition > ( ) { @ Override public int compare ( final EventDefinition _eventDef0 , final EventDefinition _eventDef1 ) { return Long . compare ( _eventDef0 . getIndexPos ( ) , _eventDef1 . getIndexPos ( ) ) ; } } ) ; } setDirty ( ) ; }
Adds a new event to this AdminObject .