View Javadoc
1   /*
2    * Copyright (c) 2002-2024, 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.plugins.grubusiness.business.notification;
35  
36  import com.fasterxml.jackson.annotation.JsonInclude;
37  import com.fasterxml.jackson.annotation.JsonInclude.Include;
38  import com.fasterxml.jackson.annotation.JsonProperty;
39  import com.fasterxml.jackson.annotation.JsonPropertyOrder;
40  import com.fasterxml.jackson.annotation.JsonRootName;
41  
42  import java.util.ArrayList;
43  import java.util.List;
44  
45  /**
46   * The Class BroadcastNotification for broadcast notification.<br/>
47   * Fields description :<br/>
48   * - message, content of the notification<br/>
49   * - recipient, list of emailAddress for the broadcast - bcc, list of emailAddress for blind carbon copy<br/>
50   * - subject, subject of the email<br/>
51   * - sender_email, sender email address<br/>
52   * - sender_name, sender name<br/>
53   * - cc, list of emailAddress for carbon copy
54   */
55  @JsonRootName( value = "broadcast_email" )
56  @JsonPropertyOrder( {
57          "message", "bcc", "subject", "sender_email", "sender_name", "recipient", "cc"
58  } )
59  public class BroadcastNotification
60  {
61      // Variables declarations
62      private String _strSenderName;
63      private String _strSenderEmail;
64      private List<EmailAddress> _lstRecipient;
65      private String _strSubject;
66      private String _strMessage;
67      private List<EmailAddress> _lstCc;
68      private List<EmailAddress> _lstBcc;
69  
70      /**
71       * Returns the SenderName.
72       *
73       * @return The SenderName
74       */
75      @JsonProperty( "sender_name" )
76      public String getSenderName( )
77      {
78          return _strSenderName;
79      }
80  
81      /**
82       * Sets the SenderName.
83       *
84       * @param strSenderName
85       *            The SenderName
86       */
87      @JsonProperty( "sender_name" )
88      public void setSenderName( String strSenderName )
89      {
90          _strSenderName = strSenderName;
91      }
92  
93      /**
94       * Returns the SenderEmail.
95       *
96       * @return The SenderEmail
97       */
98      @JsonProperty( "sender_email" )
99      public String getSenderEmail( )
100     {
101         return _strSenderEmail;
102     }
103 
104     /**
105      * Sets the SenderEmail.
106      *
107      * @param strSenderEmail
108      *            The SenderEmail
109      */
110     @JsonProperty( "sender_email" )
111     public void setSenderEmail( String strSenderEmail )
112     {
113         _strSenderEmail = strSenderEmail;
114     }
115 
116     /**
117      * Returns Recipients.
118      *
119      * @return Recipients
120      */
121     @JsonProperty( "recipient" )
122     public List<EmailAddress> getRecipient( )
123     {
124         return _lstRecipient;
125     }
126 
127     /**
128      * Sets Recipients.
129      *
130      * @param lstRecipient
131      *            all Recipients
132      */
133     @JsonProperty( "recipient" )
134     public void setRecipient( List<EmailAddress> lstRecipient )
135     {
136         _lstRecipient = lstRecipient;
137     }
138 
139     /**
140      * Adds a recipient
141      * 
142      * @param recipient
143      *            the recipient to add
144      */
145     public void addRecipient( EmailAddress recipient )
146     {
147         if ( this._lstRecipient == null )
148         {
149             this._lstRecipient = new ArrayList<EmailAddress>( );
150         }
151 
152         this._lstRecipient.add( recipient );
153     }
154 
155     /**
156      * Returns the Subject.
157      *
158      * @return The Subject
159      */
160     @JsonProperty( "subject" )
161     public String getSubject( )
162     {
163         return _strSubject;
164     }
165 
166     /**
167      * Sets the Subject.
168      *
169      * @param strSubject
170      *            The Subject
171      */
172     @JsonProperty( "subject" )
173     public void setSubject( String strSubject )
174     {
175         _strSubject = strSubject;
176     }
177 
178     /**
179      * Returns the Message.
180      *
181      * @return The Message
182      */
183     @JsonProperty( "message" )
184     public String getMessage( )
185     {
186         return _strMessage;
187     }
188 
189     /**
190      * Sets the Message.
191      *
192      * @param strMessage
193      *            The Message
194      */
195     @JsonProperty( "message" )
196     public void setMessage( String strMessage )
197     {
198         _strMessage = strMessage;
199     }
200 
201     /**
202      * Gets cc addresses.
203      *
204      * @return cc addresses
205      */
206     @JsonProperty( "cc" )
207     @JsonInclude( Include.NON_NULL )
208     public List<EmailAddress> getCc( )
209     {
210         return _lstCc;
211     }
212 
213     /**
214      * Sets cc addresses.
215      *
216      * @param lstCc
217      *            cc addresses
218      */
219     @JsonProperty( "cc" )
220     public void setCc( List<EmailAddress> lstCc )
221     {
222         _lstCc = lstCc;
223     }
224 
225     /**
226      * Adds a carbon copy recipient
227      * 
228      * @param recipient
229      *            the recipient to add
230      */
231     public void addCc( EmailAddress recipient )
232     {
233         if ( this._lstCc == null )
234         {
235             this._lstCc = new ArrayList<EmailAddress>( );
236         }
237 
238         this._lstCc.add( recipient );
239     }
240 
241     /**
242      * Gets bcc addresses.
243      *
244      * @return bbc addresses
245      */
246     @JsonProperty( "bcc" )
247     @JsonInclude( Include.NON_NULL )
248     public List<EmailAddress> getBcc( )
249     {
250         return _lstBcc;
251     }
252 
253     /**
254      * Sets bcc addresses.
255      *
256      * @param lstBcc
257      *            bcc addresses
258      */
259     @JsonProperty( "bcc" )
260     public void setBcc( List<EmailAddress> lstBcc )
261     {
262         _lstBcc = lstBcc;
263     }
264 
265     /**
266      * Adds a blind carbon copy recipient
267      * 
268      * @param recipient
269      *            the recipient to add
270      */
271     public void addBcc( EmailAddress recipient )
272     {
273         if ( this._lstBcc == null )
274         {
275             this._lstBcc = new ArrayList<EmailAddress>( );
276         }
277 
278         this._lstBcc.add( recipient );
279     }
280 }