1 package com.panogenesis.model;
2
3 import java.util.Date;
4
5 import org.apache.commons.lang.builder.EqualsBuilder;
6 import org.apache.commons.lang.builder.HashCodeBuilder;
7
8 import org.apache.commons.lang.builder.ToStringBuilder;
9 import org.apache.commons.lang.builder.ToStringStyle;
10 /***
11 * This class is used to manage cookie-based authentication.
12 *
13 * <p>
14 * <a href="UserCookie.java.html"><i>View Source</i></a>
15 * </p>
16 *
17 * @author <a href="mailto:matt@raibledesigns.com">Matt Raible</a>
18 *
19 * @hibernate.class table="user_cookie"
20 *
21 */
22 public class UserCookie extends BaseObject {
23 private Long id;
24 private String username;
25 private String cookieId;
26 private Date dateCreated;
27
28 public UserCookie() {
29 this.dateCreated = new Date();
30 }
31
32 /***
33 * Returns the id.
34 * @return String
35 *
36 * @hibernate.id column="id"
37 * generator-class="increment" unsaved-value="null"
38 */
39 public Long getId() {
40 return id;
41 }
42
43 /***
44 * Sets the id.
45 * @param id The id to set
46 */
47 public void setId(Long id) {
48 this.id = id;
49 }
50
51 /***
52 * Returns the username.
53 * @return String
54 *
55 * @hibernate.property
56 * @hibernate.property
57 * @hibernate.column name="username" not-null="true"
58 * length="30" index="user_cookie_username_cookie_id"
59 */
60 public String getUsername() {
61 return username;
62 }
63
64 /***
65 * Sets the username.
66 * @param username The username to set
67 */
68 public void setUsername(String username) {
69 this.username = username;
70 }
71
72 /***
73 * Returns the cookieId (a GUID).
74 * @return String
75 *
76 * @hibernate.property
77 * @hibernate.column name="cookie_id" not-null="true"
78 * length="100" index="user_cookie_username_cookie_id"
79 */
80 public String getCookieId() {
81 return cookieId;
82 }
83
84 /***
85 * Sets the cookieId.
86 * @param rolename The cookieId to set
87 */
88 public void setCookieId(String rolename) {
89 this.cookieId = rolename;
90 }
91
92 /***
93 * @return Returns the dateCreated.
94 * @hibernate.property column="date_created" not-null="true"
95 */
96 public Date getDateCreated() {
97 return dateCreated;
98 }
99
100 /***
101 * @param dateCreated The dateCreated to set.
102 */
103 public void setDateCreated(Date dateCreated) {
104 this.dateCreated = dateCreated;
105 }
106
107 /***
108 * Generated using Commonclipse (http://commonclipse.sf.net)
109 */
110 public boolean equals(Object object) {
111 if (!(object instanceof UserCookie)) {
112 return false;
113 }
114
115 UserCookie rhs = (UserCookie) object;
116
117 return new EqualsBuilder().append(this.username, rhs.username)
118 .append(this.dateCreated, rhs.dateCreated)
119 .append(this.id, rhs.id)
120 .append(this.cookieId, rhs.cookieId).isEquals();
121 }
122
123 /***
124 * Generated using Commonclipse (http://commonclipse.sf.net)
125 */
126 public int hashCode() {
127 return new HashCodeBuilder(1954972321, -113979947).append(this.username)
128 .append(this.dateCreated)
129 .append(this.id)
130 .append(this.cookieId)
131 .toHashCode();
132 }
133
134 /***
135 * Generated using Commonclipse (http://commonclipse.sf.net)
136 */
137 public String toString() {
138 return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
139 .append("id", this.id).append("username", this.username)
140 .append("cookieId", this.cookieId).append("dateCreated",
141 this.dateCreated).toString();
142 }
143 }