View Javadoc

1   package org.gnomekr.potron.data;
2   
3   import java.io.Serializable;
4   import java.util.Date;
5   
6   import org.apache.commons.lang.builder.HashCodeBuilder;
7   import org.apache.commons.lang.builder.ToStringBuilder;
8   
9   /***
10   * User.java
11   * @author Xavier Cho
12   * @version $Revision 1.1 $ $Date: 2005/07/21 10:04:43 $
13   * @hibernate.class table = "POTRON_USER"
14   * @hibernate.cache usage = "nonstrict-read-write"
15   */
16  public class User implements Serializable {
17  
18      private static final long serialVersionUID = 8469024607727491849L;
19  
20      private String userName;
21      private String realName;
22      private String password;
23      private Date registeredDate;
24      private String email;
25      private boolean active = true;
26      private boolean admin = false;
27      private String homepage;
28      private String comment;
29  
30      public User() {
31      }
32  
33      /***
34       * @param userName
35       */
36      public User(String userName) {
37          this.userName = userName;
38      }
39  
40      /***
41       * @return
42       * @hibernate.id
43       *          column = "user_name"
44       *          length = "20"
45       *          unsaved-value = "null"
46       *          generator-class = "assigned"
47       */
48      public String getUserName() {
49          return userName;
50      }
51  
52      /***
53       * @return
54       * @hibernate.property
55       *          column = "email"
56       *          length = "80"
57       *          update = "true"
58       *          not-null = "true"
59       */
60      public String getEmail() {
61          return email;
62      }
63  
64      /***
65       * @return Returns the active.
66       * @hibernate.property
67       *          column = "active"
68       *          update = "true"
69       *          not-null = "true"
70       */
71      public boolean isActive() {
72          return active;
73      }
74  
75      /***
76       * @return Returns the admin.
77       * @hibernate.property
78       *          column = "admin"
79       *          update = "true"
80       *          not-null = "true"
81       */
82      public boolean isAdmin() {
83          return admin;
84      }
85  
86      /***
87       * @return
88       * @hibernate.property
89       *          column = "note"
90       *          length = "800"
91       *          update = "true"
92       *          not-null = "false"
93       */
94      public String getComment() {
95          return comment;
96      }
97  
98      /***
99       * @return
100      * @hibernate.property
101      *          column = "password"
102      *          length = "60"
103      *          update = "true"
104      *          not-null = "true"
105      */
106     public String getPassword() {
107         return password;
108     }
109 
110     /***
111      * @return
112      * @hibernate.property
113      *          column = "homepage"
114      *          length = "100"
115      *          update = "true"
116      *          not-null = "false"
117      */
118     public String getHomepage() {
119         return homepage;
120     }
121 
122     /***
123      * @return
124      * @hibernate.property
125      *          column = "real_name"
126      *          length = "50"
127      *          update = "true"
128      *          not-null = "true"
129      */
130     public String getRealName() {
131         return realName;
132     }
133 
134     /***
135      * @return
136      * @hibernate.property
137      *          column = "reg_date"
138      *          update = "false"
139      *          not-null = "true"
140      */
141     public Date getRegisteredDate() {
142         return registeredDate;
143     }
144 
145     /***
146      * @param comment
147      */
148     public void setComment(String comment) {
149         this.comment = comment;
150     }
151 
152     /***
153      * @param email
154      */
155     public void setEmail(String email) {
156         this.email = email;
157     }
158 
159     /***
160      * @param homepage
161      */
162     public void setHomepage(String homepage) {
163         this.homepage = homepage;
164     }
165 
166     /***
167      * @param password
168      */
169     public void setPassword(String password) {
170         this.password = password;
171     }
172 
173     /***
174      * @param realName
175      */
176     public void setRealName(String realName) {
177         this.realName = realName;
178     }
179 
180     /***
181      * @param registeredDate
182      */
183     public void setRegisteredDate(Date registeredDate) {
184         this.registeredDate = registeredDate;
185     }
186 
187     /***
188      * @param userName
189      */
190     public void setUserName(String userName) {
191         this.userName = userName;
192     }
193 
194     /***
195      * @param active The active to set.
196      */
197     public void setActive(boolean active) {
198         this.active = active;
199     }
200 
201     /***
202      * @param admin The admin to set.
203      */
204     public void setAdmin(boolean admin) {
205         this.admin = admin;
206     }
207 
208     /***
209      * @see java.lang.Object#equals(java.lang.Object)
210      */
211     public boolean equals(final Object object) {
212         if (object instanceof User) {
213             String value = ((User) object).getUserName();
214             return userName.equals(value);
215         }
216 
217         return false;
218     }
219 
220     /***
221      * @see java.lang.Object#toString()
222      */
223     public String toString() {
224         ToStringBuilder builder = new ToStringBuilder(this);
225         builder.append("userName", userName);
226         builder.append("realName", realName);
227         builder.append("email", email);
228         builder.append("homepage", homepage);
229 
230         return builder.toString();
231     }
232 
233     /***
234      * @see java.lang.Object#hashCode()
235      */
236     public int hashCode() {
237         HashCodeBuilder builder = new HashCodeBuilder();
238         builder.append(userName);
239 
240         return builder.toHashCode();
241     }
242 }