wisemapping-open-source/wise-webapp/src/main/java/com/wisemapping/model/User.java

140 lines
3.7 KiB
Java
Raw Normal View History

/*
* Copyright [2011] [wisemapping]
*
* Licensed under WiseMapping Public License, Version 1.0 (the "License").
* It is basically the Apache License, Version 2.0 (the "License") plus the
* "powered by wisemapping" text requirement on every single page;
* you may not use this file except in compliance with the License.
* You may obtain a copy of the license at
*
* http://www.wisemapping.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wisemapping.model;
2012-07-13 04:56:04 +02:00
import org.jetbrains.annotations.Nullable;
2012-06-30 07:26:21 +02:00
2012-09-30 22:15:01 +02:00
import javax.servlet.http.HttpSessionBindingEvent;
import javax.servlet.http.HttpSessionBindingListener;
import java.io.Serializable;
import java.util.*;
public class User
extends Collaborator
implements Serializable {
private String firstname;
private String lastname;
private String password;
private long activationCode;
private Calendar activationDate;
private Set<String> tags = new HashSet<String>();
private boolean allowSendEmail = false;
2012-06-30 07:26:21 +02:00
private String locale;
public User() {
}
public void setTags(Set<String> tags) {
this.tags = tags;
}
public Set<String> getTags() {
return tags;
}
2012-06-14 04:04:29 +02:00
public String getFullName() {
return this.getFirstname() + " " + this.getLastname();
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public boolean isActive() {
return activationDate != null;
}
public void setActivationCode(long code) {
this.activationCode = code;
}
public long getActivationCode() {
return activationCode;
}
public void setActivationDate(Calendar date) {
this.activationDate = date;
}
public Calendar getActivationDate() {
return activationDate;
}
public boolean isAllowSendEmail() {
return allowSendEmail;
}
public void setAllowSendEmail(boolean allowSendEmail) {
this.allowSendEmail = allowSendEmail;
}
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) 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;
2012-07-15 05:57:44 +02:00
return !(lastname != null ? !lastname.equals(user.lastname) : user.lastname != null);
}
2012-06-30 07:26:21 +02:00
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;
}
2012-07-13 04:56:04 +02:00
@Nullable
2012-06-30 07:26:21 +02:00
public String getLocale() {
return locale;
}
2012-07-13 04:56:04 +02:00
public void setLocale(@Nullable String locale) {
2012-06-30 07:26:21 +02:00
this.locale = locale;
}
}