Class 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 Detail

      • NotificationFiltersScriptService

        public NotificationFiltersScriptService()
    • 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 than getToggleableNotificationFilters 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
      • getWikiFilters

        public Collection<NotificationFilter> getWikiFilters​(WikiReference wikiReference)
                                                      throws NotificationException
        Get the filters of the given wiki. Note: we use a distinct name than getFilters 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
      • 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 than getFilterPreferences 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 preferences
        wikiReference - the wiki for which to retrieve the filter
        Returns:
        a set of NotificationFilterPreference
        Throws:
        NotificationException - if an error occurs
        Since:
        13.3RC1
      • 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 preference
        userReference - 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 than deleteFilterPreference 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 preference
        wikiReference - 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 preference
        enabled - 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 preference
        enabled - either or not the filter preference should be enabled
        userReference - 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 than setFilterPreferenceEnabled 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 preference
        enabled - either or not the filter preference should be enabled
        wikiReference - 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 date
        userReference - 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 create
        formats - formats concerned by the preference
        eventTypes - the event types concerned by the preference
        reference - 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 create
        formats - formats concerned by the preference
        eventTypes - the event types concerned by the preference
        reference - the reference of the wiki, the space or the page concerned by the preference
        userReference - 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 than createScopeFilterPreference 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 create
        formats - formats concerned by the preference
        eventTypes - the event types concerned by the preference
        reference - the reference of the wiki, the space or the page concerned by the preference
        wikiReference - the wiki for which to create the filter
        Throws:
        NotificationException - if an error occurs
        Since:
        13.3RC1