001: /**********************************************************************************
002: * $URL: https://source.sakaiproject.org/svn/msgcntr/trunk/messageforums-api/src/java/org/sakaiproject/api/app/messageforums/ui/PrivateMessageManager.java $
003: * $Id: PrivateMessageManager.java 9227 2006-05-15 15:02:42Z cwen@iupui.edu $
004: ***********************************************************************************
005: *
006: * Copyright (c) 2003, 2004, 2005, 2006 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.Date;
023: import java.util.List;
024: import java.util.Set;
025:
026: import org.sakaiproject.api.app.messageforums.Area;
027: import org.sakaiproject.api.app.messageforums.Attachment;
028: import org.sakaiproject.api.app.messageforums.Message;
029: import org.sakaiproject.api.app.messageforums.MessageForumsMessageManager;
030: import org.sakaiproject.api.app.messageforums.PrivateForum;
031: import org.sakaiproject.api.app.messageforums.PrivateMessage;
032: import org.sakaiproject.api.app.messageforums.PrivateTopic;
033: import org.sakaiproject.api.app.messageforums.Topic;
034:
035: public interface PrivateMessageManager {
036:
037: public static String SORT_COLUMN_SUBJECT = "title";
038: public static String SORT_COLUMN_AUTHOR = "author";
039: public static String SORT_COLUMN_DATE = "message.created";
040: public static String SORT_COLUMN_LABEL = "label";
041: public static String SORT_COLUMN_TO = "message.recipientsAsText";
042: public static String SORT_COLUMN_ATTACHMENT = "message.hasAttachments";
043:
044: public static String SORT_ASC = "asc";
045: public static String SORT_DESC = "desc";
046:
047: public String getContextId();
048:
049: public String getContextSiteId();
050:
051: public PrivateMessage initMessageWithAttachmentsAndRecipients(
052: PrivateMessage msg);
053:
054: //public List getPvtMsgByIdWithAttachments(PrivateMessage msg);
055:
056: public void saveAreaAndForumSettings(Area area, PrivateForum forum);
057:
058: public void savePrivateMessageArea(Area area);
059:
060: public void saveForumSettings(PrivateForum forum);
061:
062: public void markMessageAsReadForUser(final PrivateMessage message);
063:
064: public void markMessageAsReadForUser(final PrivateMessage message,
065: final String contextId);
066:
067: public List getMessagesByType(final String typeUuid,
068: final String orderField, final String order);
069:
070: public List getMessagesByTypeByContext(final String typeUuid,
071: final String contextId);
072:
073: /**
074: * check if private message area is enabled for the current user
075: * @return boolean
076: */
077: boolean isPrivateAreaEnabled();
078:
079: /**
080: * retrieve private message area if it is enabled for the current user
081: * @return area
082: */
083: Area getPrivateMessageArea();
084:
085: public PrivateForum initializePrivateMessageArea(Area area);
086:
087: public PrivateForum initializationHelper(PrivateForum forum,
088: Area area);
089:
090: /**
091: * create private message with type
092: * @param typeUuid
093: * @return private message
094: */
095: public PrivateMessage createPrivateMessage(String typeUuid);
096:
097: /**
098: * send private message to recipients
099: * @param message
100: * @param recipients
101: * @param asEmail
102: */
103: public void sendPrivateMessage(PrivateMessage message,
104: Set recipients, boolean asEmail);
105:
106: /**
107: * mark message as deleted for user
108: * @param message
109: */
110: public void deletePrivateMessage(PrivateMessage message,
111: String typeUuid);
112:
113: /**
114: * Save private message
115: * @param message
116: * @param recipients
117: */
118: void savePrivateMessage(Message message);
119:
120: /**
121: * find message count for type
122: * @param typeUuid
123: * @return count
124: */
125: public int findMessageCount(String typeUuid);
126:
127: /**
128: * find unread message count for type
129: * @param typeUuid
130: * @return count
131: */
132: public int findUnreadMessageCount(String typeUuid);
133:
134: public MessageForumsMessageManager getMessageManager();
135:
136: public Message getMessageById(Long messageId);
137:
138: public List getReceivedMessages(String orderField, String order);
139:
140: public List getSentMessages(String orderField, String order);
141:
142: public List getDeletedMessages(String orderField, String order);
143:
144: public List getDraftedMessages(String orderField, String order);
145:
146: // will the below be helpful for displaying messages related to other mutable topics.
147: public List getMessagesByTopic(String userId, Long topicId);
148:
149: int getTotalNoMessages(Topic topic);
150:
151: int getUnreadNoMessages(Topic topic);
152:
153: public List getPrivateMessageCountsForAllSites();
154:
155: //Topic Folder Setting
156: public boolean isMutableTopicFolder(String parentTopicId);
157:
158: /** create a folder in Private forum */
159: public void createTopicFolderInForum(PrivateForum pf,
160: String foderName);
161:
162: /** rename folder title */
163: public void renameTopicFolder(PrivateForum pf, String topicId,
164: String newName);
165:
166: /** Delete a topic from private forum */
167: public void deleteTopicFolder(PrivateForum pf, String topicId);
168:
169: /** Move the message under new topic */
170: public void movePvtMsgTopic(PrivateMessage message, Topic oldTopic,
171: Topic newTopic);
172:
173: /** Get the Topic from uuid
174: * TODO - this can be replaced with another method which doesn't return messages*/
175: public Topic getTopicByUuid(final String topicUuid);
176:
177: /** create Folder within Folder*/
178: public void createTopicFolderInTopic(PrivateForum pf,
179: PrivateTopic parentTopic, String folderName);
180:
181: //Attachment
182: public void addAttachToPvtMsg(final PrivateMessage pvtMsgData,
183: final Attachment pvtMsgAttach);
184:
185: public Attachment createPvtMsgAttachment(String attachId,
186: String name);
187:
188: public void removePvtMsgAttachment(Attachment o);
189:
190: public Attachment getPvtMsgAttachment(final Long pvtMsgAttachId);
191:
192: public boolean isInstructor();
193:
194: public PrivateMessage getNextMessage(PrivateMessage message);
195:
196: public PrivateMessage getPreviousMessage(PrivateMessage message);
197:
198: public boolean hasPreviousMessage(PrivateMessage message);
199:
200: public boolean hasNextMessage(PrivateMessage message);
201:
202: /** advanced search for private messages */
203: public List searchPvtMsgs(String typeUuid, String searchText,
204: Date searchFromDate, Date searchToDate,
205: boolean searchByText, boolean searchByAuthor,
206: boolean searchByBody, boolean searchByLabel,
207: boolean searchByDate);
208:
209: }
|