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
2017-02-14 11:14:23 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cd66d4a875259c76e94a1b13ccaaf5805b9f4c27
cd66d4a8
1 parent
22defb2b
Refactoring de User en Account (fin sur le nom des classes et fichiers).
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
127 additions
and
127 deletions
src/main/java/org/legrog/entities/Account.java
src/main/java/org/legrog/entities/AccountRole.java
src/main/java/org/legrog/web/user/UserService.java → src/main/java/org/legrog/web/account/AccountService.java
src/main/java/org/legrog/web/user/UserServiceDefault.java → src/main/java/org/legrog/web/account/AccountServiceDefault.java
src/main/java/org/legrog/web/user/ListUsersBean.java → src/main/java/org/legrog/web/account/ListAccountsBean.java
src/main/java/org/legrog/web/user/UpdateUserBean.java → src/main/java/org/legrog/web/account/UpdateAccountBean.java
src/main/java/org/legrog/web/user/addUser_short.xhtml → src/main/java/org/legrog/web/account/addAccount_short.xhtml
src/main/java/org/legrog/web/user/listUsers.xhtml → src/main/java/org/legrog/web/account/listAccounts.xhtml
src/main/java/org/legrog/web/user/listUsers_short.xhtml → src/main/java/org/legrog/web/account/listAccounts_short.xhtml
src/main/java/org/legrog/web/user/updateUser.xhtml → src/main/java/org/legrog/web/account/updateAccount.xhtml
src/main/java/org/legrog/web/xyz/SharedServiceDefault.java
src/test/java/org/legrog/web/user/UpdateAccountBeanTest.java → src/test/java/org/legrog/web/account/UpdateAccountBeanTest.java
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
src/test/java/org/legrog/web/xyz/SharedServiceDefaultTest.java
src/main/java/org/legrog/entities/Account.java
View file @
cd66d4a
...
...
@@ -38,7 +38,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
*/
/**
* The mask used for
user
name.
* The mask used for
account
name.
*/
private
DisplayNameMask
displayNameMask
;
/*
...
...
@@ -49,7 +49,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* @return the
user
's name as desired. By default, return the complete name.
* @return the
account
's name as desired. By default, return the complete name.
* see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity)
*/
public
String
getDisplayName
()
...
...
@@ -61,7 +61,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the
user
's name mask.
* Returns the
account
's name mask.
* @return the mask.
* see #setNameMask(NameMask)
* hibernate.property
...
...
@@ -76,7 +76,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
's name mask.
* Initializes the
account
's name mask.
* @param mask the new {link org.roliste.data.db.NameMask}.
* see #getNameMask()
*/
...
...
@@ -87,43 +87,43 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
// TODO Faire ailleurs les contrôles de chaîne vide sur : username, password, firstname, lastname, nickname, email, text
/**
* The
user
identifier.
* The
account
identifier.
*/
private
String
username
;
/**
* The
user
password.
* The
account
password.
*/
private
String
password
;
/**
* The
user
first name.
* The
account
first name.
*/
private
String
firstName
;
/**
* The
user
last name.
* The
account
last name.
*/
private
String
lastName
;
/**
* The
user
nick name.
* The
account
nick name.
*/
private
String
nickname
;
/**
* The
user
email address.
* The
account
email address.
*/
private
String
email
;
/**
* The {link org.roliste.data.db.AccountRole}s for this
user
.
* The {link org.roliste.data.db.AccountRole}s for this
account
.
*/
@ManyToMany
(
fetch
=
FetchType
.
EAGER
)
private
List
<
AccountRole
>
roles
;
/**
* Retrieves the list of {@link AccountRole}s for this
user
.
* Retrieves the list of {@link AccountRole}s for this
account
.
* SHALL be used as a read-only attribute. In particular, avoid
* using {@link List#add(Object)} or {@link List#remove(Object)} on
* the returned value without caution.
...
...
@@ -151,7 +151,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Lists the list of {@link AccountRole}s for this
user
.
* Lists the list of {@link AccountRole}s for this
account
.
* @param roles the new {@link List} of {@link AccountRole}s. Shall not be <code>null</code>.
* @throws NullPointerException if roles is <code>null</code>.
* @see #getRoles()
...
...
@@ -168,7 +168,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Add the
user
to a given {@link AccountRole}s.
* Add the
account
to a given {@link AccountRole}s.
* @param role the new {@link AccountRole}. Ignored if <code>null</code>.
* @see #getRoles()
* @see #setRoles(List)
...
...
@@ -187,7 +187,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Remove the
user
from a given {@link AccountRole}s.
* Remove the
account
from a given {@link AccountRole}s.
* @param role the {@link AccountRole} this {@link Account} will lose. Ignored if <code>null</code>.
* @see #getRoles()
* @see #setRoles(List)
...
...
@@ -206,23 +206,23 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* The
user
anonymous status.
* If anonymous,
user
cannot be contacted through email.
* The
account
anonymous status.
* If anonymous,
account
cannot be contacted through email.
*/
private
boolean
anonymous
;
/**
* The
user
validation status.
* The
account
validation status.
*/
private
boolean
visible
;
/**
* The
user
was activated at least once.
* The
account
was activated at least once.
*/
private
boolean
activated
;
/**
* The
user
provides critics for archive.
* The
account
provides critics for archive.
*/
private
boolean
criticProvider
;
...
...
@@ -232,12 +232,12 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
private
String
presentation
;
/**
* The {@link org.roliste.data.db.BookDetails}s in this
user
's collection.
* The {@link org.roliste.data.db.BookDetails}s in this
account
's collection.
*/
// private List<BookDetails> _collection;
/**
* Retrieves the list of {@link org.roliste.data.db.BookDetails}s in this
user
's collection.
* Retrieves the list of {@link org.roliste.data.db.BookDetails}s in this
account
's collection.
* SHALL be used as a read-only attribute. In particular, avoid using {@link List#add(Object)}
* or {@link List#remove(Object)} on the returned value without caution.
* @return a {@link List} of {@link org.roliste.data.db.BookDetails}. Shall not be <code>null</code>.
...
...
@@ -263,7 +263,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Lists the list of {@link org.roliste.data.db.BookDetails}s in this
user
's collection.
* Lists the list of {@link org.roliste.data.db.BookDetails}s in this
account
's collection.
* @param collec the new {@link List} of {@link org.roliste.data.db.BookDetails}s. Shall not be <code>null</code>.
* @throws NullPointerException if collec is <code>null</code>.
* @see #getCollection()
...
...
@@ -280,7 +280,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Add a book to the
user
's collection.
* Add a book to the
account
's collection.
* @param book the new {@link org.roliste.data.db.BookDetails}. Ignored if <code>null</code>.
* @see #getCollection()
* @see #setCollection(List)
...
...
@@ -299,7 +299,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Remove a book from
user
's collection.
* Remove a book from
account
's collection.
* @param book the {@link org.roliste.data.db.BookDetails} this {@link Account} will lose. Ignored if <code>null</code>.
* @see #getCollection()
* @see #setCollection(List)
...
...
@@ -318,14 +318,14 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* The {@link org.roliste.data.db.Traceable}s delegated to this
user
.
* The {@link org.roliste.data.db.Traceable}s delegated to this
account
.
*/
// private List<Traceable> _delegations;
/**
* Retrieves the list of delegations for this
user
.
* Retrieves the list of delegations for this
account
.
* Each delegation is a link to a {@link org.roliste.data.db.Traceable} object.
* A
user
having delegation may update field values for delegated object.
* A
account
having delegation may update field values for delegated object.
* @return a {@link List} of {@link AccountRole}. Shall not be <code>null</code>. SHALL be used as a
* read-only attribute. In particular, avoid using {@link List#add(Object)} or {@link List#remove(Object)}
* on the returned value without caution.
...
...
@@ -352,7 +352,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Sets the list of delegations for this
user
.
* Sets the list of delegations for this
account
.
* @param objects the new {@link List} of delegated {@link Traceable}. Shall not be <code>null</code>.
* @throws NullPointerException if objects is <code>null</code>.
* @see #getDelegations()
...
...
@@ -369,7 +369,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Give delegation on a given {@link Traceable} to this
user
.
* Give delegation on a given {@link Traceable} to this
account
.
* @param object the new delegation. Ignored if <code>null</code>.
* @see #getDelegations()
* @see #setDelegations(List)
...
...
@@ -388,7 +388,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Remove delegation on a given {@link Traceable} from this
user
.
* Remove delegation on a given {@link Traceable} from this
account
.
* @param object the delegation this {@link Account} will lose. Ignored if <code>null</code>.
* @see #getDelegations()
* @see #setDelegations(List)
...
...
@@ -407,7 +407,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Clear all delegations for this
user
.
* Clear all delegations for this
account
.
*/
/*
public void clearDelegations()
...
...
@@ -423,13 +423,13 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* The list of attributes / properties for this
user
.
* The list of attributes / properties for this
account
.
*/
@OneToMany
(
mappedBy
=
"account"
)
private
List
<
AccountAttribute
>
accountAttributes
;
/**
* Retrieve this
user
's attributes.
* Retrieve this
account
's attributes.
* @hibernate.one-to-many
* class="org.roliste.data.db.AccountAttribute"
* @hibernate.bag
...
...
@@ -438,7 +438,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
* inverse="true"
* @hibernate.key
* column="ID_UTILISATEUR"
* @return a {@link java.util.List} of
user
attributes linked to this. Shall not be <code>null</code>.
* @return a {@link java.util.List} of
account
attributes linked to this. Shall not be <code>null</code>.
* @see #setAttributes(java.util.List)
*/
...
...
@@ -448,7 +448,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* @param attribs the List of attributes for this
user
.
* @param attribs the List of attributes for this
account
.
* @see #getAttributes()
*/
...
...
@@ -458,12 +458,12 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* The {@link org.roliste.data.db.GamingEvent}s this
user
's visited.
* The {@link org.roliste.data.db.GamingEvent}s this
account
's visited.
*/
// private Set<GamingEvent> _visitedEvents = new HashSet<GamingEvent>();
/**
* Retrieves the list of {@link GamingEvent}s visited by this
user
.
* Retrieves the list of {@link GamingEvent}s visited by this
account
.
* 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.
...
...
@@ -487,7 +487,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
*/
/**
* Sets the list of {link GamingEvent}s for this
user
.
* Sets the list of {link GamingEvent}s for this
account
.
* param events the new {@link Set} of {link GamingEvent}s. May be
* <code>null</code> (we don't handle the relation from this side).
* see #getVisitedEvents()
...
...
@@ -507,7 +507,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the
user
identifier.
* Returns the
account
identifier.
* @return the {@link String} identifier.
* @see #setUsername(String)
* hibernate.property
...
...
@@ -522,7 +522,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
identifier.
* Initializes the
account
identifier.
* @param name the new {@link String} identifier.
* @see #getUsername()
*/
...
...
@@ -530,7 +530,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
this
.
username
=
name
;
}
/**
* Returns the
user
password.
* Returns the
account
password.
* @return the {@link String} password.
* @see #setPassword(String)
* hibernate.property
...
...
@@ -544,7 +544,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
password.
* Initializes the
account
password.
* @param pwd the new {@link String} password.
* @see #getPassword()
*/
...
...
@@ -553,7 +553,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the
user
full first name.
* Returns the
account
full first name.
* @return the {@link String} first name.
* @see #setFirstName(String)
* hibernate.property
...
...
@@ -567,7 +567,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
first name.
* Initializes the
account
first name.
* @param name the new {@link String} first name.
* @see #getFirstName()
*/
...
...
@@ -576,7 +576,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the
user
full last name.
* Returns the
account
full last name.
* @return the {@link String} last name.
* @see #setLastName(String)
* hibernate.property
...
...
@@ -590,7 +590,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
last name.
* Initializes the
account
last name.
* @param name the new {@link String} last name.
* @see #getLastName()
*/
...
...
@@ -599,7 +599,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the
user
full screen name.
* Returns the
account
full screen name.
* @return the {@link String} screen name.
* @see #setNickName(String)
* hibernate.property
...
...
@@ -612,7 +612,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
screen name.
* Initializes the
account
screen name.
* @param name the new {@link String} screen name.
* @see #getNickName()
*/
...
...
@@ -621,7 +621,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the
user
email.
* Returns the
account
email.
* @return the {@link String} email.
* @see #setEmail(String)
* hibernate.property
...
...
@@ -636,7 +636,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
email.
* Initializes the
account
email.
* @param address the new {@link String} email.
* @see #getEmail()
*/
...
...
@@ -645,7 +645,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Indicates if the
user
is anonymous.
* Indicates if the
account
is anonymous.
* Anonymous users' email and first/last name won't be shown.
* @return the anonymous flag.
* @see #setAnonymous(boolean)
...
...
@@ -658,7 +658,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
anonymous flag.
* Initializes the
account
anonymous flag.
* @param anonymous the new flag value.
* @see #isAnonymous
*/
...
...
@@ -682,7 +682,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Indicates if the
user
was activated at least once.
* Indicates if the
account
was activated at least once.
* @return the activation flag.
* @see #setCriticProvider(boolean)
* hibernate.property
...
...
@@ -694,7 +694,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Initializes the
user
activation flag.
* Initializes the
account
activation flag.
* @param active the new flag value.
* @see #isActivated
*/
...
...
@@ -703,7 +703,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Indicates if the
user
provides critics for archives.
* Indicates if the
account
provides critics for archives.
* @return the critics provider flag.
* @see #setCriticProvider(boolean)
* hibernate.property
...
...
@@ -724,7 +724,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* Returns the HTML text presentation for this
user
.
* Returns the HTML text presentation for this
account
.
* @return the {@link String} HTML text.
* @see #setPresentation(String)
* hibernate.property
...
...
@@ -747,7 +747,7 @@ public class Account /* extends org.roliste.data.DbTraceableEntity */ implements
}
/**
* The
user
submission date.
* The
account
submission date.
*/
private
Date
creationDate
;
...
...
src/main/java/org/legrog/entities/AccountRole.java
View file @
cd66d4a
...
...
@@ -6,7 +6,7 @@ import java.util.Set;
import
javax.persistence.*
;
/**
* The database representation of a
user
role or group.
* The database representation of a
account
role or group.
* A given {@link Account} may be part of one or more {@link AccountRole}.
* <br/>
* Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly.
...
...
@@ -31,13 +31,13 @@ public class AccountRole /* extends org.roliste.data.DbEntity */
private
String
rolename
;
/**
* The {@link Account}s for this
user
role.
* The {@link Account}s for this
account
role.
*/
@ManyToMany
(
mappedBy
=
"roles"
)
private
Set
<
Account
>
accounts
;
/**
* Builds a new and empty
user
role definition.
* Builds a new and empty
account
role definition.
* All attributes are set to their default value.
* <br/>
* Needed by Hibernate for Java reflection.
...
...
@@ -103,7 +103,7 @@ public class AccountRole /* extends org.roliste.data.DbEntity */
}
/**
* Initializes the
user
visible flag.
* Initializes the
account
visible flag.
* @param visible the new flag value.
* @see #isVisible
*/
...
...
@@ -112,7 +112,7 @@ public class AccountRole /* extends org.roliste.data.DbEntity */
}
/**
* Retrieves the list of {@link Account}s for this
user
role.
* Retrieves the list of {@link Account}s for this
account
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.
...
...
@@ -137,7 +137,7 @@ public class AccountRole /* extends org.roliste.data.DbEntity */
}
/**
* Sets the list of {@link Account}s for this
user
role.
* Sets the list of {@link Account}s for this
account
role.
* @param accounts the new {@link Set} of {@link Account}s. May be
* <code>null</code> (we don't handle the relation from this side).
* @see #getAccounts()
...
...
@@ -147,8 +147,8 @@ public class AccountRole /* extends org.roliste.data.DbEntity */
}
/**
* Returns a string representation of this
user
role definition.
* @return a string representing this
user
role definition.
* Returns a string representation of this
account
role definition.
* @return a string representing this
account
role definition.
* hidden
*/
@Override
...
...
src/main/java/org/legrog/web/
user/User
Service.java
→
src/main/java/org/legrog/web/
account/Account
Service.java
View file @
cd66d4a
package
org
.
legrog
.
web
.
user
;
package
org
.
legrog
.
web
.
account
;
import
org.legrog.entities.Account
;
import
java.util.List
;
public
interface
User
Service
{
public
interface
Account
Service
{
void
addUser
(
Account
account
);
List
<
Account
>
getAllUsers
();
...
...
src/main/java/org/legrog/web/
user/User
ServiceDefault.java
→
src/main/java/org/legrog/web/
account/Account
ServiceDefault.java
View file @
cd66d4a
package
org
.
legrog
.
web
.
user
;
package
org
.
legrog
.
web
.
account
;
import
org.legrog.entities.Account
;
import
org.legrog.entities.AccountRepository
;
...
...
@@ -8,7 +8,7 @@ import javax.inject.Inject;
import
java.util.List
;
@Stateless
public
class
UserServiceDefault
implements
User
Service
{
public
class
AccountServiceDefault
implements
Account
Service
{
@Inject
AccountRepository
accountRepository
;
...
...
src/main/java/org/legrog/web/
user/ListUser
sBean.java
→
src/main/java/org/legrog/web/
account/ListAccount
sBean.java
View file @
cd66d4a
package
org
.
legrog
.
web
.
user
;
package
org
.
legrog
.
web
.
account
;
import
org.legrog.entities.Account
;
...
...
@@ -10,9 +10,9 @@ import java.util.List;
@Named
@RequestScoped
public
class
List
User
sBean
{
public
class
List
Account
sBean
{
@Inject
private
User
Service
userService
;
private
Account
Service
userService
;
private
List
<
Account
>
accounts
;
...
...
src/main/java/org/legrog/web/
user/UpdateUser
Bean.java
→
src/main/java/org/legrog/web/
account/UpdateAccount
Bean.java
View file @
cd66d4a
package
org
.
legrog
.
web
.
user
;
package
org
.
legrog
.
web
.
account
;
import
org.legrog.web.xyz.SharedService
;
import
org.legrog.entities.*
;
...
...
@@ -16,11 +16,11 @@ import java.util.List;
@Named
@SessionScoped
public
class
Update
User
Bean
{
public
class
Update
Account
Bean
{
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
User
Service
userService
;
private
Account
Service
userService
;
private
SharedService
sharedService
;
private
List
<
DisplayNameMask
>
allDisplayNameMasks
;
...
...
@@ -45,12 +45,12 @@ public class UpdateUserBean {
private
boolean
activated
;
@Inject
public
Update
UserBean
(
User
Service
userService
,
SharedService
sharedService
)
{
public
Update
AccountBean
(
Account
Service
userService
,
SharedService
sharedService
)
{
this
.
userService
=
userService
;
this
.
sharedService
=
sharedService
;
}
Update
User
Bean
()
{
Update
Account
Bean
()
{
//no args constructor to make it proxyable
}
...
...
@@ -122,10 +122,10 @@ public class UpdateUserBean {
}
username
=
account
.
getUsername
();
visible
=
account
.
isVisible
();
return
"update
User
.xhtml"
;
return
"update
Account
.xhtml"
;
}
}
return
"list
User
s.xhtml"
;
return
"list
Account
s.xhtml"
;
}
public
String
update
()
{
...
...
@@ -208,11 +208,11 @@ public class UpdateUserBean {
this
.
activated
=
activated
;
}
public
User
Service
getUserService
()
{
public
Account
Service
getUserService
()
{
return
userService
;
}
public
void
setUserService
(
User
Service
userService
)
{
public
void
setUserService
(
Account
Service
userService
)
{
this
.
userService
=
userService
;
}
...
...
src/main/java/org/legrog/web/
user/addUser
_short.xhtml
→
src/main/java/org/legrog/web/
account/addAccount
_short.xhtml
View file @
cd66d4a
...
...
@@ -13,9 +13,9 @@
<h:panelGrid
columns=
"2"
>
<h:outputText
value=
"Username de l'utilisateur"
/>
<h:inputText
value=
'#{update
User
Bean.username}'
/>
<h:inputText
value=
'#{update
Account
Bean.username}'
/>
<h:outputText
value=
'Add'
/>
<h:commandButton
action=
"#{update
User
Bean.add}"
value=
"Add"
/>
<h:commandButton
action=
"#{update
Account
Bean.add}"
value=
"Add"
/>
</h:panelGrid>
</h:form>
</body>
...
...
src/main/java/org/legrog/web/
user/listUser
s.xhtml
→
src/main/java/org/legrog/web/
account/listAccount
s.xhtml
View file @
cd66d4a
...
...
@@ -32,13 +32,13 @@
<div
id=
"listElements"
>
<h:commandLink
styleClass=
"fRight acLink"
action=
"add"
rendered=
"#{not empty list
User
sBean.accounts}"
>
<h:commandLink
styleClass=
"fRight acLink"
action=
"add"
rendered=
"#{not empty list
Account
sBean.accounts}"
>
<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 list
User
sBean.accounts}"
var=
"account"
value=
"#{list
User
sBean.accounts}"
<p:dataTable
id=
"tableElements"
rendered=
"#{not empty list
Account
sBean.accounts}"
var=
"account"
value=
"#{list
Account
sBean.accounts}"
styleClass=
"results"
rowClasses=
"altRichRow,altRow"
>
<!-- TODO Grer la pagination -->
<!-- <p:dataTable id="tableElements" rendered="#{listUsersBean.accounts.size>0}"
...
...
@@ -61,7 +61,7 @@
</h:commandLink>-->
</p:column>
<p:column>
<h:commandLink
action=
"#{update
User
Bean.prepareUpdate(account.userId)}"
>
<h:commandLink
action=
"#{update
Account
Bean.prepareUpdate(account.userId)}"
>
<img
src=
"/images/structure/vide.gif"
class=
"icEdit"
alt=
"Modifier"
title=
"Modifier"
/>
</h:commandLink>
</p:column>
...
...
@@ -99,7 +99,7 @@
</div>
<p>
<h:commandLink
action=
"add"
value=
"Crer un nouvel utilisateur"
rendered=
"#{empty list
User
sBean.accounts}"
>
rendered=
"#{empty list
Account
sBean.accounts}"
>
</h:commandLink>
</p>
</h:form>
...
...
src/main/java/org/legrog/web/
user/listUser
s_short.xhtml
→
src/main/java/org/legrog/web/
account/listAccount
s_short.xhtml
View file @
cd66d4a
...
...
@@ -12,7 +12,7 @@
</h:commandLink>
</h:form>
<ul>
<ui:repeat
value=
"#{list
User
sBean.accounts}"
var=
"account"
>
<ui:repeat
value=
"#{list
Account
sBean.accounts}"
var=
"account"
>
<li>
#{account.username}
</li>
</ui:repeat>
</ul>
...
...
src/main/java/org/legrog/web/
user/updateUser
.xhtml
→
src/main/java/org/legrog/web/
account/updateAccount
.xhtml
View file @
cd66d4a
...
...
@@ -18,8 +18,8 @@
<!-- content -->
<!-- <ui:define name="content">-->
<body>
<h2><h:outputText
value=
"Cration "
rendered=
"#{update
User
Bean.userId == 0}"
/>
<h:outputText
value=
"Modification "
rendered=
"#{update
User
Bean.userId != 0}"
/>
d'un utilisateur
</h2>
<h2><h:outputText
value=
"Cration "
rendered=
"#{update
Account
Bean.userId == 0}"
/>
<h:outputText
value=
"Modification "
rendered=
"#{update
Account
Bean.userId != 0}"
/>
d'un utilisateur
</h2>
<p>
Les rles sont hirarchiss, et la hirarchie est automatiquement applique lorsque vous
...
...
@@ -40,53 +40,53 @@
<table
class=
"noMargin"
>
<tr>
<td><h:outputLabel
for=
"username"
>
Identifiant *
</h:outputLabel></td>
<td><h:inputText
id=
"username"
value=
"#{update
User
Bean.username}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:inputText
id=
"username"
value=
"#{update
Account
Bean.username}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"username"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"firstname"
>
Prnom *
</h:outputLabel></td>
<td><h:inputText
id=
"firstname"
value=
"#{update
User
Bean.firstName}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:inputText
id=
"firstname"
value=
"#{update
Account
Bean.firstName}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"firstname"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"lastname"
>
Nom *
</h:outputLabel></td>
<td><h:inputText
id=
"lastname"
value=
"#{update
User
Bean.lastName}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:inputText
id=
"lastname"
value=
"#{update
Account
Bean.lastName}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"lastname"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"nickname"
>
Pseudonyme
</h:outputLabel></td>
<td><h:inputText
id=
"nickname"
value=
"#{update
User
Bean.nickName}"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:inputText
id=
"nickname"
value=
"#{update
Account
Bean.nickName}"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"nickname"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"mask"
>
Affichage public du nom *
</h:outputLabel></td>
<td>
<h:selectOneMenu
id=
"mask"
value=
"#{update
User
Bean.displayNameMask}"
converter=
"omnifaces.SelectItemsConverter"
required=
"true"
style=
"width: 175px;"
>
<f:selectItems
value=
"#{update
User
Bean.allDisplayNameMasks}"
/>
<h:selectOneMenu
id=
"mask"
value=
"#{update
Account
Bean.displayNameMask}"
converter=
"omnifaces.SelectItemsConverter"
required=
"true"
style=
"width: 175px;"
>
<f:selectItems
value=
"#{update
Account
Bean.allDisplayNameMasks}"
/>
</h:selectOneMenu>
</td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"mask"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"email"
>
Adresse email *
</h:outputLabel></td>
<td><h:inputText
id=
"email"
value=
"#{update
User
Bean.email}"
required=
"true"
style=
"width: 175px;"
maxlength=
"100"
>
<!--<f:validator validatorId="validateEmail"/>-->
</h:inputText></td>
<td><h:inputText
id=
"email"
value=
"#{update
Account
Bean.email}"
required=
"true"
style=
"width: 175px;"
maxlength=
"100"
>
<!--<f:validator validatorId="validateEmail"/>-->
</h:inputText></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"email"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"anonymous"
>
Profil Anonyme ?
</h:outputLabel></td>
<td><h:selectBooleanCheckbox
id=
"anonymous"
value=
"#{update
User
Bean.anonymous}"
/></td>
<td><h:selectBooleanCheckbox
id=
"anonymous"
value=
"#{update
Account
Bean.anonymous}"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"anonymous"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"password"
>
Mot de passe *
</h:outputLabel></td>
<td><h:inputSecret
id=
"password"
redisplay=
"true"
value=
"#{update
User
Bean.password}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:inputSecret
id=
"password"
redisplay=
"true"
value=
"#{update
Account
Bean.password}"
required=
"true"
style=
"width: 175px;"
maxlength=
"50"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"password"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"roles"
>
Rles
</h:outputLabel></td>
<td>
<h:selectManyCheckbox
id=
"roles"
value=
"#{update
User
Bean.roles}"
converter=
"omnifaces.SelectItemsConverter"
layout=
"pageDirection"
>
<f:selectItems
value=
"#{update
User
Bean.availableAccountRoles}"
var=
"role"
itemLabel=
"#{role.rolename}"
/>
<h:selectManyCheckbox
id=
"roles"
value=
"#{update
Account
Bean.roles}"
converter=
"omnifaces.SelectItemsConverter"
layout=
"pageDirection"
>
<f:selectItems
value=
"#{update
Account
Bean.availableAccountRoles}"
var=
"role"
itemLabel=
"#{role.rolename}"
/>
</h:selectManyCheckbox>
</td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"roles"
/></td>
...
...
@@ -100,17 +100,17 @@
<td
colspan=
"2"
>
<!--<rich:editor id="text" value="#{updateUserBean.presentation}" configuration="article-editor"/>-->
</td>
</tr>
<ui:remove>
<ui:fragment
rendered=
"#{update
User
Bean.userId != 0}"
>
<ui:fragment
rendered=
"#{update
Account
Bean.userId != 0}"
>
<tr>
<td
colspan=
"3"
class=
"taCenter"
>
<h:dataTable
style=
"width:75%"
headerClass=
"colDroite"
var=
"userProperty"
value=
"#{update
User
Bean.availableUserProperties}"
>
var=
"userProperty"
value=
"#{update
Account
Bean.availableUserProperties}"
>
<h:column>
<f:facet
name=
"header"
><h:outputLabel>
Proprits
</h:outputLabel></f:facet>
<h:outputText
value=
"#{userProperty.tag}"
/>
</h:column>
<h:column>
<h:inputText
id=
"prop_#{userProperty.name}"
value=
"#{update
User
Bean.accountAttributes[userProperty.name].value}"
style=
"width: 175px;"
>
<h:inputText
id=
"prop_#{userProperty.name}"
value=
"#{update
Account
Bean.accountAttributes[userProperty.name].value}"
style=
"width: 175px;"
>
<f:validateLength
maximum=
"200"
/>
</h:inputText>
</h:column>
...
...
@@ -121,24 +121,24 @@
</ui:remove>
<tr>
<td><h:outputLabel
for=
"criticProvider"
>
Archives de critiques ?
</h:outputLabel></td>
<td><h:selectBooleanCheckbox
id=
"criticProvider"
value=
"#{update
User
Bean.criticProvider}"
/></td>
<td><h:selectBooleanCheckbox
id=
"criticProvider"
value=
"#{update
Account
Bean.criticProvider}"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"criticProvider"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"visible"
>
Visible ?
</h:outputLabel></td>
<td><h:selectBooleanCheckbox
id=
"visible"
value=
"#{update
User
Bean.visible}"
/></td>
<td><h:selectBooleanCheckbox
id=
"visible"
value=
"#{update
Account
Bean.visible}"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"visible"
/></td>
</tr>
<tr>
<td><h:outputLabel
for=
"activated"
>
Activ ?
</h:outputLabel></td>
<td><h:selectBooleanCheckbox
id=
"activated"
value=
"#{update
User
Bean.activated}"
/></td>
<td><h:selectBooleanCheckbox
id=
"activated"
value=
"#{update
Account
Bean.activated}"
/></td>
<td><h:message
errorClass=
"errorMsg"
infoClass=
"infoMsg"
for=
"activated"
/></td>
</tr>
<tr>
<td
colspan=
"3"
class=
"taCenter"
>
<!-- <h:outputText>"</h:outputText>#{updateUserBean.userId}<h:outputText>"</h:outputText>-->
<h:commandButton
id=
"update"
value=
"Enregistrer"
action=
"#{update
UserBean.update}"
rendered=
"#{updateUser
Bean.userId != 0}"
/>
 
