View Javadoc
1 package org.argosfields.persistence; 2 3 import java.util.Collection; 4 import java.util.Date; 5 6 import net.sf.hibernate.CallbackException; 7 import net.sf.hibernate.Session; 8 9 import org.apache.commons.lang.builder.EqualsBuilder; 10 import org.apache.commons.lang.builder.HashCodeBuilder; 11 import org.apache.commons.lang.builder.ToStringBuilder; 12 13 /*** 14 * Account.java 15 * 16 * @author Xavier Cho 17 * @version $Revision: 1.1 $ $Date: 2004/04/15 05:43:55 $ 18 * 19 * @hibernate.class table = "AF_ACCOUNT" 20 */ 21 public class Account extends PersistentEntity { 22 public static final int MIN_USERNAME_LENGTH = 4; 23 public static final int MAX_USERNAME_LENGTH = 12; 24 public static final int MIN_PASSWORD_LENGTH = 4; 25 public static final int MAX_PASSWORD_LENGTH = 12; 26 public static final int MAX_REALNAME_LENGTH = 20; 27 28 private String userName; 29 private String password; 30 private String realName; 31 private String email; 32 private boolean admin = false; 33 private Date registeredDate; 34 private Collection gameLogs; 35 36 /*** 37 * @return Returns the password. 38 * @hibernate.property 39 * column = "password" 40 * length = "20" 41 * not-null = "true" 42 */ 43 public String getPassword() { 44 return password; 45 } 46 47 /*** 48 * @param password The password to set. 49 */ 50 public void setPassword(final String password) { 51 this.password = password; 52 } 53 54 /*** 55 * @return Returns the realName. 56 * @hibernate.property 57 * column = "real_name" 58 * length = "20" 59 * not-null = "true" 60 */ 61 public String getRealName() { 62 return realName; 63 } 64 65 /*** 66 * @param realName The realName to set. 67 */ 68 public void setRealName(final String realName) { 69 this.realName = realName; 70 } 71 72 /*** 73 * @return Returns the userName. 74 * @hibernate.id 75 * column = "user_name" 76 * length = "20" 77 * generator-class = "assigned" 78 */ 79 public String getUserName() { 80 return userName; 81 } 82 83 /*** 84 * @param userName The userName to set. 85 */ 86 public void setUserName(final String userName) { 87 this.userName = userName; 88 } 89 90 /*** 91 * @return Returns the admin. 92 * @hibernate.property 93 * column = "is_admin" 94 * not-null = "false" 95 */ 96 public boolean isAdmin() { 97 return admin; 98 } 99 100 /*** 101 * @param admin The admin to set. 102 */ 103 public void setAdmin(final boolean admin) { 104 this.admin = admin; 105 } 106 107 /*** 108 * @return Returns the registeredDate. 109 * @hibernate.property 110 * column = "reg_date" 111 * not-null = "true" 112 */ 113 public Date getRegisteredDate() { 114 return registeredDate; 115 } 116 117 /*** 118 * @param date The date to set. 119 */ 120 public void setRegisteredDate(final Date date) { 121 registeredDate = date; 122 } 123 124 /*** 125 * @return 126 * @hibernate.property 127 * column = "email" 128 * length = "40" 129 * not-null = "false" 130 */ 131 public String getEmail() { 132 return email; 133 } 134 135 /*** 136 * @param string 137 */ 138 public void setEmail(final String string) { 139 email = string; 140 } 141 142 /*** 143 * @return 144 * @hibernate.collection-one-to-many 145 * class = "org.argosfields.persistence.GameLog" 146 * @hibernate.collection-key 147 * column = "user_name" 148 * @hibernate.set 149 * cascade = "all" 150 * order-by = "game_id desc" 151 * lazy = "true" 152 */ 153 public Collection getGameLogs() { 154 return gameLogs; 155 } 156 157 /*** 158 * @param collection 159 */ 160 public void setGameLogs(final Collection collection) { 161 gameLogs = collection; 162 } 163 164 /*** 165 * @see net.sf.hibernate.Lifecycle#onSave(net.sf.hibernate.Session) 166 */ 167 public boolean onSave(final Session session) throws CallbackException { 168 this.registeredDate = new Date(System.currentTimeMillis()); 169 170 return super.onSave(session); 171 } 172 173 /*** 174 * @see java.lang.Object#equals(java.lang.Object) 175 */ 176 public boolean equals(final Object obj) { 177 if (obj instanceof Account) { 178 Account account = (Account) obj; 179 EqualsBuilder builder = new EqualsBuilder(); 180 builder.append(userName, account.userName); 181 182 return builder.isEquals(); 183 } 184 185 return false; 186 } 187 188 /*** 189 * @see java.lang.Object#hashCode() 190 */ 191 public int hashCode() { 192 HashCodeBuilder builder = new HashCodeBuilder(); 193 builder.append(userName); 194 195 return builder.hashCode(); 196 } 197 198 /*** 199 * @see java.lang.Object#toString() 200 */ 201 public String toString() { 202 ToStringBuilder builder = new ToStringBuilder(this); 203 builder.append("userName", userName); 204 builder.append("realName", realName); 205 builder.append("email", email); 206 207 return builder.toString(); 208 } 209 }

This page was automatically generated by Maven