Jean-Francois Leveque

Refactoring de User en Account (fin sur le nom des classes et fichiers).

......@@ -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;
......
......@@ -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
......
package org.legrog.web.user;
package org.legrog.web.account;
import org.legrog.entities.Account;
import java.util.List;
public interface UserService {
public interface AccountService {
void addUser(Account account);
List<Account> getAllUsers();
......
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 UserService {
public class AccountServiceDefault implements AccountService {
@Inject
AccountRepository accountRepository;
......
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 ListUsersBean {
public class ListAccountsBean {
@Inject
private UserService userService;
private AccountService userService;
private List<Account> accounts;
......
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 UpdateUserBean {
public class UpdateAccountBean {
Logger logger = LoggerFactory.getLogger(getClass());
private UserService userService;
private AccountService userService;
private SharedService sharedService;
private List<DisplayNameMask> allDisplayNameMasks;
......@@ -45,12 +45,12 @@ public class UpdateUserBean {
private boolean activated;
@Inject
public UpdateUserBean(UserService userService, SharedService sharedService) {
public UpdateAccountBean(AccountService userService, SharedService sharedService) {
this.userService = userService;
this.sharedService = sharedService;
}
UpdateUserBean() {
UpdateAccountBean() {
//no args constructor to make it proxyable
}
......@@ -122,10 +122,10 @@ public class UpdateUserBean {
}
username = account.getUsername();
visible = account.isVisible();
return "updateUser.xhtml";
return "updateAccount.xhtml";
}
}
return "listUsers.xhtml";
return "listAccounts.xhtml";
}
public String update() {
......@@ -208,11 +208,11 @@ public class UpdateUserBean {
this.activated = activated;
}
public UserService getUserService() {
public AccountService getUserService() {
return userService;
}
public void setUserService(UserService userService) {
public void setUserService(AccountService userService) {
this.userService = userService;
}
......
......@@ -13,9 +13,9 @@
<h:panelGrid columns="2">
<h:outputText value="Username de l'utilisateur"/>
<h:inputText value='#{updateUserBean.username}'/>
<h:inputText value='#{updateAccountBean.username}'/>
<h:outputText value='Add'/>
<h:commandButton action="#{updateUserBean.add}" value="Add"/>
<h:commandButton action="#{updateAccountBean.add}" value="Add"/>
</h:panelGrid>
</h:form>
</body>
......
......@@ -32,13 +32,13 @@
<div id="listElements">
<h:commandLink styleClass="fRight acLink" action="add" rendered="#{not empty listUsersBean.accounts}" >
<h:commandLink styleClass="fRight acLink" action="add" rendered="#{not empty listAccountsBean.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 listUsersBean.accounts}"
var="account" value="#{listUsersBean.accounts}"
<p:dataTable id="tableElements" rendered="#{not empty listAccountsBean.accounts}"
var="account" value="#{listAccountsBean.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="#{updateUserBean.prepareUpdate(account.userId)}">
<h:commandLink action="#{updateAccountBean.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 listUsersBean.accounts}">
rendered="#{empty listAccountsBean.accounts}">
</h:commandLink>
</p>
</h:form>
......
......@@ -12,7 +12,7 @@
</h:commandLink>
</h:form>
<ul>
<ui:repeat value="#{listUsersBean.accounts}" var="account">
<ui:repeat value="#{listAccountsBean.accounts}" var="account">
<li>#{account.username}</li>
</ui:repeat>
</ul>
......
......@@ -18,8 +18,8 @@
<!-- content -->
<!-- <ui:define name="content">-->
<body>
<h2><h:outputText value="Cration " rendered="#{updateUserBean.userId == 0}"/>
<h:outputText value="Modification " rendered="#{updateUserBean.userId != 0}"/>d'un utilisateur</h2>
<h2><h:outputText value="Cration " rendered="#{updateAccountBean.userId == 0}"/>
<h:outputText value="Modification " rendered="#{updateAccountBean.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="#{updateUserBean.username}" required="true" style="width: 175px;" maxlength="50"/></td>
<td><h:inputText id="username" value="#{updateAccountBean.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="#{updateUserBean.firstName}" required="true" style="width: 175px;" maxlength="50"/></td>
<td><h:inputText id="firstname" value="#{updateAccountBean.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="#{updateUserBean.lastName}" required="true" style="width: 175px;" maxlength="50"/></td>
<td><h:inputText id="lastname" value="#{updateAccountBean.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="#{updateUserBean.nickName}" style="width: 175px;" maxlength="50"/></td>
<td><h:inputText id="nickname" value="#{updateAccountBean.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="#{updateUserBean.displayNameMask}" converter="omnifaces.SelectItemsConverter" required="true" style="width: 175px;">
<f:selectItems value="#{updateUserBean.allDisplayNameMasks}"/>
<h:selectOneMenu id="mask" value="#{updateAccountBean.displayNameMask}" converter="omnifaces.SelectItemsConverter" required="true" style="width: 175px;">
<f:selectItems value="#{updateAccountBean.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="#{updateUserBean.email}" required="true" style="width: 175px;" maxlength="100"><!--<f:validator validatorId="validateEmail"/>--></h:inputText></td>
<td><h:inputText id="email" value="#{updateAccountBean.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="#{updateUserBean.anonymous}"/></td>
<td><h:selectBooleanCheckbox id="anonymous" value="#{updateAccountBean.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="#{updateUserBean.password}" required="true" style="width: 175px;" maxlength="50"/></td>
<td><h:inputSecret id="password" redisplay="true" value="#{updateAccountBean.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="#{updateUserBean.roles}" converter="omnifaces.SelectItemsConverter" layout="pageDirection" >
<f:selectItems value="#{updateUserBean.availableAccountRoles}" var="role" itemLabel="#{role.rolename}" />
<h:selectManyCheckbox id="roles" value="#{updateAccountBean.roles}" converter="omnifaces.SelectItemsConverter" layout="pageDirection" >
<f:selectItems value="#{updateAccountBean.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="#{updateUserBean.userId != 0}">
<ui:fragment rendered="#{updateAccountBean.userId != 0}">
<tr>
<td colspan="3" class="taCenter">
<h:dataTable style="width:75%" headerClass="colDroite"
var="userProperty" value="#{updateUserBean.availableUserProperties}">
var="userProperty" value="#{updateAccountBean.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="#{updateUserBean.accountAttributes[userProperty.name].value}" style="width: 175px;">
<h:inputText id="prop_#{userProperty.name}" value="#{updateAccountBean.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="#{updateUserBean.criticProvider}"/></td>
<td><h:selectBooleanCheckbox id="criticProvider" value="#{updateAccountBean.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="#{updateUserBean.visible}"/></td>
<td><h:selectBooleanCheckbox id="visible" value="#{updateAccountBean.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="#{updateUserBean.activated}"/></td>
<td><h:selectBooleanCheckbox id="activated" value="#{updateAccountBean.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="#{updateUserBean.update}" rendered="#{updateUserBean.userId != 0}"/>&#160;
<h:commandButton id="add" value="Crer" action="#{updateUserBean.add}" rendered="#{updateUserBean.userId == 0}"/>&#160;
<h:commandButton id="update" value="Enregistrer" action="#{updateAccountBean.update}" rendered="#{updateAccountBean.userId != 0}"/>&#160;
<h:commandButton id="add" value="Crer" action="#{updateAccountBean.add}" rendered="#{updateAccountBean.userId == 0}"/>&#160;
<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="#{updateUserBean.userId != 0}">
switchType="ajax" opened="true" rendered="#{updateAccountBean.userId != 0}">
<h:form>
<!--<s:validateAll>-->
<p>
......
package org.legrog.web.xyz;
import org.legrog.entities.*;
import org.legrog.web.user.UserService;
import org.legrog.web.account.AccountService;
import javax.ejb.Stateless;
import javax.inject.Inject;
......@@ -18,7 +18,7 @@ public class SharedServiceDefault implements SharedService {
CountryRepository countryRepository;
AccountRoleRepository accountRoleRepository;
AccountPropertyRepository accountPropertyRepository;
UserService userService;
AccountService accountService;
private List<DisplayNameMask> allDisplayNameMasks;
......@@ -28,15 +28,15 @@ public class SharedServiceDefault implements SharedService {
* @param countryRepository
* @param accountRoleRepository
* @param accountPropertyRepository
* @param userService
* @param accountService
*/
@Inject
public SharedServiceDefault(CountryRepository countryRepository, AccountRoleRepository accountRoleRepository,
AccountPropertyRepository accountPropertyRepository, UserService userService) {
AccountPropertyRepository accountPropertyRepository, AccountService accountService) {
this.countryRepository = countryRepository;
this.accountRoleRepository = accountRoleRepository;
this.accountPropertyRepository = accountPropertyRepository;
this.userService = userService;
this.accountService = accountService;
}
@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 = userService.getAllUsers();
List<Account> accounts = accountService.getAllUsers();
Random random = new Random();
return accounts.get(random.nextInt(accounts.size()));
......
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 {
UpdateUserBean updateUserBean;
UpdateAccountBean updateUserBean;
@BeforeEach
public void setUp(@Mock UserService userService, @Mock SharedService sharedService) throws Exception {
updateUserBean = new UpdateUserBean(userService, sharedService) ;
public void setUp(@Mock AccountService userService, @Mock SharedService sharedService) throws Exception {
updateUserBean = new UpdateAccountBean(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);
......
......@@ -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);
......
......@@ -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.UserService;
import org.legrog.web.account.AccountService;
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 userService) {
@Mock AccountService accountService) {
sharedServiceDefault = new SharedServiceDefault(countryRepository, accountRoleRepository,
accountPropertyRepository, userService);
accountPropertyRepository, accountService);
}
@Nested
......