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.customer;
35  
36  import java.io.Serializable;
37  import java.util.Collection;
38  import java.util.HashMap;
39  import java.util.Map;
40  
41  import javax.validation.constraints.Email;
42  import javax.validation.constraints.NotEmpty;
43  import javax.validation.constraints.Size;
44  
45  import com.fasterxml.jackson.annotation.JsonIgnore;
46  import com.fasterxml.jackson.annotation.JsonProperty;
47  import com.fasterxml.jackson.annotation.JsonRootName;
48  
49  // TODO: Auto-generated Javadoc
50  /**
51   * This is the business class for the object Customer.
52   */
53  @JsonRootName( value = "customer" )
54  public class Customer implements Serializable
55  {
56      /** The Constant serialVersionUID. */
57      private static final long serialVersionUID = 1L;
58  
59      // Variables declarations
60      private String _strId;
61  
62      /** The _n id title. */
63      private int _nIdTitle;
64  
65      /** The _str firstname. */
66      @NotEmpty( message = "#i18n{gru.validation.customer.Firstname.notEmpty}" )
67      @Size( max = 50, message = "#i18n{gru.validation.customer.Firstname.size}" )
68      private String _strFirstname;
69  
70      /** The _str lastname. */
71      @NotEmpty( message = "#i18n{gru.validation.customer.Lastname.notEmpty}" )
72      @Size( max = 50, message = "#i18n{gru.validation.customer.Lastname.size}" )
73      private String _strLastname;
74  
75      /** The _str familyname. */
76      @Size( max = 50, message = "#i18n{gru.validation.customer.Familyname.size}" )
77      private String _strFamilyname;
78  
79      /** The _b has account. */
80      private boolean _bHasAccount;
81  
82      /** The _str account login. */
83      @Size( max = 50, message = "#i18n{gru.validation.customer.AccountLogin.size}" )
84      private String _strAccountLogin;
85  
86      /** The connection Id. */
87      @Size( max = 56, message = "#i18n{gru.validation.customer.AccountGuid.size}" )
88      private String _strConnectionId;
89  
90      /** The customer Id. */
91      @Size( max = 50, message = "#i18n{gru.validation.customer.AccountCuid.size}" )
92      private String _strCustomerId;
93  
94      /** The _str email. */
95      @Email( message = "#i18n{portal.validation.message.email}" )
96      @Size( max = 255, message = "#i18n{gru.validation.customer.Email.size}" )
97      private String _strEmail;
98  
99      /** The _b is email verified. */
100     private boolean _bIsEmailVerified;
101 
102     /** The _str fixe phone. */
103     @Size( max = 50, message = "#i18n{gru.validation.customer.FixedPhoneNumber.size}" )
104     private String _strFixedPhoneNumber;
105 
106     /** The _str mobile phone. */
107     @Size( max = 50, message = "#i18n{gru.validation.customer.MobilePhone.size}" )
108     private String _strMobilePhone;
109 
110     /** The _b is mobile phone verified. */
111     private boolean _bIsMobilePhoneVerified;
112 
113     /** The _str extras attributes. */
114     @NotEmpty( message = "#i18n{gru.validation.customer.ExtrasAttributes.notEmpty}" )
115     private String _strExtrasAttributes;
116 
117     /** The _str birthdate. */
118     private String _strBirthDate;
119 
120     private final Map<String, String> _mapAttributes;
121 
122     /**
123      * Constructor
124      */
125     public Customer( )
126     {
127         _mapAttributes = new HashMap<>( );
128     }
129 
130     /**
131      * Returns the Id.
132      *
133      * @return The Id
134      */
135     @JsonProperty( "id" )
136     public String getId( )
137     {
138         return _strId;
139     }
140 
141     /**
142      * Sets the Id.
143      *
144      * @param strId
145      *            The Id
146      */
147     @JsonProperty( "id" )
148     public void setId( String strId )
149     {
150         _strId = strId;
151     }
152 
153     /**
154      * Returns the IdTitle.
155      *
156      * @return The IdTitle
157      */
158     @JsonIgnore
159     public int getIdTitle( )
160     {
161         return _nIdTitle;
162     }
163 
164     /**
165      * Sets the IdTitle.
166      *
167      * @param nIdTitle
168      *            The IdTitle
169      */
170     public void setIdTitle( int nIdTitle )
171     {
172         _nIdTitle = nIdTitle;
173     }
174 
175     /**
176      * Returns the Firstname.
177      *
178      * @return The Firstname
179      */
180     public String getFirstname( )
181     {
182         return _strFirstname;
183     }
184 
185     /**
186      * Sets the Firstname.
187      *
188      * @param strFirstname
189      *            The Firstname
190      */
191     public void setFirstname( String strFirstname )
192     {
193         _strFirstname = strFirstname;
194     }
195 
196     /**
197      * Returns the Lastname.
198      *
199      * @return The Lastname
200      */
201     public String getLastname( )
202     {
203         return _strLastname;
204     }
205 
206     /**
207      * Sets the Lastname.
208      *
209      * @param strLastname
210      *            The Lastname
211      */
212     public void setLastname( String strLastname )
213     {
214         _strLastname = strLastname;
215     }
216 
217     /**
218      * Returns the Familyname.
219      *
220      * @return The Familyname
221      */
222     public String getFamilyname( )
223     {
224         return _strFamilyname;
225     }
226 
227     /**
228      * Sets the Familyname.
229      *
230      * @param strFamilyname
231      *            The Familyname
232      */
233     public void setFamilyname( String strFamilyname )
234     {
235         _strFamilyname = strFamilyname;
236     }
237 
238     /**
239      * Returns the HasAccount.
240      *
241      * @return The HasAccount
242      */
243     @JsonIgnore
244     public boolean getHasAccount( )
245     {
246         return _bHasAccount;
247     }
248 
249     /**
250      * Sets the HasAccount.
251      *
252      * @param bHasAccount
253      *            The HasAccount
254      */
255     public void setHasAccount( boolean bHasAccount )
256     {
257         _bHasAccount = bHasAccount;
258     }
259 
260     /**
261      * Returns the AccountLogin.
262      *
263      * @return The AccountLogin
264      */
265     @JsonIgnore
266     public String getAccountLogin( )
267     {
268         return _strAccountLogin;
269     }
270 
271     /**
272      * Sets the AccountLogin.
273      *
274      * @param strAccountLogin
275      *            The AccountLogin
276      */
277     public void setAccountLogin( String strAccountLogin )
278     {
279         _strAccountLogin = strAccountLogin;
280     }
281 
282     /**
283      * Returns the connection Id.
284      *
285      * @return The connection Id
286      */
287     @JsonProperty( "connection_id" )
288     public String getConnectionId( )
289     {
290         return _strConnectionId;
291     }
292 
293     /**
294      * Sets the connection id.
295      *
296      * @param strConnectionId
297      *            The Connection Id
298      */
299     @JsonProperty( "connection_id" )
300     public void setConnectionId( String strConnectionId )
301     {
302         _strConnectionId = strConnectionId;
303     }
304 
305     /**
306      * Returns the Customer Id.
307      *
308      * @return The Customer Id
309      */
310     @JsonProperty( "customer_id" )
311     public String getCustomerId( )
312     {
313         return _strCustomerId;
314     }
315 
316     /**
317      * Sets the Customer id.
318      *
319      * @param strCustomerId
320      *            The Customer Id
321      */
322     @JsonProperty( "customer_id" )
323     public void setCustomerId( String strCustomerId )
324     {
325         _strCustomerId = strCustomerId;
326     }
327 
328     /**
329      * Returns the Email.
330      *
331      * @return The Email
332      */
333     @JsonProperty( "email" )
334     public String getEmail( )
335     {
336         return _strEmail;
337     }
338 
339     /**
340      * Sets the Email.
341      *
342      * @param strEmail
343      *            The Email
344      */
345     @JsonProperty( "email" )
346     public void setEmail( String strEmail )
347     {
348         _strEmail = strEmail;
349     }
350 
351     /**
352      * Returns the IsEmailVerified.
353      *
354      * @return The IsEmailVerified
355      */
356     @JsonIgnore
357     public boolean getIsEmailVerified( )
358     {
359         return _bIsEmailVerified;
360     }
361 
362     /**
363      * Sets the IsEmailVerified.
364      *
365      * @param bIsEmailVerified
366      *            The IsEmailVerified
367      */
368     public void setIsEmailVerified( boolean bIsEmailVerified )
369     {
370         _bIsEmailVerified = bIsEmailVerified;
371     }
372 
373     /**
374      * Returns the MobilePhone.
375      *
376      * @return The MobilePhone
377      */
378     public String getMobilePhone( )
379     {
380         return _strMobilePhone;
381     }
382 
383     /**
384      * Sets the MobilePhone.
385      *
386      * @param strMobilePhone
387      *            The MobilePhone
388      */
389     public void setMobilePhone( String strMobilePhone )
390     {
391         _strMobilePhone = strMobilePhone;
392     }
393 
394     /**
395      * Gets the fixe phone.
396      *
397      * @return the fixe phone
398      */
399     public String getFixedPhoneNumber( )
400     {
401         return _strFixedPhoneNumber;
402     }
403 
404     /**
405      * Sets the fixe phone.
406      *
407      * @param strFixedPhoneNumber
408      *            the new fixe phone
409      */
410     public void setFixedPhoneNumber( String strFixedPhoneNumber )
411     {
412         _strFixedPhoneNumber = strFixedPhoneNumber;
413     }
414 
415     /**
416      * Returns the IsMobilePhoneVerified.
417      *
418      * @return The IsMobilePhoneVerified
419      */
420     @JsonIgnore
421     public boolean getIsMobilePhoneVerified( )
422     {
423         return _bIsMobilePhoneVerified;
424     }
425 
426     /**
427      * Sets the IsMobilePhoneVerified.
428      *
429      * @param bIsMobilePhoneVerified
430      *            The IsMobilePhoneVerified
431      */
432     public void setIsMobilePhoneVerified( boolean bIsMobilePhoneVerified )
433     {
434         _bIsMobilePhoneVerified = bIsMobilePhoneVerified;
435     }
436 
437     /**
438      * Returns the ExtrasAttributes.
439      *
440      * @return The ExtrasAttributes
441      */
442     @JsonIgnore
443     public String getExtrasAttributes( )
444     {
445         return _strExtrasAttributes;
446     }
447 
448     /**
449      * Sets the ExtrasAttributes.
450      *
451      * @param strExtrasAttributes
452      *            The ExtrasAttributes
453      */
454     public void setExtrasAttributes( String strExtrasAttributes )
455     {
456         _strExtrasAttributes = strExtrasAttributes;
457     }
458 
459     /**
460      * Returns the birthDate.
461      *
462      * @return The birthDate
463      */
464     public String getBirthDate( )
465     {
466         return _strBirthDate;
467     }
468 
469     /**
470      * Sets the birthDate.
471      *
472      * @param strBirthDate
473      *            The birthDate
474      */
475     public void setBirthDate( String strBirthDate )
476     {
477         _strBirthDate = strBirthDate;
478     }
479 
480     /**
481      * Adds an attribute
482      * 
483      * @param strName
484      *            the attribute name
485      * @param strValue
486      *            the attribute value
487      */
488     public void addAttributes( String strName, String strValue )
489     {
490         _mapAttributes.put( strName, strValue );
491     }
492 
493     /**
494      * Gives the attribute with the specified name
495      * 
496      * @param strName
497      *            the attribute name
498      * @return the attribute or {@code null} if the attribute does not exist
499      */
500     public String getAttribute( String strName )
501     {
502         return _mapAttributes.get( strName );
503     }
504 
505     /**
506      * Gives all the attribute names
507      * 
508      * @return the attributes names
509      */
510     public Collection<String> getAttributeNames( )
511     {
512         return _mapAttributes.keySet( );
513     }
514 }