Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
WatchListNotificationCache | 33 | 0 | - | 0 | 0 |
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.watchlist.internal; | |
21 | ||
22 | import java.util.Collection; | |
23 | import java.util.List; | |
24 | ||
25 | import org.xwiki.component.annotation.Role; | |
26 | ||
27 | /** | |
28 | * Caches information that is useful when notifying users of changes on the watched elements. | |
29 | * | |
30 | * @version $Id: c3779a1c2b4844535a0c5d46c64bcc05a565496e $ | |
31 | */ | |
32 | @Role | |
33 | public interface WatchListNotificationCache | |
34 | { | |
35 | /** | |
36 | * @param intervalId ID of the interval | |
37 | * @return subscribers to be notified for the given interval | |
38 | */ | |
39 | Collection<String> getSubscribers(String intervalId); | |
40 | ||
41 | /** | |
42 | * Register a new subscriber for the given interval. | |
43 | * | |
44 | * @param intervalId ID of the interval | |
45 | * @param user subscriber to add | |
46 | * @return true if the interval was valid and the subscriber was added, false otherwise | |
47 | */ | |
48 | boolean addSubscriber(String intervalId, String user); | |
49 | ||
50 | /** | |
51 | * Move a subscriber from one interval to another. | |
52 | * | |
53 | * @param oldIntervalId the interval from which to move the subscriber | |
54 | * @param newIntervalId the new interval to move the subscriber to | |
55 | * @param user subscriber to add | |
56 | * @return true if at least the new interval was valid and the subscriber is in the new interval (i.e. was moved), | |
57 | * false otherwise | |
58 | */ | |
59 | boolean moveSubscriber(String oldIntervalId, String newIntervalId, String user); | |
60 | ||
61 | /** | |
62 | * Remove a subscriber for the given interval. | |
63 | * | |
64 | * @param intervalId ID of the interval | |
65 | * @param user subscriber to remove | |
66 | * @return true if the interval was valid and the subscriber was removed, false otherwise | |
67 | */ | |
68 | boolean removeSubscriber(String intervalId, String user); | |
69 | ||
70 | /** | |
71 | * @return the list of notification intervals, sorted by size | |
72 | */ | |
73 | List<String> getIntervals(); | |
74 | ||
75 | /** | |
76 | * Add a new notification interval. | |
77 | * | |
78 | * @param intervalId ID of the interval to add | |
79 | * @return true if the interval was added, false otherwise | |
80 | */ | |
81 | boolean addInterval(String intervalId); | |
82 | ||
83 | /** | |
84 | * Removes an existing notification interval. | |
85 | * | |
86 | * @param intervalId ID of the interval to remove | |
87 | * @return true if the interval was removed, false otherwise | |
88 | */ | |
89 | boolean removeInterval(String intervalId); | |
90 | } |