Package org.xwiki.notifications.filters
Interface NotificationFilterPreference
-
public interface NotificationFilterPreference
Define the preference of a notification filter. A notification filter preference represents a set of parameters that can be passed to a filter in order to customize it. Example : Let’s say that we have defined a filter based on the wiki users : in order to work, this filter needs to know which wiki users he has to filter, and for which types of events he should be applied. Those wiki users and those event types are like parameters to the filter, aNotificationFilterPreference
is nothing else than a combination of those parameters.- Since:
- 9.7RC1
- Version:
- $Id: 7c1b5e8fadc2b05052e09566786c19ade5d4d272 $
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description Set<String>
getEventTypes()
String
getFilterName()
NotificationFilterType
getFilterType()
String
getId()
Set<NotificationFormat>
getNotificationFormats()
String
getPage()
String
getPageOnly()
String
getProviderHint()
Date
getStartingDate()
String
getUser()
String
getWiki()
default Optional<String>
getWikiId()
getWiki()
,getPage()
,getPageOnly()
andgetUser()
are analyzed (in this order) to find the wiki identifier.boolean
isActive()
A filter preference can either be active or passive.boolean
isEnabled()
default boolean
isFromWiki(String wikiId)
Returntrue
if the filter preference is related to a given wiki.void
setEnabled(boolean enabled)
-
-
-
Method Detail
-
getId
String getId()
- Returns:
- the unique identifier of the filter preference.
- Since:
- 10.8RC1, 9.11.8
-
getFilterName
String getFilterName()
- Returns:
- the name of the filter corresponding to this preference.
-
getProviderHint
String getProviderHint()
- Returns:
- the name of the
NotificationFilterPreferenceProvider
associated with this preference.
-
isEnabled
boolean isEnabled()
- Returns:
- true if the current notification preference is enabled.
-
isActive
boolean isActive()
A filter preference can either be active or passive. It the preference is active, then it should force the retrieval of notifications when used in conjunction with aNotificationFilter
. On the other hand, a passive (non-active) notification filter should not automatically trigger the retrieval of notifications.- Returns:
- true if the filter preference is active.
-
getFilterType
NotificationFilterType getFilterType()
- Returns:
- the type of the filter described by this preference.
-
getNotificationFormats
Set<NotificationFormat> getNotificationFormats()
- Returns:
- a set of
NotificationFormat
for which the filter should be applied. - Since:
- 10.8RC1, 9.11.8
-
getStartingDate
Date getStartingDate()
- Returns:
- the date from which the filter preference is enabled.
- Since:
- 10.5RC1, 10.4, 9.11.5
-
getEventTypes
Set<String> getEventTypes()
- Returns:
- the event types concerned by the preference (can be empty to affect all event types)
- Since:
- 10.8RC1, 9.11.8
-
getUser
String getUser()
- Returns:
- the user concerned by the preference (can be null)
- Since:
- 10.8RC1, 9.11.8
-
getPageOnly
String getPageOnly()
- Returns:
- the page concerned by the preference (can be null)
- Since:
- 10.8RC1, 9.11.8
-
getPage
String getPage()
- Returns:
- the page (and its children) concerned by the preference (can be null)
- Since:
- 10.8RC1, 9.11.8
-
getWiki
String getWiki()
- Returns:
- the wiki concerned by the preference (can be null)
- Since:
- 10.8RC1, 9.11.8
-
setEnabled
void setEnabled(boolean enabled)
- Parameters:
enabled
- if the preference is enabled or not- Since:
- 10.8RC1, 9.11.8
-
isFromWiki
@Unstable default boolean isFromWiki(String wikiId)
Returntrue
if the filter preference is related to a given wiki. This is the case ifgetWiki()
returnswikiId
, or ifgetPage()
,getPageOnly()
orgetUser()
are containing the wiki identifier.- Parameters:
wikiId
- a wiki identifier- Returns:
true
if the notification filter preference is related to a given wiki,false
otherwise- Since:
- 14.5, 14.4.1, 13.10.7
-
getWikiId
@Unstable default Optional<String> getWikiId()
getWiki()
,getPage()
,getPageOnly()
andgetUser()
are analyzed (in this order) to find the wiki identifier. The first non-null value is used.- Returns:
- the wiki identifier of the resource concerned by the filter preference,
Optional.empty()
if no wiki identifier can be found - Since:
- 14.5, 14.4.1, 13.10.7
-
-