1
2
3
4
5
6
7 package hu.elte.tribus.model;
8
9 import java.util.Set;
10
11 import javax.persistence.Column;
12 import javax.persistence.Entity;
13 import javax.persistence.GeneratedValue;
14 import javax.persistence.Id;
15 import javax.persistence.JoinColumn;
16 import javax.persistence.OneToMany;
17 /***
18 * @author linux48
19 */
20 @Entity(name="usr")
21 public class User {
22
23 @Id()
24 @Column(name="user_id")
25 @GeneratedValue()
26 private Integer id;
27 @Column
28 private String lastname;
29 @Column
30 private String firstname;
31 @Column(unique=true, nullable=false, updatable=false)
32 private String username;
33 @Column(nullable=false)
34 private String passwd;
35 @Column(nullable=false)
36 private String email;
37 @Column(nullable=false)
38 private boolean admin = false;
39
40 @OneToMany
41 @JoinColumn(name="user_id")
42 private Set<Conversation> conversations;
43
44 public static final int ENUM_STATUS_REG_REQUESTED = 0;
45 public static final int ENUM_STATUS_REG_REFUSED = 1;
46 public static final int ENUM_STATUS_REG_ACCEPTED = 2;
47 public static final int ENUM_STATUS_REG_DISABLED = 3;
48
49 private int status = ENUM_STATUS_REG_REQUESTED;
50
51 public User() {}
52 /***
53 * @return Returns the email.
54 */
55 public String getEmail() {
56 return email;
57 }
58 /***
59 * @param email The email to set.
60 */
61 public void setEmail(String email) {
62 this.email = email;
63 }
64 /***
65 * @return Returns the firstname.
66 */
67 public String getFirstname() {
68 return firstname;
69 }
70 /***
71 * @param firstname The firstname to set.
72 */
73 public void setFirstname(String firstname) {
74 this.firstname = firstname;
75 }
76 /***
77 * @return Returns the id.
78 */
79 public Integer getId() {
80 return id;
81 }
82 /***
83 * @param id The id to set.
84 */
85 public void setId(Integer id) {
86 this.id = id;
87 }
88 /***
89 * @return Returns the lastname.
90 */
91 public String getLastname() {
92 return lastname;
93 }
94 /***
95 * @param lastname The lastname to set.
96 */
97 public void setLastname(String lastname) {
98 this.lastname = lastname;
99 }
100 /***
101 * @return Returns the passwd.
102 */
103 public String getPasswd() {
104 return passwd;
105 }
106 /***
107 * @param passwd The passwd to set.
108 */
109 public void setPasswd(String passwd) {
110 this.passwd = passwd;
111 }
112 /***
113 * @return Returns the username.
114 */
115 public String getUsername() {
116 return username;
117 }
118 /***
119 * @param username The username to set.
120 */
121 public void setUsername(String username) {
122 this.username = username;
123 }
124 public Set<Conversation> getConversations() {
125 return conversations;
126 }
127 public void setConversations(Set<Conversation> conversations) {
128 this.conversations = conversations;
129 }
130 public int getStatus() {
131 return status;
132 }
133 public void setStatus(int status) {
134 this.status = status;
135 }
136 public boolean isAdmin() {
137 return admin;
138 }
139 public void setAdmin(boolean admin) {
140 this.admin = admin;
141 }
142 }