1 : |
dgarcia |
1 |
package eu.smartlm.abs.portal.security.login.model;
|
2 : |
|
|
|
3 : |
|
|
import org.hibernate.validator.constraints.NotEmpty;
|
4 : |
|
|
|
5 : |
|
|
import javax.persistence.Column;
|
6 : |
|
|
import javax.persistence.Entity;
|
7 : |
|
|
import javax.persistence.GeneratedValue;
|
8 : |
|
|
import javax.persistence.GenerationType;
|
9 : |
|
|
import javax.persistence.Id;
|
10 : |
|
|
import javax.persistence.Table;
|
11 : |
|
|
|
12 : |
|
|
/**
|
13 : |
|
|
* POJO object that contains all the User information for the Accounting and Billing Portlets
|
14 : |
|
|
* @author David García Pérez - CESGA
|
15 : |
|
|
*/
|
16 : |
|
|
@Entity
|
17 : |
|
|
@Table(name="USER_TBL")
|
18 : |
|
|
public class User {
|
19 : |
|
|
@Id
|
20 : |
|
|
@GeneratedValue(strategy=GenerationType.AUTO)
|
21 : |
|
|
@Column(name="id")
|
22 : |
|
|
private int id;
|
23 : |
|
|
|
24 : |
|
|
@NotEmpty
|
25 : |
|
|
@Column(name="username", unique=true)
|
26 : |
|
|
private String username;
|
27 : |
|
|
|
28 : |
|
|
@NotEmpty
|
29 : |
|
|
@Column(name="password")
|
30 : |
|
|
private String password;
|
31 : |
|
|
|
32 : |
|
|
@NotEmpty
|
33 : |
|
|
@Column(name="accounting_username")
|
34 : |
|
|
private String accountingUsername;
|
35 : |
|
|
|
36 : |
|
|
@Column(name="accounting_group")
|
37 : |
|
|
private String accountingGroup;
|
38 : |
|
|
|
39 : |
|
|
@Column(name="see_accounting_group_data")
|
40 : |
|
|
private boolean seeAccountingGroupData;
|
41 : |
|
|
|
42 : |
|
|
@Column(name="see_all")
|
43 : |
|
|
private boolean seeAll;
|
44 : |
|
|
|
45 : |
|
|
public User(String username, String password, String accountingUsername, String accountingGroup, boolean seeAccountingGroupData, boolean seeAll) {
|
46 : |
|
|
this.username = username;
|
47 : |
|
|
this.password = password;
|
48 : |
|
|
this.accountingUsername = accountingUsername;
|
49 : |
|
|
this.accountingGroup = accountingGroup;
|
50 : |
|
|
this.seeAccountingGroupData = seeAccountingGroupData;
|
51 : |
|
|
this.seeAll = seeAll;
|
52 : |
|
|
}
|
53 : |
|
|
|
54 : |
|
|
public User() {}
|
55 : |
|
|
|
56 : |
|
|
public int getId() {
|
57 : |
|
|
return id;
|
58 : |
|
|
}
|
59 : |
|
|
|
60 : |
|
|
public void setId(int id) {
|
61 : |
|
|
this.id = id;
|
62 : |
|
|
}
|
63 : |
|
|
|
64 : |
|
|
public void setUsername(String username) {
|
65 : |
|
|
this.username = username;
|
66 : |
|
|
}
|
67 : |
|
|
public String getUsername() {
|
68 : |
|
|
return username;
|
69 : |
|
|
}
|
70 : |
|
|
public void setPassword(String password) {
|
71 : |
|
|
this.password = password;
|
72 : |
|
|
}
|
73 : |
|
|
public String getPassword() {
|
74 : |
|
|
return password;
|
75 : |
|
|
}
|
76 : |
|
|
|
77 : |
|
|
public void setAccountingUsername(String accountingUsername) {
|
78 : |
|
|
this.accountingUsername = accountingUsername;
|
79 : |
|
|
}
|
80 : |
|
|
|
81 : |
|
|
public String getAccountingUsername() {
|
82 : |
|
|
return accountingUsername;
|
83 : |
|
|
}
|
84 : |
|
|
|
85 : |
|
|
public void setAccountingGroup(String accountingGroup) {
|
86 : |
|
|
this.accountingGroup = accountingGroup;
|
87 : |
|
|
}
|
88 : |
|
|
|
89 : |
|
|
public String getAccountingGroup() {
|
90 : |
|
|
return accountingGroup;
|
91 : |
|
|
}
|
92 : |
|
|
|
93 : |
|
|
public void setSeeAccountingGroupData(boolean seeAccountingGroupData) {
|
94 : |
|
|
this.seeAccountingGroupData = seeAccountingGroupData;
|
95 : |
|
|
}
|
96 : |
|
|
|
97 : |
|
|
public boolean isSeeAccountingGroupData() {
|
98 : |
|
|
return seeAccountingGroupData;
|
99 : |
|
|
}
|
100 : |
|
|
|
101 : |
|
|
public void setSeeAll(boolean seeAll) {
|
102 : |
|
|
this.seeAll = seeAll;
|
103 : |
|
|
}
|
104 : |
|
|
|
105 : |
|
|
public boolean isSeeAll() {
|
106 : |
|
|
return seeAll;
|
107 : |
|
|
}
|
108 : |
|
|
|
109 : |
|
|
@Override
|
110 : |
|
|
public boolean equals(Object otherObject) {
|
111 : |
|
|
User otherUser = (User) otherObject;
|
112 : |
|
|
|
113 : |
|
|
if(otherUser.getUsername().equals(this.username)) {
|
114 : |
|
|
return true;
|
115 : |
|
|
} else {
|
116 : |
|
|
return false;
|
117 : |
|
|
}
|
118 : |
|
|
}
|
119 : |
|
|
}
|