View Javadoc
1   /*
2    * Copyright (c) 2002-2017, 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.plugins.mylutece.modules.openiddatabase.authentication.business;
35  
36  import fr.paris.lutece.portal.service.mail.MailService;
37  import fr.paris.lutece.util.string.StringUtil;
38  
39  
40  /**
41   * This class represents the business object DatabaseUser
42   */
43  public class OpenIdDatabaseUser
44  {
45      // Variables declarations
46      private int _nUserId;
47      private String _strLogin;
48      private String _strLastName;
49      private String _strFirstName;
50      private String _strEmail;
51      private String _strAuthenticationType;
52  
53      /**
54       * Returns the UserId
55       *
56       * @return The UserId
57       */
58      public int getUserId(  )
59      {
60          return _nUserId;
61      }
62  
63      /**
64       * Sets the UserId
65       *
66       * @param nUserId The UserId
67       */
68      public void setUserId( int nUserId )
69      {
70          _nUserId = nUserId;
71      }
72  
73      /**
74       * Returns the Email
75       *
76       * @return The Email
77       */
78      public String getEmail(  )
79      {
80          return _strEmail;
81      }
82  
83      /**
84       * Sets the Email
85       *
86       * @param strEmail The email
87       */
88      public void setEmail( String strEmail )
89      {
90          _strEmail = strEmail;
91      }
92  
93      /**
94       * Returns user first name
95       *
96       * @return The first name
97       */
98      public String getFirstName(  )
99      {
100         return _strFirstName;
101     }
102 
103     /**
104      * Sets the first name
105      *
106      * @param strFirstName The first name
107      */
108     public void setFirstName( String strFirstName )
109     {
110         _strFirstName = strFirstName;
111     }
112 
113     /**
114      * Returns the last name
115      *
116      * @return The last name
117      */
118     public String getLastName(  )
119     {
120         return _strLastName;
121     }
122 
123     /**
124      * Sets the last name
125      *
126      * @param strLastName The last name
127      */
128     public void setLastName( String strLastName )
129     {
130         _strLastName = strLastName;
131     }
132 
133     /**
134      * Returns the login
135      *
136      * @return The login
137      */
138     public String getLogin(  )
139     {
140         return _strLogin;
141     }
142 
143     /**
144      * Sets the login
145      *
146      * @param strLogin The login
147      */
148     public void setLogin( String strLogin )
149     {
150         _strLogin = strLogin;
151     }
152 
153     /**
154      * Returns the authentication type
155      *
156      */
157     public String getAuthenticationType(  )
158     {
159         return _strAuthenticationType;
160     }
161 
162     /**
163      * Sets the authentication type
164      *
165      * @param strAuthenticationType The login
166      */
167     public void setAuthentificationType( String strAuthenticationType )
168     {
169         _strAuthenticationType = strAuthenticationType;
170     }
171 
172     /**
173      * Verifies if user details are valid
174      *
175      * @param strAuthenticationType The login
176      */
177     public boolean isValid(  )
178     {
179         return ( _strFirstName != null ) && !( _strFirstName.equals( "" ) ) && ( _strLastName != null ) &&
180         !( _strLastName.equals( "" ) ) && ( _strLogin != null ) && !( _strLogin.equals( "" ) ) &&
181         ( _strAuthenticationType != null ) && !( _strAuthenticationType.equals( "" ) ) && ( _strEmail != null ) &&
182         !( _strEmail.equals( "" ) ) && StringUtil.checkEmail( _strEmail );
183     }
184 }