-
Notifications
You must be signed in to change notification settings - Fork 0
/
User.java
121 lines (98 loc) · 2.82 KB
/
User.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
package com.epitech.dashboard.model;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import javax.persistence.*;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotEmpty;
import java.util.Set;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "user_id")
private int id;
@Column(name = "user_name")
@Length(min = 5, message = "*Your user name must have at least 5 characters")
@NotEmpty(message = "*Please provide a user name")
private String userName;
@Column(name = "email")
@Email(message = "*Please provide a valid Email")
@NotEmpty(message = "*Please provide an email")
private String email;
@Column(name = "password")
@Length(min = 5, message = "*Your password must have at least 5 characters")
@NotEmpty(message = "*Please provide your password")
private String password;
@Column(name = "name")
@NotEmpty(message = "*Please provide your name")
private String name;
@Column(name = "last_name")
@NotEmpty(message = "*Please provide your last name")
private String lastName;
@Column(name = "active")
private Boolean active;
@Column(name = "dashboard")
private String dashboard;
@ManyToMany(cascade = CascadeType.MERGE)
@JoinTable(name = "user_role", joinColumns = @JoinColumn(name = "user_id"), inverseJoinColumns = @JoinColumn(name = "role_id"))
private Set<Role> roles;
public int getId() {
return id;
}
public Boolean getActive() {
return active;
}
public Set<Role> getRoles() {
return roles;
}
public String getUserName() {
return userName;
}
public String getPassword() {
return password;
}
public String getName() {
return name;
}
public String getLastName() {
return lastName;
}
public String getEmail() {
return email;
}
public String getDashboard(){
return dashboard;
}
public void setPassword(String password) {
this.password = password;
}
public void setEmail(String email) {
this.email = email;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public void setName(String name) {
this.name = name;
}
public void setUserName(String userName) {
this.userName = userName;
}
public void setDashboard(String dashboard){
this.dashboard = dashboard;
}
public void setActive(Boolean active) {
this.active = active;
}
public void setRoles(Set<Role> roles) {
this.roles = roles;
}
}