View Javadoc
1 /* 2 * (C) 2002 David Carr david@carr.name 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation; either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program; if not, write to the Free Software 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 */ 18 19 package net.sourceforge.mflow.api; 20 21 import java.util.Date; 22 23 /*** 24 * This class models a generic message. Msg contains a set of attributes and a 25 * "content". 26 * 27 * @author <a href="mailto:david@carr.name">David Carr</a> 28 * @version $Revision: 1.4 $ 29 */ 30 public interface Msg { 31 /*** 32 * Add this recipient ContactMethod to the existing ones. 33 * 34 * @param cm the recipient 35 */ 36 void addRecipient(ContactMethod cm); 37 38 /*** 39 * Add these recipient ContactMethods to the existing ones. 40 * 41 * @param cms the recipients 42 */ 43 void addRecipients(ContactMethod[] cms); 44 45 /*** 46 * Add this ContactMethod to be replied to 47 * 48 * @param cm the reply ContactMethod 49 */ 50 void addReplyTo(ContactMethod cm); 51 52 /*** 53 * Get all the recipient ContactMethods for the Msg. 54 * 55 * @return an array of the recipients for this Msg 56 */ 57 ContactMethod[] getRecipients(); 58 59 /*** 60 * Return the ContentHandlers for the content 61 * 62 * @return the ContentHandlers for the content 63 */ 64 ContentHandler[] getContentHandlers(); 65 66 /*** 67 * Get the sender(s). 68 * 69 * @return the sender(s) of this Msg. 70 */ 71 Contact[] getFrom(); 72 73 /*** 74 * Get the Date this Msg was received. 75 * 76 * @return the Date this Msg was received, or null if it wasn't received 77 */ 78 Date getReceivedDate(); 79 80 /*** 81 * Get the ContactMethods to which replies should be directed. This will 82 * usually be the sender of the message, but some messages may direct 83 * replies to a different ContactMethod. 84 * 85 * @return an array of the ContactMethods to which replies to this Msg should 86 * be directed 87 */ 88 ContactMethod[] getReplyTo(); 89 90 /*** 91 * Get the Date this Msg was sent. 92 * 93 * @return the Date this Msg was sent, or null if it wasn't sent 94 */ 95 Date getSentDate(); 96 97 /*** 98 * Get the subject of this Msg 99 * 100 * @return the subject of this Msg 101 */ 102 String getSubject(); 103 104 /*** 105 * <p>Get a new Msg suitable for a reply to this message. The new Msg will 106 * have its attributes set up appropriately. Note that this new Msg object 107 * will be empty, that is, it will <b>not</b> have a "content". These will 108 * have to be suitably filled in by the client.</p> 109 * <p>If replyToAll is set, the new Msg will be addressed to all recipients 110 * of this message. Otherwise, the reply will be addressed to only the sender 111 * of this message (using the value of the getReplyTo method).</p> 112 * <p>The "Subject" field is filled in with the original subject prefixed 113 * with "Re: " (unless it already starts with "Re:" (case insensitive)).</p> 114 * 115 * @param replyToAll whether to reply to all recipients of the original 116 * message, or just the reply-to ContactMethods 117 * @return a message to use for the reply 118 */ 119 Msg reply(boolean replyToAll); 120 121 /*** 122 * Adds a new ContentHandler 123 * 124 * @param ch the new ContentHandler 125 */ 126 void addContentHandler(ContentHandler ch); 127 128 /*** 129 * Sets a new ContentHandler 130 * 131 * @param ch the new ContentHandler 132 */ 133 void setContentHandler(ContentHandler ch); 134 135 /*** 136 * Sets the content of the Msg 137 * 138 * @param chs the new ContentHandlers 139 */ 140 void setContentHandlers(ContentHandler[] chs); 141 142 /*** 143 * Set the "from" Contact for this Msg. 144 * 145 * @param c the Contact for the sender 146 */ 147 void setFrom(Contact c); 148 149 /*** 150 * Set the "from" Contact(s) for this Msg. 151 * 152 * @param cs the new sender Contact(s) 153 */ 154 void setFrom(Contact[] cs); 155 156 /*** 157 * Set the received Date 158 * 159 * @param d the Date the Msg was received 160 */ 161 void setReceivedDate(Date d); 162 163 /*** 164 * Set the recipient ContactMethod. All ContactMethodare replaced by the 165 * ContactMethod parameter. 166 * 167 * @param cm the recipient 168 */ 169 void setRecipient(ContactMethod cm); 170 171 /*** 172 * Set these recipient ContactMethods. Eliminates all previous recipients. 173 * 174 * @param cms the recipients 175 */ 176 void setRecipients(ContactMethod[] cms); 177 178 /*** 179 * Set the address to which replies should be directed. 180 * 181 * @param cm the reply ContactMethod 182 */ 183 void setReplyTo(ContactMethod cm); 184 185 /*** 186 * Set the addresses to which replies should be directed. (Normally only a 187 * single address will be specified.) 188 * 189 * @param cms the reply ContactMethods 190 */ 191 void setReplyTo(ContactMethod[] cms); 192 193 /*** 194 * Set the sent Date 195 * 196 * @param d the Date the Msg was sent 197 */ 198 void setSentDate(Date d); 199 200 /*** 201 * Set the subject 202 * 203 * @param s the subject 204 */ 205 void setSubject(String s); 206 207 /*** 208 * Convenience method to get the content of the Msg as a String 209 * 210 * @return a String content 211 */ 212 String getText(); 213 214 /*** 215 * Convenience method to set the content of the Msg to a String 216 * 217 * @param body the text to set as the content 218 */ 219 void setText(String body); 220 221 /*** 222 * Mutator for the unread state 223 * 224 * @param isUnread whether the Msg has not been read 225 */ 226 void setUnread(boolean isUnread); 227 228 /*** 229 * Mutator for the "new" state 230 * 231 * @param isNew whether the Msg is "new" 232 */ 233 void setNew(boolean isNew); 234 235 /*** 236 * Accessor for the unread state 237 * 238 * @return whether the Msg has not been read 239 */ 240 boolean isUnread(); 241 242 /*** 243 * Accessor for the "new" state 244 * 245 * @return whether the Msg is "new" 246 */ 247 boolean isNew(); 248 }

This page was automatically generated by Maven