@ EventListener public void handleRegisteredServiceExpiredEvent ( final CasRegisteredServiceExpiredEvent event ) { val registeredService = event . getRegisteredService ( ) ; val contacts = registeredService . getContacts ( ) ; val mail = casProperties . getServiceRegistry ( ) . getMail ( ) ; val sms = casProperties . getServiceRegistry ( ) . getSms ( ) ; val serviceName = StringUtils . defaultIfBlank ( registeredService . getName ( ) , registeredService . getServiceId ( ) ) ; if ( communicationsManager . isMailSenderDefined ( ) ) { val message = mail . getFormattedBody ( serviceName ) ; contacts . stream ( ) . filter ( c -> StringUtils . isNotBlank ( c . getEmail ( ) ) ) . forEach ( c -> communicationsManager . email ( mail , c . getEmail ( ) , message ) ) ; } if ( communicationsManager . isSmsSenderDefined ( ) ) { val message = String . format ( sms . getText ( ) , serviceName ) ; contacts . stream ( ) . filter ( c -> StringUtils . isNotBlank ( c . getPhone ( ) ) ) . forEach ( c -> communicationsManager . sms ( sms . getFrom ( ) , c . getPhone ( ) , message ) ) ; } servicesManager . load ( ) ; }
Handle registered service expired event .