@ Override public void invoke ( final ActionRequest req , final ActionResponse res ) throws IOException { final NotificationEntry entry = getTarget ( ) ; final String notificationId = entry . getId ( ) ; final Set < String > favoriteNotices = this . getFavoriteNotices ( req ) ; if ( favoriteNotices . contains ( notificationId ) ) { favoriteNotices . remove ( notificationId ) ; } else { favoriteNotices . add ( notificationId ) ; } setFavoriteNotices ( req , favoriteNotices ) ; }
Invoking a FavoriteAction toggles it .