Package org.xwiki.notifications.filters
Interface NotificationFilterManager
-
@Role public interface NotificationFilterManager
Provide an interface for interacting with user notification filters.- Since:
- 9.7RC1
- Version:
- $Id: 3c85ec4ba75fdadeedc6c661644e5bf3276d9cd2 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description org.xwiki.rendering.block.Block
displayFilter(NotificationFilter filter, NotificationFilterPreference preference)
Render aNotificationFilter
using an associatedNotificationFilterPreference
.Collection<NotificationFilter>
getAllFilters(boolean allWikis)
Get all notifications filters.Collection<NotificationFilter>
getAllFilters(DocumentReference user, boolean onlyEnabled)
Get all notifications filters that are enabled to the given user.default Collection<NotificationFilter>
getAllFilters(DocumentReference user, boolean onlyEnabled, NotificationFilter.FilteringPhase filteringPhase)
Get all notifications filters that are enabled to the given user and matching the requested filtering moment.default Collection<NotificationFilter>
getAllFilters(WikiReference wikiReference)
Get all notifications filters from the given wikis.Stream<NotificationFilter>
getEnabledFilters(Collection<NotificationFilter> filters, Map<String,Boolean> filterActivation)
Goes through every givenNotificationFilter
.Stream<NotificationFilter>
getFiltersRelatedToNotificationPreference(Collection<NotificationFilter> filters, NotificationPreference preference)
Get from the filters the one that match the given notification preference.Map<String,Boolean>
getToggeableFilterActivations(DocumentReference user)
For all toggeable notification filters, get if the filter is enabled regarding the user profile.Stream<NotificationFilter>
getToggleableFilters(Collection<NotificationFilter> filters)
Get from the given filter the one that are toggleable.
-
-
-
Method Detail
-
getAllFilters
Collection<NotificationFilter> getAllFilters(boolean allWikis) throws NotificationException
Get all notifications filters.- Parameters:
allWikis
- include filters from all wikis or only the current one- Returns:
- a collection of notification filters
- Throws:
NotificationException
- if error happens- Since:
- 10.4RC1
-
getAllFilters
default Collection<NotificationFilter> getAllFilters(WikiReference wikiReference) throws NotificationException
Get all notifications filters from the given wikis.- Parameters:
wikiReference
- include filters from the given wiki.- Returns:
- a collection of notification filters
- Throws:
NotificationException
- if error happens- Since:
- 13.3RC1
-
getAllFilters
Collection<NotificationFilter> getAllFilters(DocumentReference user, boolean onlyEnabled) throws NotificationException
Get all notifications filters that are enabled to the given user.- Parameters:
user
- reference to the useronlyEnabled
- either or not only filters enabled for the user should be collected- Returns:
- the collection of notification filters enabled to the user.
- Throws:
NotificationException
- if an error happens- Since:
- 10.4RC1
-
getAllFilters
default Collection<NotificationFilter> getAllFilters(DocumentReference user, boolean onlyEnabled, NotificationFilter.FilteringPhase filteringPhase) throws NotificationException
Get all notifications filters that are enabled to the given user and matching the requested filtering moment.- Parameters:
user
- reference to the useronlyEnabled
- either or not only filters enabled for the user should be collectedfilteringPhase
- when the filter should be used (null
means any phase)- Returns:
- the collection of notification filters enabled to the user.
- Throws:
NotificationException
- if an error happens- Since:
- 12.9RC1, 12.6.3
-
getFiltersRelatedToNotificationPreference
Stream<NotificationFilter> getFiltersRelatedToNotificationPreference(Collection<NotificationFilter> filters, NotificationPreference preference)
Get from the filters the one that match the given notification preference.- Parameters:
filters
- a collection of notification filterspreference
- a notification preference- Returns:
- a stream returning the filters that match the given notification preference.
- Since:
- 10.4RC1
-
getToggleableFilters
Stream<NotificationFilter> getToggleableFilters(Collection<NotificationFilter> filters)
Get from the given filter the one that are toggleable.- Parameters:
filters
- a list of notification filters- Returns:
- a stream returning the toggeable filters that was on the given collection
- Since:
- 10.4RC1
-
getToggeableFilterActivations
Map<String,Boolean> getToggeableFilterActivations(DocumentReference user) throws NotificationException
For all toggeable notification filters, get if the filter is enabled regarding the user profile.- Parameters:
user
- the user to use- Returns:
- a map of notification filters with their activation state
- Throws:
NotificationException
- if an error happens- Since:
- 10.4RC1
-
getEnabledFilters
Stream<NotificationFilter> getEnabledFilters(Collection<NotificationFilter> filters, Map<String,Boolean> filterActivation)
Goes through every givenNotificationFilter
. One of the filters implementsToggleableNotificationFilter
, checks if the given user has disabled this filter. If so, remove the filter from the set.- Parameters:
filters
- the filters that should be examinedfilterActivation
- the map of filters associated to their active status- Returns:
- a set of filters that are not marked as disabled by the user
- Since:
- 10.4RC1
-
displayFilter
org.xwiki.rendering.block.Block displayFilter(NotificationFilter filter, NotificationFilterPreference preference) throws NotificationException
Render aNotificationFilter
using an associatedNotificationFilterPreference
.- Parameters:
filter
- the filter to usepreference
- the notification preference to use- Returns:
- a rendered form of the notification filter
- Throws:
NotificationException
- if an error happens
-
-