Revision 01a30cd0 src/gr/ebs/gss/server/domain/Invitation.java
b/src/gr/ebs/gss/server/domain/Invitation.java | ||
---|---|---|
24 | 24 |
import javax.persistence.Entity; |
25 | 25 |
import javax.persistence.GeneratedValue; |
26 | 26 |
import javax.persistence.Id; |
27 |
import javax.persistence.JoinColumn; |
|
28 |
import javax.persistence.ManyToOne; |
|
27 | 29 |
import javax.persistence.Version; |
28 | 30 |
|
29 | 31 |
import org.hibernate.annotations.Cache; |
... | ... | |
78 | 80 |
private String email; |
79 | 81 |
|
80 | 82 |
/** |
83 |
* The user that used this invitation. |
|
84 |
*/ |
|
85 |
@ManyToOne |
|
86 |
@JoinColumn |
|
87 |
private User user; |
|
88 |
|
|
89 |
/** |
|
81 | 90 |
* Retrieve the firstname. |
82 | 91 |
* |
83 | 92 |
* @return the firstname |
... | ... | |
119 | 128 |
* @return the name |
120 | 129 |
*/ |
121 | 130 |
public String getName() { |
122 |
return name; |
|
131 |
return name != null ? name : firstname + " " + lastname;
|
|
123 | 132 |
} |
124 | 133 |
|
125 | 134 |
/** |
... | ... | |
177 | 186 |
return id; |
178 | 187 |
} |
179 | 188 |
|
189 |
|
|
190 |
/** |
|
191 |
* Retrieve the user. |
|
192 |
* |
|
193 |
* @return the user |
|
194 |
*/ |
|
195 |
public User getUser() { |
|
196 |
return user; |
|
197 |
} |
|
198 |
|
|
199 |
|
|
200 |
/** |
|
201 |
* Modify the user. |
|
202 |
* |
|
203 |
* @param aUser the user to set |
|
204 |
*/ |
|
205 |
public void setUser(User aUser) { |
|
206 |
user = aUser; |
|
207 |
} |
|
208 |
|
|
180 | 209 |
@Override |
181 | 210 |
public boolean equals(Object o) { |
182 | 211 |
if (this == o) return true; |
183 | 212 |
if (!(o instanceof Invitation)) return false; |
184 |
Invitation user = (Invitation) o;
|
|
185 |
return user.getCode().equals(code) && user.getName().equals(name);
|
|
213 |
Invitation invite = (Invitation) o;
|
|
214 |
return invite.getCode().equals(code) && invite.getName().equals(getName());
|
|
186 | 215 |
} |
187 | 216 |
|
188 | 217 |
@Override |
189 | 218 |
public int hashCode() { |
190 |
return 37 * code.hashCode() + name.hashCode();
|
|
219 |
return 37 * code.hashCode() + getName().hashCode();
|
|
191 | 220 |
} |
192 | 221 |
} |
Also available in: Unified diff