Removed all DTO where possible
[pithos] / src / gr / ebs / gss / server / domain / dto / UserDTO.java
1 /*
2  * Copyright 2007, 2008, 2009, 2010 Electronic Business Systems Ltd.
3  *
4  * This file is part of GSS.
5  *
6  * GSS is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GSS is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with GSS.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 package gr.ebs.gss.server.domain.dto;
20
21 import java.io.Serializable;
22 import java.util.Date;
23
24 /**
25  * @author chstath
26  */
27 public class UserDTO implements Serializable {
28         /**
29          * The serial version UID.
30          */
31         private static final long serialVersionUID = 1L;
32
33         /**
34          * The persistence ID of the object.
35          */
36         private Long id;
37
38         /**
39          * The first name of the user.
40          */
41         private String firstname;
42
43         /**
44          * The last name of the user.
45          */
46         private String lastname;
47
48         /**
49          * The full name of the user.
50          */
51         private String name;
52
53         /**
54          * The username of the user.
55          */
56         private String username;
57
58         /**
59          * The e-mail address of the user.
60          */
61         private String email;
62
63         private Boolean active;
64
65         private Date lastLoginDate;
66         
67         private Date currentLoginDate;
68
69         /**
70          * The user class to which this user belongs.
71          */
72         private UserClassDTO userClass;
73
74         /**
75          * @return the id
76          */
77         public Long getId() {
78                 return id;
79         }
80
81         /**
82          * @param newId the id to set
83          */
84         public void setId(final Long newId) {
85                 id = newId;
86         }
87
88         /**
89          * @return the firstname
90          */
91         public String getFirstname() {
92                 return firstname;
93         }
94
95         /**
96          * @param newFirstname the firstname to set
97          */
98         public void setFirstname(final String newFirstname) {
99                 firstname = newFirstname;
100         }
101
102         /**
103          * @return the lastname
104          */
105         public String getLastname() {
106                 return lastname;
107         }
108
109         /**
110          * @param newLastname the lastname to set
111          */
112         public void setLastname(final String newLastname) {
113                 lastname = newLastname;
114         }
115
116         /**
117          * @return the name
118          */
119         public String getName() {
120                 return name;
121         }
122
123         /**
124          * @param newName the name to set
125          */
126         public void setName(final String newName) {
127                 name = newName;
128         }
129
130         /**
131          * @return the email
132          */
133         public String getEmail() {
134                 return email;
135         }
136
137         /**
138          * @param newEmail the email to set
139          */
140         public void setEmail(final String newEmail) {
141                 email = newEmail;
142         }
143
144         /**
145          * Retrieve the username.
146          *
147          * @return the username
148          */
149         public String getUsername() {
150                 return username;
151         }
152
153         /**
154          * Modify the username.
155          *
156          * @param newUsername the username to set
157          */
158         public void setUsername(String newUsername) {
159                 username = newUsername;
160         }
161
162         public UserClassDTO getUserClass() {
163                 return userClass;
164         }
165
166         public void setUserClass(UserClassDTO aUserClass) {
167                 userClass = aUserClass;
168         }
169
170         public Boolean isActive() {
171                 return active;
172         }
173
174         public void setActive(Boolean isActive) {
175                 active = isActive;
176         }
177
178         /**
179          * Retrieve the lastLoginDate.
180          *
181          * @return the lastLoginDate
182          */
183         public Date getLastLoginDate() {
184                 return lastLoginDate;
185         }
186
187         /**
188          * Modify the lastLoginDate.
189          *
190          * @param aLlastLoginDate the lastLoginDate to set
191          */
192         public void setLastLoginDate(Date aLlastLoginDate) {
193                 lastLoginDate = aLlastLoginDate;
194         }
195
196
197         public UserDTO cloneUser(){
198                 final UserDTO u = new UserDTO();
199                 u.setId(id);
200                 u.setName(name);
201                 u.setLastname(lastname);
202                 u.setFirstname(firstname);
203                 u.setEmail(email);
204                 u.setUsername(username);
205                 u.setActive(isActive());
206                 if(userClass!= null)
207                         u.setUserClass(userClass);
208                 u.setLastLoginDate(lastLoginDate);
209                 return u;
210         }
211
212         /**
213          * Modify the currentLoginDate.
214          *
215          * @param _currentLoginDate the currentLoginDate to set
216          */
217         public void setCurrentLoginDate(Date _currentLoginDate) {
218                 this.currentLoginDate = _currentLoginDate;
219         }
220
221         /**
222          * Retrieve the currentLoginDate.
223          *
224          * @return the currentLoginDate
225          */
226         public Date getCurrentLoginDate() {
227                 return currentLoginDate;
228         }
229 }