Interface NotificationManager


  • @Role
    public interface NotificationManager
    Get notifications for users.
    Since:
    9.2RC1
    Version:
    $Id: 7be8801f47d00bc74fde332719b401d05db8cfda $
    • Method Detail

      • getEvents

        List<org.xwiki.notifications.CompositeEvent> getEvents​(String userId,
                                                               int expectedCount)
                                                        throws org.xwiki.notifications.NotificationException
        Return events to display as notifications concerning the specified user.
        Parameters:
        userId - id of the user
        expectedCount - the maximum events to return
        Returns:
        the matching events for the user, could be less than expectedCount but not more
        Throws:
        org.xwiki.notifications.NotificationException - if error happens
        Since:
        10.1RC1
      • getEvents

        List<org.xwiki.notifications.CompositeEvent> getEvents​(String userId,
                                                               int expectedCount,
                                                               Date untilDate,
                                                               List<String> blackList)
                                                        throws org.xwiki.notifications.NotificationException
        Return events to display as notifications concerning the specified user.
        Parameters:
        userId - id of the user
        expectedCount - the maximum events to return
        untilDate - do not return events happened after this date
        blackList - list of ids of blacklisted events to not return (to not get already known events again)
        Returns:
        the matching events for the user, could be less than expectedCount but not more
        Throws:
        org.xwiki.notifications.NotificationException - if error happens
        Since:
        10.1RC1
      • getEvents

        List<org.xwiki.notifications.CompositeEvent> getEvents​(String userId,
                                                               int expectedCount,
                                                               Date untilDate,
                                                               Date fromDate,
                                                               List<String> blackList)
                                                        throws org.xwiki.notifications.NotificationException
        Return events to display as notifications concerning the specified user.
        Parameters:
        userId - id of the user
        expectedCount - the maximum events to return
        untilDate - do not return events happened after this date
        fromDate - do not return events happened before this date
        blackList - list of ids of blacklisted events to not return (to not get already known events again)
        Returns:
        the matching events for the user, could be less than expectedCount but not more
        Throws:
        org.xwiki.notifications.NotificationException - if error happens
        Since:
        10.1RC1
      • getEvents

        List<org.xwiki.notifications.CompositeEvent> getEvents​(String userId,
                                                               org.xwiki.notifications.NotificationFormat format,
                                                               int expectedCount,
                                                               Date untilDate,
                                                               Date fromDate,
                                                               List<String> blackList)
                                                        throws org.xwiki.notifications.NotificationException
        Return events to display as notifications concerning the specified user.
        Parameters:
        userId - id of the user
        format - format of the notifications
        expectedCount - the maximum events to return
        untilDate - do not return events happened after this date
        fromDate - do not return events happened before this date
        blackList - list of ids of blacklisted events to not return (to not get already known events again)
        Returns:
        the matching events for the user, could be less than expectedCount but not more
        Throws:
        org.xwiki.notifications.NotificationException - if error happens
        Since:
        10.1RC1
      • getEvents

        default List<org.xwiki.notifications.CompositeEvent> getEvents​(String userId,
                                                                       org.xwiki.notifications.NotificationFormat format,
                                                                       int expectedCount,
                                                                       Date untilDate,
                                                                       boolean untilDateIncluded,
                                                                       Date fromDate,
                                                                       List<String> blackList)
                                                                throws org.xwiki.notifications.NotificationException
        Return events to display as notifications concerning the specified user.
        Parameters:
        userId - id of the user
        format - format of the notifications
        expectedCount - the maximum events to return
        untilDate - do not return events happened after this date
        untilDateIncluded - true if the passed untilDate should be included
        fromDate - do not return events happened before this date
        blackList - list of ids of blacklisted events to not return (to not get already known events again)
        Returns:
        the matching events for the user, could be less than expectedCount but not more
        Throws:
        org.xwiki.notifications.NotificationException - if error happens
        Since:
        12.6.1, 12.7RC1
      • getEventsCount

        long getEventsCount​(String userId,
                            int maxCount)
                     throws org.xwiki.notifications.NotificationException
        Return the number of events to display as notifications concerning the specified user.
        Parameters:
        userId - id of the user
        maxCount - maximum number of events to count
        Returns:
        the list of events to display as notifications
        Throws:
        org.xwiki.notifications.NotificationException - if an error happens
        Since:
        10.1RC1
      • setStartDate

        void setStartDate​(String userId,
                          Date startDate)
                   throws org.xwiki.notifications.NotificationException
        Set the start date for every notification preference of the given user.
        Parameters:
        userId - the id of the user
        startDate - the date before which we ignore notifications
        Throws:
        org.xwiki.notifications.NotificationException - if an error happens
      • getPreferences

        List<NotificationPreference> getPreferences()
                                             throws org.xwiki.notifications.NotificationException
        Returns:
        the list of notifications preferences for the current user
        Throws:
        org.xwiki.notifications.NotificationException - if an error happens
      • getPreferences

        List<NotificationPreference> getPreferences​(String userId)
                                             throws org.xwiki.notifications.NotificationException
        Parameters:
        userId - id of the user
        Returns:
        the list of notifications preferences for a given user
        Throws:
        org.xwiki.notifications.NotificationException - if an error happens