blob: ebe50485846ab6ccfa86e84498641aca8616236f [file] [log] [blame]
Matthias Andreas Benkard764e4d12020-01-12 16:46:13 +01001package eu.mulk.mulkcms2.entity;
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +01002
3import io.quarkus.hibernate.orm.panache.PanacheEntityBase;
4import java.util.Collection;
5import java.util.Objects;
6import javax.persistence.Basic;
7import javax.persistence.Column;
8import javax.persistence.Entity;
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +01009import javax.persistence.FetchType;
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +010010import javax.persistence.Id;
11import javax.persistence.OneToMany;
12import javax.persistence.Table;
13
14@Entity
15@Table(name = "users", schema = "public", catalog = "mulkcms")
16public class User extends PanacheEntityBase {
17
18 private int id;
19 private String name;
20 private String status;
21 private String email;
22 private String website;
23 private Collection<ArticleRevision> articleRevisions;
24 private Collection<CommentRevision> commentRevisions;
25 private Collection<LoginCertificate> loginCertificates;
26 private Collection<OpenId> openids;
27 private Collection<Password> passwords;
28 private Collection<UserPermission> userPermissions;
29 private Collection<UserSetting> userSettings;
30
31 @Id
32 @Column(name = "id", nullable = false)
33 public int getId() {
34 return id;
35 }
36
37 public void setId(int id) {
38 this.id = id;
39 }
40
41 @Basic
42 @Column(name = "name", nullable = true, length = -1)
43 public String getName() {
44 return name;
45 }
46
47 public void setName(String name) {
48 this.name = name;
49 }
50
51 @Basic
52 @Column(name = "status", nullable = false, length = -1)
53 public String getStatus() {
54 return status;
55 }
56
57 public void setStatus(String status) {
58 this.status = status;
59 }
60
61 @Basic
62 @Column(name = "email", nullable = true, length = -1)
63 public String getEmail() {
64 return email;
65 }
66
67 public void setEmail(String email) {
68 this.email = email;
69 }
70
71 @Basic
72 @Column(name = "website", nullable = true, length = -1)
73 public String getWebsite() {
74 return website;
75 }
76
77 public void setWebsite(String website) {
78 this.website = website;
79 }
80
81 @Override
82 public boolean equals(Object o) {
83 if (this == o) {
84 return true;
85 }
86 if (o == null || getClass() != o.getClass()) {
87 return false;
88 }
89 User user = (User) o;
90 return id == user.id &&
91 Objects.equals(name, user.name) &&
92 Objects.equals(status, user.status) &&
93 Objects.equals(email, user.email) &&
94 Objects.equals(website, user.website);
95 }
96
97 @Override
98 public int hashCode() {
99 return Objects.hash(id, name, status, email, website);
100 }
101
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100102 @OneToMany(mappedBy = "authors", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100103 public Collection<ArticleRevision> getArticleRevisions() {
104 return articleRevisions;
105 }
106
107 public void setArticleRevisions(Collection<ArticleRevision> articleRevisions) {
108 this.articleRevisions = articleRevisions;
109 }
110
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100111 @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100112 public Collection<CommentRevision> getCommentRevisions() {
113 return commentRevisions;
114 }
115
116 public void setCommentRevisions(Collection<CommentRevision> commentRevisions) {
117 this.commentRevisions = commentRevisions;
118 }
119
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100120 @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100121 public Collection<LoginCertificate> getLoginCertificates() {
122 return loginCertificates;
123 }
124
125 public void setLoginCertificates(Collection<LoginCertificate> loginCertificates) {
126 this.loginCertificates = loginCertificates;
127 }
128
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100129 @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100130 public Collection<OpenId> getOpenids() {
131 return openids;
132 }
133
134 public void setOpenids(Collection<OpenId> openids) {
135 this.openids = openids;
136 }
137
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100138 @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100139 public Collection<Password> getPasswords() {
140 return passwords;
141 }
142
143 public void setPasswords(Collection<Password> passwords) {
144 this.passwords = passwords;
145 }
146
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100147 @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100148 public Collection<UserPermission> getUserPermissions() {
149 return userPermissions;
150 }
151
152 public void setUserPermissions(Collection<UserPermission> userPermissions) {
153 this.userPermissions = userPermissions;
154 }
155
Matthias Andreas Benkard366d8eb2020-01-12 16:46:36 +0100156 @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
Matthias Andreas Benkard2f0b3702020-01-12 15:46:34 +0100157 public Collection<UserSetting> getUserSettings() {
158 return userSettings;
159 }
160
161 public void setUserSettings(Collection<UserSetting> userSettings) {
162 this.userSettings = userSettings;
163 }
164}