user.java
来自「anewssystem新闻发布系统集成使用了spring hibernate f」· Java 代码 · 共 303 行
JAVA
303 行
package anni.asecurity.domain;
import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Transient;
import anni.core.grid.LongGridBean;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
/**
* User generated by Lingo.
*
* @author Lingo
* @since 2007年08月18日 下午 20时18分45秒0
*/
@Entity
@Table(name = "A_SECURITY_USER")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class User extends LongGridBean {
// ----------------------------------------------------
// static fields
// ----------------------------------------------------
/** * serial. */
static final long serialVersionUID = 0L;
/** * 可用状态. */
public static final Byte STATUS_ENABLED = (byte) 1;
/** * 不可用状态. */
public static final Byte STATUS_DISABLED = (byte) 0;
/** * 状态枚举. */
public static final Map<Byte, String> STATUS_ENUM = new LinkedHashMap<Byte, String>();
static {
STATUS_ENUM.put(STATUS_ENABLED, "有效");
STATUS_ENUM.put(STATUS_DISABLED, "无效");
}
/** * id. */
private Long id;
/** * dept. */
private Dept dept;
/** * username. */
private String username;
/** * password. */
private String password;
/** * status. */
private Byte status;
/** * code. */
private String code;
/** * truename. */
private String truename;
/** * sex. */
private Byte sex;
/** * birthday. */
private Date birthday = null;
/** * tel. */
private String tel;
/** * mobile. */
private String mobile;
/** * email. */
private String email;
/** * duty. */
private String duty;
/** * descn. */
private String descn;
/** * roles. */
private Set<Role> roles = new HashSet<Role>(0);
/** * 构造方法. */
public User() {
}
/** * @return id. */
@GenericGenerator(name = "generator", strategy = "increment")
@Id
@GeneratedValue(generator = "generator")
@Column(name = "ID", unique = true, nullable = false)
public Long getId() {
return id;
}
/** * @param id id. */
public void setId(Long id) {
this.id = id;
}
/** * @return dept. */
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "DEPT_ID")
public Dept getDept() {
return dept;
}
/** * @param dept dept. */
public void setDept(Dept dept) {
this.dept = dept;
}
/** * @return username. */
@Column(name = "USERNAME", length = 50)
public String getUsername() {
return username;
}
/** * @param username username. */
public void setUsername(String username) {
this.username = username;
}
/** * @return password. */
@Column(name = "PASSWORD", length = 50)
public String getPassword() {
return password;
}
/** * @param password password. */
public void setPassword(String password) {
this.password = password;
}
/** * @return status. */
@Column(name = "STATUS")
public Byte getStatus() {
return status;
}
/** * @param status status. */
public void setStatus(Byte status) {
this.status = status;
}
/** * @return code. */
@Column(name = "CODE", length = 50)
public String getCode() {
return code;
}
/** * @param code code. */
public void setCode(String code) {
this.code = code;
}
/** * @return truename. */
@Column(name = "TRUENAME", length = 50)
public String getTruename() {
return truename;
}
/** * @param truename truename. */
public void setTruename(String truename) {
this.truename = truename;
}
/** * @return sex. */
@Column(name = "SEX")
public Byte getSex() {
return sex;
}
/** * @param sex sex. */
public void setSex(Byte sex) {
this.sex = sex;
}
/** * @return birthday. */
@Column(name = "BIRTHDAY")
public Date getBirthday() {
if (birthday == null) {
return null;
} else {
return (Date) birthday.clone();
}
}
/** * @param birthday birthday. */
public void setBirthday(Date birthday) {
if (birthday != null) {
this.birthday = (Date) birthday.clone();
} else {
this.birthday = null;
}
}
/** * @return tel. */
@Column(name = "TEL", length = 50)
public String getTel() {
return tel;
}
/** * @param tel tel. */
public void setTel(String tel) {
this.tel = tel;
}
/** * @return mobile. */
@Column(name = "MOBILE", length = 50)
public String getMobile() {
return mobile;
}
/** * @param mobile mobile. */
public void setMobile(String mobile) {
this.mobile = mobile;
}
/** * @return email. */
@Column(name = "EMAIL", length = 100)
public String getEmail() {
return email;
}
/** * @param email email. */
public void setEmail(String email) {
this.email = email;
}
/** * @return duty. */
@Column(name = "DUTY", length = 50)
public String getDuty() {
return duty;
}
/** * @param duty duty. */
public void setDuty(String duty) {
this.duty = duty;
}
/** * @return descn. */
@Column(name = "DESCN", length = 200)
public String getDescn() {
return descn;
}
/** * @param descn descn. */
public void setDescn(String descn) {
this.descn = descn;
}
/** * @return roles. */
@ManyToMany(cascade = {
CascadeType.PERSIST, CascadeType.MERGE}
, fetch = FetchType.LAZY)
@JoinTable(name = "A_SECURITY_ROLE_USER", joinColumns = {
@JoinColumn(name = "USER_ID")
}
, inverseJoinColumns = {
@JoinColumn(name = "ROLE_ID")
}
)
public Set<Role> getRoles() {
return roles;
}
/** * @param roles roles. */
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
// ----------------------------------------------------
// transient methods
// ----------------------------------------------------
/** * @return 当前用户是否可用. */
@Transient
public boolean isEnabled() {
return ((status != null) && !status.equals(STATUS_DISABLED));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?