Showing
21 changed files
with
230 additions
and
228 deletions
... | @@ -11,7 +11,7 @@ import java.util.*; | ... | @@ -11,7 +11,7 @@ import java.util.*; |
11 | Migréee depuis la v2. | 11 | Migréee depuis la v2. |
12 | */ | 12 | */ |
13 | @Entity | 13 | @Entity |
14 | -public class Person /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ { | 14 | +public class Account /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ { |
15 | 15 | ||
16 | @Id | 16 | @Id |
17 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 17 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
... | @@ -117,23 +117,23 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -117,23 +117,23 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
117 | private String email; | 117 | private String email; |
118 | 118 | ||
119 | /** | 119 | /** |
120 | - * The {link org.roliste.data.db.UserRole}s for this user. | 120 | + * The {link org.roliste.data.db.AccountRole}s for this user. |
121 | */ | 121 | */ |
122 | @ManyToMany(fetch = FetchType.EAGER) | 122 | @ManyToMany(fetch = FetchType.EAGER) |
123 | - private List<UserRole> roles; | 123 | + private List<AccountRole> roles; |
124 | 124 | ||
125 | /** | 125 | /** |
126 | - * Retrieves the list of {@link UserRole}s for this user. | 126 | + * Retrieves the list of {@link AccountRole}s for this user. |
127 | * SHALL be used as a read-only attribute. In particular, avoid | 127 | * SHALL be used as a read-only attribute. In particular, avoid |
128 | * using {@link List#add(Object)} or {@link List#remove(Object)} on | 128 | * using {@link List#add(Object)} or {@link List#remove(Object)} on |
129 | * the returned value without caution. | 129 | * the returned value without caution. |
130 | - * @return a {@link List} of {@link UserRole}. Shall not be <code>null</code>. | 130 | + * @return a {@link List} of {@link AccountRole}. Shall not be <code>null</code>. |
131 | * @see #setRoles(List) | 131 | * @see #setRoles(List) |
132 | - * see #addToRole(UserRole) | 132 | + * see #addToRole(AccountRole) |
133 | - * see #removeFromRole(UserRole) | 133 | + * see #removeFromRole(AccountRole) |
134 | * hibernate.many-to-many | 134 | * hibernate.many-to-many |
135 | * column="ROLE_FK" | 135 | * column="ROLE_FK" |
136 | - * class="org.roliste.data.db.UserRole" | 136 | + * class="org.roliste.data.db.AccountRole" |
137 | * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" | 137 | * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" |
138 | * @hibernate.key | 138 | * @hibernate.key |
139 | * column="UTILISATEUR_FK" | 139 | * column="UTILISATEUR_FK" |
... | @@ -146,20 +146,20 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -146,20 +146,20 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
146 | * lazy="true" | 146 | * lazy="true" |
147 | */ | 147 | */ |
148 | 148 | ||
149 | - public List<UserRole> getRoles() { | 149 | + public List<AccountRole> getRoles() { |
150 | return roles; | 150 | return roles; |
151 | } | 151 | } |
152 | 152 | ||
153 | /** | 153 | /** |
154 | - * Lists the list of {@link UserRole}s for this user. | 154 | + * Lists the list of {@link AccountRole}s for this user. |
155 | - * @param roles the new {@link List} of {@link UserRole}s. Shall not be <code>null</code>. | 155 | + * @param roles the new {@link List} of {@link AccountRole}s. Shall not be <code>null</code>. |
156 | * @throws NullPointerException if roles is <code>null</code>. | 156 | * @throws NullPointerException if roles is <code>null</code>. |
157 | * @see #getRoles() | 157 | * @see #getRoles() |
158 | - * see #addToRole(UserRole) | 158 | + * see #addToRole(AccountRole) |
159 | - * see #removeFromRole(UserRole) | 159 | + * see #removeFromRole(AccountRole) |
160 | */ | 160 | */ |
161 | 161 | ||
162 | - public void setRoles(List<UserRole> roles) { | 162 | + public void setRoles(List<AccountRole> roles) { |
163 | if (roles == null) | 163 | if (roles == null) |
164 | { | 164 | { |
165 | throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur"); | 165 | throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur"); |
... | @@ -168,38 +168,38 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -168,38 +168,38 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
168 | } | 168 | } |
169 | 169 | ||
170 | /** | 170 | /** |
171 | - * Add the user to a given {@link UserRole}s. | 171 | + * Add the user to a given {@link AccountRole}s. |
172 | - * @param role the new {@link UserRole}. Ignored if <code>null</code>. | 172 | + * @param role the new {@link AccountRole}. Ignored if <code>null</code>. |
173 | * @see #getRoles() | 173 | * @see #getRoles() |
174 | * @see #setRoles(List) | 174 | * @see #setRoles(List) |
175 | - * @see #removeFromRole(UserRole) | 175 | + * @see #removeFromRole(AccountRole) |
176 | */ | 176 | */ |
177 | /* | 177 | /* |
178 | - public void addToRole(UserRole role) { | 178 | + public void addToRole(AccountRole role) { |
179 | synchronized (this) | 179 | synchronized (this) |
180 | { | 180 | { |
181 | if ((role != null) && !(getRoles().contains(role)) ) | 181 | if ((role != null) && !(getRoles().contains(role)) ) |
182 | { | 182 | { |
183 | - role.getPersons().add(this); | 183 | + role.getAccounts().add(this); |
184 | getRoles().add(role); | 184 | getRoles().add(role); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | } | 187 | } |
188 | */ | 188 | */ |
189 | /** | 189 | /** |
190 | - * Remove the user from a given {@link UserRole}s. | 190 | + * Remove the user from a given {@link AccountRole}s. |
191 | - * @param role the {@link UserRole} this {@link Person} will lose. Ignored if <code>null</code>. | 191 | + * @param role the {@link AccountRole} this {@link Account} will lose. Ignored if <code>null</code>. |
192 | * @see #getRoles() | 192 | * @see #getRoles() |
193 | * @see #setRoles(List) | 193 | * @see #setRoles(List) |
194 | - * @see #addToRole(UserRole) | 194 | + * @see #addToRole(AccountRole) |
195 | */ | 195 | */ |
196 | /* | 196 | /* |
197 | - public void removeFromRole(UserRole role) { | 197 | + public void removeFromRole(AccountRole role) { |
198 | synchronized (this) | 198 | synchronized (this) |
199 | { | 199 | { |
200 | if ((role != null) && (getRoles().contains(role)) ) | 200 | if ((role != null) && (getRoles().contains(role)) ) |
201 | { | 201 | { |
202 | - role.getPersons().remove(this); | 202 | + role.getAccounts().remove(this); |
203 | getRoles().remove(role); | 203 | getRoles().remove(role); |
204 | } | 204 | } |
205 | } | 205 | } |
... | @@ -300,7 +300,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -300,7 +300,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
300 | */ | 300 | */ |
301 | /** | 301 | /** |
302 | * Remove a book from user's collection. | 302 | * Remove a book from user's collection. |
303 | - * @param book the {@link org.roliste.data.db.BookDetails} this {@link Person} will lose. Ignored if <code>null</code>. | 303 | + * @param book the {@link org.roliste.data.db.BookDetails} this {@link Account} will lose. Ignored if <code>null</code>. |
304 | * @see #getCollection() | 304 | * @see #getCollection() |
305 | * @see #setCollection(List) | 305 | * @see #setCollection(List) |
306 | * @see #addToCollection(BookDetails) | 306 | * @see #addToCollection(BookDetails) |
... | @@ -326,7 +326,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -326,7 +326,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
326 | * Retrieves the list of delegations for this user. | 326 | * Retrieves the list of delegations for this user. |
327 | * Each delegation is a link to a {@link org.roliste.data.db.Traceable} object. | 327 | * Each delegation is a link to a {@link org.roliste.data.db.Traceable} object. |
328 | * A user having delegation may update field values for delegated object. | 328 | * A user having delegation may update field values for delegated object. |
329 | - * @return a {@link List} of {@link UserRole}. Shall not be <code>null</code>. SHALL be used as a | 329 | + * @return a {@link List} of {@link AccountRole}. Shall not be <code>null</code>. SHALL be used as a |
330 | * read-only attribute. In particular, avoid using {@link List#add(Object)} or {@link List#remove(Object)} | 330 | * read-only attribute. In particular, avoid using {@link List#add(Object)} or {@link List#remove(Object)} |
331 | * on the returned value without caution. | 331 | * on the returned value without caution. |
332 | * @see #setDelegations(List) | 332 | * @see #setDelegations(List) |
... | @@ -389,7 +389,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -389,7 +389,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
389 | */ | 389 | */ |
390 | /** | 390 | /** |
391 | * Remove delegation on a given {@link Traceable} from this user. | 391 | * Remove delegation on a given {@link Traceable} from this user. |
392 | - * @param object the delegation this {@link Person} will lose. Ignored if <code>null</code>. | 392 | + * @param object the delegation this {@link Account} will lose. Ignored if <code>null</code>. |
393 | * @see #getDelegations() | 393 | * @see #getDelegations() |
394 | * @see #setDelegations(List) | 394 | * @see #setDelegations(List) |
395 | * @see #giveDelegation(Traceable) | 395 | * @see #giveDelegation(Traceable) |
... | @@ -426,12 +426,12 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -426,12 +426,12 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
426 | * The list of attributes / properties for this user. | 426 | * The list of attributes / properties for this user. |
427 | */ | 427 | */ |
428 | @OneToMany(mappedBy = "person") | 428 | @OneToMany(mappedBy = "person") |
429 | - private List<UserAttribute> userAttributes; | 429 | + private List<AccountAttribute> accountAttributes; |
430 | 430 | ||
431 | /** | 431 | /** |
432 | * Retrieve this user's attributes. | 432 | * Retrieve this user's attributes. |
433 | * @hibernate.one-to-many | 433 | * @hibernate.one-to-many |
434 | - * class="org.roliste.data.db.UserAttribute" | 434 | + * class="org.roliste.data.db.AccountAttribute" |
435 | * @hibernate.bag | 435 | * @hibernate.bag |
436 | * cascade="all" | 436 | * cascade="all" |
437 | * lazy="true" | 437 | * lazy="true" |
... | @@ -442,9 +442,9 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -442,9 +442,9 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
442 | * @see #setAttributes(java.util.List) | 442 | * @see #setAttributes(java.util.List) |
443 | */ | 443 | */ |
444 | 444 | ||
445 | - public List<UserAttribute> getAttributes() | 445 | + public List<AccountAttribute> getAttributes() |
446 | { | 446 | { |
447 | - return userAttributes; | 447 | + return accountAttributes; |
448 | } | 448 | } |
449 | 449 | ||
450 | /** | 450 | /** |
... | @@ -452,9 +452,9 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements | ... | @@ -452,9 +452,9 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements |
452 | * @see #getAttributes() | 452 | * @see #getAttributes() |
453 | */ | 453 | */ |
454 | 454 | ||
455 | - public void setAttributes(List<UserAttribute> attribs) | 455 | + public void setAttributes(List<AccountAttribute> attribs) |
456 | { | 456 | { |
457 | - this.userAttributes = attribs; | 457 | + this.accountAttributes = attribs; |
458 | } | 458 | } |
459 | 459 | ||
460 | /** | 460 | /** | ... | ... |
... | @@ -7,7 +7,7 @@ import javax.persistence.*; | ... | @@ -7,7 +7,7 @@ import javax.persistence.*; |
7 | Migréee depuis la v2. | 7 | Migréee depuis la v2. |
8 | */ | 8 | */ |
9 | @Entity | 9 | @Entity |
10 | -public class UserAttribute { | 10 | +public class AccountAttribute { |
11 | @Id | 11 | @Id |
12 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
13 | private int userAttributeId; | 13 | private int userAttributeId; |
... | @@ -17,69 +17,69 @@ public class UserAttribute { | ... | @@ -17,69 +17,69 @@ public class UserAttribute { |
17 | } | 17 | } |
18 | 18 | ||
19 | /** | 19 | /** |
20 | - * The linked person. | 20 | + * The linked account. |
21 | */ | 21 | */ |
22 | @ManyToOne | 22 | @ManyToOne |
23 | - private Person person; | 23 | + private Account account; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | - * Retrieve the person this attribute is attached to. | 26 | + * Retrieve the account this attribute is attached to. |
27 | * hibernate.many-to-one | 27 | * hibernate.many-to-one |
28 | * column="ID_UTILISATEUR" | 28 | * column="ID_UTILISATEUR" |
29 | - * class="org.roliste.data.db.Person" | 29 | + * class="org.roliste.data.db.Account" |
30 | * not-null="true" | 30 | * not-null="true" |
31 | * access="property" | 31 | * access="property" |
32 | * lazy="proxy" | 32 | * lazy="proxy" |
33 | * properties-name="PropertyPerUser" | 33 | * properties-name="PropertyPerUser" |
34 | * foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR" | 34 | * foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR" |
35 | - * @return the {link org.roliste.data.db.Person} this attribute is attached to. | 35 | + * @return the {link org.roliste.data.db.Account} this attribute is attached to. |
36 | * Shall not be <code>null</code>. | 36 | * Shall not be <code>null</code>. |
37 | - * see #setPerson(org.roliste.data.db.Person) | 37 | + * see #setAccount(org.roliste.data.db.Account) |
38 | */ | 38 | */ |
39 | - public Person getPerson() { | 39 | + public Account getAccount() { |
40 | - return person; | 40 | + return account; |
41 | } | 41 | } |
42 | 42 | ||
43 | /** | 43 | /** |
44 | - * Set the person this attribute is attached to. | 44 | + * Set the account this attribute is attached to. |
45 | - * @param person the new {link org.roliste.data.db.Person} this attribute will be attached to. Shall not be <code>null</code>. | 45 | + * @param account the new {link org.roliste.data.db.Account} this attribute will be attached to. Shall not be <code>null</code>. |
46 | - * @see #getPerson() | 46 | + * @see #getAccount() |
47 | */ | 47 | */ |
48 | - public void setPerson(Person person) { | 48 | + public void setAccount(Account account) { |
49 | - this.person = person; | 49 | + this.account = account; |
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
53 | * The linked property. | 53 | * The linked property. |
54 | */ | 54 | */ |
55 | @ManyToOne | 55 | @ManyToOne |
56 | - private UserProperty userProperty; | 56 | + private AccountProperty accountProperty; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Retrieve the property this attribute is attached to. | 59 | * Retrieve the property this attribute is attached to. |
60 | * hibernate.many-to-one | 60 | * hibernate.many-to-one |
61 | * column="ID_PROP" | 61 | * column="ID_PROP" |
62 | - * class="org.roliste.data.db.UserProperty" | 62 | + * class="org.roliste.data.db.AccountProperty" |
63 | * not-null="true" | 63 | * not-null="true" |
64 | * access="property" | 64 | * access="property" |
65 | * lazy="false" | 65 | * lazy="false" |
66 | * properties-name="PropertyPerUser" | 66 | * properties-name="PropertyPerUser" |
67 | * foreign-key="FK_ATTRIBUTUTILISATEUR_PROPRIETE" | 67 | * foreign-key="FK_ATTRIBUTUTILISATEUR_PROPRIETE" |
68 | - * @return the {link org.roliste.data.db.UserProperty} this attribute is attached to. | 68 | + * @return the {link org.roliste.data.db.AccountProperty} this attribute is attached to. |
69 | * Shall not be <code>null</code>. | 69 | * Shall not be <code>null</code>. |
70 | - * see #setProperty(org.roliste.data.db.UserProperty) | 70 | + * see #setProperty(org.roliste.data.db.AccountProperty) |
71 | */ | 71 | */ |
72 | - public UserProperty getProperty() { | 72 | + public AccountProperty getProperty() { |
73 | - return userProperty; | 73 | + return accountProperty; |
74 | } | 74 | } |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Set the property this attribute is attached to. | 77 | * Set the property this attribute is attached to. |
78 | - * @param prop the new {link org.roliste.data.db.UserProperty} this attribute will be attached to. Shall not be <code>null</code>. | 78 | + * @param prop the new {link org.roliste.data.db.AccountProperty} this attribute will be attached to. Shall not be <code>null</code>. |
79 | * @see #getProperty() | 79 | * @see #getProperty() |
80 | */ | 80 | */ |
81 | - public void setProperty(UserProperty prop) { | 81 | + public void setProperty(AccountProperty prop) { |
82 | - userProperty = prop; | 82 | + accountProperty = prop; |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
... | @@ -112,14 +112,14 @@ public class UserAttribute { | ... | @@ -112,14 +112,14 @@ public class UserAttribute { |
112 | } | 112 | } |
113 | 113 | ||
114 | /** | 114 | /** |
115 | - * Returns a string representation of this person attribute definition. | 115 | + * Returns a string representation of this account attribute definition. |
116 | - * @return a string representing this person attribute definition. | 116 | + * @return a string representing this account attribute definition. |
117 | * hidden | 117 | * hidden |
118 | */ | 118 | */ |
119 | @Override | 119 | @Override |
120 | public String toString() | 120 | public String toString() |
121 | { | 121 | { |
122 | - return "ID_ATTR=" + getUserAttributeId() + " ATTR_PROP=" + userProperty + " ATTR_VALUE=" + value; | 122 | + return "ID_ATTR=" + getUserAttributeId() + " ATTR_PROP=" + accountProperty + " ATTR_VALUE=" + value; |
123 | } | 123 | } |
124 | 124 | ||
125 | } | 125 | } | ... | ... |
... | @@ -2,5 +2,5 @@ package org.legrog.entities; | ... | @@ -2,5 +2,5 @@ package org.legrog.entities; |
2 | 2 | ||
3 | import org.springframework.data.jpa.repository.JpaRepository; | 3 | import org.springframework.data.jpa.repository.JpaRepository; |
4 | 4 | ||
5 | -public interface UserPropertyRepository extends JpaRepository<UserProperty, Integer> { | 5 | +public interface AccountAttributeRepository extends JpaRepository<AccountAttribute, Integer> { |
6 | } | 6 | } | ... | ... |
... | @@ -7,7 +7,7 @@ import javax.persistence.*; | ... | @@ -7,7 +7,7 @@ import javax.persistence.*; |
7 | Importée depuis la v2. | 7 | Importée depuis la v2. |
8 | */ | 8 | */ |
9 | @Entity | 9 | @Entity |
10 | -public class UserProperty { | 10 | +public class AccountProperty { |
11 | @Id | 11 | @Id |
12 | @GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */ | 12 | @GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */ |
13 | private int userPropertyId; | 13 | private int userPropertyId; | ... | ... |
... | @@ -2,5 +2,5 @@ package org.legrog.entities; | ... | @@ -2,5 +2,5 @@ package org.legrog.entities; |
2 | 2 | ||
3 | import org.springframework.data.jpa.repository.JpaRepository; | 3 | import org.springframework.data.jpa.repository.JpaRepository; |
4 | 4 | ||
5 | -public interface UserRoleRepository extends JpaRepository<UserRole, Integer> { | 5 | +public interface AccountPropertyRepository extends JpaRepository<AccountProperty, Integer> { |
6 | } | 6 | } | ... | ... |
... | @@ -2,5 +2,5 @@ package org.legrog.entities; | ... | @@ -2,5 +2,5 @@ package org.legrog.entities; |
2 | 2 | ||
3 | import org.springframework.data.jpa.repository.JpaRepository; | 3 | import org.springframework.data.jpa.repository.JpaRepository; |
4 | 4 | ||
5 | -public interface PersonRepository extends JpaRepository<Person, Integer> { | 5 | +public interface AccountRepository extends JpaRepository<Account, Integer> { |
6 | } | 6 | } | ... | ... |
src/main/java/org/legrog/entities/UserRole.java
→
src/main/java/org/legrog/entities/AccountRole.java
... | @@ -7,11 +7,11 @@ import javax.persistence.*; | ... | @@ -7,11 +7,11 @@ import javax.persistence.*; |
7 | 7 | ||
8 | /** | 8 | /** |
9 | * The database representation of a user role or group. | 9 | * The database representation of a user role or group. |
10 | - * A given {@link Person} may be part of one or more {@link UserRole}. | 10 | + * A given {@link Account} may be part of one or more {@link AccountRole}. |
11 | * <br/> | 11 | * <br/> |
12 | * Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly. | 12 | * Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly. |
13 | * You shall always use the getter/setter methods. | 13 | * You shall always use the getter/setter methods. |
14 | - * alias UserRole | 14 | + * alias AccountRole |
15 | * | 15 | * |
16 | */ | 16 | */ |
17 | /* | 17 | /* |
... | @@ -19,7 +19,7 @@ import javax.persistence.*; | ... | @@ -19,7 +19,7 @@ import javax.persistence.*; |
19 | */ | 19 | */ |
20 | @Entity | 20 | @Entity |
21 | // TODO évaluer extend v2 | 21 | // TODO évaluer extend v2 |
22 | -public class UserRole /* extends org.roliste.data.DbEntity */ | 22 | +public class AccountRole /* extends org.roliste.data.DbEntity */ |
23 | { | 23 | { |
24 | @Id | 24 | @Id |
25 | @GeneratedValue(strategy = GenerationType.IDENTITY) | 25 | @GeneratedValue(strategy = GenerationType.IDENTITY) |
... | @@ -31,10 +31,10 @@ public class UserRole /* extends org.roliste.data.DbEntity */ | ... | @@ -31,10 +31,10 @@ public class UserRole /* extends org.roliste.data.DbEntity */ |
31 | private String rolename; | 31 | private String rolename; |
32 | 32 | ||
33 | /** | 33 | /** |
34 | - * The {@link Person}s for this user role. | 34 | + * The {@link Account}s for this user role. |
35 | */ | 35 | */ |
36 | @ManyToMany(mappedBy = "roles") | 36 | @ManyToMany(mappedBy = "roles") |
37 | - private Set<Person> persons; | 37 | + private Set<Account> accounts; |
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Builds a new and empty user role definition. | 40 | * Builds a new and empty user role definition. |
... | @@ -42,12 +42,12 @@ public class UserRole /* extends org.roliste.data.DbEntity */ | ... | @@ -42,12 +42,12 @@ public class UserRole /* extends org.roliste.data.DbEntity */ |
42 | * <br/> | 42 | * <br/> |
43 | * Needed by Hibernate for Java reflection. | 43 | * Needed by Hibernate for Java reflection. |
44 | */ | 44 | */ |
45 | - public UserRole() { | 45 | + public AccountRole() { |
46 | super(); | 46 | super(); |
47 | rolename = null; | 47 | rolename = null; |
48 | visible = true; | 48 | visible = true; |
49 | // no need to synchronize this | 49 | // no need to synchronize this |
50 | - persons = new HashSet<Person>(); | 50 | + accounts = new HashSet<Account>(); |
51 | } | 51 | } |
52 | 52 | ||
53 | public int getUserRoleId() { | 53 | public int getUserRoleId() { |
... | @@ -90,7 +90,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */ | ... | @@ -90,7 +90,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */ |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Indicates if the role is visible. | 92 | * Indicates if the role is visible. |
93 | - * If not, persons should not be able to access the privileges | 93 | + * If not, accounts should not be able to access the privileges |
94 | * they inherit from being part of this role. | 94 | * they inherit from being part of this role. |
95 | * @return the visible flag. | 95 | * @return the visible flag. |
96 | * @see #setVisible(boolean) | 96 | * @see #setVisible(boolean) |
... | @@ -112,12 +112,12 @@ public class UserRole /* extends org.roliste.data.DbEntity */ | ... | @@ -112,12 +112,12 @@ public class UserRole /* extends org.roliste.data.DbEntity */ |
112 | } | 112 | } |
113 | 113 | ||
114 | /** | 114 | /** |
115 | - * Retrieves the list of {@link Person}s for this user role. | 115 | + * Retrieves the list of {@link Account}s for this user role. |
116 | * SHALL be used as a read-only attribute. In particular, avoid | 116 | * SHALL be used as a read-only attribute. In particular, avoid |
117 | * using {@link Set#add(Object)} or {@link Set#remove(Object)} on | 117 | * using {@link Set#add(Object)} or {@link Set#remove(Object)} on |
118 | * the returned value without caution. | 118 | * the returned value without caution. |
119 | - * @return a {@link Set} of {@link Person}. May be <code>null</code>. | 119 | + * @return a {@link Set} of {@link Account}. May be <code>null</code>. |
120 | - * @see #setPersons(Set) | 120 | + * @see #setAccounts(Set) |
121 | * hibernate.many-to-many | 121 | * hibernate.many-to-many |
122 | * column="UTILISATEUR_FK" | 122 | * column="UTILISATEUR_FK" |
123 | * class="org.roliste.data.db.Person" | 123 | * class="org.roliste.data.db.Person" |
... | @@ -132,18 +132,18 @@ public class UserRole /* extends org.roliste.data.DbEntity */ | ... | @@ -132,18 +132,18 @@ public class UserRole /* extends org.roliste.data.DbEntity */ |
132 | * lazy="true" | 132 | * lazy="true" |
133 | * inverse="true" | 133 | * inverse="true" |
134 | */ | 134 | */ |
135 | - public Set<Person> getPersons() { | 135 | + public Set<Account> getAccounts() { |
136 | - return persons; | 136 | + return accounts; |
137 | } | 137 | } |
138 | 138 | ||
139 | /** | 139 | /** |
140 | - * Sets the list of {@link Person}s for this user role. | 140 | + * Sets the list of {@link Account}s for this user role. |
141 | - * @param persons the new {@link Set} of {@link Person}s. May be | 141 | + * @param accounts the new {@link Set} of {@link Account}s. May be |
142 | * <code>null</code> (we don't handle the relation from this side). | 142 | * <code>null</code> (we don't handle the relation from this side). |
143 | - * @see #getPersons() | 143 | + * @see #getAccounts() |
144 | */ | 144 | */ |
145 | - protected void setPersons(Set<Person> persons) { | 145 | + protected void setAccounts(Set<Account> accounts) { |
146 | - this.persons = persons; | 146 | + this.accounts = accounts; |
147 | } | 147 | } |
148 | 148 | ||
149 | /** | 149 | /** | ... | ... |
... | @@ -2,5 +2,5 @@ package org.legrog.entities; | ... | @@ -2,5 +2,5 @@ package org.legrog.entities; |
2 | 2 | ||
3 | import org.springframework.data.jpa.repository.JpaRepository; | 3 | import org.springframework.data.jpa.repository.JpaRepository; |
4 | 4 | ||
5 | -public interface UserAttributeRepository extends JpaRepository<UserAttribute, Integer> { | 5 | +public interface AccountRoleRepository extends JpaRepository<AccountRole, Integer> { |
6 | } | 6 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,7 +15,7 @@ public class PublisherAction { | ... | @@ -15,7 +15,7 @@ public class PublisherAction { |
15 | @Enumerated | 15 | @Enumerated |
16 | private ActionType actionType; | 16 | private ActionType actionType; |
17 | @ManyToOne | 17 | @ManyToOne |
18 | - private Person publisherActionAuthor; | 18 | + private Account publisherActionAuthor; |
19 | @ManyToOne | 19 | @ManyToOne |
20 | private PublisherVersion publisherVersion; | 20 | private PublisherVersion publisherVersion; |
21 | 21 | ||
... | @@ -25,7 +25,7 @@ public class PublisherAction { | ... | @@ -25,7 +25,7 @@ public class PublisherAction { |
25 | @ManyToOne | 25 | @ManyToOne |
26 | private Publisher publisher; | 26 | private Publisher publisher; |
27 | 27 | ||
28 | - public void setPublisherActionAuthor(Person publisherActionAuthor) { | 28 | + public void setPublisherActionAuthor(Account publisherActionAuthor) { |
29 | this.publisherActionAuthor = publisherActionAuthor; | 29 | this.publisherActionAuthor = publisherActionAuthor; |
30 | } | 30 | } |
31 | 31 | ||
... | @@ -49,7 +49,7 @@ public class PublisherAction { | ... | @@ -49,7 +49,7 @@ public class PublisherAction { |
49 | return actionType; | 49 | return actionType; |
50 | } | 50 | } |
51 | 51 | ||
52 | - public Person getPublisherActionAuthor() { | 52 | + public Account getPublisherActionAuthor() { |
53 | return publisherActionAuthor; | 53 | return publisherActionAuthor; |
54 | } | 54 | } |
55 | 55 | ... | ... |
... | @@ -31,7 +31,7 @@ public class PublisherVersion { | ... | @@ -31,7 +31,7 @@ public class PublisherVersion { |
31 | private boolean publisherActive; | 31 | private boolean publisherActive; |
32 | private String publisherHistory; | 32 | private String publisherHistory; |
33 | @ManyToOne | 33 | @ManyToOne |
34 | - private Person publisherVersionAuthor; | 34 | + private Account publisherVersionAuthor; |
35 | private Timestamp publisherVersionDatetime; | 35 | private Timestamp publisherVersionDatetime; |
36 | 36 | ||
37 | public Timestamp getPublisherVersionDatetime() { | 37 | public Timestamp getPublisherVersionDatetime() { |
... | @@ -146,11 +146,11 @@ public class PublisherVersion { | ... | @@ -146,11 +146,11 @@ public class PublisherVersion { |
146 | this.publisherAddressCountry = publisherAddressCountry; | 146 | this.publisherAddressCountry = publisherAddressCountry; |
147 | } | 147 | } |
148 | 148 | ||
149 | - public Person getPublisherVersionAuthor() { | 149 | + public Account getPublisherVersionAuthor() { |
150 | return publisherVersionAuthor; | 150 | return publisherVersionAuthor; |
151 | } | 151 | } |
152 | 152 | ||
153 | - public void setPublisherVersionAuthor(Person publisherVersionAuthor) { | 153 | + public void setPublisherVersionAuthor(Account publisherVersionAuthor) { |
154 | this.publisherVersionAuthor = publisherVersionAuthor; | 154 | this.publisherVersionAuthor = publisherVersionAuthor; |
155 | } | 155 | } |
156 | 156 | ... | ... |
... | @@ -43,7 +43,7 @@ public class PublisherVersionView implements Serializable { | ... | @@ -43,7 +43,7 @@ public class PublisherVersionView implements Serializable { |
43 | private String publisherURL; | 43 | private String publisherURL; |
44 | private boolean publisherActive; | 44 | private boolean publisherActive; |
45 | private String publisherHistory; | 45 | private String publisherHistory; |
46 | - private transient Person publisherVersionAuthor; | 46 | + private transient Account publisherVersionAuthor; |
47 | private Timestamp publisherVersionDatetime; | 47 | private Timestamp publisherVersionDatetime; |
48 | 48 | ||
49 | private transient Publisher publisher; | 49 | private transient Publisher publisher; |
... | @@ -312,11 +312,11 @@ public class PublisherVersionView implements Serializable { | ... | @@ -312,11 +312,11 @@ public class PublisherVersionView implements Serializable { |
312 | this.publisherHistory = publisherHistory; | 312 | this.publisherHistory = publisherHistory; |
313 | } | 313 | } |
314 | 314 | ||
315 | - public Person getPublisherVersionAuthor() { | 315 | + public Account getPublisherVersionAuthor() { |
316 | return publisherVersionAuthor; | 316 | return publisherVersionAuthor; |
317 | } | 317 | } |
318 | 318 | ||
319 | - public void setPublisherVersionAuthor(Person publisherVersionAuthor) { | 319 | + public void setPublisherVersionAuthor(Account publisherVersionAuthor) { |
320 | this.publisherVersionAuthor = publisherVersionAuthor; | 320 | this.publisherVersionAuthor = publisherVersionAuthor; |
321 | } | 321 | } |
322 | 322 | ... | ... |
1 | package org.legrog.web.user; | 1 | package org.legrog.web.user; |
2 | 2 | ||
3 | -import org.legrog.entities.Person; | 3 | +import org.legrog.entities.Account; |
4 | 4 | ||
5 | import javax.annotation.PostConstruct; | 5 | import javax.annotation.PostConstruct; |
6 | import javax.enterprise.context.RequestScoped; | 6 | import javax.enterprise.context.RequestScoped; |
... | @@ -14,19 +14,19 @@ public class ListUsersBean { | ... | @@ -14,19 +14,19 @@ public class ListUsersBean { |
14 | @Inject | 14 | @Inject |
15 | private UserService userService; | 15 | private UserService userService; |
16 | 16 | ||
17 | - private List<Person> persons; | 17 | + private List<Account> accounts; |
18 | 18 | ||
19 | - public List<Person> getPersons() { | 19 | + public List<Account> getAccounts() { |
20 | - return persons; | 20 | + return accounts; |
21 | } | 21 | } |
22 | 22 | ||
23 | - public void setPersons(List<Person> persons) { | 23 | + public void setAccounts(List<Account> accounts) { |
24 | - this.persons = persons; | 24 | + this.accounts = accounts; |
25 | } | 25 | } |
26 | 26 | ||
27 | @PostConstruct | 27 | @PostConstruct |
28 | public void init() { | 28 | public void init() { |
29 | - persons = userService.getAllUsers(); | 29 | + accounts = userService.getAllUsers(); |
30 | } | 30 | } |
31 | 31 | ||
32 | } | 32 | } | ... | ... |
... | @@ -24,8 +24,8 @@ public class UpdateUserBean { | ... | @@ -24,8 +24,8 @@ public class UpdateUserBean { |
24 | private SharedService sharedService; | 24 | private SharedService sharedService; |
25 | 25 | ||
26 | private List<DisplayNameMask> allDisplayNameMasks; | 26 | private List<DisplayNameMask> allDisplayNameMasks; |
27 | - private List<UserRole> availableUserRoles; | 27 | + private List<AccountRole> availableAccountRoles; |
28 | - private List<UserProperty> availableUserProperties; | 28 | + private List<AccountProperty> availableUserProperties; |
29 | 29 | ||
30 | @ManagedProperty("#{param.userId}") | 30 | @ManagedProperty("#{param.userId}") |
31 | private int userId; | 31 | private int userId; |
... | @@ -37,9 +37,9 @@ public class UpdateUserBean { | ... | @@ -37,9 +37,9 @@ public class UpdateUserBean { |
37 | private String email; | 37 | private String email; |
38 | private boolean anonymous; | 38 | private boolean anonymous; |
39 | private String password; | 39 | private String password; |
40 | - private List<UserRole> roles; | 40 | + private List<AccountRole> roles; |
41 | private String presentation; | 41 | private String presentation; |
42 | - private List<UserAttribute> userAttributes; | 42 | + private List<AccountAttribute> accountAttributes; |
43 | private boolean criticProvider; | 43 | private boolean criticProvider; |
44 | private boolean visible; | 44 | private boolean visible; |
45 | private boolean activated; | 45 | private boolean activated; |
... | @@ -59,41 +59,41 @@ public class UpdateUserBean { | ... | @@ -59,41 +59,41 @@ public class UpdateUserBean { |
59 | public void init() { | 59 | public void init() { |
60 | logger.info("init"); | 60 | logger.info("init"); |
61 | allDisplayNameMasks = sharedService.getAllDisplayNameMasks(); | 61 | allDisplayNameMasks = sharedService.getAllDisplayNameMasks(); |
62 | - availableUserRoles = sharedService.getAvailableUserRoles(); | 62 | + availableAccountRoles = sharedService.getAvailableUserRoles(); |
63 | availableUserProperties = sharedService.getAvailableUserProperties(); | 63 | availableUserProperties = sharedService.getAvailableUserProperties(); |
64 | } | 64 | } |
65 | 65 | ||
66 | 66 | ||
67 | public String add() { | 67 | public String add() { |
68 | - Person person = new Person(); | 68 | + Account account = new Account(); |
69 | - person.setActivated(activated); | 69 | + account.setActivated(activated); |
70 | - person.setAnonymous(anonymous); | 70 | + account.setAnonymous(anonymous); |
71 | - if (userAttributes != null) { | 71 | + if (accountAttributes != null) { |
72 | - person.setAttributes(userAttributes); | 72 | + account.setAttributes(accountAttributes); |
73 | } | 73 | } |
74 | - person.setCriticProvider(criticProvider); | 74 | + account.setCriticProvider(criticProvider); |
75 | if (displayNameMask != null) { | 75 | if (displayNameMask != null) { |
76 | - person.setDisplayNameMask(displayNameMask); | 76 | + account.setDisplayNameMask(displayNameMask); |
77 | } else { | 77 | } else { |
78 | - person.setDisplayNameMask(DisplayNameMask.PRENOMNOM); | 78 | + account.setDisplayNameMask(DisplayNameMask.PRENOMNOM); |
79 | } | 79 | } |
80 | - person.setEmail(email); | 80 | + account.setEmail(email); |
81 | - person.setFirstName(firstName); | 81 | + account.setFirstName(firstName); |
82 | - person.setLastName(lastName); | 82 | + account.setLastName(lastName); |
83 | if (nickName != null && !nickName.isEmpty()) { | 83 | if (nickName != null && !nickName.isEmpty()) { |
84 | - person.setNickName(nickName); | 84 | + account.setNickName(nickName); |
85 | } | 85 | } |
86 | - person.setPassword(password); | 86 | + account.setPassword(password); |
87 | if (presentation != null) { | 87 | if (presentation != null) { |
88 | - person.setPresentation(presentation); | 88 | + account.setPresentation(presentation); |
89 | } | 89 | } |
90 | if (roles != null) { | 90 | if (roles != null) { |
91 | - person.setRoles(roles); | 91 | + account.setRoles(roles); |
92 | } | 92 | } |
93 | - person.setUsername(username); | 93 | + account.setUsername(username); |
94 | - person.setVisible(visible); | 94 | + account.setVisible(visible); |
95 | - person.setCreationDate(new Date()); | 95 | + account.setCreationDate(new Date()); |
96 | - userService.addUser(person); | 96 | + userService.addUser(account); |
97 | return "success"; | 97 | return "success"; |
98 | } | 98 | } |
99 | 99 | ||
... | @@ -103,25 +103,25 @@ public class UpdateUserBean { | ... | @@ -103,25 +103,25 @@ public class UpdateUserBean { |
103 | logger.info("userId =" + userId); | 103 | logger.info("userId =" + userId); |
104 | this.userId = userId; | 104 | this.userId = userId; |
105 | if (userId != 0) { | 105 | if (userId != 0) { |
106 | - Person person = userService.findUserById(userId); | 106 | + Account account = userService.findUserById(userId); |
107 | - if (person != null) { | 107 | + if (account != null) { |
108 | - activated = person.isActivated(); | 108 | + activated = account.isActivated(); |
109 | - anonymous = person.isAnonymous(); | 109 | + anonymous = account.isAnonymous(); |
110 | - userAttributes = person.getAttributes(); | 110 | + accountAttributes = account.getAttributes(); |
111 | - criticProvider = person.isCriticProvider(); | 111 | + criticProvider = account.isCriticProvider(); |
112 | - displayNameMask = person.getDisplayNameMask(); | 112 | + displayNameMask = account.getDisplayNameMask(); |
113 | - email = person.getEmail(); | 113 | + email = account.getEmail(); |
114 | - firstName = person.getFirstName(); | 114 | + firstName = account.getFirstName(); |
115 | - lastName = person.getLastName(); | 115 | + lastName = account.getLastName(); |
116 | - nickName = person.getNickName(); | 116 | + nickName = account.getNickName(); |
117 | - password = person.getPassword(); | 117 | + password = account.getPassword(); |
118 | - presentation = person.getPresentation(); | 118 | + presentation = account.getPresentation(); |
119 | - roles = person.getRoles(); | 119 | + roles = account.getRoles(); |
120 | if (roles == null) { | 120 | if (roles == null) { |
121 | - roles = new ArrayList<UserRole>(); | 121 | + roles = new ArrayList<AccountRole>(); |
122 | } | 122 | } |
123 | - username = person.getUsername(); | 123 | + username = account.getUsername(); |
124 | - visible = person.isVisible(); | 124 | + visible = account.isVisible(); |
125 | return "updateUser.xhtml"; | 125 | return "updateUser.xhtml"; |
126 | } | 126 | } |
127 | } | 127 | } |
... | @@ -132,32 +132,32 @@ public class UpdateUserBean { | ... | @@ -132,32 +132,32 @@ public class UpdateUserBean { |
132 | logger.info("update"); | 132 | logger.info("update"); |
133 | 133 | ||
134 | logger.info("userId =" + userId); | 134 | logger.info("userId =" + userId); |
135 | - Person person = userService.findUserById(userId); | 135 | + Account account = userService.findUserById(userId); |
136 | - person.setActivated(activated); | 136 | + account.setActivated(activated); |
137 | - person.setAnonymous(anonymous); | 137 | + account.setAnonymous(anonymous); |
138 | - person.setAttributes(userAttributes); | 138 | + account.setAttributes(accountAttributes); |
139 | - person.setCriticProvider(criticProvider); | 139 | + account.setCriticProvider(criticProvider); |
140 | - person.setDisplayNameMask(displayNameMask); | 140 | + account.setDisplayNameMask(displayNameMask); |
141 | - person.setEmail(email); | 141 | + account.setEmail(email); |
142 | - person.setFirstName(firstName); | 142 | + account.setFirstName(firstName); |
143 | - person.setLastName(lastName); | 143 | + account.setLastName(lastName); |
144 | - person.setNickName(nickName); | 144 | + account.setNickName(nickName); |
145 | - person.setPassword(password); | 145 | + account.setPassword(password); |
146 | - person.setPresentation(presentation); | 146 | + account.setPresentation(presentation); |
147 | - person.setRoles(roles); | 147 | + account.setRoles(roles); |
148 | - person.setUsername(username); | 148 | + account.setUsername(username); |
149 | - person.setVisible(visible); | 149 | + account.setVisible(visible); |
150 | - userService.updateUser(person); | 150 | + userService.updateUser(account); |
151 | return "success"; | 151 | return "success"; |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | - public List<UserRole> getAvailableUserRoles() { | 155 | + public List<AccountRole> getAvailableAccountRoles() { |
156 | - return availableUserRoles; | 156 | + return availableAccountRoles; |
157 | } | 157 | } |
158 | 158 | ||
159 | - public void setAvailableUserRoles(List<UserRole> availableUserRoles) { | 159 | + public void setAvailableAccountRoles(List<AccountRole> availableAccountRoles) { |
160 | - this.availableUserRoles = availableUserRoles; | 160 | + this.availableAccountRoles = availableAccountRoles; |
161 | } | 161 | } |
162 | 162 | ||
163 | public String getPresentation() { | 163 | public String getPresentation() { |
... | @@ -168,20 +168,20 @@ public class UpdateUserBean { | ... | @@ -168,20 +168,20 @@ public class UpdateUserBean { |
168 | this.presentation = presentation; | 168 | this.presentation = presentation; |
169 | } | 169 | } |
170 | 170 | ||
171 | - public List<UserProperty> getAvailableUserProperties() { | 171 | + public List<AccountProperty> getAvailableUserProperties() { |
172 | return availableUserProperties; | 172 | return availableUserProperties; |
173 | } | 173 | } |
174 | 174 | ||
175 | - public void setAvailableUserProperties(List<UserProperty> availableUserProperties) { | 175 | + public void setAvailableUserProperties(List<AccountProperty> availableUserProperties) { |
176 | this.availableUserProperties = availableUserProperties; | 176 | this.availableUserProperties = availableUserProperties; |
177 | } | 177 | } |
178 | 178 | ||
179 | - public List<UserAttribute> getUserAttributes() { | 179 | + public List<AccountAttribute> getAccountAttributes() { |
180 | - return userAttributes; | 180 | + return accountAttributes; |
181 | } | 181 | } |
182 | 182 | ||
183 | - public void setUserAttributes(List<UserAttribute> userAttributes) { | 183 | + public void setAccountAttributes(List<AccountAttribute> accountAttributes) { |
184 | - this.userAttributes = userAttributes; | 184 | + this.accountAttributes = accountAttributes; |
185 | } | 185 | } |
186 | 186 | ||
187 | public boolean isCriticProvider() { | 187 | public boolean isCriticProvider() { |
... | @@ -304,11 +304,11 @@ public class UpdateUserBean { | ... | @@ -304,11 +304,11 @@ public class UpdateUserBean { |
304 | this.password = password; | 304 | this.password = password; |
305 | } | 305 | } |
306 | 306 | ||
307 | - public List<UserRole> getRoles() { | 307 | + public List<AccountRole> getRoles() { |
308 | return roles; | 308 | return roles; |
309 | } | 309 | } |
310 | 310 | ||
311 | - public void setRoles(List<UserRole> roles) { | 311 | + public void setRoles(List<AccountRole> roles) { |
312 | this.roles = roles; | 312 | this.roles = roles; |
313 | } | 313 | } |
314 | } | 314 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | package org.legrog.web.user; | 1 | package org.legrog.web.user; |
2 | 2 | ||
3 | -import org.legrog.entities.Person; | 3 | +import org.legrog.entities.Account; |
4 | 4 | ||
5 | import java.util.List; | 5 | import java.util.List; |
6 | 6 | ||
7 | public interface UserService { | 7 | public interface UserService { |
8 | - void addUser(Person person); | 8 | + void addUser(Account account); |
9 | 9 | ||
10 | - List<Person> getAllUsers(); | 10 | + List<Account> getAllUsers(); |
11 | 11 | ||
12 | - Person findUserById(int id); | 12 | + Account findUserById(int id); |
13 | 13 | ||
14 | - void updateUser(Person person); | 14 | + void updateUser(Account account); |
15 | } | 15 | } | ... | ... |
1 | package org.legrog.web.user; | 1 | package org.legrog.web.user; |
2 | 2 | ||
3 | -import org.legrog.entities.Person; | 3 | +import org.legrog.entities.Account; |
4 | -import org.legrog.entities.PersonRepository; | 4 | +import org.legrog.entities.AccountRepository; |
5 | 5 | ||
6 | import javax.ejb.Stateless; | 6 | import javax.ejb.Stateless; |
7 | import javax.inject.Inject; | 7 | import javax.inject.Inject; |
... | @@ -10,21 +10,21 @@ import java.util.List; | ... | @@ -10,21 +10,21 @@ import java.util.List; |
10 | @Stateless | 10 | @Stateless |
11 | public class UserServiceSpring implements UserService { | 11 | public class UserServiceSpring implements UserService { |
12 | @Inject | 12 | @Inject |
13 | - PersonRepository personRepository; | 13 | + AccountRepository accountRepository; |
14 | 14 | ||
15 | - public void addUser(Person person) { | 15 | + public void addUser(Account account) { |
16 | - personRepository.save(person); | 16 | + accountRepository.save(account); |
17 | } | 17 | } |
18 | 18 | ||
19 | - public List<Person> getAllUsers() { | 19 | + public List<Account> getAllUsers() { |
20 | - return personRepository.findAll(); | 20 | + return accountRepository.findAll(); |
21 | } | 21 | } |
22 | 22 | ||
23 | - public Person findUserById(int id) { | 23 | + public Account findUserById(int id) { |
24 | - return personRepository.findOne(new Integer(id)); | 24 | + return accountRepository.findOne(new Integer(id)); |
25 | } | 25 | } |
26 | 26 | ||
27 | - public void updateUser(Person person) { | 27 | + public void updateUser(Account account) { |
28 | - personRepository.save(person); | 28 | + accountRepository.save(account); |
29 | } | 29 | } |
30 | } | 30 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -32,17 +32,17 @@ | ... | @@ -32,17 +32,17 @@ |
32 | 32 | ||
33 | <div id="listElements"> | 33 | <div id="listElements"> |
34 | 34 | ||
35 | - <h:commandLink styleClass="fRight acLink" action="add" rendered="#{not empty listUsersBean.persons}" > | 35 | + <h:commandLink styleClass="fRight acLink" action="add" rendered="#{not empty listUsersBean.accounts}" > |
36 | <img src="/images/structure/vide.gif" class="icAddC" alt="" title="Crer un nouvel utilisateur" /> | 36 | <img src="/images/structure/vide.gif" class="icAddC" alt="" title="Crer un nouvel utilisateur" /> |
37 | Nouvel Utilisateur | 37 | Nouvel Utilisateur |
38 | </h:commandLink> | 38 | </h:commandLink> |
39 | 39 | ||
40 | - <p:dataTable id="tableElements" rendered="#{not empty listUsersBean.persons}" | 40 | + <p:dataTable id="tableElements" rendered="#{not empty listUsersBean.accounts}" |
41 | - var="person" value="#{listUsersBean.persons}" | 41 | + var="account" value="#{listUsersBean.accounts}" |
42 | styleClass="results" rowClasses="altRichRow,altRow"> | 42 | styleClass="results" rowClasses="altRichRow,altRow"> |
43 | <!-- TODO Grer la pagination --> | 43 | <!-- TODO Grer la pagination --> |
44 | -<!-- <p:dataTable id="tableElements" rendered="#{listUsersBean.persons.size>0}" | 44 | +<!-- <p:dataTable id="tableElements" rendered="#{listUsersBean.accounts.size>0}" |
45 | - var="person" value="#{listUsersBean.persons}" rows="#{userListMgr.pageSize}" | 45 | + var="account" value="#{listUsersBean.accounts}" rows="#{userListMgr.pageSize}" |
46 | styleClass="results" rowClasses="altRichRow,altRow">--> | 46 | styleClass="results" rowClasses="altRichRow,altRow">--> |
47 | <f:facet name="header"> | 47 | <f:facet name="header"> |
48 | <p:dataScroller for="tableElements" | 48 | <p:dataScroller for="tableElements" |
... | @@ -61,35 +61,35 @@ | ... | @@ -61,35 +61,35 @@ |
61 | </h:commandLink>--> | 61 | </h:commandLink>--> |
62 | </p:column> | 62 | </p:column> |
63 | <p:column> | 63 | <p:column> |
64 | - <h:commandLink action="#{updateUserBean.prepareUpdate(person.userId)}"> | 64 | + <h:commandLink action="#{updateUserBean.prepareUpdate(account.userId)}"> |
65 | <img src="/images/structure/vide.gif" class="icEdit" alt="Modifier" title="Modifier" /> | 65 | <img src="/images/structure/vide.gif" class="icEdit" alt="Modifier" title="Modifier" /> |
66 | </h:commandLink> | 66 | </h:commandLink> |
67 | </p:column> | 67 | </p:column> |
68 | - <p:column styleClass="third" sortBy="#{person.username}"> | 68 | + <p:column styleClass="third" sortBy="#{account.username}"> |
69 | <f:facet name="header">Identifiant</f:facet> | 69 | <f:facet name="header">Identifiant</f:facet> |
70 | <!-- TODO Dcider de l'avenir de traceable --> | 70 | <!-- TODO Dcider de l'avenir de traceable --> |
71 | <ui:remove> | 71 | <ui:remove> |
72 | - <!-- <h:outputLink value="#{person.traceable.urlRewrite}">--> | 72 | + <!-- <h:outputLink value="#{account.traceable.urlRewrite}">--> |
73 | </ui:remove> | 73 | </ui:remove> |
74 | - <h:outputText value="#{person.username}" /> | 74 | + <h:outputText value="#{account.username}" /> |
75 | <!-- </h:outputLink>--> | 75 | <!-- </h:outputLink>--> |
76 | </p:column> | 76 | </p:column> |
77 | - <p:column styleClass="third" sortBy="#{person.firstName} #{person.lastName}"> | 77 | + <p:column styleClass="third" sortBy="#{account.firstName} #{account.lastName}"> |
78 | <f:facet name="header">Nom</f:facet> | 78 | <f:facet name="header">Nom</f:facet> |
79 | <ui:remove> | 79 | <ui:remove> |
80 | - <!--<h:outputLink value="#{person.traceable.urlRewrite}">--> | 80 | + <!--<h:outputLink value="#{account.traceable.urlRewrite}">--> |
81 | </ui:remove> | 81 | </ui:remove> |
82 | - <h:outputText value="#{person.firstName} #{person.lastName}" /> | 82 | + <h:outputText value="#{account.firstName} #{account.lastName}" /> |
83 | <!--</h:outputLink>--> | 83 | <!--</h:outputLink>--> |
84 | </p:column> | 84 | </p:column> |
85 | - <p:column styleClass="third" sortBy="#{person.email}"> | 85 | + <p:column styleClass="third" sortBy="#{account.email}"> |
86 | <f:facet name="header">Email</f:facet> | 86 | <f:facet name="header">Email</f:facet> |
87 | - <h:outputText value="#{person.email}" /> | 87 | + <h:outputText value="#{account.email}" /> |
88 | </p:column> | 88 | </p:column> |
89 | <p:column> | 89 | <p:column> |
90 | - <h:graphicImage value="/images/structure/dVert.gif" rendered="#{person.visible and person.activated}" title="Utilisateur activ" /> | 90 | + <h:graphicImage value="/images/structure/dVert.gif" rendered="#{account.visible and account.activated}" title="Utilisateur activ" /> |
91 | - <h:graphicImage value="/images/structure/dOrange.gif" rendered="#{(not person.visible) and person.activated}" title="Utilisateur dsactiv" /> | 91 | + <h:graphicImage value="/images/structure/dOrange.gif" rendered="#{(not account.visible) and account.activated}" title="Utilisateur dsactiv" /> |
92 | - <h:graphicImage value="/images/structure/dRouge.gif" rendered="#{not person.activated}" title="Utilisateur non enregistr" /> | 92 | + <h:graphicImage value="/images/structure/dRouge.gif" rendered="#{not account.activated}" title="Utilisateur non enregistr" /> |
93 | </p:column> | 93 | </p:column> |
94 | <f:facet name="footer"> | 94 | <f:facet name="footer"> |
95 | <h:commandLink action="add" value="Crer un nouvel utilisateur" > | 95 | <h:commandLink action="add" value="Crer un nouvel utilisateur" > |
... | @@ -99,7 +99,7 @@ | ... | @@ -99,7 +99,7 @@ |
99 | </div> | 99 | </div> |
100 | <p> | 100 | <p> |
101 | <h:commandLink action="add" value="Crer un nouvel utilisateur" | 101 | <h:commandLink action="add" value="Crer un nouvel utilisateur" |
102 | - rendered="#{empty listUsersBean.persons}"> | 102 | + rendered="#{empty listUsersBean.accounts}"> |
103 | </h:commandLink> | 103 | </h:commandLink> |
104 | </p> | 104 | </p> |
105 | </h:form> | 105 | </h:form> | ... | ... |
... | @@ -12,8 +12,8 @@ | ... | @@ -12,8 +12,8 @@ |
12 | </h:commandLink> | 12 | </h:commandLink> |
13 | </h:form> | 13 | </h:form> |
14 | <ul> | 14 | <ul> |
15 | - <ui:repeat value="#{listUsersBean.persons}" var="person"> | 15 | + <ui:repeat value="#{listUsersBean.accounts}" var="account"> |
16 | - <li>#{person.username}</li> | 16 | + <li>#{account.username}</li> |
17 | </ui:repeat> | 17 | </ui:repeat> |
18 | </ul> | 18 | </ul> |
19 | </f:view> | 19 | </f:view> | ... | ... |
... | @@ -86,7 +86,7 @@ | ... | @@ -86,7 +86,7 @@ |
86 | <td><h:outputLabel for="roles">Rles</h:outputLabel></td> | 86 | <td><h:outputLabel for="roles">Rles</h:outputLabel></td> |
87 | <td> | 87 | <td> |
88 | <h:selectManyCheckbox id="roles" value="#{updateUserBean.roles}" converter="omnifaces.SelectItemsConverter" layout="pageDirection" > | 88 | <h:selectManyCheckbox id="roles" value="#{updateUserBean.roles}" converter="omnifaces.SelectItemsConverter" layout="pageDirection" > |
89 | - <f:selectItems value="#{updateUserBean.availableUserRoles}" var="role" itemLabel="#{role.rolename}" /> | 89 | + <f:selectItems value="#{updateUserBean.availableAccountRoles}" var="role" itemLabel="#{role.rolename}" /> |
90 | </h:selectManyCheckbox> | 90 | </h:selectManyCheckbox> |
91 | </td> | 91 | </td> |
92 | <td><h:message errorClass="errorMsg" infoClass="infoMsg" for="roles"/></td> | 92 | <td><h:message errorClass="errorMsg" infoClass="infoMsg" for="roles"/></td> |
... | @@ -110,7 +110,7 @@ | ... | @@ -110,7 +110,7 @@ |
110 | <h:outputText value="#{userProperty.tag}"/> | 110 | <h:outputText value="#{userProperty.tag}"/> |
111 | </h:column> | 111 | </h:column> |
112 | <h:column> | 112 | <h:column> |
113 | - <h:inputText id="prop_#{userProperty.name}" value="#{updateUserBean.userAttributes[userProperty.name].value}" style="width: 175px;"> | 113 | + <h:inputText id="prop_#{userProperty.name}" value="#{updateUserBean.accountAttributes[userProperty.name].value}" style="width: 175px;"> |
114 | <f:validateLength maximum="200"/> | 114 | <f:validateLength maximum="200"/> |
115 | </h:inputText> | 115 | </h:inputText> |
116 | </h:column> | 116 | </h:column> | ... | ... |
... | @@ -12,9 +12,9 @@ public interface SharedService { | ... | @@ -12,9 +12,9 @@ public interface SharedService { |
12 | 12 | ||
13 | List<DisplayNameMask> getAllDisplayNameMasks(); | 13 | List<DisplayNameMask> getAllDisplayNameMasks(); |
14 | 14 | ||
15 | - List<UserRole> getAvailableUserRoles(); | 15 | + List<AccountRole> getAvailableUserRoles(); |
16 | 16 | ||
17 | - List<UserProperty> getAvailableUserProperties(); | 17 | + List<AccountProperty> getAvailableUserProperties(); |
18 | 18 | ||
19 | - Person getCurrentUser(); | 19 | + Account getCurrentUser(); |
20 | } | 20 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -15,16 +15,16 @@ import java.util.Vector; | ... | @@ -15,16 +15,16 @@ import java.util.Vector; |
15 | public class SharedServiceSpring implements SharedService { | 15 | public class SharedServiceSpring implements SharedService { |
16 | 16 | ||
17 | CountryRepository countryRepository; | 17 | CountryRepository countryRepository; |
18 | - UserRoleRepository userRoleRepository; | 18 | + AccountRoleRepository accountRoleRepository; |
19 | - UserPropertyRepository userPropertyRepository; | 19 | + AccountPropertyRepository accountPropertyRepository; |
20 | UserService userService; | 20 | UserService userService; |
21 | 21 | ||
22 | @Inject | 22 | @Inject |
23 | - public SharedServiceSpring(CountryRepository countryRepository, UserRoleRepository userRoleRepository, | 23 | + public SharedServiceSpring(CountryRepository countryRepository, AccountRoleRepository accountRoleRepository, |
24 | - UserPropertyRepository userPropertyRepository, UserService userService) { | 24 | + AccountPropertyRepository accountPropertyRepository, UserService userService) { |
25 | this.countryRepository = countryRepository; | 25 | this.countryRepository = countryRepository; |
26 | - this.userRoleRepository = userRoleRepository; | 26 | + this.accountRoleRepository = accountRoleRepository; |
27 | - this.userPropertyRepository = userPropertyRepository; | 27 | + this.accountPropertyRepository = accountPropertyRepository; |
28 | this.userService = userService; | 28 | this.userService = userService; |
29 | } | 29 | } |
30 | 30 | ||
... | @@ -52,18 +52,18 @@ public class SharedServiceSpring implements SharedService { | ... | @@ -52,18 +52,18 @@ public class SharedServiceSpring implements SharedService { |
52 | return allDisplayNameMasks; | 52 | return allDisplayNameMasks; |
53 | } | 53 | } |
54 | 54 | ||
55 | - public List<UserRole> getAvailableUserRoles() { | 55 | + public List<AccountRole> getAvailableUserRoles() { |
56 | - return userRoleRepository.findAll(); | 56 | + return accountRoleRepository.findAll(); |
57 | } | 57 | } |
58 | 58 | ||
59 | - public List<UserProperty> getAvailableUserProperties() { return userPropertyRepository.findAll(); } | 59 | + public List<AccountProperty> getAvailableUserProperties() { return accountPropertyRepository.findAll(); } |
60 | 60 | ||
61 | - public Person getCurrentUser() { | 61 | + public Account getCurrentUser() { |
62 | // TODO Remplacer l'astuce par une vraie récupération de l'utilisateur | 62 | // TODO Remplacer l'astuce par une vraie récupération de l'utilisateur |
63 | - List<Person> persons = userService.getAllUsers(); | 63 | + List<Account> accounts = userService.getAllUsers(); |
64 | Random random = new Random(); | 64 | Random random = new Random(); |
65 | - Person person = persons.get(random.nextInt(persons.size())); | 65 | + Account account = accounts.get(random.nextInt(accounts.size())); |
66 | // End TODO | 66 | // End TODO |
67 | - return person; | 67 | + return account; |
68 | } | 68 | } |
69 | } | 69 | } | ... | ... |
... | @@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test; | ... | @@ -7,6 +7,8 @@ import org.junit.jupiter.api.Test; |
7 | import org.junit.jupiter.api.extension.ExtendWith; | 7 | import org.junit.jupiter.api.extension.ExtendWith; |
8 | import org.junit.platform.runner.JUnitPlatform; | 8 | import org.junit.platform.runner.JUnitPlatform; |
9 | import org.junit.runner.RunWith; | 9 | import org.junit.runner.RunWith; |
10 | +import org.legrog.entities.AccountProperty; | ||
11 | +import org.legrog.entities.AccountRole; | ||
10 | import org.legrog.entities.DisplayNameMask; | 12 | import org.legrog.entities.DisplayNameMask; |
11 | import org.legrog.test.MockitoExtension; | 13 | import org.legrog.test.MockitoExtension; |
12 | import org.legrog.web.xyz.SharedService; | 14 | import org.legrog.web.xyz.SharedService; |
... | @@ -20,10 +22,10 @@ import static org.mockito.Mockito.when; | ... | @@ -20,10 +22,10 @@ import static org.mockito.Mockito.when; |
20 | /** | 22 | /** |
21 | * Created by jai on 15/11/16. | 23 | * Created by jai on 15/11/16. |
22 | */ | 24 | */ |
23 | -@DisplayName("Update Person Bean") | 25 | +@DisplayName("Update Account Bean") |
24 | @ExtendWith(MockitoExtension.class) | 26 | @ExtendWith(MockitoExtension.class) |
25 | @RunWith(JUnitPlatform.class) | 27 | @RunWith(JUnitPlatform.class) |
26 | -public class UpdatePersonBeanTest { | 28 | +public class UpdateAccountBeanTest { |
27 | 29 | ||
28 | UpdateUserBean updateUserBean; | 30 | UpdateUserBean updateUserBean; |
29 | 31 | ||
... | @@ -33,7 +35,7 @@ public class UpdatePersonBeanTest { | ... | @@ -33,7 +35,7 @@ public class UpdatePersonBeanTest { |
33 | } | 35 | } |
34 | 36 | ||
35 | @Test | 37 | @Test |
36 | - @DisplayName("depends on Shared Service and Person Service") | 38 | + @DisplayName("depends on Shared Service and Account Service") |
37 | public void testDependencies() { | 39 | public void testDependencies() { |
38 | assertThat(updateUserBean).isNotNull(); | 40 | assertThat(updateUserBean).isNotNull(); |
39 | } | 41 | } |
... | @@ -43,14 +45,14 @@ public class UpdatePersonBeanTest { | ... | @@ -43,14 +45,14 @@ public class UpdatePersonBeanTest { |
43 | class init { | 45 | class init { |
44 | 46 | ||
45 | private List<DisplayNameMask> displayNameMasks; | 47 | private List<DisplayNameMask> displayNameMasks; |
46 | - private List<org.legrog.entities.UserProperty> userProperties; | 48 | + private List<AccountProperty> userProperties; |
47 | - private List<org.legrog.entities.UserRole> userRoles; | 49 | + private List<AccountRole> accountRoles; |
48 | 50 | ||
49 | @BeforeEach | 51 | @BeforeEach |
50 | public void setUp(@Mock SharedService sharedService) { | 52 | public void setUp(@Mock SharedService sharedService) { |
51 | when(sharedService.getAllDisplayNameMasks()).thenReturn(displayNameMasks); | 53 | when(sharedService.getAllDisplayNameMasks()).thenReturn(displayNameMasks); |
52 | when(sharedService.getAvailableUserProperties()).thenReturn(userProperties); | 54 | when(sharedService.getAvailableUserProperties()).thenReturn(userProperties); |
53 | - when(sharedService.getAvailableUserRoles()).thenReturn(userRoles); | 55 | + when(sharedService.getAvailableUserRoles()).thenReturn(accountRoles); |
54 | } | 56 | } |
55 | 57 | ||
56 | @Test | 58 | @Test |
... | @@ -59,7 +61,7 @@ public class UpdatePersonBeanTest { | ... | @@ -59,7 +61,7 @@ public class UpdatePersonBeanTest { |
59 | updateUserBean.init(); | 61 | updateUserBean.init(); |
60 | assertThat(updateUserBean.getAllDisplayNameMasks()).isEqualTo(displayNameMasks); | 62 | assertThat(updateUserBean.getAllDisplayNameMasks()).isEqualTo(displayNameMasks); |
61 | assertThat(updateUserBean.getAvailableUserProperties()).isEqualTo(userProperties); | 63 | assertThat(updateUserBean.getAvailableUserProperties()).isEqualTo(userProperties); |
62 | - assertThat(updateUserBean.getAvailableUserRoles()).isEqualTo(userRoles); | 64 | + assertThat(updateUserBean.getAvailableAccountRoles()).isEqualTo(accountRoles); |
63 | } | 65 | } |
64 | } | 66 | } |
65 | 67 | ... | ... |
-
Please register or login to post a comment