public boolean hasProjectSubscribersForTypes ( String projectUuid , Set < Class < ? extends Notification > > notificationTypes ) { Set < String > dispatcherKeys = handlers . stream ( ) . filter ( handler -> notificationTypes . stream ( ) . anyMatch ( notificationType -> handler . getNotificationClass ( ) == notificationType ) ) . map ( NotificationHandler :: getMetadata ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . map ( NotificationDispatcherMetadata :: getDispatcherKey ) . collect ( MoreCollectors . toSet ( notificationTypes . size ( ) ) ) ; return dbClient . propertiesDao ( ) . hasProjectNotificationSubscribersForDispatchers ( projectUuid , dispatcherKeys ) ; }
Returns true if at least one user is subscribed to at least one notification with given types . Subscription can be global or on the specific project .