@Role public interface NotificationFilter extends Comparable
NotificationFilter
has two goals :
AbstractNode
) that will be used to retrieve a specific
subset of notifications from a provider.Event
, determine if this event should be filtered or not.Modifier and Type | Interface and Description |
---|---|
static class |
NotificationFilter.FilteringPhase
The different phases when a filter can be called.
|
static class |
NotificationFilter.FilterPolicy
The different behaviours a filter could have regarding an event.
|
Modifier and Type | Field and Description |
---|---|
static Set<NotificationFilter.FilteringPhase> |
SUPPORT_BOTH_FILTERING_PHASE
A static set containing both
NotificationFilter.FilteringPhase.POST_FILTERING and NotificationFilter.FilteringPhase.PRE_FILTERING . |
static Set<NotificationFilter.FilteringPhase> |
SUPPORT_ONLY_POST_FILTERING_PHASE
A static set containing only
NotificationFilter.FilteringPhase.POST_FILTERING . |
static Set<NotificationFilter.FilteringPhase> |
SUPPORT_ONLY_PRE_FILTERING_PHASE
A static set containing only
NotificationFilter.FilteringPhase.PRE_FILTERING . |
Modifier and Type | Method and Description |
---|---|
default int |
compareTo(Object o) |
NotificationFilter.FilterPolicy |
filterEvent(org.xwiki.eventstream.Event event,
DocumentReference user,
Collection<NotificationFilterPreference> filterPreferences,
NotificationFormat format)
Enable or disable an event in the notification list (post-filter).
|
ExpressionNode |
filterExpression(DocumentReference user,
Collection<NotificationFilterPreference> filterPreferences,
NotificationFilterType type,
NotificationFormat format)
Filtering expression to use when retrieving notifications.
|
default ExpressionNode |
filterExpression(DocumentReference user,
Collection<NotificationFilterPreference> filterPreferences,
NotificationFilterType type,
NotificationFormat format,
Collection<NotificationPreference> preferences)
Filtering expression to use when retrieving notifications.
|
ExpressionNode |
filterExpression(DocumentReference user,
Collection<NotificationFilterPreference> filterPreferences,
NotificationPreference preference)
Filtering expression to use when retrieving notifications.
|
default Set<NotificationFilter.FilteringPhase> |
getFilteringPhases() |
String |
getName()
Get the name of the filter.
|
default int |
getPriority() |
boolean |
matchesPreference(NotificationPreference preference)
Determine if the current filter can be applied to the given preference.
|
static final Set<NotificationFilter.FilteringPhase> SUPPORT_BOTH_FILTERING_PHASE
NotificationFilter.FilteringPhase.POST_FILTERING
and NotificationFilter.FilteringPhase.PRE_FILTERING
.
To be used in overrides of getFilteringPhases()
for performance reasons.static final Set<NotificationFilter.FilteringPhase> SUPPORT_ONLY_POST_FILTERING_PHASE
NotificationFilter.FilteringPhase.POST_FILTERING
.
To be used in overrides of getFilteringPhases()
for performance reasons.static final Set<NotificationFilter.FilteringPhase> SUPPORT_ONLY_PRE_FILTERING_PHASE
NotificationFilter.FilteringPhase.PRE_FILTERING
.
To be used in overrides of getFilteringPhases()
for performance reasons.NotificationFilter.FilterPolicy filterEvent(org.xwiki.eventstream.Event event, DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFormat format)
event
- an eventuser
- the user interested in the notificationfilterPreferences
- the collection of all preferences to take into accountformat
- format of the notificationboolean matchesPreference(NotificationPreference preference)
NotificationFilter
can rely on the different parameters of the
NotificationPreference
.preference
- the preference to useExpressionNode filterExpression(DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationPreference preference)
user
- the user interested in the notificationsfilterPreferences
- the collection of all preferences to take into accountpreference
- the notification preference associated with the filterExpressionNode filterExpression(DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFilterType type, NotificationFormat format)
user
- the user interested in the notificationsfilterPreferences
- the collection of all preferences to take into accounttype
- of the expected notification filterformat
- format of the notificationdefault ExpressionNode filterExpression(DocumentReference user, Collection<NotificationFilterPreference> filterPreferences, NotificationFilterType type, NotificationFormat format, Collection<NotificationPreference> preferences)
user
- the user interested in the notificationsfilterPreferences
- the collection of all preferences to take into accounttype
- of the expected notification filterformat
- format of the notificationpreferences
- list of preferencesString getName()
NotificationFilterPreference
will be able to be linked to
this filter using its name. If the NotificationFilter
is used as a component, consider defining
the hint of this component as the name of the filter.default int getPriority()
filterEvent(Event, DocumentReference, Collection, NotificationFormat)
is.default int compareTo(Object o)
compareTo
in interface Comparable
@Unstable default Set<NotificationFilter.FilteringPhase> getFilteringPhases()
Copyright © 2004–2022 XWiki. All rights reserved.