Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
WatchListStore | 35 | 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.api; | |
21 | ||
22 | import java.util.Collection; | |
23 | import java.util.List; | |
24 | ||
25 | import org.xwiki.component.annotation.Role; | |
26 | ||
27 | import com.xpn.xwiki.XWikiException; | |
28 | ||
29 | /** | |
30 | * WatchList store class. Handles user subscription storage. | |
31 | * | |
32 | * @version $Id: 80c7627959204d66ded0e9c6b3ed03e000a72274 $ | |
33 | */ | |
34 | @Role | |
35 | public interface WatchListStore | |
36 | { | |
37 | /** | |
38 | * @param user the user to match | |
39 | * @param type the element type to match | |
40 | * @return the watched elements for the given element type by the given user | |
41 | * @throws XWikiException if retrieval of elements fails | |
42 | */ | |
43 | Collection<String> getWatchedElements(String user, WatchedElementType type) throws XWikiException; | |
44 | ||
45 | /** | |
46 | * @param element the element to look for | |
47 | * @param user the user to check | |
48 | * @param type the type of the element | |
49 | * @return true if the element is watched by the user, false otherwise | |
50 | * @throws XWikiException if the retrieval of watched elements fails | |
51 | */ | |
52 | boolean isWatched(String element, String user, WatchedElementType type) throws XWikiException; | |
53 | ||
54 | /** | |
55 | * Add the specified element (document or space) to the corresponding list in the user's WatchList. | |
56 | * | |
57 | * @param user the user to which to add the watched element | |
58 | * @param newWatchedElement the name of the element to add (document, space, wiki, user) | |
59 | * @param type the type of the element to add | |
60 | * @return true if the element wasn't already in watched list or false otherwise | |
61 | * @throws XWikiException if the modification hasn't been saved | |
62 | */ | |
63 | boolean addWatchedElement(String user, String newWatchedElement, WatchedElementType type) throws XWikiException; | |
64 | ||
65 | /** | |
66 | * Remove the specified element (document or space) from the corresponding list in the user's WatchList. | |
67 | * | |
68 | * @param user the user from which to removed the watched element | |
69 | * @param watchedElement the name of the element to remove (document or space) | |
70 | * @param type the type of the element to remove | |
71 | * @return true if the element was in list and has been removed, false if the element wasn't in the list | |
72 | * @throws XWikiException if the WatchList Object cannot be retrieved or if the user's profile cannot be saved | |
73 | */ | |
74 | boolean removeWatchedElement(String user, String watchedElement, WatchedElementType type) throws XWikiException; | |
75 | ||
76 | /** | |
77 | * Get the automatic document watching mode preference of a user. | |
78 | * | |
79 | * @param user the user to check | |
80 | * @return the mode, if not set return the default one which is {@link AutomaticWatchMode#MAJOR} | |
81 | */ | |
82 | AutomaticWatchMode getAutomaticWatchMode(String user); | |
83 | ||
84 | /** | |
85 | * Get the notification interval preference of a user. | |
86 | * | |
87 | * @param user the user to check | |
88 | * @return the notification interval ID, which can be either an ID or a scheduler job document name | |
89 | */ | |
90 | String getInterval(String user); | |
91 | ||
92 | /** | |
93 | * Get the list of all the possible notification intervals that a user can choose from. | |
94 | * | |
95 | * @return the list of interval IDs | |
96 | */ | |
97 | List<String> getIntervals(); | |
98 | ||
99 | /** | |
100 | * @param intervalId ID of the interval | |
101 | * @return subscribers to be notified for the given interval | |
102 | */ | |
103 | Collection<String> getSubscribers(String intervalId); | |
104 | } |