1 package de.tivsource.page.entity.administration;
2
3 import java.security.Principal;
4 import java.util.Date;
5 import java.util.List;
6
7 import javax.persistence.CascadeType;
8 import javax.persistence.Column;
9 import javax.persistence.Entity;
10 import javax.persistence.FetchType;
11 import javax.persistence.Id;
12 import javax.persistence.JoinColumn;
13 import javax.persistence.JoinTable;
14 import javax.persistence.ManyToMany;
15 import javax.persistence.Temporal;
16
17 import org.hibernate.envers.Audited;
18 import org.hibernate.search.annotations.DocumentId;
19
20
21
22
23
24
25 @Audited
26 @Entity
27 public class User implements Principal {
28
29
30
31
32
33
34 @Id
35 @DocumentId
36 @Column(name="uuid", unique=true, length=42)
37 private String uuid;
38
39
40
41
42
43
44 @Column(name="username", unique=true)
45 private String username;
46
47
48
49
50
51
52 @Column(name="email", unique=true)
53 private String email;
54
55
56
57
58 private String firstname;
59
60
61
62
63 private String lastname;
64
65
66
67
68 private String password;
69
70
71
72
73 @ManyToMany(targetEntity = Role.class, cascade = { CascadeType.PERSIST }, fetch = FetchType.EAGER)
74 @JoinTable(
75 name = "User_Role",
76 joinColumns = @JoinColumn(name = "user_uuid"),
77 inverseJoinColumns = @JoinColumn(name = "role_uuid")
78 )
79 private List<Role> roles;
80
81
82
83
84
85 @Temporal(javax.persistence.TemporalType.TIMESTAMP)
86 private Date created;
87
88
89
90
91 @Temporal(javax.persistence.TemporalType.TIMESTAMP)
92 private Date modified;
93
94
95
96
97
98 private String modifiedBy;
99
100
101
102
103 private String modifiedAddress;
104
105 public String getUuid() {
106 return uuid;
107 }
108
109 public void setUuid(String uuid) {
110 this.uuid = uuid;
111 }
112
113 public String getUsername() {
114 return username;
115 }
116
117 public void setUsername(String username) {
118 this.username = username;
119 }
120
121 public String getEmail() {
122 return email;
123 }
124
125 public void setEmail(String email) {
126 this.email = email;
127 }
128
129 public String getFirstname() {
130 return firstname;
131 }
132
133 public void setFirstname(String firstname) {
134 this.firstname = firstname;
135 }
136
137 public String getLastname() {
138 return lastname;
139 }
140
141 public void setLastname(String lastname) {
142 this.lastname = lastname;
143 }
144
145 public String getPassword() {
146 return password;
147 }
148
149 public void setPassword(String password) {
150 this.password = password;
151 }
152
153 public List<Role> getRoles() {
154 return roles;
155 }
156
157 public void setRoles(List<Role> roles) {
158 this.roles = roles;
159 }
160
161 public Date getCreated() {
162 return created;
163 }
164
165 public void setCreated(Date created) {
166 this.created = created;
167 }
168
169 public Date getModified() {
170 return modified;
171 }
172
173 public void setModified(Date modified) {
174 this.modified = modified;
175 }
176
177 public String getModifiedAddress() {
178 return modifiedAddress;
179 }
180
181 public void setModifiedAddress(String modifiedAddress) {
182 this.modifiedAddress = modifiedAddress;
183 }
184
185 public String getModifiedBy() {
186 return modifiedBy;
187 }
188
189 public void setModifiedBy(String modifiedBy) {
190 this.modifiedBy = modifiedBy;
191 }
192
193
194
195
196
197 @Override
198 public String getName() {
199 return this.username;
200 }
201
202 }