1. Project Clover database Sat Feb 2 2019 06:45:20 CET
  2. Package org.xwiki.notifications.sources

File NotificationManager.java

 

Code metrics

0
0
0
1
130
23
0
-
-
0
-

Classes

Class Line # Actions
NotificationManager 38 0 - 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.notifications.sources;
21   
22    import java.util.Date;
23    import java.util.List;
24   
25    import org.xwiki.component.annotation.Role;
26    import org.xwiki.notifications.CompositeEvent;
27    import org.xwiki.notifications.NotificationException;
28    import org.xwiki.notifications.NotificationFormat;
29    import org.xwiki.notifications.preferences.NotificationPreference;
30   
31    /**
32    * Get notifications for users.
33    *
34    * @version $Id: 25b33286d7e43d3b3861a4e1492fe9829393f0f7 $
35    * @since 9.2RC1
36    */
37    @Role
 
38    public interface NotificationManager
39    {
40    /**
41    * Return events to display as notifications concerning the specified user.
42    *
43    * @param userId id of the user
44    * @param expectedCount the maximum events to return
45    * @return the matching events for the user, could be less than expectedCount but not more
46    * @throws NotificationException if error happens
47    * @since 10.1RC1
48    */
49    List<CompositeEvent> getEvents(String userId, int expectedCount) throws NotificationException;
50   
51    /**
52    * Return events to display as notifications concerning the specified user.
53    *
54    * @param userId id of the user
55    * @param expectedCount the maximum events to return
56    * @param untilDate do not return events happened after this date
57    * @param blackList list of ids of blacklisted events to not return (to not get already known events again)
58    * @return the matching events for the user, could be less than expectedCount but not more
59    * @throws NotificationException if error happens
60    * @since 10.1RC1
61    */
62    List<CompositeEvent> getEvents(String userId, int expectedCount, Date untilDate, List<String> blackList)
63    throws NotificationException;
64   
65    /**
66    * Return events to display as notifications concerning the specified user.
67    *
68    * @param userId id of the user
69    * @param expectedCount the maximum events to return
70    * @param untilDate do not return events happened after this date
71    * @param fromDate do not return events happened before this date
72    * @param blackList list of ids of blacklisted events to not return (to not get already known events again)
73    * @return the matching events for the user, could be less than expectedCount but not more
74    * @throws NotificationException if error happens
75    * @since 10.1RC1
76    */
77    List<CompositeEvent> getEvents(String userId, int expectedCount, Date untilDate, Date fromDate,
78    List<String> blackList) throws NotificationException;
79   
80    /**
81    * Return events to display as notifications concerning the specified user.
82    *
83    * @param userId id of the user
84    * @param format format of the notifications
85    * @param expectedCount the maximum events to return
86    * @param untilDate do not return events happened after this date
87    * @param fromDate do not return events happened before this date
88    * @param blackList list of ids of blacklisted events to not return (to not get already known events again)
89    * @return the matching events for the user, could be less than expectedCount but not more
90    * @throws NotificationException if error happens
91    *
92    * @since 10.1RC1
93    */
94    List<CompositeEvent> getEvents(String userId, NotificationFormat format, int expectedCount, Date untilDate,
95    Date fromDate, List<String> blackList) throws NotificationException;
96   
97    /**
98    * Return the number of events to display as notifications concerning the specified user.
99    *
100    * @param userId id of the user
101    * @param maxCount maximum number of events to count
102    * @return the list of events to display as notifications
103    * @throws NotificationException if an error happens
104    *
105    * @since 10.1RC1
106    */
107    long getEventsCount(String userId, int maxCount) throws NotificationException;
108   
109    /**
110    * Set the start date for every notification preference of the given user.
111    *
112    * @param userId the id of the user
113    * @param startDate the date before which we ignore notifications
114    * @throws NotificationException if an error happens
115    */
116    void setStartDate(String userId, Date startDate) throws NotificationException;
117   
118    /**
119    * @return the list of notifications preferences for the current user
120    * @throws NotificationException if an error happens
121    */
122    List<NotificationPreference> getPreferences() throws NotificationException;
123   
124    /**
125    * @param userId id of the user
126    * @return the list of notifications preferences for a given user
127    * @throws NotificationException if an error happens
128    */
129    List<NotificationPreference> getPreferences(String userId) throws NotificationException;
130    }