001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/DiscussionForumManager.java $
003: * $Id: DiscussionForumManager.java 9227 2006-05-15 15:02:42Z cwen@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006, 2007 The Sakai Foundation.
007: *
008: * Licensed under the Educational Community License, Version 1.0 (the "License");
009: * you may not use this file except in compliance with the License.
010: * You may obtain a copy of the License at
011: *
012: * http://www.opensource.org/licenses/ecl1.php
013: *
014: * Unless required by applicable law or agreed to in writing, software
015: * distributed under the License is distributed on an "AS IS" BASIS,
016: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: * See the License for the specific language governing permissions and
018: * limitations under the License.
019: *
020: **********************************************************************************/package org.sakaiproject.api.app.messageforums.ui;
021:
022: import java.util.ArrayList;
023: import java.util.List;
024: import java.util.Map;
025: import java.util.Set;
026:
027: import org.sakaiproject.api.app.messageforums.Area;
028: import org.sakaiproject.api.app.messageforums.AreaControlPermission;
029: import org.sakaiproject.api.app.messageforums.Attachment;
030: import org.sakaiproject.api.app.messageforums.BaseForum;
031: import org.sakaiproject.api.app.messageforums.DBMembershipItem;
032: import org.sakaiproject.api.app.messageforums.DiscussionForum;
033: import org.sakaiproject.api.app.messageforums.DiscussionTopic;
034: import org.sakaiproject.api.app.messageforums.Message;
035: import org.sakaiproject.api.app.messageforums.Topic;
036: import org.sakaiproject.api.app.messageforums.PermissionsMask;
037: import org.sakaiproject.authz.api.Role;
038:
039: /**
040: * @author <a href="mailto:rshastri@iupui.edu">Rashmi Shastri</a>
041: */
042: public interface DiscussionForumManager {
043: public List searchTopicMessages(Long topicId, String searchText);
044:
045: public Topic getTopicByIdWithAttachments(Long topicId);
046:
047: public DiscussionForum getForumByIdWithTopics(Long forumId);
048:
049: public List getTopicsByIdWithMessages(final Long forumId);
050:
051: public List getTopicsByIdWithMessagesAndAttachments(
052: final Long forumId);
053:
054: public List getTopicsByIdWithMessagesMembershipAndAttachments(
055: final Long forumId);
056:
057: public Topic getTopicByIdWithMessages(final Long topicId);
058:
059: public Topic getTopicByIdWithMessagesAndAttachments(
060: final Long topicId);
061:
062: /**
063: * Returns all moderated topics in site
064: * @param areaId
065: * @return
066: */
067: public List getModeratedTopicsInSite();
068:
069: /**
070: * Retrieve discussion forum area
071: *
072: * @return
073: */
074: Area getDiscussionForumArea();
075:
076: /**
077: * @param message
078: */
079: void saveMessage(Message message);
080:
081: /**
082: * @param message
083: */
084: void deleteMessage(Message message);
085:
086: /**
087: * @param id
088: * @return
089: */
090: Message getMessageById(Long id);
091:
092: /**
093: * @param topic
094: * @return
095: */
096: int getTotalNoMessages(Topic topic);
097:
098: /**
099: * When topic is moderated and the user does not have the moderate
100: * perm, only count approved messages and messages authored by user
101: * @param topic
102: * @return
103: */
104: int getTotalViewableMessagesWhenMod(Topic topic);
105:
106: /**
107: * @param topic
108: * @return
109: */
110: int getUnreadNoMessages(Topic topic);
111:
112: /**
113: * When topic is moderated and the user does not have the moderate
114: * perm, only count approved messages and messages authored by user
115: * @param topic
116: * @return
117: */
118: int getNumUnreadViewableMessagesWhenMod(Topic topic);
119:
120: /**
121: * Mark all pending messages in a give topic as "Approved"
122: * Used when a moderated topic is changed to not moderated
123: * @param topicId
124: */
125: public void approveAllPendingMessages(Long topicId);
126:
127: /**
128: * Returns pending msgs in site according to user's memberships
129: * @return
130: */
131: List getPendingMsgsInSiteByMembership(List membershipList);
132:
133: /**
134: *
135: * @return
136: */
137: public List getDiscussionForums();
138:
139: /**
140: * @return
141: */
142: public List getDiscussionForumsWithTopics();
143:
144: /**
145: * @return
146: */
147: public List getDiscussionForumsByContextId(String contextId);
148:
149: /**
150: * @param topicId
151: * @return
152: */
153: public DiscussionForum getForumById(Long forumId);
154:
155: /**
156: * @param forumId
157: * @return
158: */
159: public DiscussionForum getForumByUuid(String forumId);
160:
161: /**
162: * @param topicId
163: * @return
164: */
165: public List getMessagesByTopicId(Long topicId);
166:
167: /**
168: * @param topicId
169: * @return
170: */
171: public DiscussionTopic getTopicById(Long topicId);
172:
173: public DiscussionTopic getTopicByUuid(String uuid);
174:
175: /**
176: * @return
177: */
178: public boolean hasNextTopic(DiscussionTopic topic);
179:
180: /**
181: * @return
182: */
183: public boolean hasPreviousTopic(DiscussionTopic topic);
184:
185: /**
186: * @param topic
187: * @return
188: */
189: public DiscussionTopic getNextTopic(DiscussionTopic topic);
190:
191: /**
192: * @param topic
193: * @return
194: */
195: public DiscussionTopic getPreviousTopic(DiscussionTopic topic);
196:
197: /**
198: * @return
199: */
200: public boolean isInstructor();
201:
202: /**
203: * @return
204: */
205: public DiscussionForum createForum();
206:
207: /**
208: * @param forum
209: */
210: public void deleteForum(DiscussionForum forum);
211:
212: /**
213: * @param forum
214: * TODO
215: * @return
216: */
217: public DiscussionTopic createTopic(DiscussionForum forum);
218:
219: /**
220: * @param forum
221: */
222: public void saveForum(DiscussionForum forum);
223:
224: /**
225: * @param forum
226: * @param object
227: */
228: public void saveForumAsDraft(DiscussionForum forum);
229:
230: /**
231: * @param topic
232: */
233: public void saveTopic(DiscussionTopic topic);
234:
235: /**
236: * @param topic
237: */
238: public void deleteTopic(DiscussionTopic topic);
239:
240: /**
241: * @return
242: */
243: public List getDefaultControlPermissions();
244:
245: /**
246: * @return
247: */
248: public List getDefaultMessagePermissions();
249:
250: /**
251: * @return
252: */
253: public List getAreaControlPermissions();
254:
255: /**
256: * @return
257: */
258: public List getAreaMessagePermissions();
259:
260: /**
261: * @param forum
262: * @return
263: */
264: public List getForumControlPermissions(DiscussionForum forum);
265:
266: /**
267: * @param forum
268: * @return
269: */
270: public List getForumMessagePermissions(DiscussionForum forum);
271:
272: /**
273: * @param topic
274: * @return
275: */
276: public List getTopicControlPermissions(DiscussionTopic topic);
277:
278: /**
279: * @param topic
280: * @return
281: */
282: public List getTopicMessagePermissions(DiscussionTopic topic);
283:
284: /**
285: * @param controlPermission
286: */
287: public void saveAreaControlPermissions(List controlpermissions);
288:
289: /**
290: * @param messagePermissions
291: */
292: public void saveAreaMessagePermissions(List messagePermissions);
293:
294: /**
295: * @param forum
296: * @param controlPermissions
297: */
298: public void saveForumControlPermissions(DiscussionForum forum,
299: List controlPermissions);
300:
301: /**
302: * @param forum
303: * @param messagePermissions
304: */
305: public void saveForumMessagePermissions(DiscussionForum forum,
306: List messagePermissions);
307:
308: /**
309: * @param topic
310: * @param controlPermissions
311: */
312: public void saveTopicControlPermissions(DiscussionTopic topic,
313: List controlPermissions);
314:
315: /**
316: * @param topic
317: * @param messagePermissions
318: */
319: public void saveTopicMessagePermissions(DiscussionTopic topic,
320: List messagePermissions);
321:
322: /**
323: * @param topic
324: */
325: public void saveTopicAsDraft(DiscussionTopic topic);
326:
327: /**
328: * @param message
329: * @param readStatus TODO
330: */
331: public void markMessageAs(Message message, boolean readStatus);
332:
333: /**
334: * Mark the read status for a given message for a given user
335: * @param message
336: * @param readStatus
337: * @param userId
338: */
339: public void markMessageReadStatusForUser(Message message,
340: boolean readStatus, String userId);
341:
342: /**
343: * @param accessorList
344: * @return
345: */
346: public List decodeContributorsList(ArrayList contributorList);
347:
348: /**
349: * @param accessorList
350: * @return
351: */
352: public List decodeAccessorsList(ArrayList accessorList);
353:
354: /**
355: * @param forum
356: * @return
357: */
358: public List getContributorsList(DiscussionForum forum);
359:
360: /**
361: * @param forum
362: * @return
363: */
364: public List getAccessorsList(DiscussionForum forum);
365:
366: /**
367: * @return
368: */
369: public Map getAllCourseMembers();
370:
371: /**
372: * @param topic
373: * @param forum
374: * @return
375: */
376: public List getAccessorsList(DiscussionTopic topic,
377: DiscussionForum forum);
378:
379: /**
380: * @param topic
381: * @param forum
382: * @return
383: */
384: public List getContributorsList(DiscussionTopic topic,
385: DiscussionForum forum);
386:
387: /**
388: *
389: */
390: public void setCourseMemberMapToNull();
391:
392: public DBMembershipItem getAreaDBMember(Set originalSet,
393: String name, Integer type);
394:
395: public DBMembershipItem getDBMember(Set originalSet, String name,
396: Integer type);
397:
398: /**
399: *
400: * @param attachId
401: * @param name
402: * @return
403: */
404: public Attachment createDFAttachment(String attachId, String name);
405:
406: public Map getReadStatusForMessagesWithId(List msgIds, String userId);
407:
408: public List getDiscussionForumsWithTopicsMembershipNoAttachments(
409: String contextId);
410:
411: /**
412: * Returns all pending msgs in the given topic
413: * @param topicId
414: * @return
415: */
416: public List getPendingMsgsInTopic(Long topicId);
417:
418: /**
419: * Returns num moderated topics in the current site that the current user
420: * has moderate permission for, given the user's memberships
421: * @param membershipList
422: * @param contextId
423: * @return
424: */
425: public int getNumModTopicsWithModPermission(List membershipList);
426: }
|