<h:commandButton
id=
"add"
value=
"Crer"
action=
"#{update
UserBean.add}"
rendered=
"#{updateUser
Bean.userId == 0}"
/>
 
<h:commandButton
id=
"update"
value=
"Enregistrer"
action=
"#{update
AccountBean.update}"
rendered=
"#{updateAccount
Bean.userId != 0}"
/>
 
<h:commandButton
id=
"add"
value=
"Crer"
action=
"#{update
AccountBean.add}"
rendered=
"#{updateAccount
Bean.userId == 0}"
/>
 
<h:button
id=
"cancel"
value=
"Annuler"
outcome=
"cancel"
/>
</td>
</tr>
...
...
@@ -147,7 +147,7 @@
</p:panel>
<ui:remove>
<p:panel
headerClass=
"colDroite"
bodyClass=
"colTexte"
label=
"Import d'anciennes donnes"
switchType=
"ajax"
opened=
"true"
rendered=
"#{update
User
Bean.userId != 0}"
>
switchType=
"ajax"
opened=
"true"
rendered=
"#{update
Account
Bean.userId != 0}"
>
<h:form>
<!--<s:validateAll>-->
<p>
...
...
src/main/java/org/legrog/web/xyz/SharedServiceDefault.java
View file @
cd66d4a
package
org
.
legrog
.
web
.
xyz
;
import
org.legrog.entities.*
;
import
org.legrog.web.
user.User
Service
;
import
org.legrog.web.
account.Account
Service
;
import
javax.ejb.Stateless
;
import
javax.inject.Inject
;
...
...
@@ -18,7 +18,7 @@ public class SharedServiceDefault implements SharedService {
CountryRepository
countryRepository
;
AccountRoleRepository
accountRoleRepository
;
AccountPropertyRepository
accountPropertyRepository
;
UserService
user
Service
;
AccountService
account
Service
;
private
List
<
DisplayNameMask
>
allDisplayNameMasks
;
...
...
@@ -28,15 +28,15 @@ public class SharedServiceDefault implements SharedService {
* @param countryRepository
* @param accountRoleRepository
* @param accountPropertyRepository
* @param
user
Service
* @param
account
Service
*/
@Inject
public
SharedServiceDefault
(
CountryRepository
countryRepository
,
AccountRoleRepository
accountRoleRepository
,
AccountPropertyRepository
accountPropertyRepository
,
UserService
user
Service
)
{
AccountPropertyRepository
accountPropertyRepository
,
AccountService
account
Service
)
{
this
.
countryRepository
=
countryRepository
;
this
.
accountRoleRepository
=
accountRoleRepository
;
this
.
accountPropertyRepository
=
accountPropertyRepository
;
this
.
userService
=
user
Service
;
this
.
accountService
=
account
Service
;
}
@Override
...
...
@@ -75,7 +75,7 @@ public class SharedServiceDefault implements SharedService {
@Override
public
Account
getCurrentUser
()
{
// TODO Remplacer l'astuce par une vraie récupération de l'utilisateur
List
<
Account
>
accounts
=
user
Service
.
getAllUsers
();
List
<
Account
>
accounts
=
account
Service
.
getAllUsers
();
Random
random
=
new
Random
();
return
accounts
.
get
(
random
.
nextInt
(
accounts
.
size
()));
...
...
src/test/java/org/legrog/web/
user
/UpdateAccountBeanTest.java
→
src/test/java/org/legrog/web/
account
/UpdateAccountBeanTest.java
View file @
cd66d4a
package
org
.
legrog
.
web
.
user
;
package
org
.
legrog
.
web
.
account
;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.DisplayName
;
...
...
@@ -27,11 +27,11 @@ import static org.mockito.Mockito.when;
@RunWith
(
JUnitPlatform
.
class
)
public
class
UpdateAccountBeanTest
{
Update
User
Bean
updateUserBean
;
Update
Account
Bean
updateUserBean
;
@BeforeEach
public
void
setUp
(
@Mock
User
Service
userService
,
@Mock
SharedService
sharedService
)
throws
Exception
{
updateUserBean
=
new
Update
User
Bean
(
userService
,
sharedService
)
;
public
void
setUp
(
@Mock
Account
Service
userService
,
@Mock
SharedService
sharedService
)
throws
Exception
{
updateUserBean
=
new
Update
Account
Bean
(
userService
,
sharedService
)
;
}
@Test
...
...
@@ -56,7 +56,7 @@ public class UpdateAccountBeanTest {
}
@Test
@DisplayName
(
"should set lists of available masks,
user roles, and user
properties from shared service"
)
@DisplayName
(
"should set lists of available masks,
account roles, and account
properties from shared service"
)
public
void
testList
(
@Mock
SharedService
sharedService
)
{
updateUserBean
.
init
();
assertThat
(
updateUserBean
.
getAllDisplayNameMasks
()).
isEqualTo
(
displayNameMasks
);
...
...
src/test/java/org/legrog/web/publisher/PublisherVersionViewTest.java
View file @
cd66d4a
...
...
@@ -252,7 +252,7 @@ public class PublisherVersionViewTest {
}
@Test
@DisplayName
(
"should set lists of available masks,
user roles, and user
properties from shared service"
)
@DisplayName
(
"should set lists of available masks,
account roles, and account
properties from shared service"
)
public
void
testList
(
@Mock
SharedService
sharedService
)
{
publisherVersionView
.
init
();
assertThat
(
publisherVersionView
.
getAvailableCountries
()).
isEqualTo
(
countries
);
...
...
src/test/java/org/legrog/web/xyz/SharedServiceDefaultTest.java
View file @
cd66d4a
...
...
@@ -12,7 +12,7 @@ import org.legrog.entities.AccountRoleRepository;
import
org.legrog.entities.Country
;
import
org.legrog.entities.CountryRepository
;
import
org.legrog.test.MockitoExtension
;
import
org.legrog.web.
user.User
Service
;
import
org.legrog.web.
account.Account
Service
;
import
org.mockito.Mock
;
import
org.mockito.*
;
...
...
@@ -31,9 +31,9 @@ public class SharedServiceDefaultTest {
public
void
setUp
(
@Mock
CountryRepository
countryRepository
,
@Mock
AccountRoleRepository
accountRoleRepository
,
@Mock
AccountPropertyRepository
accountPropertyRepository
,
@Mock
UserService
user
Service
)
{
@Mock
AccountService
account
Service
)
{
sharedServiceDefault
=
new
SharedServiceDefault
(
countryRepository
,
accountRoleRepository
,
accountPropertyRepository
,
user
Service
);
accountPropertyRepository
,
account
Service
);
}
@Nested
...
...
Please
register
or
login
to post a comment