You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
2.5 KiB
102 lines
2.5 KiB
package org.ros.chatto.model;
|
|
|
|
import java.util.Date;
|
|
import java.util.HashSet;
|
|
import java.util.Set;
|
|
|
|
import javax.persistence.CascadeType;
|
|
import javax.persistence.Column;
|
|
import javax.persistence.Entity;
|
|
import javax.persistence.EntityListeners;
|
|
import javax.persistence.GeneratedValue;
|
|
import javax.persistence.GenerationType;
|
|
import javax.persistence.Id;
|
|
import javax.persistence.JoinTable;
|
|
import javax.persistence.ManyToMany;
|
|
import javax.persistence.OneToMany;
|
|
import javax.persistence.SequenceGenerator;
|
|
import javax.persistence.Table;
|
|
import javax.persistence.Temporal;
|
|
import javax.persistence.TemporalType;
|
|
import javax.persistence.JoinColumn;
|
|
|
|
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonBackReference;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
|
|
@Entity
|
|
@Table(name = "users")
|
|
@EntityListeners(AuditingEntityListener.class)
|
|
@JsonIgnoreProperties(value = { "password"}, allowGetters = false)
|
|
|
|
public class ChatUser {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
|
// @SequenceGenerator(name="user_generator", sequenceName = "user_seq", allocationSize=50)
|
|
@Column(name = "user_id")
|
|
private int userID;
|
|
@Column(name = "name")
|
|
private String userName;
|
|
String password;
|
|
@Temporal(TemporalType.TIMESTAMP)
|
|
private Date joinDate;
|
|
// @ManyToMany(cascade = CascadeType.ALL)
|
|
// @JoinTable(name = "users_roles", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
|
|
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL)
|
|
@JsonBackReference
|
|
// private Set<UserRole> userRoles = new HashSet<UserRole>();
|
|
private Set<UserRole> userRoles;
|
|
|
|
public int getUserID() {
|
|
return userID;
|
|
}
|
|
|
|
public void setUserID(int userID) {
|
|
this.userID = userID;
|
|
}
|
|
|
|
public String getUserName() {
|
|
return userName;
|
|
}
|
|
|
|
public void setUserName(String userName) {
|
|
this.userName = userName;
|
|
}
|
|
|
|
public String getPassword() {
|
|
return password;
|
|
}
|
|
|
|
public void setPassword(String password) {
|
|
this.password = password;
|
|
}
|
|
|
|
public Date getJoinDate() {
|
|
return joinDate;
|
|
}
|
|
|
|
public void setJoinDate(Date joinDate) {
|
|
this.joinDate = joinDate;
|
|
}
|
|
|
|
public ChatUser(int userID, String userName, String password, Date joinDate) {
|
|
super();
|
|
this.userID = userID;
|
|
this.userName = userName;
|
|
this.password = password;
|
|
this.joinDate = joinDate;
|
|
}
|
|
|
|
public ChatUser() {
|
|
}
|
|
|
|
public Set<UserRole> getUserRoles() {
|
|
return userRoles;
|
|
}
|
|
|
|
public void setUserRoles(Set<UserRole> userRoles) {
|
|
this.userRoles = userRoles;
|
|
}
|
|
|
|
}
|