Fix user comparator.

This commit is contained in:
Paulo Gustavo Veiga 2012-11-14 20:00:46 -03:00
parent b1172f16cc
commit 2861a7b5f9
3 changed files with 21 additions and 25 deletions

View File

@ -76,4 +76,24 @@ public class Collaborator implements Serializable {
public void setCreationDate(Calendar creationDate) { public void setCreationDate(Calendar creationDate) {
this.creationDate = creationDate; this.creationDate = creationDate;
} }
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Collaborator that = (Collaborator) o;
if (id != that.id) return false;
if (email != null ? !email.equals(that.email) : that.email != null) return false;
return true;
}
@Override
public int hashCode() {
int result = (int) (id ^ (id >>> 32));
result = 31 * result + (email != null ? email.hashCode() : 0);
return result;
}
} }

View File

@ -106,30 +106,6 @@ public class User
this.allowSendEmail = allowSendEmail; this.allowSendEmail = allowSendEmail;
} }
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || !User.class.getClass().isInstance(o))
return false;
final User user = (User) o;
final String email = getEmail();
if (email != null ? !email.equals(user.getEmail()) : user.getEmail() != null) return false;
if (firstname != null ? !firstname.equals(user.firstname) : user.firstname != null) return false;
return !(lastname != null ? !lastname.equals(user.lastname) : user.lastname != null);
}
public int hashCode() {
int result;
result = (firstname != null ? firstname.hashCode() : 0);
result = 29 * result + (lastname != null ? lastname.hashCode() : 0);
result = 29 * result + (password != null ? password.hashCode() : 0);
result = 29 * result + (getEmail() != null ? getEmail().hashCode() : 0);
return result;
}
@Nullable @Nullable
public String getLocale() { public String getLocale() {
return locale; return locale;

View File

@ -130,7 +130,7 @@ class LockManagerImpl implements LockManager {
// Update timeout only... // Update timeout only...
logger.debug("Update timestamp:" + mindmap.getId()); logger.debug("Update timestamp:" + mindmap.getId());
updateExpirationTimeout(mindmap, user); updateExpirationTimeout(mindmap, user);
result.setSession(session); // result.setSession(session);
} else { } else {
logger.debug("Lock map id:" + mindmap.getId()); logger.debug("Lock map id:" + mindmap.getId());
result = new LockInfo(user, mindmap, session); result = new LockInfo(user, mindmap, session);