Jean-Francois Leveque

Elimination des annotations BD et refactoring de User en Person car user est un mot réservé en BD.

...@@ -11,12 +11,10 @@ import java.util.*; ...@@ -11,12 +11,10 @@ import java.util.*;
11 Migréee depuis la v2. 11 Migréee depuis la v2.
12 */ 12 */
13 @Entity 13 @Entity
14 -@Table(name="UserTable") 14 +public class Person /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ {
15 -public class User /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ {
16 15
17 @Id 16 @Id
18 @GeneratedValue(strategy = GenerationType.IDENTITY) 17 @GeneratedValue(strategy = GenerationType.IDENTITY)
19 - @Column(name="USER_ID")
20 private int userId; 18 private int userId;
21 19
22 // TODO traiter Traceable 20 // TODO traiter Traceable
...@@ -183,7 +181,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di ...@@ -183,7 +181,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
183 { 181 {
184 if ((role != null) && !(getRoles().contains(role)) ) 182 if ((role != null) && !(getRoles().contains(role)) )
185 { 183 {
186 - role.getUsers().add(this); 184 + role.getPersons().add(this);
187 getRoles().add(role); 185 getRoles().add(role);
188 } 186 }
189 } 187 }
...@@ -191,7 +189,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di ...@@ -191,7 +189,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
191 */ 189 */
192 /** 190 /**
193 * Remove the user from a given {@link UserRole}s. 191 * Remove the user from a given {@link UserRole}s.
194 - * @param role the {@link UserRole} this {@link User} will lose. Ignored if <code>null</code>. 192 + * @param role the {@link UserRole} this {@link Person} will lose. Ignored if <code>null</code>.
195 * @see #getRoles() 193 * @see #getRoles()
196 * @see #setRoles(List) 194 * @see #setRoles(List)
197 * @see #addToRole(UserRole) 195 * @see #addToRole(UserRole)
...@@ -202,7 +200,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di ...@@ -202,7 +200,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
202 { 200 {
203 if ((role != null) && (getRoles().contains(role)) ) 201 if ((role != null) && (getRoles().contains(role)) )
204 { 202 {
205 - role.getUsers().remove(this); 203 + role.getPersons().remove(this);
206 getRoles().remove(role); 204 getRoles().remove(role);
207 } 205 }
208 } 206 }
...@@ -303,7 +301,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di ...@@ -303,7 +301,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
303 */ 301 */
304 /** 302 /**
305 * Remove a book from user's collection. 303 * Remove a book from user's collection.
306 - * @param book the {@link org.roliste.data.db.BookDetails} this {@link User} will lose. Ignored if <code>null</code>. 304 + * @param book the {@link org.roliste.data.db.BookDetails} this {@link Person} will lose. Ignored if <code>null</code>.
307 * @see #getCollection() 305 * @see #getCollection()
308 * @see #setCollection(List) 306 * @see #setCollection(List)
309 * @see #addToCollection(BookDetails) 307 * @see #addToCollection(BookDetails)
...@@ -392,7 +390,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di ...@@ -392,7 +390,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
392 */ 390 */
393 /** 391 /**
394 * Remove delegation on a given {@link Traceable} from this user. 392 * Remove delegation on a given {@link Traceable} from this user.
395 - * @param object the delegation this {@link User} will lose. Ignored if <code>null</code>. 393 + * @param object the delegation this {@link Person} will lose. Ignored if <code>null</code>.
396 * @see #getDelegations() 394 * @see #getDelegations()
397 * @see #setDelegations(List) 395 * @see #setDelegations(List)
398 * @see #giveDelegation(Traceable) 396 * @see #giveDelegation(Traceable)
......
...@@ -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 UserRepository extends JpaRepository<User, Integer> { 5 +public interface PersonRepository extends JpaRepository<Person, Integer> {
6 } 6 }
......
...@@ -15,7 +15,7 @@ public class PublisherAction { ...@@ -15,7 +15,7 @@ public class PublisherAction {
15 @ManyToOne 15 @ManyToOne
16 private UserAction userAction; 16 private UserAction userAction;
17 @ManyToOne 17 @ManyToOne
18 - private User publisherActionAuthor; 18 + private Person 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(User publisherActionAuthor) { 28 + public void setPublisherActionAuthor(Person 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 userAction; 49 return userAction;
50 } 50 }
51 51
52 - public User getPublisherActionAuthor() { 52 + public Person 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 User publisherVersionAuthor; 34 + private Person 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 User getPublisherVersionAuthor() { 149 + public Person getPublisherVersionAuthor() {
150 return publisherVersionAuthor; 150 return publisherVersionAuthor;
151 } 151 }
152 152
153 - public void setPublisherVersionAuthor(User publisherVersionAuthor) { 153 + public void setPublisherVersionAuthor(Person publisherVersionAuthor) {
154 this.publisherVersionAuthor = publisherVersionAuthor; 154 this.publisherVersionAuthor = publisherVersionAuthor;
155 } 155 }
156 156
......
...@@ -17,37 +17,37 @@ public class UserAttribute { ...@@ -17,37 +17,37 @@ public class UserAttribute {
17 } 17 }
18 18
19 /** 19 /**
20 - * The linked user. 20 + * The linked person.
21 */ 21 */
22 @ManyToOne 22 @ManyToOne
23 @JoinColumn(name = "USER_ID") 23 @JoinColumn(name = "USER_ID")
24 - private User user; 24 + private Person person;
25 25
26 /** 26 /**
27 - * Retrieve the user this attribute is attached to. 27 + * Retrieve the person this attribute is attached to.
28 * hibernate.many-to-one 28 * hibernate.many-to-one
29 * column="ID_UTILISATEUR" 29 * column="ID_UTILISATEUR"
30 - * class="org.roliste.data.db.User" 30 + * class="org.roliste.data.db.Person"
31 * not-null="true" 31 * not-null="true"
32 * access="property" 32 * access="property"
33 * lazy="proxy" 33 * lazy="proxy"
34 * properties-name="PropertyPerUser" 34 * properties-name="PropertyPerUser"
35 * foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR" 35 * foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR"
36 - * @return the {link org.roliste.data.db.User} this attribute is attached to. 36 + * @return the {link org.roliste.data.db.Person} this attribute is attached to.
37 * Shall not be <code>null</code>. 37 * Shall not be <code>null</code>.
38 - * see #setUser(org.roliste.data.db.User) 38 + * see #setPerson(org.roliste.data.db.Person)
39 */ 39 */
40 - public User getUser() { 40 + public Person getPerson() {
41 - return user; 41 + return person;
42 } 42 }
43 43
44 /** 44 /**
45 - * Set the user this attribute is attached to. 45 + * Set the person this attribute is attached to.
46 - * @param user the new {link org.roliste.data.db.User} this attribute will be attached to. Shall not be <code>null</code>. 46 + * @param person the new {link org.roliste.data.db.Person} this attribute will be attached to. Shall not be <code>null</code>.
47 - * @see #getUser() 47 + * @see #getPerson()
48 */ 48 */
49 - public void setUser(User user) { 49 + public void setPerson(Person person) {
50 - this.user = user; 50 + this.person = person;
51 } 51 }
52 52
53 /** 53 /**
...@@ -114,8 +114,8 @@ public class UserAttribute { ...@@ -114,8 +114,8 @@ public class UserAttribute {
114 } 114 }
115 115
116 /** 116 /**
117 - * Returns a string representation of this user attribute definition. 117 + * Returns a string representation of this person attribute definition.
118 - * @return a string representing this user attribute definition. 118 + * @return a string representing this person attribute definition.
119 * hidden 119 * hidden
120 */ 120 */
121 @Override 121 @Override
......
...@@ -7,7 +7,7 @@ import javax.persistence.*; ...@@ -7,7 +7,7 @@ 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 User} may be part of one or more {@link UserRole}. 10 + * A given {@link Person} may be part of one or more {@link UserRole}.
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.
...@@ -23,7 +23,6 @@ public class UserRole /* extends org.roliste.data.DbEntity */ ...@@ -23,7 +23,6 @@ public class UserRole /* extends org.roliste.data.DbEntity */
23 { 23 {
24 @Id 24 @Id
25 @GeneratedValue(strategy = GenerationType.IDENTITY) 25 @GeneratedValue(strategy = GenerationType.IDENTITY)
26 - @Column(name="USER_ROLE_ID")
27 private int userRoleId; 26 private int userRoleId;
28 27
29 /** 28 /**
...@@ -32,11 +31,10 @@ public class UserRole /* extends org.roliste.data.DbEntity */ ...@@ -32,11 +31,10 @@ public class UserRole /* extends org.roliste.data.DbEntity */
32 private String rolename; 31 private String rolename;
33 32
34 /** 33 /**
35 - * The {@link User}s for this user role. 34 + * The {@link Person}s for this user role.
36 */ 35 */
37 @ManyToMany(mappedBy = "roles") 36 @ManyToMany(mappedBy = "roles")
38 - @Column(name = "USER_ID") 37 + private Set<Person> persons;
39 - private Set<User> users;
40 38
41 /** 39 /**
42 * Builds a new and empty user role definition. 40 * Builds a new and empty user role definition.
...@@ -49,7 +47,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */ ...@@ -49,7 +47,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */
49 rolename = null; 47 rolename = null;
50 visible = true; 48 visible = true;
51 // no need to synchronize this 49 // no need to synchronize this
52 - users = new HashSet<User>(); 50 + persons = new HashSet<Person>();
53 } 51 }
54 52
55 public int getUserRoleId() { 53 public int getUserRoleId() {
...@@ -92,7 +90,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */ ...@@ -92,7 +90,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */
92 90
93 /** 91 /**
94 * Indicates if the role is visible. 92 * Indicates if the role is visible.
95 - * If not, users should not be able to access the privileges 93 + * If not, persons should not be able to access the privileges
96 * they inherit from being part of this role. 94 * they inherit from being part of this role.
97 * @return the visible flag. 95 * @return the visible flag.
98 * @see #setVisible(boolean) 96 * @see #setVisible(boolean)
...@@ -114,15 +112,15 @@ public class UserRole /* extends org.roliste.data.DbEntity */ ...@@ -114,15 +112,15 @@ public class UserRole /* extends org.roliste.data.DbEntity */
114 } 112 }
115 113
116 /** 114 /**
117 - * Retrieves the list of {@link User}s for this user role. 115 + * Retrieves the list of {@link Person}s for this user role.
118 * SHALL be used as a read-only attribute. In particular, avoid 116 * SHALL be used as a read-only attribute. In particular, avoid
119 * using {@link Set#add(Object)} or {@link Set#remove(Object)} on 117 * using {@link Set#add(Object)} or {@link Set#remove(Object)} on
120 * the returned value without caution. 118 * the returned value without caution.
121 - * @return a {@link Set} of {@link User}. May be <code>null</code>. 119 + * @return a {@link Set} of {@link Person}. May be <code>null</code>.
122 - * @see #setUsers(Set) 120 + * @see #setPersons(Set)
123 * hibernate.many-to-many 121 * hibernate.many-to-many
124 * column="UTILISATEUR_FK" 122 * column="UTILISATEUR_FK"
125 - * class="org.roliste.data.db.User" 123 + * class="org.roliste.data.db.Person"
126 * foreign-key="FK_UTILISATEURROLE_UTILISATEUR" 124 * foreign-key="FK_UTILISATEURROLE_UTILISATEUR"
127 * hibernate.key 125 * hibernate.key
128 * column="ROLE_FK" 126 * column="ROLE_FK"
...@@ -134,18 +132,18 @@ public class UserRole /* extends org.roliste.data.DbEntity */ ...@@ -134,18 +132,18 @@ public class UserRole /* extends org.roliste.data.DbEntity */
134 * lazy="true" 132 * lazy="true"
135 * inverse="true" 133 * inverse="true"
136 */ 134 */
137 - public Set<User> getUsers() { 135 + public Set<Person> getPersons() {
138 - return users; 136 + return persons;
139 } 137 }
140 138
141 /** 139 /**
142 - * Sets the list of {@link User}s for this user role. 140 + * Sets the list of {@link Person}s for this user role.
143 - * @param users the new {@link Set} of {@link User}s. May be 141 + * @param persons the new {@link Set} of {@link Person}s. May be
144 * <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).
145 - * @see #getUsers() 143 + * @see #getPersons()
146 */ 144 */
147 - protected void setUsers(Set<User> users) { 145 + protected void setPersons(Set<Person> persons) {
148 - this.users = users; 146 + this.persons = persons;
149 } 147 }
150 148
151 /** 149 /**
......
...@@ -4,7 +4,7 @@ import org.legrog.entities.PublisherVersion; ...@@ -4,7 +4,7 @@ import org.legrog.entities.PublisherVersion;
4 import org.legrog.web.xyz.SharedService; 4 import org.legrog.web.xyz.SharedService;
5 import org.legrog.entities.Country; 5 import org.legrog.entities.Country;
6 import org.legrog.entities.Publisher; 6 import org.legrog.entities.Publisher;
7 -import org.legrog.entities.User; 7 +import org.legrog.entities.Person;
8 import org.slf4j.Logger; 8 import org.slf4j.Logger;
9 import org.slf4j.LoggerFactory; 9 import org.slf4j.LoggerFactory;
10 10
...@@ -47,7 +47,7 @@ public class PublisherVersionView implements Serializable { ...@@ -47,7 +47,7 @@ public class PublisherVersionView implements Serializable {
47 private String publisherURL; 47 private String publisherURL;
48 private boolean publisherActive; 48 private boolean publisherActive;
49 private String publisherHistory; 49 private String publisherHistory;
50 - private User publisherVersionAuthor; 50 + private Person publisherVersionAuthor;
51 private Timestamp publisherVersionDatetime; 51 private Timestamp publisherVersionDatetime;
52 52
53 private Publisher publisher; 53 private Publisher publisher;
...@@ -313,11 +313,11 @@ public class PublisherVersionView implements Serializable { ...@@ -313,11 +313,11 @@ public class PublisherVersionView implements Serializable {
313 this.publisherHistory = publisherHistory; 313 this.publisherHistory = publisherHistory;
314 } 314 }
315 315
316 - public User getPublisherVersionAuthor() { 316 + public Person getPublisherVersionAuthor() {
317 return publisherVersionAuthor; 317 return publisherVersionAuthor;
318 } 318 }
319 319
320 - public void setPublisherVersionAuthor(User publisherVersionAuthor) { 320 + public void setPublisherVersionAuthor(Person publisherVersionAuthor) {
321 this.publisherVersionAuthor = publisherVersionAuthor; 321 this.publisherVersionAuthor = publisherVersionAuthor;
322 } 322 }
323 323
......
1 package org.legrog.web.user; 1 package org.legrog.web.user;
2 2
3 -import org.legrog.entities.User; 3 +import org.legrog.entities.Person;
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<User> users; 17 + private List<Person> persons;
18 18
19 - public List<User> getUsers() { 19 + public List<Person> getPersons() {
20 - return users; 20 + return persons;
21 } 21 }
22 22
23 - public void setUsers(List<User> users) { 23 + public void setPersons(List<Person> persons) {
24 - this.users = users; 24 + this.persons = persons;
25 } 25 }
26 26
27 @PostConstruct 27 @PostConstruct
28 public void init() { 28 public void init() {
29 - users = userService.getAllUsers(); 29 + persons = userService.getAllUsers();
30 } 30 }
31 31
32 } 32 }
......
...@@ -65,35 +65,35 @@ public class UpdateUserBean { ...@@ -65,35 +65,35 @@ public class UpdateUserBean {
65 65
66 66
67 public String add() { 67 public String add() {
68 - User user = new User(); 68 + Person person = new Person();
69 - user.setActivated(activated); 69 + person.setActivated(activated);
70 - user.setAnonymous(anonymous); 70 + person.setAnonymous(anonymous);
71 if (userAttributes != null) { 71 if (userAttributes != null) {
72 - user.setAttributes(userAttributes); 72 + person.setAttributes(userAttributes);
73 } 73 }
74 - user.setCriticProvider(criticProvider); 74 + person.setCriticProvider(criticProvider);
75 if (displayNameMask != null) { 75 if (displayNameMask != null) {
76 - user.setDisplayNameMask(displayNameMask); 76 + person.setDisplayNameMask(displayNameMask);
77 } else { 77 } else {
78 - user.setDisplayNameMask(DisplayNameMask.PRENOMNOM); 78 + person.setDisplayNameMask(DisplayNameMask.PRENOMNOM);
79 } 79 }
80 - user.setEmail(email); 80 + person.setEmail(email);
81 - user.setFirstName(firstName); 81 + person.setFirstName(firstName);
82 - user.setLastName(lastName); 82 + person.setLastName(lastName);
83 if (nickName != null && !nickName.isEmpty()) { 83 if (nickName != null && !nickName.isEmpty()) {
84 - user.setNickName(nickName); 84 + person.setNickName(nickName);
85 } 85 }
86 - user.setPassword(password); 86 + person.setPassword(password);
87 if (presentation != null) { 87 if (presentation != null) {
88 - user.setPresentation(presentation); 88 + person.setPresentation(presentation);
89 } 89 }
90 if (roles != null) { 90 if (roles != null) {
91 - user.setRoles(roles); 91 + person.setRoles(roles);
92 } 92 }
93 - user.setUsername(username); 93 + person.setUsername(username);
94 - user.setVisible(visible); 94 + person.setVisible(visible);
95 - user.setCreationDate(new Date()); 95 + person.setCreationDate(new Date());
96 - userService.addUser(user); 96 + userService.addUser(person);
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 - User user = userService.findUserById(userId); 106 + Person person = userService.findUserById(userId);
107 - if (user != null) { 107 + if (person != null) {
108 - activated = user.isActivated(); 108 + activated = person.isActivated();
109 - anonymous = user.isAnonymous(); 109 + anonymous = person.isAnonymous();
110 - userAttributes = user.getAttributes(); 110 + userAttributes = person.getAttributes();
111 - criticProvider = user.isCriticProvider(); 111 + criticProvider = person.isCriticProvider();
112 - displayNameMask = user.getDisplayNameMask(); 112 + displayNameMask = person.getDisplayNameMask();
113 - email = user.getEmail(); 113 + email = person.getEmail();
114 - firstName = user.getFirstName(); 114 + firstName = person.getFirstName();
115 - lastName = user.getLastName(); 115 + lastName = person.getLastName();
116 - nickName = user.getNickName(); 116 + nickName = person.getNickName();
117 - password = user.getPassword(); 117 + password = person.getPassword();
118 - presentation = user.getPresentation(); 118 + presentation = person.getPresentation();
119 - roles = user.getRoles(); 119 + roles = person.getRoles();
120 if (roles == null) { 120 if (roles == null) {
121 roles = new ArrayList<UserRole>(); 121 roles = new ArrayList<UserRole>();
122 } 122 }
123 - username = user.getUsername(); 123 + username = person.getUsername();
124 - visible = user.isVisible(); 124 + visible = person.isVisible();
125 return "updateUser.xhtml"; 125 return "updateUser.xhtml";
126 } 126 }
127 } 127 }
...@@ -132,22 +132,22 @@ public class UpdateUserBean { ...@@ -132,22 +132,22 @@ public class UpdateUserBean {
132 logger.info("update"); 132 logger.info("update");
133 133
134 logger.info("userId =" + userId); 134 logger.info("userId =" + userId);
135 - User user = userService.findUserById(userId); 135 + Person person = userService.findUserById(userId);
136 - user.setActivated(activated); 136 + person.setActivated(activated);
137 - user.setAnonymous(anonymous); 137 + person.setAnonymous(anonymous);
138 - user.setAttributes(userAttributes); 138 + person.setAttributes(userAttributes);
139 - user.setCriticProvider(criticProvider); 139 + person.setCriticProvider(criticProvider);
140 - user.setDisplayNameMask(displayNameMask); 140 + person.setDisplayNameMask(displayNameMask);
141 - user.setEmail(email); 141 + person.setEmail(email);
142 - user.setFirstName(firstName); 142 + person.setFirstName(firstName);
143 - user.setLastName(lastName); 143 + person.setLastName(lastName);
144 - user.setNickName(nickName); 144 + person.setNickName(nickName);
145 - user.setPassword(password); 145 + person.setPassword(password);
146 - user.setPresentation(presentation); 146 + person.setPresentation(presentation);
147 - user.setRoles(roles); 147 + person.setRoles(roles);
148 - user.setUsername(username); 148 + person.setUsername(username);
149 - user.setVisible(visible); 149 + person.setVisible(visible);
150 - userService.updateUser(user); 150 + userService.updateUser(person);
151 return "success"; 151 return "success";
152 } 152 }
153 153
......
1 package org.legrog.web.user; 1 package org.legrog.web.user;
2 2
3 -import org.legrog.entities.User; 3 +import org.legrog.entities.Person;
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(User user); 8 + void addUser(Person person);
9 9
10 - List<User> getAllUsers(); 10 + List<Person> getAllUsers();
11 11
12 - User findUserById(int id); 12 + Person findUserById(int id);
13 13
14 - void updateUser(User user); 14 + void updateUser(Person person);
15 } 15 }
......
1 package org.legrog.web.user; 1 package org.legrog.web.user;
2 2
3 -import org.legrog.entities.User; 3 +import org.legrog.entities.Person;
4 -import org.legrog.entities.UserRepository; 4 +import org.legrog.entities.PersonRepository;
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 - UserRepository userRepository; 13 + PersonRepository personRepository;
14 14
15 - public void addUser(User user) { 15 + public void addUser(Person person) {
16 - userRepository.save(user); 16 + personRepository.save(person);
17 } 17 }
18 18
19 - public List<User> getAllUsers() { 19 + public List<Person> getAllUsers() {
20 - return userRepository.findAll(); 20 + return personRepository.findAll();
21 } 21 }
22 22
23 - public User findUserById(int id) { 23 + public Person findUserById(int id) {
24 - return userRepository.findOne(new Integer(id)); 24 + return personRepository.findOne(new Integer(id));
25 } 25 }
26 26
27 - public void updateUser(User user) { 27 + public void updateUser(Person person) {
28 - userRepository.save(user); 28 + personRepository.save(person);
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.users}" > 35 + <h:commandLink styleClass="fRight acLink" action="add" rendered="#{not empty listUsersBean.persons}" >
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.users}" 40 + <p:dataTable id="tableElements" rendered="#{not empty listUsersBean.persons}"
41 - var="user" value="#{listUsersBean.users}" 41 + var="person" value="#{listUsersBean.persons}"
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.users.size>0}" 44 +<!-- <p:dataTable id="tableElements" rendered="#{listUsersBean.persons.size>0}"
45 - var="user" value="#{listUsersBean.users}" rows="#{userListMgr.pageSize}" 45 + var="person" value="#{listUsersBean.persons}" 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(user.userId)}"> 64 + <h:commandLink action="#{updateUserBean.prepareUpdate(person.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="#{user.username}"> 68 + <p:column styleClass="third" sortBy="#{person.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="#{user.traceable.urlRewrite}">--> 72 + <!-- <h:outputLink value="#{person.traceable.urlRewrite}">-->
73 </ui:remove> 73 </ui:remove>
74 - <h:outputText value="#{user.username}" /> 74 + <h:outputText value="#{person.username}" />
75 <!-- </h:outputLink>--> 75 <!-- </h:outputLink>-->
76 </p:column> 76 </p:column>
77 - <p:column styleClass="third" sortBy="#{user.firstName} #{user.lastName}"> 77 + <p:column styleClass="third" sortBy="#{person.firstName} #{person.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="#{user.traceable.urlRewrite}">--> 80 + <!--<h:outputLink value="#{person.traceable.urlRewrite}">-->
81 </ui:remove> 81 </ui:remove>
82 - <h:outputText value="#{user.firstName} #{user.lastName}" /> 82 + <h:outputText value="#{person.firstName} #{person.lastName}" />
83 <!--</h:outputLink>--> 83 <!--</h:outputLink>-->
84 </p:column> 84 </p:column>
85 - <p:column styleClass="third" sortBy="#{user.email}"> 85 + <p:column styleClass="third" sortBy="#{person.email}">
86 <f:facet name="header">Email</f:facet> 86 <f:facet name="header">Email</f:facet>
87 - <h:outputText value="#{user.email}" /> 87 + <h:outputText value="#{person.email}" />
88 </p:column> 88 </p:column>
89 <p:column> 89 <p:column>
90 - <h:graphicImage value="/images/structure/dVert.gif" rendered="#{user.visible and user.activated}" title="Utilisateur activ" /> 90 + <h:graphicImage value="/images/structure/dVert.gif" rendered="#{person.visible and person.activated}" title="Utilisateur activ" />
91 - <h:graphicImage value="/images/structure/dOrange.gif" rendered="#{(not user.visible) and user.activated}" title="Utilisateur dsactiv" /> 91 + <h:graphicImage value="/images/structure/dOrange.gif" rendered="#{(not person.visible) and person.activated}" title="Utilisateur dsactiv" />
92 - <h:graphicImage value="/images/structure/dRouge.gif" rendered="#{not user.activated}" title="Utilisateur non enregistr" /> 92 + <h:graphicImage value="/images/structure/dRouge.gif" rendered="#{not person.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.users}"> 102 + rendered="#{empty listUsersBean.persons}">
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.users}" var="user"> 15 + <ui:repeat value="#{listUsersBean.persons}" var="person">
16 - <li>#{user.username}</li> 16 + <li>#{person.username}</li>
17 </ui:repeat> 17 </ui:repeat>
18 </ul> 18 </ul>
19 </f:view> 19 </f:view>
......
...@@ -16,5 +16,5 @@ public interface SharedService { ...@@ -16,5 +16,5 @@ public interface SharedService {
16 16
17 List<UserProperty> getAvailableUserProperties(); 17 List<UserProperty> getAvailableUserProperties();
18 18
19 - User getCurrentUser(); 19 + Person getCurrentUser();
20 } 20 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -52,12 +52,12 @@ public class SharedServiceSpring implements SharedService { ...@@ -52,12 +52,12 @@ public class SharedServiceSpring implements SharedService {
52 52
53 public List<UserProperty> getAvailableUserProperties() { return userPropertyRepository.findAll(); } 53 public List<UserProperty> getAvailableUserProperties() { return userPropertyRepository.findAll(); }
54 54
55 - public User getCurrentUser() { 55 + public Person getCurrentUser() {
56 // TODO Remplacer l'astuce par une vraie récupération de l'utilisateur 56 // TODO Remplacer l'astuce par une vraie récupération de l'utilisateur
57 - List<User> users = userService.getAllUsers(); 57 + List<Person> persons = userService.getAllUsers();
58 Random random = new Random(); 58 Random random = new Random();
59 - User user = users.get(random.nextInt(users.size())); 59 + Person person = persons.get(random.nextInt(persons.size()));
60 // End TODO 60 // End TODO
61 - return user; 61 + return person;
62 } 62 }
63 } 63 }
......
...@@ -65,7 +65,7 @@ public class PublisherVersionViewTest { ...@@ -65,7 +65,7 @@ public class PublisherVersionViewTest {
65 } 65 }
66 66
67 @Test 67 @Test
68 - @DisplayName("depends on Shared Service and User Service") 68 + @DisplayName("depends on Shared Service and Person Service")
69 public void testDependencies() { 69 public void testDependencies() {
70 assertThat(publisherVersionView).isNotNull(); 70 assertThat(publisherVersionView).isNotNull();
71 } 71 }
......
...@@ -20,10 +20,10 @@ import static org.mockito.Mockito.when; ...@@ -20,10 +20,10 @@ import static org.mockito.Mockito.when;
20 /** 20 /**
21 * Created by jai on 15/11/16. 21 * Created by jai on 15/11/16.
22 */ 22 */
23 -@DisplayName("Update User Bean") 23 +@DisplayName("Update Person Bean")
24 @ExtendWith(MockitoExtension.class) 24 @ExtendWith(MockitoExtension.class)
25 @RunWith(JUnitPlatform.class) 25 @RunWith(JUnitPlatform.class)
26 -public class UpdateUserBeanTest { 26 +public class UpdatePersonBeanTest {
27 27
28 UpdateUserBean updateUserBean; 28 UpdateUserBean updateUserBean;
29 29
...@@ -33,7 +33,7 @@ public class UpdateUserBeanTest { ...@@ -33,7 +33,7 @@ public class UpdateUserBeanTest {
33 } 33 }
34 34
35 @Test 35 @Test
36 - @DisplayName("depends on Shared Service and User Service") 36 + @DisplayName("depends on Shared Service and Person Service")
37 public void testDependencies() { 37 public void testDependencies() {
38 assertThat(updateUserBean).isNotNull(); 38 assertThat(updateUserBean).isNotNull();
39 } 39 }
......