Class NotificationFiltersScriptService
- java.lang.Object
-
- org.xwiki.notifications.filters.script.NotificationFiltersScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("notification.filters") @Singleton public class NotificationFiltersScriptService extends Object implements org.xwiki.script.service.ScriptService
Script service for the notification filters.- Since:
- 9.7RC1
- Version:
- $Id: a1bc852d5fce53c327fad8408cdeb4ecb3433557 $
-
-
Constructor Summary
Constructors Constructor Description NotificationFiltersScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
createScopeFilterPreference(NotificationFilterType type, Set<NotificationFormat> formats, List<String> eventTypes, EntityReference reference)
Create a scope notification filter preference for the current user.void
createScopeFilterPreference(NotificationFilterType type, Set<NotificationFormat> formats, List<String> eventTypes, EntityReference reference, org.xwiki.user.UserReference userReference)
Create a scope notification filter preference for the given user.void
createWikiScopeFilterPreference(NotificationFilterType type, Set<NotificationFormat> formats, List<String> eventTypes, EntityReference reference, WikiReference wikiReference)
Create a scope notification filter preference for the given user.void
deleteFilterPreference(String filterPreferenceId)
Delete a filter preference.void
deleteFilterPreference(String filterPreferenceId, org.xwiki.user.UserReference userReference)
Delete a filter preference for the given user.void
deleteWikiFilterPreference(String filterPreferenceId, WikiReference wikiReference)
Delete a filter preference for the given wiki.org.xwiki.rendering.block.Block
displayFilterPreference(NotificationFilter filter, NotificationFilterPreference preference)
Get a displayable form of the givenNotificationFilterPreference
.Set<NotificationFilterPreference>
getFilterPreferences(NotificationFilter filter)
Get a collection of notification filters preferences that are available for the current user and that corresponds to the given filter.Set<NotificationFilterPreference>
getFilterPreferences(NotificationFilter filter, org.xwiki.user.UserReference userReference)
Get a collection of notification filters preferences that are available for the given user and that corresponds to the given filter.Collection<NotificationFilter>
getFilters()
Collection<NotificationFilter>
getFilters(org.xwiki.user.UserReference userReference)
Set<NotificationFilter>
getToggleableNotificationFilters()
Get a set of notification filters that can be toggled by the current user.Set<NotificationFilter>
getToggleableNotificationFilters(org.xwiki.user.UserReference userReference)
Get a set of notification filters that can be toggled by the given user.Set<NotificationFilterPreference>
getWikiFilterPreferences(NotificationFilter filter, WikiReference wikiReference)
Get a collection of notification filters preferences that are available for the given wiki and that corresponds to the given filter.Collection<NotificationFilter>
getWikiFilters(WikiReference wikiReference)
Get the filters of the given wiki.Set<NotificationFilter>
getWikiToggleableNotificationFilters(WikiReference wikiReference)
Get a set of notification filters that can be toggled for the given wiki.void
setFilterPreferenceEnabled(String filterPreferenceId, boolean enabled)
Enable or disable a filter preference.void
setFilterPreferenceEnabled(String filterPreferenceId, boolean enabled, org.xwiki.user.UserReference userReference)
Enable or disable a filter preference.void
setStartDate(Date startDate)
Update the start date for every filter preference that current user has.void
setStartDate(Date startDate, org.xwiki.user.UserReference userReference)
Update the start date for every filter preference that given user has.void
setWikiFilterPreferenceEnabled(String filterPreferenceId, boolean enabled, WikiReference wikiReference)
Enable or disable a filter preference.
-
-
-
Method Detail
-
getToggleableNotificationFilters
public Set<NotificationFilter> getToggleableNotificationFilters() throws NotificationException
Get a set of notification filters that can be toggled by the current user.- Returns:
- a set of notification filters that are toggleable
- Throws:
NotificationException
- if an error occurs
-
getToggleableNotificationFilters
public Set<NotificationFilter> getToggleableNotificationFilters(org.xwiki.user.UserReference userReference) throws NotificationException
Get a set of notification filters that can be toggled by the given user.- Parameters:
userReference
- the user for which to retrieve the notification filters.- Returns:
- a set of notification filters that are toggleable
- Throws:
NotificationException
- if an error occurs- Since:
- 13.2RC1
-
getWikiToggleableNotificationFilters
public Set<NotificationFilter> getWikiToggleableNotificationFilters(WikiReference wikiReference) throws NotificationException
Get a set of notification filters that can be toggled for the given wiki. Note: we use a distinct name thangetToggleableNotificationFilters
since a WikiReference can be converted to a UserReference by our converters, check https://jira.xwiki.org/browse/XWIKI-18496.- Parameters:
wikiReference
- the wiki for which to retrieve the notification filters.- Returns:
- a set of notification filters that are toggleable
- Throws:
NotificationException
- if an error occurs- Since:
- 13.3RC1
-
getFilters
public Collection<NotificationFilter> getFilters() throws NotificationException
- Returns:
- a collection of every
NotificationFilter
available to the current user. - Throws:
NotificationException
- if an error happens- Since:
- 9.8RC1
-
getFilters
public Collection<NotificationFilter> getFilters(org.xwiki.user.UserReference userReference) throws NotificationException
- Parameters:
userReference
- the user for which to retrieve the filters.- Returns:
- a collection of every
NotificationFilter
available for the given user. - Throws:
NotificationException
- if the reference is not correct or if an error happens when retrieving the filters- Since:
- 13.2RC1
-
getWikiFilters
public Collection<NotificationFilter> getWikiFilters(WikiReference wikiReference) throws NotificationException
Get the filters of the given wiki. Note: we use a distinct name thangetFilters
since a WikiReference can be converted to a UserReference by our converters, check https://jira.xwiki.org/browse/XWIKI-18496.- Parameters:
wikiReference
- the wiki for which to retrieve the filters.- Returns:
- a collection of every
NotificationFilter
available for the given user. - Throws:
NotificationException
- if the reference is not correct or if an error happens when retrieving the filters- Since:
- 13.3RC1
-
getFilterPreferences
public Set<NotificationFilterPreference> getFilterPreferences(NotificationFilter filter) throws NotificationException
Get a collection of notification filters preferences that are available for the current user and that corresponds to the given filter.- Parameters:
filter
- the filter associated to the preferences- Returns:
- a set of
NotificationFilterPreference
- Throws:
NotificationException
- if an error occurs- Since:
- 9.8RC1
-
getFilterPreferences
public Set<NotificationFilterPreference> getFilterPreferences(NotificationFilter filter, org.xwiki.user.UserReference userReference) throws NotificationException
Get a collection of notification filters preferences that are available for the given user and that corresponds to the given filter.- Parameters:
filter
- the filter associated to the preferencesuserReference
- the user for which to retrieve the filter- Returns:
- a set of
NotificationFilterPreference
- Throws:
NotificationException
- if an error occurs- Since:
- 13.2RC1
-
getWikiFilterPreferences
public Set<NotificationFilterPreference> getWikiFilterPreferences(NotificationFilter filter, WikiReference wikiReference) throws NotificationException
Get a collection of notification filters preferences that are available for the given wiki and that corresponds to the given filter. Note: we use a distinct name thangetFilterPreferences
since a WikiReference can be converted to a UserReference by our converters, check https://jira.xwiki.org/browse/XWIKI-18496.- Parameters:
filter
- the filter associated to the preferenceswikiReference
- the wiki for which to retrieve the filter- Returns:
- a set of
NotificationFilterPreference
- Throws:
NotificationException
- if an error occurs- Since:
- 13.3RC1
-
displayFilterPreference
public org.xwiki.rendering.block.Block displayFilterPreference(NotificationFilter filter, NotificationFilterPreference preference) throws NotificationException
Get a displayable form of the givenNotificationFilterPreference
.- Parameters:
filter
- the filter bound to the given preferencepreference
- the filter preference to display- Returns:
- a
Block
that can be used to display the given notification filter - Throws:
NotificationException
- if an error occurs- Since:
- 9.8RC1
-
deleteFilterPreference
public void deleteFilterPreference(String filterPreferenceId) throws NotificationException
Delete a filter preference.- Parameters:
filterPreferenceId
- name of the filter preference- Throws:
NotificationException
- if an error happens- Since:
- 9.8RC1
-
deleteFilterPreference
public void deleteFilterPreference(String filterPreferenceId, org.xwiki.user.UserReference userReference) throws NotificationException
Delete a filter preference for the given user.- Parameters:
filterPreferenceId
- name of the filter preferenceuserReference
- the user for which to delete the filter preference.- Throws:
NotificationException
- if an error happens- Since:
- 13.2RC1
-
deleteWikiFilterPreference
public void deleteWikiFilterPreference(String filterPreferenceId, WikiReference wikiReference) throws NotificationException
Delete a filter preference for the given wiki. Note: we use a distinct name thandeleteFilterPreference
since a WikiReference can be converted to a UserReference by our converters, check https://jira.xwiki.org/browse/XWIKI-18496.- Parameters:
filterPreferenceId
- name of the filter preferencewikiReference
- the wiki for which to delete the filter preference.- Throws:
NotificationException
- if an error happens- Since:
- 13.3RC1
-
setFilterPreferenceEnabled
public void setFilterPreferenceEnabled(String filterPreferenceId, boolean enabled) throws NotificationException
Enable or disable a filter preference.- Parameters:
filterPreferenceId
- id of the filter preferenceenabled
- either or not the filter preference should be enabled- Throws:
NotificationException
- if an error happens- Since:
- 9.8RC1
-
setFilterPreferenceEnabled
public void setFilterPreferenceEnabled(String filterPreferenceId, boolean enabled, org.xwiki.user.UserReference userReference) throws NotificationException
Enable or disable a filter preference.- Parameters:
filterPreferenceId
- id of the filter preferenceenabled
- either or not the filter preference should be enableduserReference
- the user for which to enable or disable a filter.- Throws:
NotificationException
- if an error happens- Since:
- 13.2RC1
-
setWikiFilterPreferenceEnabled
public void setWikiFilterPreferenceEnabled(String filterPreferenceId, boolean enabled, WikiReference wikiReference) throws NotificationException
Enable or disable a filter preference. Note: we use a distinct name thansetFilterPreferenceEnabled
since a WikiReference can be converted to a UserReference by our converters, check https://jira.xwiki.org/browse/XWIKI-18496.- Parameters:
filterPreferenceId
- id of the filter preferenceenabled
- either or not the filter preference should be enabledwikiReference
- the wiki for which to enable or disable a filter.- Throws:
NotificationException
- if an error happens- Since:
- 13.3RC1
-
setStartDate
public void setStartDate(Date startDate) throws NotificationException
Update the start date for every filter preference that current user has.- Parameters:
startDate
- the new start date- Throws:
NotificationException
- if an error occurs- Since:
- 10.5RC1, 10.4, 9.11.5
-
setStartDate
public void setStartDate(Date startDate, org.xwiki.user.UserReference userReference) throws NotificationException
Update the start date for every filter preference that given user has.- Parameters:
startDate
- the new start dateuserReference
- the user for which to set the start date- Throws:
NotificationException
- if an error occurs- Since:
- 13.2RC1
-
createScopeFilterPreference
public void createScopeFilterPreference(NotificationFilterType type, Set<NotificationFormat> formats, List<String> eventTypes, EntityReference reference) throws NotificationException
Create a scope notification filter preference for the current user.- Parameters:
type
- type of the filter preference to createformats
- formats concerned by the preferenceeventTypes
- the event types concerned by the preferencereference
- the reference of the wiki, the space or the page concerned by the preference- Throws:
NotificationException
- if an error occurs- Since:
- 10.8RC1, 9.11.8
-
createScopeFilterPreference
public void createScopeFilterPreference(NotificationFilterType type, Set<NotificationFormat> formats, List<String> eventTypes, EntityReference reference, org.xwiki.user.UserReference userReference) throws NotificationException
Create a scope notification filter preference for the given user.- Parameters:
type
- type of the filter preference to createformats
- formats concerned by the preferenceeventTypes
- the event types concerned by the preferencereference
- the reference of the wiki, the space or the page concerned by the preferenceuserReference
- the user for which to create the filter- Throws:
NotificationException
- if an error occurs- Since:
- 13.2RC1
-
createWikiScopeFilterPreference
public void createWikiScopeFilterPreference(NotificationFilterType type, Set<NotificationFormat> formats, List<String> eventTypes, EntityReference reference, WikiReference wikiReference) throws NotificationException
Create a scope notification filter preference for the given user. Note: we use a distinct name thancreateScopeFilterPreference
since a WikiReference can be converted to a UserReference by our converters, check https://jira.xwiki.org/browse/XWIKI-18496.- Parameters:
type
- type of the filter preference to createformats
- formats concerned by the preferenceeventTypes
- the event types concerned by the preferencereference
- the reference of the wiki, the space or the page concerned by the preferencewikiReference
- the wiki for which to create the filter- Throws:
NotificationException
- if an error occurs- Since:
- 13.3RC1
-
-