View Javadoc
1   /*
2    * Copyright (c) 2002-2016, Mairie de Paris
3    * All rights reserved.
4    *
5    * Rediibution 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. Rediibutions of source code must retain the above copyright notice
10   *     and the following disclaimer.
11   *
12   *  2. Rediibutions 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 diibution.
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.mydashboard.modules.identity.business;
35  
36  import java.sql.Timestamp;
37  import java.util.HashMap;
38  import java.util.Map;
39  
40  import fr.paris.lutece.plugins.mydashboard.modules.identity.util.Constants;
41  
42  /**
43   *
44   * DashboardIdentity
45   *
46   */
47  public class DashboardIdentity
48  {
49      private Map<String, DashboardAttribute> _mapAttributes;
50      private Timestamp _lastUpdateDate;
51      private Integer _nCoverage;
52      
53      public DashboardIdentity ()
54      {
55          _mapAttributes = new HashMap<String, DashboardAttribute>( );
56      }
57      
58      /**
59       * Set a value to a specific attribute of DashboardIdentityAttribute
60       * @param key the name of the attribute
61       * @param value the value of the attribute
62       */
63      public void setAttributeValue ( String key, String value )
64      {
65          DashboardAttribute attribute = _mapAttributes.get( key );
66          if ( attribute != null )
67          {
68              attribute.setValue( value );
69              _mapAttributes.put( key, attribute );
70          }
71      }
72      
73      /**
74       * Get a DashboardAttribute for a key
75       * @param key the key
76       * @return the DashboardAttribute
77       */
78      public DashboardAttribute getAttribute ( String key )
79      {
80          return _mapAttributes.get( key );
81      }
82      
83      /**
84       * Set an attribute to DashboardIdentity attribute map
85       * @param key the key of the attribute
86       * @param attribute the DashboardAttribute to set
87       */
88      public void setAttribute ( String key, DashboardAttribute attribute )
89      {
90          if ( attribute != null )
91          {
92              _mapAttributes.put( key, attribute );
93          }
94      }
95  
96      /**
97       * @return the _ConnectionId
98       */
99      public DashboardAttribute getConnectionId( )
100     {
101         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_CONNECTION_ID );
102     }
103 
104     /**
105      * @param connectionId
106      *            the _ConnectionId to set
107      */
108     public void setConnectionId( DashboardAttribute connectionId )
109     {
110         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_CONNECTION_ID, connectionId );
111     }
112 
113     /**
114      * @return the _CustomerId
115      */
116     public DashboardAttribute getCustomerId( )
117     {
118         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_CUSTOMER_ID );
119     }
120 
121     /**
122      * @param customerId
123      *            the _customerId to set
124      */
125     public void setCustomerId( DashboardAttribute customerId )
126     {
127         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_CUSTOMER_ID, customerId );
128     }
129 
130     /**
131      * @return the _LastName
132      */
133     public DashboardAttribute getLastName( )
134     {
135         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_LAST_NAME );
136     }
137 
138     /**
139      * @param lastName
140      *            the lastName to set
141      */
142     public void setLastName( DashboardAttribute lastName )
143     {
144         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_LAST_NAME, lastName );
145     }
146 
147     /**
148      * @return the Preferred Username
149      */
150     public DashboardAttribute getPreferredUsername( )
151     {
152         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_PREFERRED_USER_NAME );
153     }
154 
155     /**
156      * @param preferredUsername
157      *            the preferredUsername to set
158      */
159     public void setPreferredUsername( DashboardAttribute preferredUsername )
160     {
161         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_PREFERRED_USER_NAME, preferredUsername );
162     }
163 
164     /**
165      * @return the _Firstname
166      */
167     public DashboardAttribute getFirstname( )
168     {
169         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_FIRSTNAME );
170     }
171 
172     /**
173      * @param firstname
174      *            the firstname to set
175      */
176     public void setFirstname( DashboardAttribute firstname )
177     {
178         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_FIRSTNAME, firstname );
179     }
180 
181     /**
182      * @return the _Gender
183      */
184     public DashboardAttribute getGender( )
185     {
186         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_GENDER );
187     }
188 
189     /**
190      * @param gender
191      *            the gender to set
192      */
193     public void setGender( DashboardAttribute gender )
194     {
195         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_GENDER, gender );
196     }
197 
198     /**
199      * @return the _Birthdate
200      */
201     public DashboardAttribute getBirthdate( )
202     {
203         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHDATE );
204     }
205 
206     /**
207      * @param birthdate
208      *            the birthdate to set
209      */
210     public void setBirthdate( DashboardAttribute birthdate )
211     {
212         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHDATE, birthdate );
213     }
214 
215     /**
216      * @return the _Birthplace
217      */
218     public DashboardAttribute getBirthplace( )
219     {
220         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHPLACE );
221     }
222 
223     /**
224      * @param birthplace
225      *            the _birthplace to set
226      */
227     public void setBirthplace( DashboardAttribute birthplace )
228     {
229         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHPLACE, birthplace );
230     }
231 
232     /**
233      * @return the Birthcountry
234      */
235     public DashboardAttribute getBirthcountry( )
236     {
237         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHCOUNTRY );
238     }
239 
240     /**
241      * @param birthcountry
242      *            the birthcountry to set
243      */
244     public void setBirthcountry( DashboardAttribute birthcountry )
245     {
246         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHCOUNTRY, birthcountry );
247     }
248 
249     /**
250      * @return the Address
251      */
252     public DashboardAttribute getAddress( )
253     {
254         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS );
255     }
256 
257     /**
258      * @param address
259      *            the address to set
260      */
261     public void setAddress( DashboardAttribute address )
262     {
263         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS, address );
264     }
265 
266     /**
267      * @return the AddressDetail
268      */
269     public DashboardAttribute getAddressDetail( )
270     {
271         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS_DETAIL );
272     }
273 
274     /**
275      * @param addressDetail
276      *            the addressDetail to set
277      */
278     public void setAddressDetail( DashboardAttribute addressDetail )
279     {
280         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS_DETAIL, addressDetail );
281     }
282 
283     /**
284      * @return the _AddressPostalcode
285      */
286     public DashboardAttribute getAddressPostalcode( )
287     {
288         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS_POSTAL_CODE );
289     }
290 
291     /**
292      * @param addressPostalcode
293      *            the addressPostalcode to set
294      */
295     public void setAddressPostalcode( DashboardAttribute addressPostalcode )
296     {
297         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS_POSTAL_CODE, addressPostalcode );
298     }
299 
300     /**
301      * @return the AddressCity
302      */
303     public DashboardAttribute getAddressCity( )
304     {
305         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS_CITY );
306     }
307 
308     /**
309      * @param addressCity
310      *            the addressCity to set
311      */
312     public void setAddressCity( DashboardAttribute addressCity )
313     {
314         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_ADDRESS_CITY, addressCity );
315     }
316 
317     /**
318      * @return the BillingAddress
319      */
320     public DashboardAttribute getBillingAddress( )
321     {
322         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS );
323     }
324 
325     /**
326      * @param billingAddress
327      *            the billingAddress to set
328      */
329     public void setBillingAddress( DashboardAttribute billingAddress )
330     {
331         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS, billingAddress );
332     }
333 
334     /**
335      * @return the BillingAddressDetail
336      */
337     public DashboardAttribute getBillingAddressDetail( )
338     {
339         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS_DETAIL );
340     }
341 
342     /**
343      * @param billingAddressDetail
344      *            the billingAddressDetail to set
345      */
346     public void setBillingAddressDetail( DashboardAttribute billingAddressDetail )
347     {
348         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS_DETAIL, billingAddressDetail );
349     }
350 
351     /**
352      * @return the BillingAddressPostalcode
353      */
354     public DashboardAttribute getBillingAddressPostalcode( )
355     {
356         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS_POSTAL_CODE );
357     }
358 
359     /**
360      * @param billingAddressPostalcode
361      *            the billingAddressPostalcode to set
362      */
363     public void setBillingAddressPostalcode( DashboardAttribute billingAddressPostalcode )
364     {
365         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS_POSTAL_CODE, billingAddressPostalcode );
366     }
367 
368     /**
369      * @return the BillingAddressCity
370      */
371     public DashboardAttribute getBillingAddressCity( )
372     {
373         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS_CITY );
374     }
375 
376     /**
377      * @param billingAddressCity
378      *            the billingAddressCity to set
379      */
380     public void setBillingAddressCity( DashboardAttribute billingAddressCity )
381     {
382         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BILLING_ADDRESS_CITY, billingAddressCity );
383     }
384 
385     /**
386      * @return the _Email
387      */
388     public DashboardAttribute getEmail( )
389     {
390         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_EMAIL );
391     }
392 
393     /**
394      * @param email
395      *            the email to set
396      */
397     public void setEmail( DashboardAttribute email )
398     {
399         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_EMAIL, email );
400     }
401 
402     /**
403      * @return the _Phone
404      */
405     public DashboardAttribute getPhone( )
406     {
407         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_PHONE );
408     }
409 
410     /**
411      * @param phone
412      *            the phone to set
413      */
414     public void setPhone( DashboardAttribute phone )
415     {
416         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_PHONE, phone );
417     }
418 
419     /**
420      * @return the _MobilePhone
421      */
422     public DashboardAttribute getMobilePhone( )
423     {
424         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_MOBILE_PHONE );
425     }
426 
427     /**
428      * @param mobilePhone
429      *            the mobilePhone to set
430      */
431     public void setMobilePhone( DashboardAttribute mobilePhone )
432     {
433         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_MOBILE_PHONE, mobilePhone );
434     }
435 
436     /**
437      * @return the Login
438      */
439     public DashboardAttribute getLogin( )
440     {
441         //In this implementation of MyDashboardIdentity, login == email of user.
442         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_LOGIN );
443     }
444 
445     /**
446      * @param login
447      *            the login to set
448      */
449     public void setLogin( DashboardAttribute login )
450     {
451         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_LOGIN, login );
452     }
453   
454     /**
455      * @return the FranceConnectCertified flag
456      */
457     public DashboardAttribute getFranceConnectCertified( )
458     {
459         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_FRANCE_CONNECT_CERTIFIED );
460     }
461 
462     /**
463      * Last Update Date
464      * @return last Update Date
465      */
466 	public Timestamp getLastUpdateDate() {
467 		return _lastUpdateDate;
468 	}
469 
470 	/**
471 	 * 
472 	 * @param _lastUpdateDate last update date
473 	 */
474 	public void setLastUpdateDate(Timestamp _lastUpdateDate) {
475 		this._lastUpdateDate = _lastUpdateDate;
476 	}
477 	
478     /**
479      * @return the _BirthplaceCode
480      */
481     public DashboardAttribute getBirthplaceCode( )
482     {
483         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHPLACE_CODE );
484     }
485 
486     /**
487      * @param birthplaceCode
488      *            the _birthplaceCode to set
489      */
490     public void setBirthplaceCode( DashboardAttribute birthplaceCode )
491     {
492         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHPLACE_CODE, birthplaceCode );
493     }
494 
495     /**
496      * @return the BirthcountryCode
497      */
498     public DashboardAttribute getBirthcountryCode( )
499     {
500         return _mapAttributes.get( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHCOUNTRY_CODE );
501     }
502 
503     /**
504      * @param birthcountryCode
505      *            the birthcountryCode to set
506      */
507     public void setBirthcountryCode( DashboardAttribute birthcountryCode )
508     {
509         _mapAttributes.put( Constants.ATTRIBUTE_DB_IDENTITY_BIRTHCOUNTRY_CODE, birthcountryCode );
510     }
511 	/**
512 	 * 
513 	 * @return the coverage of the identity
514 	 */
515 	public Integer getCoverage() {
516 		return _nCoverage;
517 	}
518   
519 	/**
520 	 * set the coverage of the identity
521 	 * @param coverage the coverage
522 	 */
523 	public void setCoverage(Integer coverage) {
524 		this._nCoverage = coverage;
525 	}
526 
527 
528 }