View Javadoc
1   /*
2    * Copyright (c) 2002-2022, City of 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   * MailIem
45   */
46  public class MailItem implements Serializable
47  {
48      public static final int FORMAT_HTML = 0; // Default
49      public static final int FORMAT_TEXT = 1;
50      public static final int FORMAT_MULTIPART_HTML = 2;
51      public static final int FORMAT_MULTIPART_TEXT = 3;
52      public static final int FORMAT_CALENDAR = 4;
53      private static final long serialVersionUID = 1L;
54  
55      // Variables declarations
56      private String _strRecipientsTo;
57      private String _strRecipientsCc;
58      private String _strRecipientsBcc;
59      private String _strSenderName;
60      private String _strSenderEmail;
61      private String _strSubject;
62      private String _strMessage;
63      private String _strCalendarMessage;
64      private boolean _bCreateEvent;
65      private int _nFormat;
66      private List<UrlAttachment> _listUrlsAttachement;
67      private List<FileAttachment> _listFilesAttachement;
68      private boolean _bUniqueRecipientTo;
69  
70      /**
71       * Returns the Recipient
72       *
73       * @return The Recipient
74       */
75      public String getRecipientsTo( )
76      {
77          return _strRecipientsTo;
78      }
79  
80      /**
81       * Sets the Recipient
82       *
83       * @param strRecipient
84       *            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
105      *            The Recipient
106      */
107     public void setRecipientsCc( String strRecipient )
108     {
109         _strRecipientsCc = strRecipient;
110     }
111 
112     /**
113      * Returns the Recipient
114      *
115      * @return The Recipient
116      */
117     public String getRecipientsBcc( )
118     {
119         return _strRecipientsBcc;
120     }
121 
122     /**
123      * Sets the Recipient
124      *
125      * @param strRecipient
126      *            The Recipient
127      */
128     public void setRecipientsBcc( String strRecipient )
129     {
130         _strRecipientsBcc = strRecipient;
131     }
132 
133     /**
134      * Returns the SenderName
135      *
136      * @return The SenderName
137      */
138     public String getSenderName( )
139     {
140         return _strSenderName;
141     }
142 
143     /**
144      * Sets the SenderName
145      *
146      * @param strSenderName
147      *            The SenderName
148      */
149     public void setSenderName( String strSenderName )
150     {
151         _strSenderName = strSenderName;
152     }
153 
154     /**
155      * Returns the SenderEmail
156      *
157      * @return The SenderEmail
158      */
159     public String getSenderEmail( )
160     {
161         return _strSenderEmail;
162     }
163 
164     /**
165      * Sets the SenderEmail
166      *
167      * @param strSenderEmail
168      *            The SenderEmail
169      */
170     public void setSenderEmail( String strSenderEmail )
171     {
172         _strSenderEmail = strSenderEmail;
173     }
174 
175     /**
176      * Returns the Subject
177      *
178      * @return The Subject
179      */
180     public String getSubject( )
181     {
182         return _strSubject;
183     }
184 
185     /**
186      * Sets the Subject
187      *
188      * @param strSubject
189      *            The Subject
190      */
191     public void setSubject( String strSubject )
192     {
193         _strSubject = strSubject;
194     }
195 
196     /**
197      * Returns the Message
198      *
199      * @return The Message
200      */
201     public String getMessage( )
202     {
203         return _strMessage;
204     }
205 
206     /**
207      * Sets the Message
208      *
209      * @param strMessage
210      *            The Message
211      */
212     public void setMessage( String strMessage )
213     {
214         _strMessage = strMessage;
215     }
216 
217     /**
218      * Returns the calendar message
219      *
220      * @return The calendar message
221      */
222     public String getCalendarMessage( )
223     {
224         return _strCalendarMessage;
225     }
226 
227     /**
228      * Sets the calendar message
229      *
230      * @param strCalendarMessage
231      *            The calendar message
232      */
233     public void setCalendarMessage( String strCalendarMessage )
234     {
235         _strCalendarMessage = strCalendarMessage;
236     }
237 
238     /**
239      * Check if the calendar event of this mail item should be created or removed
240      * 
241      * @return True if the event should be created, false if it should be removed
242      */
243     public boolean getCreateEvent( )
244     {
245         return _bCreateEvent;
246     }
247 
248     /**
249      * Create or remove the event of this mail item
250      * 
251      * @param bCreateEvent
252      *            True to create the event, false otherwise
253      */
254     public void setCreateEvent( boolean bCreateEvent )
255     {
256         this._bCreateEvent = bCreateEvent;
257     }
258 
259     /**
260      * Returns the Format
261      *
262      * @return The Format
263      */
264     public int getFormat( )
265     {
266         return _nFormat;
267     }
268 
269     /**
270      * Sets the Format
271      *
272      * @param nFormat
273      *            The Format
274      */
275     public void setFormat( int nFormat )
276     {
277         _nFormat = nFormat;
278     }
279 
280     /**
281      * Returns a collection of files attachement
282      *
283      * @return The Attachements Map
284      */
285     public List<FileAttachment> getFilesAttachement( )
286     {
287         return _listFilesAttachement;
288     }
289 
290     /**
291      * Set a collection of files attachement
292      *
293      * @param fileAttachements
294      *            The collection of files attachement
295      */
296     public void setFilesAttachement( List<FileAttachment> fileAttachements )
297     {
298         _listFilesAttachement = fileAttachements;
299     }
300 
301     /**
302      * return the list of urls attachement
303      * 
304      * @return the list of urls attachement
305      */
306     public List<UrlAttachment> getUrlsAttachement( )
307     {
308         return _listUrlsAttachement;
309     }
310 
311     /**
312      * set the list of urls attachement
313      * 
314      * @param urlsAttachement
315      *            the list of urls attachement
316      */
317     public void setUrlsAttachement( List<UrlAttachment> urlsAttachement )
318     {
319         _listUrlsAttachement = urlsAttachement;
320     }
321 
322     /**
323      * set true if the mail must be send unitarily for each recipient
324      * 
325      * @param bUniqueRecipient
326      *            true if the mail must be send unitarily for each recipient
327      */
328     public void setUniqueRecipientTo( boolean bUniqueRecipient )
329     {
330         _bUniqueRecipientTo = bUniqueRecipient;
331     }
332 
333     /**
334      *
335      * @return if the mail must be send unitarily for each recipient
336      */
337     public boolean isUniqueRecipientTo( )
338     {
339         return _bUniqueRecipientTo;
340     }
341 }