Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Francois Leveque
2016-11-21 16:19:33 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0b7158bd1c17d2cf853445377e428caaf0140f57
0b7158bd
1 parent
23db94a8
Elimination des annotations BD et refactoring de User en Person car user est un mot réservé en BD.
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
150 additions
and
154 deletions
src/main/java/org/legrog/entities/User.java → src/main/java/org/legrog/entities/Person.java
src/main/java/org/legrog/entities/UserRepository.java → src/main/java/org/legrog/entities/PersonRepository.java
src/main/java/org/legrog/entities/PublisherAction.java
src/main/java/org/legrog/entities/PublisherVersion.java
src/main/java/org/legrog/entities/UserAttribute.java
src/main/java/org/legrog/entities/UserRole.java
src/main/java/org/legrog/web/publisher/PublisherVersionView.java
src/main/java/org/legrog/web/user/ListUsersBean.java
src/main/java/org/legrog/web/user/UpdateUserBean.java
src/main/java/org/legrog/web/user/UserService.java
src/main/java/org/legrog/web/user/UserServiceSpring.java
src/main/java/org/legrog/web/user/listUsers.xhtml
src/main/java/org/legrog/web/user/listUsers_short.xhtml
src/main/java/org/legrog/web/xyz/SharedService.java
src/main/java/org/legrog/web/xyz/SharedServiceSpring.java
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
src/test/java/org/legrog/web/user/UpdateUserBeanTest.java → src/test/java/org/legrog/web/user/UpdatePersonBeanTest.java
src/main/java/org/legrog/entities/
User
.java
→
src/main/java/org/legrog/entities/
Person
.java
View file @
0b7158b
...
...
@@ -11,12 +11,10 @@ import java.util.*;
Migréee depuis la v2.
*/
@Entity
@Table
(
name
=
"UserTable"
)
public
class
User
/* extends org.roliste.data.DbTraceableEntity */
implements
DisplayNameConfigurable
/*, DbValidationEntity */
{
public
class
Person
/* extends org.roliste.data.DbTraceableEntity */
implements
DisplayNameConfigurable
/*, DbValidationEntity */
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"USER_ID"
)
private
int
userId
;
// TODO traiter Traceable
...
...
@@ -183,7 +181,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
{
if ((role != null) && !(getRoles().contains(role)) )
{
role.get
User
s().add(this);
role.get
Person
s().add(this);
getRoles().add(role);
}
}
...
...
@@ -191,7 +189,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
*/
/**
* Remove the user from a given {@link UserRole}s.
* @param role the {@link UserRole} this {@link
User
} will lose. Ignored if <code>null</code>.
* @param role the {@link UserRole} this {@link
Person
} will lose. Ignored if <code>null</code>.
* @see #getRoles()
* @see #setRoles(List)
* @see #addToRole(UserRole)
...
...
@@ -202,7 +200,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
{
if ((role != null) && (getRoles().contains(role)) )
{
role.get
User
s().remove(this);
role.get
Person
s().remove(this);
getRoles().remove(role);
}
}
...
...
@@ -303,7 +301,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
*/
/**
* Remove a book from user's collection.
* @param book the {@link org.roliste.data.db.BookDetails} this {@link
User
} will lose. Ignored if <code>null</code>.
* @param book the {@link org.roliste.data.db.BookDetails} this {@link
Person
} will lose. Ignored if <code>null</code>.
* @see #getCollection()
* @see #setCollection(List)
* @see #addToCollection(BookDetails)
...
...
@@ -392,7 +390,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
*/
/**
* Remove delegation on a given {@link Traceable} from this user.
* @param object the delegation this {@link
User
} will lose. Ignored if <code>null</code>.
* @param object the delegation this {@link
Person
} will lose. Ignored if <code>null</code>.
* @see #getDelegations()
* @see #setDelegations(List)
* @see #giveDelegation(Traceable)
...
...
src/main/java/org/legrog/entities/
User
Repository.java
→
src/main/java/org/legrog/entities/
Person
Repository.java
View file @
0b7158b
...
...
@@ -2,5 +2,5 @@ package org.legrog.entities;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
UserRepository
extends
JpaRepository
<
User
,
Integer
>
{
public
interface
PersonRepository
extends
JpaRepository
<
Person
,
Integer
>
{
}
...
...
src/main/java/org/legrog/entities/PublisherAction.java
View file @
0b7158b
...
...
@@ -15,7 +15,7 @@ public class PublisherAction {
@ManyToOne
private
UserAction
userAction
;
@ManyToOne
private
User
publisherActionAuthor
;
private
Person
publisherActionAuthor
;
@ManyToOne
private
PublisherVersion
publisherVersion
;
...
...
@@ -25,7 +25,7 @@ public class PublisherAction {
@ManyToOne
private
Publisher
publisher
;
public
void
setPublisherActionAuthor
(
User
publisherActionAuthor
)
{
public
void
setPublisherActionAuthor
(
Person
publisherActionAuthor
)
{
this
.
publisherActionAuthor
=
publisherActionAuthor
;
}
...
...
@@ -49,7 +49,7 @@ public class PublisherAction {
return
userAction
;
}
public
User
getPublisherActionAuthor
()
{
public
Person
getPublisherActionAuthor
()
{
return
publisherActionAuthor
;
}
...
...
src/main/java/org/legrog/entities/PublisherVersion.java
View file @
0b7158b
...
...
@@ -31,7 +31,7 @@ public class PublisherVersion {
private
boolean
publisherActive
;
private
String
publisherHistory
;
@ManyToOne
private
User
publisherVersionAuthor
;
private
Person
publisherVersionAuthor
;
private
Timestamp
publisherVersionDatetime
;
public
Timestamp
getPublisherVersionDatetime
()
{
...
...
@@ -146,11 +146,11 @@ public class PublisherVersion {
this
.
publisherAddressCountry
=
publisherAddressCountry
;
}
public
User
getPublisherVersionAuthor
()
{
public
Person
getPublisherVersionAuthor
()
{
return
publisherVersionAuthor
;
}
public
void
setPublisherVersionAuthor
(
User
publisherVersionAuthor
)
{
public
void
setPublisherVersionAuthor
(
Person
publisherVersionAuthor
)
{
this
.
publisherVersionAuthor
=
publisherVersionAuthor
;
}
...
...
src/main/java/org/legrog/entities/UserAttribute.java
View file @
0b7158b
...
...
@@ -17,37 +17,37 @@ public class UserAttribute {
}
/**
* The linked
user
.
* The linked
person
.
*/
@ManyToOne
@JoinColumn
(
name
=
"USER_ID"
)
private
User
user
;
private
Person
person
;
/**
* Retrieve the
user
this attribute is attached to.
* Retrieve the
person
this attribute is attached to.
* hibernate.many-to-one
* column="ID_UTILISATEUR"
* class="org.roliste.data.db.
User
"
* class="org.roliste.data.db.
Person
"
* not-null="true"
* access="property"
* lazy="proxy"
* properties-name="PropertyPerUser"
* foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR"
* @return the {link org.roliste.data.db.
User
} this attribute is attached to.
* @return the {link org.roliste.data.db.
Person
} this attribute is attached to.
* Shall not be <code>null</code>.
* see #set
User(org.roliste.data.db.User
)
* see #set
Person(org.roliste.data.db.Person
)
*/
public
User
getUser
()
{
return
user
;
public
Person
getPerson
()
{
return
person
;
}
/**
* Set the
user
this attribute is attached to.
* @param
user the new {link org.roliste.data.db.User
} this attribute will be attached to. Shall not be <code>null</code>.
* @see #get
User
()
* Set the
person
this attribute is attached to.
* @param
person the new {link org.roliste.data.db.Person
} this attribute will be attached to. Shall not be <code>null</code>.
* @see #get
Person
()
*/
public
void
set
User
(
User
user
)
{
this
.
user
=
user
;
public
void
set
Person
(
Person
person
)
{
this
.
person
=
person
;
}
/**
...
...
@@ -114,8 +114,8 @@ public class UserAttribute {
}
/**
* Returns a string representation of this
user
attribute definition.
* @return a string representing this
user
attribute definition.
* Returns a string representation of this
person
attribute definition.
* @return a string representing this
person
attribute definition.
* hidden
*/
@Override
...
...
src/main/java/org/legrog/entities/UserRole.java
View file @
0b7158b
...
...
@@ -7,7 +7,7 @@ import javax.persistence.*;
/**
* The database representation of a user role or group.
* A given {@link
User
} may be part of one or more {@link UserRole}.
* A given {@link
Person
} may be part of one or more {@link UserRole}.
* <br/>
* Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly.
* You shall always use the getter/setter methods.
...
...
@@ -23,7 +23,6 @@ public class UserRole /* extends org.roliste.data.DbEntity */
{
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
@Column
(
name
=
"USER_ROLE_ID"
)
private
int
userRoleId
;
/**
...
...
@@ -32,11 +31,10 @@ public class UserRole /* extends org.roliste.data.DbEntity */
private
String
rolename
;
/**
* The {@link
User
}s for this user role.
* The {@link
Person
}s for this user role.
*/
@ManyToMany
(
mappedBy
=
"roles"
)
@Column
(
name
=
"USER_ID"
)
private
Set
<
User
>
users
;
private
Set
<
Person
>
persons
;
/**
* Builds a new and empty user role definition.
...
...
@@ -49,7 +47,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */
rolename
=
null
;
visible
=
true
;
// no need to synchronize this
users
=
new
HashSet
<
User
>();
persons
=
new
HashSet
<
Person
>();
}
public
int
getUserRoleId
()
{
...
...
@@ -92,7 +90,7 @@ public class UserRole /* extends org.roliste.data.DbEntity */
/**
* Indicates if the role is visible.
* If not,
user
s should not be able to access the privileges
* If not,
person
s should not be able to access the privileges
* they inherit from being part of this role.
* @return the visible flag.
* @see #setVisible(boolean)
...
...
@@ -114,15 +112,15 @@ public class UserRole /* extends org.roliste.data.DbEntity */
}
/**
* Retrieves the list of {@link
User
}s for this user role.
* Retrieves the list of {@link
Person
}s for this user role.
* SHALL be used as a read-only attribute. In particular, avoid
* using {@link Set#add(Object)} or {@link Set#remove(Object)} on
* the returned value without caution.
* @return a {@link Set} of {@link
User
}. May be <code>null</code>.
* @see #set
User
s(Set)
* @return a {@link Set} of {@link
Person
}. May be <code>null</code>.
* @see #set
Person
s(Set)
* hibernate.many-to-many
* column="UTILISATEUR_FK"
* class="org.roliste.data.db.
User
"
* class="org.roliste.data.db.
Person
"
* foreign-key="FK_UTILISATEURROLE_UTILISATEUR"
* hibernate.key
* column="ROLE_FK"
...
...
@@ -134,18 +132,18 @@ public class UserRole /* extends org.roliste.data.DbEntity */
* lazy="true"
* inverse="true"
*/
public
Set
<
User
>
getUser
s
()
{
return
user
s
;
public
Set
<
Person
>
getPerson
s
()
{
return
person
s
;
}
/**
* Sets the list of {@link
User
}s for this user role.
* @param
users the new {@link Set} of {@link User
}s. May be
* Sets the list of {@link
Person
}s for this user role.
* @param
persons the new {@link Set} of {@link Person
}s. May be
* <code>null</code> (we don't handle the relation from this side).
* @see #get
User
s()
* @see #get
Person
s()
*/
protected
void
set
Users
(
Set
<
User
>
user
s
)
{
this
.
users
=
user
s
;
protected
void
set
Persons
(
Set
<
Person
>
person
s
)
{
this
.
persons
=
person
s
;
}
/**
...
...
src/main/java/org/legrog/web/publisher/PublisherVersionView.java
View file @
0b7158b
...
...
@@ -4,7 +4,7 @@ import org.legrog.entities.PublisherVersion;
import
org.legrog.web.xyz.SharedService
;
import
org.legrog.entities.Country
;
import
org.legrog.entities.Publisher
;
import
org.legrog.entities.
User
;
import
org.legrog.entities.
Person
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
...
...
@@ -47,7 +47,7 @@ public class PublisherVersionView implements Serializable {
private
String
publisherURL
;
private
boolean
publisherActive
;
private
String
publisherHistory
;
private
User
publisherVersionAuthor
;
private
Person
publisherVersionAuthor
;
private
Timestamp
publisherVersionDatetime
;
private
Publisher
publisher
;
...
...
@@ -313,11 +313,11 @@ public class PublisherVersionView implements Serializable {
this
.
publisherHistory
=
publisherHistory
;
}
public
User
getPublisherVersionAuthor
()
{
public
Person
getPublisherVersionAuthor
()
{
return
publisherVersionAuthor
;
}
public
void
setPublisherVersionAuthor
(
User
publisherVersionAuthor
)
{
public
void
setPublisherVersionAuthor
(
Person
publisherVersionAuthor
)
{
this
.
publisherVersionAuthor
=
publisherVersionAuthor
;
}
...
...
src/main/java/org/legrog/web/user/ListUsersBean.java
View file @
0b7158b
package
org
.
legrog
.
web
.
user
;
import
org.legrog.entities.
User
;
import
org.legrog.entities.
Person
;
import
javax.annotation.PostConstruct
;
import
javax.enterprise.context.RequestScoped
;
...
...
@@ -14,19 +14,19 @@ public class ListUsersBean {
@Inject
private
UserService
userService
;
private
List
<
User
>
user
s
;
private
List
<
Person
>
person
s
;
public
List
<
User
>
getUser
s
()
{
return
user
s
;
public
List
<
Person
>
getPerson
s
()
{
return
person
s
;
}
public
void
set
Users
(
List
<
User
>
user
s
)
{
this
.
users
=
user
s
;
public
void
set
Persons
(
List
<
Person
>
person
s
)
{
this
.
persons
=
person
s
;
}
@PostConstruct
public
void
init
()
{
user
s
=
userService
.
getAllUsers
();
person
s
=
userService
.
getAllUsers
();
}
}
...
...
src/main/java/org/legrog/web/user/UpdateUserBean.java
View file @
0b7158b
...
...
@@ -65,35 +65,35 @@ public class UpdateUserBean {
public
String
add
()
{
User
user
=
new
User
();
user
.
setActivated
(
activated
);
user
.
setAnonymous
(
anonymous
);
Person
person
=
new
Person
();
person
.
setActivated
(
activated
);
person
.
setAnonymous
(
anonymous
);
if
(
userAttributes
!=
null
)
{
user
.
setAttributes
(
userAttributes
);
person
.
setAttributes
(
userAttributes
);
}
user
.
setCriticProvider
(
criticProvider
);
person
.
setCriticProvider
(
criticProvider
);
if
(
displayNameMask
!=
null
)
{
user
.
setDisplayNameMask
(
displayNameMask
);
person
.
setDisplayNameMask
(
displayNameMask
);
}
else
{
user
.
setDisplayNameMask
(
DisplayNameMask
.
PRENOMNOM
);
person
.
setDisplayNameMask
(
DisplayNameMask
.
PRENOMNOM
);
}
user
.
setEmail
(
email
);
user
.
setFirstName
(
firstName
);
user
.
setLastName
(
lastName
);
person
.
setEmail
(
email
);
person
.
setFirstName
(
firstName
);
person
.
setLastName
(
lastName
);
if
(
nickName
!=
null
&&
!
nickName
.
isEmpty
())
{
user
.
setNickName
(
nickName
);
person
.
setNickName
(
nickName
);
}
user
.
setPassword
(
password
);
person
.
setPassword
(
password
);
if
(
presentation
!=
null
)
{
user
.
setPresentation
(
presentation
);
person
.
setPresentation
(
presentation
);
}
if
(
roles
!=
null
)
{
user
.
setRoles
(
roles
);
person
.
setRoles
(
roles
);
}
user
.
setUsername
(
username
);
user
.
setVisible
(
visible
);
user
.
setCreationDate
(
new
Date
());
userService
.
addUser
(
user
);
person
.
setUsername
(
username
);
person
.
setVisible
(
visible
);
person
.
setCreationDate
(
new
Date
());
userService
.
addUser
(
person
);
return
"success"
;
}
...
...
@@ -103,25 +103,25 @@ public class UpdateUserBean {
logger
.
info
(
"userId ="
+
userId
);
this
.
userId
=
userId
;
if
(
userId
!=
0
)
{
User
user
=
userService
.
findUserById
(
userId
);
if
(
user
!=
null
)
{
activated
=
user
.
isActivated
();
anonymous
=
user
.
isAnonymous
();
userAttributes
=
user
.
getAttributes
();
criticProvider
=
user
.
isCriticProvider
();
displayNameMask
=
user
.
getDisplayNameMask
();
email
=
user
.
getEmail
();
firstName
=
user
.
getFirstName
();
lastName
=
user
.
getLastName
();
nickName
=
user
.
getNickName
();
password
=
user
.
getPassword
();
presentation
=
user
.
getPresentation
();
roles
=
user
.
getRoles
();
Person
person
=
userService
.
findUserById
(
userId
);
if
(
person
!=
null
)
{
activated
=
person
.
isActivated
();
anonymous
=
person
.
isAnonymous
();
userAttributes
=
person
.
getAttributes
();
criticProvider
=
person
.
isCriticProvider
();
displayNameMask
=
person
.
getDisplayNameMask
();
email
=
person
.
getEmail
();
firstName
=
person
.
getFirstName
();
lastName
=
person
.
getLastName
();
nickName
=
person
.
getNickName
();
password
=
person
.
getPassword
();
presentation
=
person
.
getPresentation
();
roles
=
person
.
getRoles
();
if
(
roles
==
null
)
{
roles
=
new
ArrayList
<
UserRole
>();
}
username
=
user
.
getUsername
();
visible
=
user
.
isVisible
();
username
=
person
.
getUsername
();
visible
=
person
.
isVisible
();
return
"updateUser.xhtml"
;
}
}
...
...
@@ -132,22 +132,22 @@ public class UpdateUserBean {
logger
.
info
(
"update"
);
logger
.
info
(
"userId ="
+
userId
);
User
user
=
userService
.
findUserById
(
userId
);
user
.
setActivated
(
activated
);
user
.
setAnonymous
(
anonymous
);
user
.
setAttributes
(
userAttributes
);
user
.
setCriticProvider
(
criticProvider
);
user
.
setDisplayNameMask
(
displayNameMask
);
user
.
setEmail
(
email
);
user
.
setFirstName
(
firstName
);
user
.
setLastName
(
lastName
);
user
.
setNickName
(
nickName
);
user
.
setPassword
(
password
);
user
.
setPresentation
(
presentation
);
user
.
setRoles
(
roles
);
user
.
setUsername
(
username
);
user
.
setVisible
(
visible
);
userService
.
updateUser
(
user
);
Person
person
=
userService
.
findUserById
(
userId
);
person
.
setActivated
(
activated
);
person
.
setAnonymous
(
anonymous
);
person
.
setAttributes
(
userAttributes
);
person
.
setCriticProvider
(
criticProvider
);
person
.
setDisplayNameMask
(
displayNameMask
);
person
.
setEmail
(
email
);
person
.
setFirstName
(
firstName
);
person
.
setLastName
(
lastName
);
person
.
setNickName
(
nickName
);
person
.
setPassword
(
password
);
person
.
setPresentation
(
presentation
);
person
.
setRoles
(
roles
);
person
.
setUsername
(
username
);
person
.
setVisible
(
visible
);
userService
.
updateUser
(
person
);
return
"success"
;
}
...
...
src/main/java/org/legrog/web/user/UserService.java
View file @
0b7158b
package
org
.
legrog
.
web
.
user
;
import
org.legrog.entities.
User
;
import
org.legrog.entities.
Person
;
import
java.util.List
;
public
interface
UserService
{
void
addUser
(
User
user
);
void
addUser
(
Person
person
);
List
<
User
>
getAllUsers
();
List
<
Person
>
getAllUsers
();
User
findUserById
(
int
id
);
Person
findUserById
(
int
id
);
void
updateUser
(
User
user
);
void
updateUser
(
Person
person
);
}
...
...
src/main/java/org/legrog/web/user/UserServiceSpring.java
View file @
0b7158b
package
org
.
legrog
.
web
.
user
;
import
org.legrog.entities.
User
;
import
org.legrog.entities.
User
Repository
;
import
org.legrog.entities.
Person
;
import
org.legrog.entities.
Person
Repository
;
import
javax.ejb.Stateless
;
import
javax.inject.Inject
;
...
...
@@ -10,21 +10,21 @@ import java.util.List;
@Stateless
public
class
UserServiceSpring
implements
UserService
{
@Inject
UserRepository
user
Repository
;
PersonRepository
person
Repository
;
public
void
addUser
(
User
user
)
{
userRepository
.
save
(
user
);
public
void
addUser
(
Person
person
)
{
personRepository
.
save
(
person
);
}
public
List
<
User
>
getAllUsers
()
{
return
user
Repository
.
findAll
();
public
List
<
Person
>
getAllUsers
()
{
return
person
Repository
.
findAll
();
}
public
User
findUserById
(
int
id
)
{
return
user
Repository
.
findOne
(
new
Integer
(
id
));
public
Person
findUserById
(
int
id
)
{
return
person
Repository
.
findOne
(
new
Integer
(
id
));
}
public
void
updateUser
(
User
user
)
{
userRepository
.
save
(
user
);
public
void
updateUser
(
Person
person
)
{
personRepository
.
save
(
person
);
}
}
\ No newline at end of file
...
...
src/main/java/org/legrog/web/user/listUsers.xhtml
View file @
0b7158b
...
...
@@ -32,17 +32,17 @@
<div
id=
"listElements"
>
<h:commandLink
styleClass=
"fRight acLink"
action=
"add"
rendered=
"#{not empty listUsersBean.
user
s}"
>
<h:commandLink
styleClass=
"fRight acLink"
action=
"add"
rendered=
"#{not empty listUsersBean.
person
s}"
>
<img
src=
"/images/structure/vide.gif"
class=
"icAddC"
alt=
""
title=
"Crer un nouvel utilisateur"
/>
Nouvel Utilisateur
</h:commandLink>
<p:dataTable
id=
"tableElements"
rendered=
"#{not empty listUsersBean.
user
s}"
var=
"
user"
value=
"#{listUsersBean.user
s}"
<p:dataTable
id=
"tableElements"
rendered=
"#{not empty listUsersBean.
person
s}"
var=
"
person"
value=
"#{listUsersBean.person
s}"
styleClass=
"results"
rowClasses=
"altRichRow,altRow"
>
<!-- TODO Grer la pagination -->
<!-- <p:dataTable id="tableElements" rendered="#{listUsersBean.
user
s.size>0}"
var="
user" value="#{listUsersBean.user
s}" rows="#{userListMgr.pageSize}"
<!-- <p:dataTable id="tableElements" rendered="#{listUsersBean.
person
s.size>0}"
var="
person" value="#{listUsersBean.person
s}" rows="#{userListMgr.pageSize}"
styleClass="results" rowClasses="altRichRow,altRow">-->
<f:facet
name=
"header"
>
<p:dataScroller
for=
"tableElements"
...
...
@@ -61,35 +61,35 @@
</h:commandLink>-->
</p:column>
<p:column>
<h:commandLink
action=
"#{updateUserBean.prepareUpdate(
user
.userId)}"
>
<h:commandLink
action=
"#{updateUserBean.prepareUpdate(
person
.userId)}"
>
<img
src=
"/images/structure/vide.gif"
class=
"icEdit"
alt=
"Modifier"
title=
"Modifier"
/>
</h:commandLink>
</p:column>
<p:column
styleClass=
"third"
sortBy=
"#{
user
.username}"
>
<p:column
styleClass=
"third"
sortBy=
"#{
person
.username}"
>
<f:facet
name=
"header"
>
Identifiant
</f:facet>
<!-- TODO Dcider de l'avenir de traceable -->
<ui:remove>
<!-- <h:outputLink value="#{
user
.traceable.urlRewrite}">-->
<!-- <h:outputLink value="#{
person
.traceable.urlRewrite}">-->
</ui:remove>
<h:outputText
value=
"#{
user
.username}"
/>
<h:outputText
value=
"#{
person
.username}"
/>
<!-- </h:outputLink>-->
</p:column>
<p:column
styleClass=
"third"
sortBy=
"#{
user.firstName} #{user
.lastName}"
>
<p:column
styleClass=
"third"
sortBy=
"#{
person.firstName} #{person
.lastName}"
>
<f:facet
name=
"header"
>
Nom
</f:facet>
<ui:remove>
<!--<h:outputLink value="#{
user
.traceable.urlRewrite}">-->
<!--<h:outputLink value="#{
person
.traceable.urlRewrite}">-->
</ui:remove>
<h:outputText
value=
"#{
user.firstName} #{user
.lastName}"
/>
<h:outputText
value=
"#{
person.firstName} #{person
.lastName}"
/>
<!--</h:outputLink>-->
</p:column>
<p:column
styleClass=
"third"
sortBy=
"#{
user
.email}"
>
<p:column
styleClass=
"third"
sortBy=
"#{
person
.email}"
>
<f:facet
name=
"header"
>
Email
</f:facet>
<h:outputText
value=
"#{
user
.email}"
/>
<h:outputText
value=
"#{
person
.email}"
/>
</p:column>
<p:column>
<h:graphicImage
value=
"/images/structure/dVert.gif"
rendered=
"#{
user.visible and user
.activated}"
title=
"Utilisateur activ"
/>
<h:graphicImage
value=
"/images/structure/dOrange.gif"
rendered=
"#{(not
user.visible) and user
.activated}"
title=
"Utilisateur dsactiv"
/>
<h:graphicImage
value=
"/images/structure/dRouge.gif"
rendered=
"#{not
user
.activated}"
title=
"Utilisateur non enregistr"
/>
<h:graphicImage
value=
"/images/structure/dVert.gif"
rendered=
"#{
person.visible and person
.activated}"
title=
"Utilisateur activ"
/>
<h:graphicImage
value=
"/images/structure/dOrange.gif"
rendered=
"#{(not
person.visible) and person
.activated}"
title=
"Utilisateur dsactiv"
/>
<h:graphicImage
value=
"/images/structure/dRouge.gif"
rendered=
"#{not
person
.activated}"
title=
"Utilisateur non enregistr"
/>
</p:column>
<f:facet
name=
"footer"
>
<h:commandLink
action=
"add"
value=
"Crer un nouvel utilisateur"
>
...
...
@@ -99,7 +99,7 @@
</div>
<p>
<h:commandLink
action=
"add"
value=
"Crer un nouvel utilisateur"
rendered=
"#{empty listUsersBean.
user
s}"
>
rendered=
"#{empty listUsersBean.
person
s}"
>
</h:commandLink>
</p>
</h:form>
...
...
src/main/java/org/legrog/web/user/listUsers_short.xhtml
View file @
0b7158b
...
...
@@ -12,8 +12,8 @@
</h:commandLink>
</h:form>
<ul>
<ui:repeat
value=
"#{listUsersBean.
users}"
var=
"user
"
>
<li>
#{
user
.username}
</li>
<ui:repeat
value=
"#{listUsersBean.
persons}"
var=
"person
"
>
<li>
#{
person
.username}
</li>
</ui:repeat>
</ul>
</f:view>
...
...
src/main/java/org/legrog/web/xyz/SharedService.java
View file @
0b7158b
...
...
@@ -16,5 +16,5 @@ public interface SharedService {
List
<
UserProperty
>
getAvailableUserProperties
();
User
getCurrentUser
();
Person
getCurrentUser
();
}
\ No newline at end of file
...
...
src/main/java/org/legrog/web/xyz/SharedServiceSpring.java
View file @
0b7158b
...
...
@@ -52,12 +52,12 @@ public class SharedServiceSpring implements SharedService {
public
List
<
UserProperty
>
getAvailableUserProperties
()
{
return
userPropertyRepository
.
findAll
();
}
public
User
getCurrentUser
()
{
public
Person
getCurrentUser
()
{
// TODO Remplacer l'astuce par une vraie récupération de l'utilisateur
List
<
User
>
user
s
=
userService
.
getAllUsers
();
List
<
Person
>
person
s
=
userService
.
getAllUsers
();
Random
random
=
new
Random
();
User
user
=
users
.
get
(
random
.
nextInt
(
user
s
.
size
()));
Person
person
=
persons
.
get
(
random
.
nextInt
(
person
s
.
size
()));
// End TODO
return
user
;
return
person
;
}
}
...
...
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
View file @
0b7158b
...
...
@@ -65,7 +65,7 @@ public class PublisherVersionViewTest {
}
@Test
@DisplayName
(
"depends on Shared Service and
User
Service"
)
@DisplayName
(
"depends on Shared Service and
Person
Service"
)
public
void
testDependencies
()
{
assertThat
(
publisherVersionView
).
isNotNull
();
}
...
...
src/test/java/org/legrog/web/user/Update
User
BeanTest.java
→
src/test/java/org/legrog/web/user/Update
Person
BeanTest.java
View file @
0b7158b
...
...
@@ -20,10 +20,10 @@ import static org.mockito.Mockito.when;
/**
* Created by jai on 15/11/16.
*/
@DisplayName
(
"Update
User
Bean"
)
@DisplayName
(
"Update
Person
Bean"
)
@ExtendWith
(
MockitoExtension
.
class
)
@RunWith
(
JUnitPlatform
.
class
)
public
class
Update
User
BeanTest
{
public
class
Update
Person
BeanTest
{
UpdateUserBean
updateUserBean
;
...
...
@@ -33,7 +33,7 @@ public class UpdateUserBeanTest {
}
@Test
@DisplayName
(
"depends on Shared Service and
User
Service"
)
@DisplayName
(
"depends on Shared Service and
Person
Service"
)
public
void
testDependencies
()
{
assertThat
(
updateUserBean
).
isNotNull
();
}
...
...
Please
register
or
login
to post a comment