1 package org.roller.pojos; 2 3 import java.io.Serializable ; 4 import java.util.Date ; 5 6 7 8 16 public class UserCookieData extends PersistentObject implements Serializable 17 { 18 static final long serialVersionUID = -1109195226932397420L; 19 20 private String id; 21 private String username; 22 private String cookieId; 23 private Date dateCreated; 24 25 public UserCookieData() 26 { 27 this.dateCreated = new Date (); 28 } 29 30 public UserCookieData( String id, String username, String cookieId, 31 Date dateCreated ) 32 { 33 this.id = id; 34 this.username = username; 35 this.cookieId = cookieId; 36 this.dateCreated = (Date )dateCreated.clone(); 37 } 38 39 public UserCookieData( UserCookieData otherData ) 40 { 41 this.id = otherData.id; 42 this.username = otherData.username; 43 this.cookieId = otherData.cookieId; 44 this.dateCreated = (Date )otherData.dateCreated.clone(); 45 } 46 47 48 53 public java.lang.String getId() 54 { 55 return this.id; 56 } 57 58 public void setId( java.lang.String id ) 59 { 60 this.id = id; 61 } 62 63 69 public String getUsername() 70 { 71 return username; 72 } 73 74 79 public void setUsername( String username ) 80 { 81 this.username = username; 82 } 83 84 90 public String getCookieId() 91 { 92 return cookieId; 93 } 94 95 100 public void setCookieId( String rolename ) 101 { 102 this.cookieId = rolename; 103 } 104 105 110 public Date getDateCreated() 111 { 112 return (Date )dateCreated.clone(); 113 } 114 115 119 public void setDateCreated(final Date dateCreated ) 120 { 121 if (dateCreated != null) 122 { 123 this.dateCreated = (Date )dateCreated.clone(); 124 } 125 else 126 { 127 this.dateCreated = null; 128 } 129 } 130 131 134 public void setData(PersistentObject vo) { 135 UserCookieData newData = (UserCookieData) vo; 136 this.id = newData.getId(); 137 this.username = newData.getUsername(); 138 this.cookieId = newData.getCookieId(); 139 this.dateCreated = newData.getDateCreated(); 140 } 141 142 145 public boolean equals(Object o) 146 { 147 if (this == o) 150 { 151 return true; 152 } 153 if (!(o instanceof UserCookieData)) 154 { 155 return false; 156 } 157 final UserCookieData userCookieData = (UserCookieData)o; 158 159 if (cookieId != null ? !cookieId.equals(userCookieData.cookieId) : userCookieData.cookieId != null) 160 { 161 return false; 162 } 163 if (dateCreated != null ? !dateCreated.equals(userCookieData.dateCreated) : userCookieData.dateCreated != null) 164 { 165 return false; 166 } 167 if (id != null ? !id.equals(userCookieData.id) : userCookieData.id != null) 168 { 169 return false; 170 } 171 if (username != null ? !username.equals(userCookieData.username) : userCookieData.username != null) 172 { 173 return false; 174 } 175 176 return true; 177 } 178 179 182 public int hashCode() 183 { 184 int result = 0; 187 result = 29 * result + (id != null ? id.hashCode() : 0); 188 result = 29 * result + (dateCreated != null ? dateCreated.hashCode() : 0); 189 return result; 190 } 191 192 } 193 | Popular Tags |