1 /*
2 * Copyright (c) 2002-2014, Mairie de Paris
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice
10 * and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice
13 * and the following disclaimer in the documentation and/or other materials
14 * provided with the distribution.
15 *
16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 *
32 * License 1.0
33 */
34 package fr.paris.lutece.portal.service.mail;
35
36 import fr.paris.lutece.util.mail.FileAttachment;
37 import fr.paris.lutece.util.mail.UrlAttachment;
38
39 import java.io.Serializable;
40
41 import java.util.List;
42
43
44 /**
45 * MailIem
46 */
47 public class MailItem implements Serializable
48 {
49 public static final int FORMAT_HTML = 0; // Default
50 public static final int FORMAT_TEXT = 1;
51 public static final int FORMAT_MULTIPART_HTML = 2;
52 public static final int FORMAT_MULTIPART_TEXT = 3;
53 public static final int FORMAT_CALENDAR = 4;
54 private static final long serialVersionUID = 1L;
55
56 // Variables declarations
57 private String _strRecipientsTo;
58 private String _strRecipientsCc;
59 private String _strRecipientsBcc;
60 private String _strSenderName;
61 private String _strSenderEmail;
62 private String _strSubject;
63 private String _strMessage;
64 private String _strCalendarMessage;
65 private boolean _bCreateEvent;
66 private int _nFormat;
67 private List<UrlAttachment> _listUrlsAttachement;
68 private List<FileAttachment> _listFilesAttachement;
69 private boolean _bUniqueRecipientTo;
70
71 /**
72 * Returns the Recipient
73 *
74 * @return The Recipient
75 */
76 public String getRecipientsTo( )
77 {
78 return _strRecipientsTo;
79 }
80
81 /**
82 * Sets the Recipient
83 *
84 * @param strRecipient The Recipient
85 */
86 public void setRecipientsTo( String strRecipient )
87 {
88 _strRecipientsTo = strRecipient;
89 }
90
91 /**
92 * Returns the Recipient
93 *
94 * @return The Recipient
95 */
96 public String getRecipientsCc( )
97 {
98 return _strRecipientsCc;
99 }
100
101 /**
102 * Sets the Recipient
103 *
104 * @param strRecipient The Recipient
105 */
106 public void setRecipientsCc( String strRecipient )
107 {
108 _strRecipientsCc = strRecipient;
109 }
110
111 /**
112 * Returns the Recipient
113 *
114 * @return The Recipient
115 */
116 public String getRecipientsBcc( )
117 {
118 return _strRecipientsBcc;
119 }
120
121 /**
122 * Sets the Recipient
123 *
124 * @param strRecipient The Recipient
125 */
126 public void setRecipientsBcc( String strRecipient )
127 {
128 _strRecipientsBcc = strRecipient;
129 }
130
131 /**
132 * Returns the SenderName
133 *
134 * @return The SenderName
135 */
136 public String getSenderName( )
137 {
138 return _strSenderName;
139 }
140
141 /**
142 * Sets the SenderName
143 *
144 * @param strSenderName The SenderName
145 */
146 public void setSenderName( String strSenderName )
147 {
148 _strSenderName = strSenderName;
149 }
150
151 /**
152 * Returns the SenderEmail
153 *
154 * @return The SenderEmail
155 */
156 public String getSenderEmail( )
157 {
158 return _strSenderEmail;
159 }
160
161 /**
162 * Sets the SenderEmail
163 *
164 * @param strSenderEmail The SenderEmail
165 */
166 public void setSenderEmail( String strSenderEmail )
167 {
168 _strSenderEmail = strSenderEmail;
169 }
170
171 /**
172 * Returns the Subject
173 *
174 * @return The Subject
175 */
176 public String getSubject( )
177 {
178 return _strSubject;
179 }
180
181 /**
182 * Sets the Subject
183 *
184 * @param strSubject The Subject
185 */
186 public void setSubject( String strSubject )
187 {
188 _strSubject = strSubject;
189 }
190
191 /**
192 * Returns the Message
193 *
194 * @return The Message
195 */
196 public String getMessage( )
197 {
198 return _strMessage;
199 }
200
201 /**
202 * Sets the Message
203 *
204 * @param strMessage The Message
205 */
206 public void setMessage( String strMessage )
207 {
208 _strMessage = strMessage;
209 }
210
211 /**
212 * Returns the calendar message
213 *
214 * @return The calendar message
215 */
216 public String getCalendarMessage( )
217 {
218 return _strCalendarMessage;
219 }
220
221 /**
222 * Sets the calendar message
223 *
224 * @param strCalendarMessage The calendar message
225 */
226 public void setCalendarMessage( String strCalendarMessage )
227 {
228 _strCalendarMessage = strCalendarMessage;
229 }
230
231 /**
232 * Check if the calendar event of this mail item should be created or
233 * removed
234 * @return True if the event should be created, false if it should be
235 * removed
236 */
237 public boolean getCreateEvent( )
238 {
239 return _bCreateEvent;
240 }
241
242 /**
243 * Create or remove the event of this mail item
244 * @param bCreateEvent True to create the event, false otherwise
245 */
246 public void setCreateEvent( boolean bCreateEvent )
247 {
248 this._bCreateEvent = bCreateEvent;
249 }
250
251 /**
252 * Returns the Format
253 *
254 * @return The Format
255 */
256 public int getFormat( )
257 {
258 return _nFormat;
259 }
260
261 /**
262 * Sets the Format
263 *
264 * @param nFormat The Format
265 */
266 public void setFormat( int nFormat )
267 {
268 _nFormat = nFormat;
269 }
270
271 /**
272 * Returns a collection of files attachement
273 *
274 * @return The Attachements Map
275 */
276 public List<FileAttachment> getFilesAttachement( )
277 {
278 return _listFilesAttachement;
279 }
280
281 /**
282 * Set a collection of files attachement
283 *
284 * @param fileAttachements The collection of files attachement
285 */
286 public void setFilesAttachement( List<FileAttachment> fileAttachements )
287 {
288 _listFilesAttachement = fileAttachements;
289 }
290
291 /**
292 * return the list of urls attachement
293 * @return the list of urls attachement
294 */
295 public List<UrlAttachment> getUrlsAttachement( )
296 {
297 return _listUrlsAttachement;
298 }
299
300 /**
301 * set the list of urls attachement
302 * @param urlsAttachement the list of urls attachement
303 */
304 public void setUrlsAttachement( List<UrlAttachment> urlsAttachement )
305 {
306 _listUrlsAttachement = urlsAttachement;
307 }
308
309 /**
310 * set true if the mail must be send unitarily for each recipient
311 * @param bUniqueRecipient true if the mail must be send unitarily for each recipient
312 */
313 public void setUniqueRecipientTo( boolean bUniqueRecipient )
314 {
315 _bUniqueRecipientTo = bUniqueRecipient;
316 }
317
318 /**
319 *
320 * @return if the mail must be send unitarily for each recipient
321 */
322 public boolean isUniqueRecipientTo( )
323 {
324 return _bUniqueRecipientTo;
325 }
326 }