Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
MessageStream | 37 | 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.messagestream; | |
21 | ||
22 | import java.util.List; | |
23 | ||
24 | import org.xwiki.component.annotation.Role; | |
25 | import org.xwiki.eventstream.Event; | |
26 | import org.xwiki.model.reference.DocumentReference; | |
27 | ||
28 | /** | |
29 | * The message stream allows to post and retrieve short messages, from one user to one of a few possible targets: direct | |
30 | * private messages to another user, messages to a group of users, personal messages to all the users that "follow" the | |
31 | * sender. | |
32 | * | |
33 | * @version $Id: 37cb09c318e066e2bf59309881f7fc3bce51eeb9 $ | |
34 | * @since 3.0M3 | |
35 | */ | |
36 | @Role | |
37 | public interface MessageStream | |
38 | { | |
39 | /** | |
40 | * Post a message to the current user's stream, visible to everyone. | |
41 | * | |
42 | * @param message the message to store | |
43 | */ | |
44 | void postPublicMessage(String message); | |
45 | ||
46 | /** | |
47 | * Post a message to the current user's personal stream, displayed on his profile page and aggregated into their | |
48 | * follower's streams. | |
49 | * | |
50 | * @param message the message to store | |
51 | */ | |
52 | void postPersonalMessage(String message); | |
53 | ||
54 | /** | |
55 | * Get the 30 most recent messages posted by the current user. | |
56 | * | |
57 | * @return a list of recent personal messages | |
58 | */ | |
59 | List<Event> getRecentPersonalMessages(); | |
60 | ||
61 | /** | |
62 | * Get the most recent messages posted by the current user, at most {@code limit}, and skipping the first {@code | |
63 | * offset}. | |
64 | * | |
65 | * @param limit the maximum number of messages to return | |
66 | * @param offset how many messages to skip | |
67 | * @return a list of recent personal messages, possibly empty | |
68 | */ | |
69 | List<Event> getRecentPersonalMessages(int limit, int offset); | |
70 | ||
71 | /** | |
72 | * Get the 30 most recent personal messages posted by the specified user. | |
73 | * | |
74 | * @param author the user that wrote the messages | |
75 | * @return a list of recent personal messages, possibly empty | |
76 | */ | |
77 | List<Event> getRecentPersonalMessages(DocumentReference author); | |
78 | ||
79 | /** | |
80 | * Get the most recent direct messages sent to the current user, at most {@code limit}, and skipping the first | |
81 | * {@code offset}. | |
82 | * | |
83 | * @param author the user that wrote the messages | |
84 | * @param limit the maximum number of messages to return | |
85 | * @param offset how many messages to skip | |
86 | * @return a list of recent personal messages, possibly empty | |
87 | */ | |
88 | List<Event> getRecentPersonalMessages(DocumentReference author, int limit, int offset); | |
89 | ||
90 | /** | |
91 | * Post a private message to another user. | |
92 | * | |
93 | * @param message the message to send | |
94 | * @param user the target user | |
95 | */ | |
96 | void postDirectMessageToUser(String message, DocumentReference user); | |
97 | ||
98 | /** | |
99 | * Get the 30 most recent direct messages sent to the current user. | |
100 | * | |
101 | * @return a list of recent direct messages received | |
102 | */ | |
103 | List<Event> getRecentDirectMessages(); | |
104 | ||
105 | /** | |
106 | * Get the most recent direct messages sent to the current user, at most {@code limit}, and skipping the first | |
107 | * {@code offset}. | |
108 | * | |
109 | * @param limit the maximum number of messages to return | |
110 | * @param offset how many messages to skip | |
111 | * @return a list of recent direct messages received | |
112 | */ | |
113 | List<Event> getRecentDirectMessages(int limit, int offset); | |
114 | ||
115 | /** | |
116 | * Post a message to a specific group of users. | |
117 | * | |
118 | * @param message the message to send | |
119 | * @param group the target group | |
120 | */ | |
121 | void postMessageToGroup(String message, DocumentReference group); | |
122 | ||
123 | /** | |
124 | * Get the 30 most recent messages sent to the specified group. | |
125 | * | |
126 | * @param group the target group for which to retrieve messages | |
127 | * @return a list of recent messages sent to the target group | |
128 | */ | |
129 | List<Event> getRecentMessagesForGroup(DocumentReference group); | |
130 | ||
131 | /** | |
132 | * Get the most recent messages sent to the specified group, at most {@code limit}, and skipping the first {@code | |
133 | * offset}. | |
134 | * | |
135 | * @param group the target group for which to retrieve messages | |
136 | * @param limit the maximum number of messages to return | |
137 | * @param offset how many messages to skip | |
138 | * @return a list of recent messages sent to the target group | |
139 | */ | |
140 | List<Event> getRecentMessagesForGroup(DocumentReference group, int limit, int offset); | |
141 | ||
142 | /** | |
143 | * Delete an existing message, identified by its unique ID, if the current user is the author of that message. | |
144 | * | |
145 | * @param id the unique ID of the message | |
146 | */ | |
147 | void deleteMessage(String id); | |
148 | } |