Files
Athou_commafeed/src/main/java/com/commafeed/backend/model/User.java

70 lines
1.7 KiB
Java
Raw Normal View History

2013-03-23 16:17:19 +01:00
package com.commafeed.backend.model;
2013-03-20 20:33:42 +01:00
2013-04-18 16:58:56 +02:00
import java.util.Date;
2013-03-28 17:07:37 +01:00
import java.util.Set;
import javax.persistence.Cacheable;
2013-03-28 17:07:37 +01:00
import javax.persistence.CascadeType;
2013-03-20 20:33:42 +01:00
import javax.persistence.Column;
import javax.persistence.Entity;
2013-06-16 18:03:52 +02:00
import javax.persistence.FetchType;
2013-03-28 17:07:37 +01:00
import javax.persistence.OneToMany;
2013-03-20 20:33:42 +01:00
import javax.persistence.Table;
2013-04-18 16:58:56 +02:00
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
2013-03-20 20:33:42 +01:00
2013-08-11 14:01:16 +02:00
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
2013-03-28 17:07:37 +01:00
import com.google.common.collect.Sets;
2013-03-20 20:33:42 +01:00
@Entity
@Table(name = "USERS")
2013-03-21 08:55:53 +01:00
@SuppressWarnings("serial")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.TRANSACTIONAL)
2013-08-11 14:01:16 +02:00
@Getter
@Setter
2013-03-23 01:49:39 +01:00
public class User extends AbstractModel {
2013-03-20 20:33:42 +01:00
2013-03-29 11:51:27 +01:00
@Column(length = 32, nullable = false, unique = true)
2013-03-20 20:33:42 +01:00
private String name;
2013-04-06 08:17:25 +02:00
@Column(length = 255, unique = true)
2013-04-05 16:31:42 +02:00
private String email;
2013-03-29 11:51:27 +01:00
@Column(length = 256, nullable = false)
2013-03-20 20:33:42 +01:00
private byte[] password;
@Column(length = 40, unique = true)
private String apiKey;
2013-03-29 11:51:27 +01:00
@Column(length = 8, nullable = false)
2013-03-20 20:33:42 +01:00
private byte[] salt;
2013-03-29 12:59:21 +01:00
@Column(nullable = false)
private boolean disabled;
2013-04-18 16:58:56 +02:00
@Temporal(TemporalType.TIMESTAMP)
private Date lastLogin;
2013-06-16 18:31:21 +02:00
@Temporal(TemporalType.TIMESTAMP)
private Date created;
2013-05-20 21:53:13 +02:00
@Column(length = 40)
private String recoverPasswordToken;
@Temporal(TemporalType.TIMESTAMP)
private Date recoverPasswordTokenDate;
2013-07-25 09:17:33 +02:00
@OneToMany(mappedBy = "user", cascade = { CascadeType.PERSIST, CascadeType.REMOVE })
2013-03-28 17:07:37 +01:00
private Set<UserRole> roles = Sets.newHashSet();
2013-06-16 18:31:21 +02:00
@OneToMany(mappedBy = "user", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
2013-06-16 18:03:52 +02:00
private Set<FeedSubscription> subscriptions;
2013-03-20 20:33:42 +01:00
}