Compile (WIP sur updateUser.xhtml et le reste de la transition User)
Showing
20 changed files
with
764 additions
and
137 deletions
... | @@ -29,6 +29,20 @@ | ... | @@ -29,6 +29,20 @@ |
29 | </dependencyManagement> | 29 | </dependencyManagement> |
30 | 30 | ||
31 | <dependencies> | 31 | <dependencies> |
32 | + <!-- **** PREREQUIS MIGRATION **** --> | ||
33 | + <!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces --> | ||
34 | + <dependency> | ||
35 | + <groupId>org.omnifaces</groupId> | ||
36 | + <artifactId>omnifaces</artifactId> | ||
37 | + <version>2.5.1</version> | ||
38 | + </dependency> | ||
39 | + | ||
40 | + <!-- https://mvnrepository.com/artifact/org.primefaces/primefaces --> | ||
41 | + <dependency> | ||
42 | + <groupId>org.primefaces</groupId> | ||
43 | + <artifactId>primefaces</artifactId> | ||
44 | + <version>6.0</version> | ||
45 | + </dependency> | ||
32 | 46 | ||
33 | <!-- **** FRAMEWORK : JSF + CDI **** --> | 47 | <!-- **** FRAMEWORK : JSF + CDI **** --> |
34 | 48 | ... | ... |
1 | -package org.legrog.application; | ||
2 | - | ||
3 | -import org.legrog.entities.Country; | ||
4 | -import org.legrog.entities.CountryRepository; | ||
5 | -//import org.slf4j.Logger; | ||
6 | -//import org.slf4j.LoggerFactory; | ||
7 | - | ||
8 | -import javax.ejb.Stateless; | ||
9 | -import javax.enterprise.inject.Alternative; | ||
10 | -import javax.inject.Inject; | ||
11 | -import java.util.List; | ||
12 | - | ||
13 | -@Stateless | ||
14 | -public class CountryServiceSpring implements CountryService { | ||
15 | - | ||
16 | - @Inject | ||
17 | - CountryRepository repository; | ||
18 | - | ||
19 | - public void addCountry(Country country) { | ||
20 | - repository.save(country); | ||
21 | - } | ||
22 | - | ||
23 | - public List<Country> getAllCountries() { | ||
24 | - return repository.findAll(); | ||
25 | - } | ||
26 | -} |
1 | package org.legrog.application; | 1 | package org.legrog.application; |
2 | 2 | ||
3 | import org.legrog.entities.Country; | 3 | import org.legrog.entities.Country; |
4 | +import org.legrog.entities.DisplayNameMask; | ||
5 | +import org.legrog.entities.UserRole; | ||
4 | 6 | ||
5 | import java.util.List; | 7 | import java.util.List; |
6 | 8 | ||
7 | -public interface CountryService { | 9 | +public interface SharedService { |
8 | 10 | ||
9 | void addCountry(Country country); | 11 | void addCountry(Country country); |
10 | 12 | ||
11 | List<Country> getAllCountries(); | 13 | List<Country> getAllCountries(); |
14 | + | ||
15 | + List<DisplayNameMask> getAllDisplayNameMasks(); | ||
16 | + | ||
17 | + List<UserRole> getAvailableUserRoles(); | ||
18 | + | ||
12 | } | 19 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | +package org.legrog.application; | ||
2 | + | ||
3 | +import org.legrog.entities.*; | ||
4 | +//import org.slf4j.Logger; | ||
5 | +//import org.slf4j.LoggerFactory; | ||
6 | + | ||
7 | +import javax.ejb.Stateless; | ||
8 | +import javax.inject.Inject; | ||
9 | +import java.util.List; | ||
10 | +import java.util.Vector; | ||
11 | + | ||
12 | +@Stateless | ||
13 | +public class SharedServiceSpring implements SharedService { | ||
14 | + | ||
15 | + @Inject | ||
16 | + CountryRepository countryRepository; | ||
17 | + @Inject | ||
18 | + UserRoleRepository userRoleRepository; | ||
19 | + | ||
20 | + private List<DisplayNameMask> allDisplayNameMasks; | ||
21 | + | ||
22 | + public void addCountry(Country country) { | ||
23 | + countryRepository.save(country); | ||
24 | + } | ||
25 | + | ||
26 | + public List<Country> getAllCountries() { | ||
27 | + return countryRepository.findAll(); | ||
28 | + } | ||
29 | + | ||
30 | + public List<DisplayNameMask> getAllDisplayNameMasks() { | ||
31 | + if (allDisplayNameMasks == null) | ||
32 | + { | ||
33 | + allDisplayNameMasks = new Vector<DisplayNameMask>(DisplayNameMask.values().length); | ||
34 | + | ||
35 | + for (DisplayNameMask mask : DisplayNameMask.values()) | ||
36 | + { | ||
37 | + allDisplayNameMasks.add(mask); | ||
38 | + } | ||
39 | + } | ||
40 | + return allDisplayNameMasks; | ||
41 | + } | ||
42 | + | ||
43 | + public List<UserRole> getAvailableUserRoles() { | ||
44 | + return userRoleRepository.findAll(); | ||
45 | + } | ||
46 | +} |
1 | +package org.legrog.entities; | ||
2 | + | ||
3 | +/* DbMaskableEntity en v2, mais je pense le nouveau nom plus clair */ | ||
4 | +public interface DisplayNameConfigurable { | ||
5 | + String getFirstName(); | ||
6 | + | ||
7 | + String getLastName(); | ||
8 | + | ||
9 | + String getNickName(); | ||
10 | + | ||
11 | +/* ScreenName en v2, mais je pense la nouveau nom plus clair */ | ||
12 | + String getDisplayName(); | ||
13 | +} |
1 | +package org.legrog.entities; | ||
2 | + | ||
3 | +/** | ||
4 | + * This enumeration provide options for name masking of authors and users. | ||
5 | + * Every {link org.roliste.data.DbMaskableEntity} provide first name, last name and nickname | ||
6 | + * capabilities, that may be "masked", thus shown in some specific way depending on chosen | ||
7 | + * NameMask. | ||
8 | + */ | ||
9 | +public enum DisplayNameMask | ||
10 | +{ | ||
11 | + PRENOMNOM("Prénom Nom") | ||
12 | + { | ||
13 | + public String listMask(DisplayNameConfigurable person) | ||
14 | + { | ||
15 | + return NOMPRENOM.getDisplayName(person); | ||
16 | + } | ||
17 | + | ||
18 | + public String getDisplayName(DisplayNameConfigurable person) | ||
19 | + { | ||
20 | + StringBuilder sb = new StringBuilder(); | ||
21 | + if (person.getFirstName() != null) | ||
22 | + { | ||
23 | + sb.append(person.getFirstName()); | ||
24 | + } | ||
25 | + if (person.getLastName() != null) | ||
26 | + { | ||
27 | + sb.append(' '); | ||
28 | + sb.append(person.getLastName()); | ||
29 | + } | ||
30 | + return sb.toString(); | ||
31 | + } | ||
32 | + }, | ||
33 | + | ||
34 | + NOMPRENOM("Nom, Prénom") | ||
35 | + { | ||
36 | + public String listMask(DisplayNameConfigurable person) | ||
37 | + { | ||
38 | + return NOMPRENOM.getDisplayName(person); | ||
39 | + } | ||
40 | + | ||
41 | + public String getDisplayName(DisplayNameConfigurable person) | ||
42 | + { | ||
43 | + StringBuilder sb = new StringBuilder(); | ||
44 | + if (person.getLastName() != null) | ||
45 | + { | ||
46 | + sb.append(person.getLastName()); | ||
47 | + if (person.getFirstName() != null) | ||
48 | + { | ||
49 | + sb.append(", "); | ||
50 | + sb.append(person.getFirstName()); | ||
51 | + } | ||
52 | + } | ||
53 | + else | ||
54 | + { | ||
55 | + sb.append("!Pas de nom"); | ||
56 | + } | ||
57 | + return sb.toString(); | ||
58 | + } | ||
59 | + }, | ||
60 | + | ||
61 | + PSEUDO("Pseudo") | ||
62 | + { | ||
63 | + public String listMask(DisplayNameConfigurable person) | ||
64 | + { | ||
65 | + return PSEUDO.getDisplayName(person); | ||
66 | + } | ||
67 | + | ||
68 | + public String getDisplayName(DisplayNameConfigurable person) | ||
69 | + { | ||
70 | + StringBuilder sb = new StringBuilder(); | ||
71 | + if (person.getNickName() != null) | ||
72 | + { | ||
73 | + sb.append(person.getNickName()); | ||
74 | + } | ||
75 | + else | ||
76 | + { | ||
77 | + sb.append("!Pas de pseudo"); | ||
78 | + } | ||
79 | + return sb.toString(); | ||
80 | + } | ||
81 | + }, | ||
82 | + | ||
83 | + COMPLET("Prénom 'Pseudo' Nom") | ||
84 | + { | ||
85 | + public String listMask(DisplayNameConfigurable person) | ||
86 | + { | ||
87 | + return NOMPRENOM.getDisplayName(person); | ||
88 | + } | ||
89 | + | ||
90 | + public String getDisplayName(DisplayNameConfigurable person) | ||
91 | + { | ||
92 | + StringBuffer myResult = new StringBuffer(); | ||
93 | + | ||
94 | + if (person.getFirstName() != null) | ||
95 | + { | ||
96 | + myResult.append(person.getFirstName()); | ||
97 | + myResult.append(' '); | ||
98 | + } | ||
99 | + if ( person.getNickName() != null ) | ||
100 | + { | ||
101 | + myResult.append('\''); | ||
102 | + myResult.append(person.getNickName()); | ||
103 | + myResult.append('\''); | ||
104 | + myResult.append(' '); | ||
105 | + } | ||
106 | + if (person.getLastName() != null) | ||
107 | + { | ||
108 | + myResult.append(person.getLastName()); | ||
109 | + } | ||
110 | + return myResult.toString(); | ||
111 | + } | ||
112 | + }; | ||
113 | + | ||
114 | + private final String symbol; | ||
115 | + | ||
116 | + private DisplayNameMask(String symbol) | ||
117 | + { | ||
118 | + this.symbol = symbol; | ||
119 | + } | ||
120 | + | ||
121 | + public String getSymbol() | ||
122 | + { | ||
123 | + return symbol; | ||
124 | + } | ||
125 | + | ||
126 | + public String toString() | ||
127 | + { | ||
128 | + return symbol; | ||
129 | + } | ||
130 | + | ||
131 | + public abstract String getDisplayName(DisplayNameConfigurable person); | ||
132 | + | ||
133 | + public abstract String listMask(DisplayNameConfigurable person); | ||
134 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -10,7 +10,7 @@ import java.util.*; | ... | @@ -10,7 +10,7 @@ import java.util.*; |
10 | // TODO NameMask et DbMaskableEntity à traiter ensemble | 10 | // TODO NameMask et DbMaskableEntity à traiter ensemble |
11 | @Entity | 11 | @Entity |
12 | //@Table(name="utilisateur") | 12 | //@Table(name="utilisateur") |
13 | -public class User /* extends org.roliste.data.DbTraceableEntity implements DbMaskableEntity, DbValidationEntity */ { | 13 | +public class User /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ { |
14 | 14 | ||
15 | // @Column(name="ID_UTILISATEUR") | 15 | // @Column(name="ID_UTILISATEUR") |
16 | @Id | 16 | @Id |
... | @@ -40,7 +40,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -40,7 +40,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
40 | /** | 40 | /** |
41 | * The mask used for user name. | 41 | * The mask used for user name. |
42 | */ | 42 | */ |
43 | -// private NameMask _mask; | 43 | + private DisplayNameMask displayNameMask; |
44 | /* | 44 | /* |
45 | @Override | 45 | @Override |
46 | public String getUrlKey() | 46 | public String getUrlKey() |
... | @@ -50,21 +50,20 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -50,21 +50,20 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
50 | */ | 50 | */ |
51 | /** | 51 | /** |
52 | * @return the user's name as desired. By default, return the complete name. | 52 | * @return the user's name as desired. By default, return the complete name. |
53 | - * @see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity) | 53 | + * see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity) |
54 | */ | 54 | */ |
55 | - /* | 55 | + public String getDisplayName() |
56 | - public String getScreenName() | ||
57 | { | 56 | { |
58 | - if (_mask != null) | 57 | + if (displayNameMask != null) |
59 | - return _mask.mask(this); | 58 | + return displayNameMask.getDisplayName(this); |
60 | else | 59 | else |
61 | - return NameMask.COMPLET.mask(this); | 60 | + return DisplayNameMask.COMPLET.getDisplayName(this); |
62 | } | 61 | } |
63 | -*/ | 62 | + |
64 | /** | 63 | /** |
65 | * Returns the user's name mask. | 64 | * Returns the user's name mask. |
66 | * @return the mask. | 65 | * @return the mask. |
67 | - * @see #setNameMask(NameMask) | 66 | + * see #setNameMask(NameMask) |
68 | * hibernate.property | 67 | * hibernate.property |
69 | * column="MASQUE_NOM_UTILISATEUR" | 68 | * column="MASQUE_NOM_UTILISATEUR" |
70 | * access="property" | 69 | * access="property" |
... | @@ -72,21 +71,18 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -72,21 +71,18 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
72 | * @hibernate.type | 71 | * @hibernate.type |
73 | * name="org.roliste.data.util.NameMaskUserType" | 72 | * name="org.roliste.data.util.NameMaskUserType" |
74 | */ | 73 | */ |
75 | - /* | 74 | + public DisplayNameMask getDisplayNameMask() { |
76 | - public NameMask getNameMask() { | 75 | + return displayNameMask; |
77 | - return _mask; | ||
78 | } | 76 | } |
79 | -*/ | 77 | + |
80 | /** | 78 | /** |
81 | * Initializes the user's name mask. | 79 | * Initializes the user's name mask. |
82 | - * @param mask the new {@link org.roliste.data.db.NameMask}. | 80 | + * @param mask the new {link org.roliste.data.db.NameMask}. |
83 | - * @see #getNameMask() | 81 | + * see #getNameMask() |
84 | */ | 82 | */ |
85 | - /* | 83 | + public void setDisplayNameMask(DisplayNameMask mask) { |
86 | - public void setNameMask(NameMask mask) { | 84 | + mask = mask; |
87 | - _mask = mask; | ||
88 | } | 85 | } |
89 | -*/ | ||
90 | 86 | ||
91 | 87 | ||
92 | // TODO Faire ailleurs les contrôles de chaîne vide sur : username, password, firstname, lastname, nickname, email, text | 88 | // TODO Faire ailleurs les contrôles de chaîne vide sur : username, password, firstname, lastname, nickname, email, text |
... | @@ -111,7 +107,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -111,7 +107,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
111 | private String lastName; | 107 | private String lastName; |
112 | 108 | ||
113 | /** | 109 | /** |
114 | - * The user screen name. | 110 | + * The user nick name. |
115 | */ | 111 | */ |
116 | private String nickname; | 112 | private String nickname; |
117 | 113 | ||
... | @@ -123,7 +119,8 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -123,7 +119,8 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
123 | /** | 119 | /** |
124 | * The {@link org.roliste.data.db.UserRole}s for this user. | 120 | * The {@link org.roliste.data.db.UserRole}s for this user. |
125 | */ | 121 | */ |
126 | -// private List<UserRole> _roles; | 122 | + @ManyToMany |
123 | + private List<UserRole> roles; | ||
127 | 124 | ||
128 | /** | 125 | /** |
129 | * Retrieves the list of {@link UserRole}s for this user. | 126 | * Retrieves the list of {@link UserRole}s for this user. |
... | @@ -134,7 +131,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -134,7 +131,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
134 | * @see #setRoles(List) | 131 | * @see #setRoles(List) |
135 | * @see #addToRole(UserRole) | 132 | * @see #addToRole(UserRole) |
136 | * @see #removeFromRole(UserRole) | 133 | * @see #removeFromRole(UserRole) |
137 | - * @hibernate.many-to-many | 134 | + * hibernate.many-to-many |
138 | * column="ROLE_FK" | 135 | * column="ROLE_FK" |
139 | * class="org.roliste.data.db.UserRole" | 136 | * class="org.roliste.data.db.UserRole" |
140 | * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" | 137 | * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" |
... | @@ -148,28 +145,28 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -148,28 +145,28 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
148 | * table="role_utilisateur" | 145 | * table="role_utilisateur" |
149 | * lazy="true" | 146 | * lazy="true" |
150 | */ | 147 | */ |
151 | - /* | 148 | + |
152 | public List<UserRole> getRoles() { | 149 | public List<UserRole> getRoles() { |
153 | - return _roles; | 150 | + return roles; |
154 | } | 151 | } |
155 | -*/ | 152 | + |
156 | /** | 153 | /** |
157 | * Lists the list of {@link UserRole}s for this user. | 154 | * Lists the list of {@link UserRole}s for this user. |
158 | * @param roles the new {@link List} of {@link UserRole}s. Shall not be <code>null</code>. | 155 | * @param roles the new {@link List} of {@link UserRole}s. Shall not be <code>null</code>. |
159 | * @throws NullPointerException if roles is <code>null</code>. | 156 | * @throws NullPointerException if roles is <code>null</code>. |
160 | * @see #getRoles() | 157 | * @see #getRoles() |
161 | - * @see #addToRole(UserRole) | 158 | + * see #addToRole(UserRole) |
162 | - * @see #removeFromRole(UserRole) | 159 | + * see #removeFromRole(UserRole) |
163 | */ | 160 | */ |
164 | - /* | 161 | + |
165 | public void setRoles(List<UserRole> roles) { | 162 | public void setRoles(List<UserRole> roles) { |
166 | if (roles == null) | 163 | if (roles == null) |
167 | { | 164 | { |
168 | throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur"); | 165 | throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur"); |
169 | } | 166 | } |
170 | - _roles = roles; | 167 | + this.roles = roles; |
171 | } | 168 | } |
172 | -*/ | 169 | + |
173 | /** | 170 | /** |
174 | * Add the user to a given {@link UserRole}s. | 171 | * Add the user to a given {@link UserRole}s. |
175 | * @param role the new {@link UserRole}. Ignored if <code>null</code>. | 172 | * @param role the new {@link UserRole}. Ignored if <code>null</code>. |
... | @@ -232,7 +229,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -232,7 +229,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
232 | /** | 229 | /** |
233 | * Presentation text. | 230 | * Presentation text. |
234 | */ | 231 | */ |
235 | - private String text; | 232 | + private String presentation; |
236 | 233 | ||
237 | /** | 234 | /** |
238 | * The {@link org.roliste.data.db.BookDetails}s in this user's collection. | 235 | * The {@link org.roliste.data.db.BookDetails}s in this user's collection. |
... | @@ -736,16 +733,16 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas | ... | @@ -736,16 +733,16 @@ public class User /* extends org.roliste.data.DbTraceableEntity implements DbMas |
736 | * length="2147483647" | 733 | * length="2147483647" |
737 | */ | 734 | */ |
738 | public String getPresentation() { | 735 | public String getPresentation() { |
739 | - return text; | 736 | + return presentation; |
740 | } | 737 | } |
741 | 738 | ||
742 | /** | 739 | /** |
743 | * Initializes the HTML text presentation. | 740 | * Initializes the HTML text presentation. |
744 | - * @param text the new {@link String} HTML text. | 741 | + * @param presentation the new {@link String} HTML text. |
745 | * @see #getPresentation() | 742 | * @see #getPresentation() |
746 | */ | 743 | */ |
747 | - public void setPresentation(String text) { | 744 | + public void setPresentation(String presentation) { |
748 | - this.text = text; | 745 | + this.presentation = presentation; |
749 | } | 746 | } |
750 | 747 | ||
751 | /** | 748 | /** | ... | ... |
1 | +package org.legrog.entities; | ||
2 | + | ||
3 | +import java.util.HashSet; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +import javax.persistence.*; | ||
7 | + | ||
8 | +/** | ||
9 | + * The database representation of a user role or group. | ||
10 | + * A given {@link User} may be part of one or more {@link UserRole}. | ||
11 | + * <br/> | ||
12 | + * Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly. | ||
13 | + * You shall always use the getter/setter methods. | ||
14 | + * alias UserRole | ||
15 | + * | ||
16 | + */ | ||
17 | +@Entity | ||
18 | +// TODO évaluer extend v2 | ||
19 | +public class UserRole /* extends org.roliste.data.DbEntity */ | ||
20 | +{ | ||
21 | + @Id | ||
22 | + @GeneratedValue(strategy = GenerationType.AUTO) | ||
23 | + private int userRoleId; | ||
24 | + | ||
25 | + /** | ||
26 | + * The role identifier. | ||
27 | + */ | ||
28 | + private String rolename; | ||
29 | + | ||
30 | + /** | ||
31 | + * The {@link User}s for this user role. | ||
32 | + */ | ||
33 | + @ManyToMany | ||
34 | + private Set<User> users; | ||
35 | + | ||
36 | + /** | ||
37 | + * Builds a new and empty user role definition. | ||
38 | + * All attributes are set to their default value. | ||
39 | + * <br/> | ||
40 | + * Needed by Hibernate for Java reflection. | ||
41 | + */ | ||
42 | + public UserRole() { | ||
43 | + super(); | ||
44 | + rolename = null; | ||
45 | + visible = true; | ||
46 | + // no need to synchronize this | ||
47 | + users = new HashSet<User>(); | ||
48 | + } | ||
49 | + | ||
50 | + public int getUserRoleId() { | ||
51 | + return userRoleId; | ||
52 | + } | ||
53 | + | ||
54 | + public void setUserRoleId(int userRoleId) { | ||
55 | + this.userRoleId = userRoleId; | ||
56 | + } | ||
57 | + | ||
58 | + /** | ||
59 | + * Returns the role identifier. | ||
60 | + * @return the {@link String} identifier. | ||
61 | + * @see #setRolename(String) | ||
62 | + * hibernate.property | ||
63 | + * column="NOM_ROLE" | ||
64 | + * not-null="true" | ||
65 | + * unique="true" | ||
66 | + * access="property" | ||
67 | + * length="50" | ||
68 | + */ | ||
69 | + public String getRolename() { | ||
70 | + return rolename; | ||
71 | + } | ||
72 | + | ||
73 | + /** | ||
74 | + * Initializes the role identifier. | ||
75 | + * @param name the new {@link String} identifier. | ||
76 | + * @see #getRolename() | ||
77 | + */ | ||
78 | + public void setRolename(String name) { | ||
79 | + rolename = name; | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * The role validation status. | ||
84 | + * A role may be temporarily deactivated. | ||
85 | + */ | ||
86 | + private boolean visible; | ||
87 | + | ||
88 | + /** | ||
89 | + * Indicates if the role is visible. | ||
90 | + * If not, users should not be able to access the privileges | ||
91 | + * they inherit from being part of this role. | ||
92 | + * @return the visible flag. | ||
93 | + * @see #setVisible(boolean) | ||
94 | + * hibernate.property | ||
95 | + * column="IND_VISIBLE" | ||
96 | + * access="property" | ||
97 | + */ | ||
98 | + public boolean isVisible() { | ||
99 | + return visible; | ||
100 | + } | ||
101 | + | ||
102 | + /** | ||
103 | + * Initializes the user visible flag. | ||
104 | + * @param visible the new flag value. | ||
105 | + * @see #isVisible | ||
106 | + */ | ||
107 | + public void setVisible(boolean visible) { | ||
108 | + this.visible = visible; | ||
109 | + } | ||
110 | + | ||
111 | + /** | ||
112 | + * Retrieves the list of {@link User}s for this user role. | ||
113 | + * SHALL be used as a read-only attribute. In particular, avoid | ||
114 | + * using {@link Set#add(Object)} or {@link Set#remove(Object)} on | ||
115 | + * the returned value without caution. | ||
116 | + * @return a {@link Set} of {@link User}. May be <code>null</code>. | ||
117 | + * @see #setUsers(Set) | ||
118 | + * hibernate.many-to-many | ||
119 | + * column="UTILISATEUR_FK" | ||
120 | + * class="org.roliste.data.db.User" | ||
121 | + * foreign-key="FK_UTILISATEURROLE_UTILISATEUR" | ||
122 | + * hibernate.key | ||
123 | + * column="ROLE_FK" | ||
124 | + * not-null="true" | ||
125 | + * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" | ||
126 | + * hibernate.set | ||
127 | + * access="property" | ||
128 | + * table="role_utilisateur" | ||
129 | + * lazy="true" | ||
130 | + * inverse="true" | ||
131 | + */ | ||
132 | + public Set<User> getUsers() { | ||
133 | + return users; | ||
134 | + } | ||
135 | + | ||
136 | + /** | ||
137 | + * Sets the list of {@link User}s for this user role. | ||
138 | + * @param users the new {@link Set} of {@link User}s. May be | ||
139 | + * <code>null</code> (we don't handle the relation from this side). | ||
140 | + * @see #getUsers() | ||
141 | + */ | ||
142 | + protected void setUsers(Set<User> users) { | ||
143 | + this.users = users; | ||
144 | + } | ||
145 | + | ||
146 | + /** | ||
147 | + * Returns a string representation of this user role definition. | ||
148 | + * @return a string representing this user role definition. | ||
149 | + * hidden | ||
150 | + */ | ||
151 | + public String toString() | ||
152 | + { | ||
153 | + StringBuilder sb = new StringBuilder(); | ||
154 | + | ||
155 | + sb.append("ID_ROLE="); | ||
156 | + sb.append(getUserRoleId()); | ||
157 | + | ||
158 | + sb.append(" NOM_ROLE="); | ||
159 | + sb.append(rolename); | ||
160 | + | ||
161 | + sb.append(" IND_VISIBLE="); | ||
162 | + sb.append(visible); | ||
163 | + | ||
164 | + return sb.toString(); | ||
165 | + } | ||
166 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | package org.legrog.presentation; | 1 | package org.legrog.presentation; |
2 | 2 | ||
3 | -import org.legrog.application.CountryService; | 3 | +import org.legrog.application.SharedService; |
4 | import org.legrog.entities.Country; | 4 | import org.legrog.entities.Country; |
5 | 5 | ||
6 | import javax.enterprise.context.RequestScoped; | 6 | import javax.enterprise.context.RequestScoped; |
7 | import javax.inject.Inject; | 7 | import javax.inject.Inject; |
8 | import javax.inject.Named; | 8 | import javax.inject.Named; |
9 | -import java.util.List; | ||
10 | 9 | ||
11 | @Named | 10 | @Named |
12 | @RequestScoped | 11 | @RequestScoped |
13 | -public class CountryBean { | 12 | +public class AddCountryBean { |
14 | @Inject | 13 | @Inject |
15 | - private CountryService service; | 14 | + private SharedService sharedService; |
16 | - | ||
17 | - private List<Country> countries; | ||
18 | 15 | ||
19 | private String countryName; | 16 | private String countryName; |
20 | 17 | ||
21 | - public List<Country> getCountries() { | ||
22 | - return countries; | ||
23 | - } | ||
24 | - | ||
25 | - public void setCountries(List<Country> countries) { | ||
26 | - this.countries = countries; | ||
27 | - } | ||
28 | - | ||
29 | public String getCountryName() { | 18 | public String getCountryName() { |
30 | return countryName; | 19 | return countryName; |
31 | } | 20 | } |
... | @@ -38,11 +27,8 @@ public class CountryBean { | ... | @@ -38,11 +27,8 @@ public class CountryBean { |
38 | { | 27 | { |
39 | Country country = new Country(); | 28 | Country country = new Country(); |
40 | country.setCountryName(countryName); | 29 | country.setCountryName(countryName); |
41 | - service.addCountry(country); | 30 | + sharedService.addCountry(country); |
42 | return "success"; | 31 | return "success"; |
43 | } | 32 | } |
44 | 33 | ||
45 | - public void onload() { | ||
46 | - countries = service.getAllCountries(); | ||
47 | - } | ||
48 | } | 34 | } | ... | ... |
1 | +package org.legrog.presentation; | ||
2 | + | ||
3 | +import org.legrog.application.SharedService; | ||
4 | +import org.legrog.application.UserService; | ||
5 | +import org.legrog.entities.DisplayNameMask; | ||
6 | +import org.legrog.entities.User; | ||
7 | +import org.legrog.entities.UserRole; | ||
8 | + | ||
9 | +import javax.annotation.PostConstruct; | ||
10 | +import javax.enterprise.context.RequestScoped; | ||
11 | +import javax.inject.Inject; | ||
12 | +import javax.inject.Named; | ||
13 | +import java.util.List; | ||
14 | + | ||
15 | +@Named | ||
16 | +@RequestScoped | ||
17 | +public class AddUserBean { | ||
18 | + @Inject | ||
19 | + private UserService userService; | ||
20 | + @Inject | ||
21 | + private SharedService sharedService; | ||
22 | + | ||
23 | + private int userId; | ||
24 | + | ||
25 | + private String username; | ||
26 | + | ||
27 | + private String firstName; | ||
28 | + | ||
29 | + private String lastName; | ||
30 | + | ||
31 | + private String nickName; | ||
32 | + | ||
33 | + private DisplayNameMask displayNameMask; | ||
34 | + | ||
35 | + private List<DisplayNameMask> allDisplayNameMasks; | ||
36 | + | ||
37 | + private List<UserRole> availableUserRoles; | ||
38 | + | ||
39 | + private String email; | ||
40 | + | ||
41 | + private boolean anonymous; | ||
42 | + | ||
43 | + private String password; | ||
44 | + | ||
45 | + private List<UserRole> roles; | ||
46 | + | ||
47 | + private String presentation; | ||
48 | + | ||
49 | + public String getUsername() { | ||
50 | + return username; | ||
51 | + } | ||
52 | + | ||
53 | + public void setUsername(String username) { | ||
54 | + this.username = username; | ||
55 | + } | ||
56 | + | ||
57 | + public String add() | ||
58 | + { | ||
59 | + User user = new User(); | ||
60 | + user.setUsername(username); | ||
61 | + userService.addUser(user); | ||
62 | + return "success"; | ||
63 | + } | ||
64 | + | ||
65 | + public String getFirstName() { | ||
66 | + return firstName; | ||
67 | + } | ||
68 | + | ||
69 | + public void setFirstName(String firstName) { | ||
70 | + this.firstName = firstName; | ||
71 | + } | ||
72 | + | ||
73 | + public String getLastName() { | ||
74 | + return lastName; | ||
75 | + } | ||
76 | + | ||
77 | + public void setLastName(String lastName) { | ||
78 | + this.lastName = lastName; | ||
79 | + } | ||
80 | + | ||
81 | + public String getNickName() { | ||
82 | + return nickName; | ||
83 | + } | ||
84 | + | ||
85 | + public void setNickName(String nickName) { | ||
86 | + this.nickName = nickName; | ||
87 | + } | ||
88 | + | ||
89 | + public DisplayNameMask getDisplayNameMask() { | ||
90 | + return displayNameMask; | ||
91 | + } | ||
92 | + | ||
93 | + public void setDisplayNameMask(DisplayNameMask displayNameMask) { | ||
94 | + this.displayNameMask = displayNameMask; | ||
95 | + } | ||
96 | + | ||
97 | + public List<DisplayNameMask> getAllDisplayNameMasks() { | ||
98 | + return allDisplayNameMasks; | ||
99 | + } | ||
100 | + | ||
101 | + public void setAllDisplayNameMasks(List<DisplayNameMask> allDisplayNameMasks) { | ||
102 | + this.allDisplayNameMasks = allDisplayNameMasks; | ||
103 | + } | ||
104 | + | ||
105 | + public int getUserId() { | ||
106 | + return userId; | ||
107 | + } | ||
108 | + | ||
109 | + public void setUserId(int userId) { | ||
110 | + this.userId = userId; | ||
111 | + } | ||
112 | + | ||
113 | + public String getEmail() { | ||
114 | + return email; | ||
115 | + } | ||
116 | + | ||
117 | + public void setEmail(String email) { | ||
118 | + this.email = email; | ||
119 | + } | ||
120 | + | ||
121 | + public boolean isAnonymous() { | ||
122 | + return anonymous; | ||
123 | + } | ||
124 | + | ||
125 | + public void setAnonymous(boolean anonymous) { | ||
126 | + this.anonymous = anonymous; | ||
127 | + } | ||
128 | + | ||
129 | + public String getPassword() { | ||
130 | + return password; | ||
131 | + } | ||
132 | + | ||
133 | + public void setPassword(String password) { | ||
134 | + this.password = password; | ||
135 | + } | ||
136 | + | ||
137 | + public List<UserRole> getRoles() { | ||
138 | + return roles; | ||
139 | + } | ||
140 | + | ||
141 | + public void setRoles(List<UserRole> roles) { | ||
142 | + this.roles = roles; | ||
143 | + } | ||
144 | + | ||
145 | + @PostConstruct | ||
146 | + public void init() { | ||
147 | + allDisplayNameMasks = sharedService.getAllDisplayNameMasks(); | ||
148 | + availableUserRoles = sharedService.getAvailableUserRoles(); | ||
149 | + } | ||
150 | + | ||
151 | + public List<UserRole> getAvailableUserRoles() { | ||
152 | + return availableUserRoles; | ||
153 | + } | ||
154 | + | ||
155 | + public void setAvailableUserRoles(List<UserRole> availableUserRoles) { | ||
156 | + this.availableUserRoles = availableUserRoles; | ||
157 | + } | ||
158 | + | ||
159 | + public String getPresentation() { | ||
160 | + return presentation; | ||
161 | + } | ||
162 | + | ||
163 | + public void setPresentation(String presentation) { | ||
164 | + this.presentation = presentation; | ||
165 | + } | ||
166 | +} |
1 | +package org.legrog.presentation; | ||
2 | + | ||
3 | +import org.legrog.application.SharedService; | ||
4 | +import org.legrog.entities.Country; | ||
5 | + | ||
6 | +import javax.annotation.PostConstruct; | ||
7 | +import javax.enterprise.context.RequestScoped; | ||
8 | +import javax.inject.Inject; | ||
9 | +import javax.inject.Named; | ||
10 | +import java.util.List; | ||
11 | + | ||
12 | +@Named | ||
13 | +@RequestScoped | ||
14 | +public class ListCountriesBean { | ||
15 | + @Inject | ||
16 | + private SharedService sharedService; | ||
17 | + | ||
18 | + private List<Country> countries; | ||
19 | + | ||
20 | + public List<Country> getCountries() { | ||
21 | + return countries; | ||
22 | + } | ||
23 | + | ||
24 | + public void setCountries(List<Country> countries) { | ||
25 | + this.countries = countries; | ||
26 | + } | ||
27 | + | ||
28 | + @PostConstruct | ||
29 | + public void init() { | ||
30 | + countries = sharedService.getAllCountries(); | ||
31 | + } | ||
32 | + | ||
33 | +} |
... | @@ -3,18 +3,13 @@ package org.legrog.presentation; | ... | @@ -3,18 +3,13 @@ package org.legrog.presentation; |
3 | import org.legrog.application.UserService; | 3 | import org.legrog.application.UserService; |
4 | import org.legrog.entities.User; | 4 | import org.legrog.entities.User; |
5 | 5 | ||
6 | -import javax.enterprise.context.RequestScoped; | 6 | +import javax.annotation.PostConstruct; |
7 | import javax.inject.Inject; | 7 | import javax.inject.Inject; |
8 | -import javax.inject.Named; | ||
9 | import java.util.List; | 8 | import java.util.List; |
10 | 9 | ||
11 | -@Named | 10 | +public class ListUsersBean { |
12 | -@RequestScoped | ||
13 | -public class UserBean { | ||
14 | @Inject | 11 | @Inject |
15 | - private UserService service; | 12 | + private UserService userService; |
16 | - | ||
17 | - private String username; | ||
18 | 13 | ||
19 | private List<User> users; | 14 | private List<User> users; |
20 | 15 | ||
... | @@ -26,24 +21,9 @@ public class UserBean { | ... | @@ -26,24 +21,9 @@ public class UserBean { |
26 | this.users = users; | 21 | this.users = users; |
27 | } | 22 | } |
28 | 23 | ||
29 | - public String getUsername() { | 24 | + @PostConstruct |
30 | - return username; | 25 | + public void init() { |
31 | - } | 26 | + users = userService.getAllUsers(); |
32 | - | ||
33 | - public void setUsername(String username) { | ||
34 | - this.username = username; | ||
35 | - } | ||
36 | - | ||
37 | - public String add() | ||
38 | - { | ||
39 | - User user = new User(); | ||
40 | - user.setUsername(username); | ||
41 | - service.addUser(user); | ||
42 | - return "success"; | ||
43 | - } | ||
44 | - | ||
45 | - public void onload() { | ||
46 | - users = service.getAllUsers(); | ||
47 | } | 27 | } |
48 | 28 | ||
49 | } | 29 | } | ... | ... |
... | @@ -37,7 +37,7 @@ | ... | @@ -37,7 +37,7 @@ |
37 | </navigation-case> | 37 | </navigation-case> |
38 | <navigation-case> | 38 | <navigation-case> |
39 | <from-outcome>listUsers</from-outcome> | 39 | <from-outcome>listUsers</from-outcome> |
40 | - <to-view-id>/listUsers.xhtml</to-view-id> | 40 | + <to-view-id>/listUsers_short.xhtml</to-view-id> |
41 | </navigation-case> | 41 | </navigation-case> |
42 | </navigation-rule> | 42 | </navigation-rule> |
43 | 43 | ||
... | @@ -53,7 +53,7 @@ | ... | @@ -53,7 +53,7 @@ |
53 | <from-view-id>/addUser.xhtml</from-view-id> | 53 | <from-view-id>/addUser.xhtml</from-view-id> |
54 | <navigation-case> | 54 | <navigation-case> |
55 | <from-outcome>success</from-outcome> | 55 | <from-outcome>success</from-outcome> |
56 | - <to-view-id>/listUsers.xhtml</to-view-id> | 56 | + <to-view-id>/listUsers_short.xhtml</to-view-id> |
57 | </navigation-case> | 57 | </navigation-case> |
58 | </navigation-rule> | 58 | </navigation-rule> |
59 | 59 | ... | ... |
... | @@ -13,9 +13,9 @@ | ... | @@ -13,9 +13,9 @@ |
13 | 13 | ||
14 | <h:panelGrid columns="2"> | 14 | <h:panelGrid columns="2"> |
15 | <h:outputText value='Nom du pays'/> | 15 | <h:outputText value='Nom du pays'/> |
16 | - <h:inputText value='#{countryBean.countryName}'/> | 16 | + <h:inputText value='#{addCountryBean.countryName}'/> |
17 | <h:outputText value='Add'/> | 17 | <h:outputText value='Add'/> |
18 | - <h:commandButton action="#{countryBean.add}" value="Add"/> | 18 | + <h:commandButton action="#{addCountryBean.add}" value="Add"/> |
19 | </h:panelGrid> | 19 | </h:panelGrid> |
20 | </h:form> | 20 | </h:form> |
21 | </body> | 21 | </body> | ... | ... |
... | @@ -13,9 +13,9 @@ | ... | @@ -13,9 +13,9 @@ |
13 | 13 | ||
14 | <h:panelGrid columns="2"> | 14 | <h:panelGrid columns="2"> |
15 | <h:outputText value="Username de l'utilisateur"/> | 15 | <h:outputText value="Username de l'utilisateur"/> |
16 | - <h:inputText value='#{userBean.username}'/> | 16 | + <h:inputText value='#{addUserBean.username}'/> |
17 | <h:outputText value='Add'/> | 17 | <h:outputText value='Add'/> |
18 | - <h:commandButton action="#{userBean.add}" value="Add"/> | 18 | + <h:commandButton action="#{addUserBean.add}" value="Add"/> |
19 | </h:panelGrid> | 19 | </h:panelGrid> |
20 | </h:form> | 20 | </h:form> |
21 | </body> | 21 | </body> | ... | ... |
... | @@ -11,11 +11,8 @@ | ... | @@ -11,11 +11,8 @@ |
11 | <h:outputText value="Menu principal"/> | 11 | <h:outputText value="Menu principal"/> |
12 | </h:commandLink> | 12 | </h:commandLink> |
13 | </h:form> | 13 | </h:form> |
14 | -<f:metadata> | ||
15 | - <f:event type="preRenderView" listener="#{countryBean.onload}" /> | ||
16 | -</f:metadata> | ||
17 | <ul> | 14 | <ul> |
18 | - <ui:repeat value="#{countryBean.countries}" var="country"> | 15 | + <ui:repeat value="#{listCountriesBean.countries}" var="country"> |
19 | <li>#{country.countryName}</li> | 16 | <li>#{country.countryName}</li> |
20 | </ui:repeat> | 17 | </ui:repeat> |
21 | </ul> | 18 | </ul> | ... | ... |
1 | -<?xml version="1.0" encoding="UTF-8"?> | 1 | +<?xml version="1.0" encoding="ISO-8859-1"?> |
2 | -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | 2 | +<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
3 | - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | 3 | +<ui:composition xmlns="http://www.w3.org/1999/xhtml" |
4 | -<html xmlns="http://www.w3.org/1999/xhtml" | 4 | + xmlns:ui="http://java.sun.com/jsf/facelets" |
5 | - xmlns:h="http://xmlns.jcp.org/jsf/html" | 5 | + xmlns:h="http://java.sun.com/jsf/html" |
6 | - xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | 6 | + xmlns:f="http://java.sun.com/jsf/core" |
7 | - xmlns:f="http://xmlns.jcp.org/jsf/core"> | 7 | + xmlns:p="http://primefaces.org/ui" |
8 | -<f:view> | 8 | + template="#{theme.template}"> |
9 | + | ||
10 | + <!-- content --> | ||
11 | + <ui:define name="content"> | ||
12 | + | ||
13 | + <h2>Liste des utilisateurs</h2> | ||
14 | + | ||
15 | + <p> | ||
16 | + Liste des utilisateurs enregistrs sur le site. Un utilisateur peut tre "visible" ou non. Dans | ||
17 | + le cas o il n'est pas visible, il lui est impossible de s'identifier sur le site. Au moment de | ||
18 | + son enregistrement, par dfaut, il n'est pas visible : un systme de confirmation par courriel permet | ||
19 | + de valider que l'adresse est correcte, et seulement ce moment l de le rendre visible. La cration | ||
20 | + d'un utilisateur directement partir de la passerelle n'utilise pas ce systme de confirmation. | ||
21 | + </p> | ||
22 | + | ||
9 | <h:form> | 23 | <h:form> |
10 | - <h:commandLink action="home"> | 24 | + <div id="search" style="text-align:center;"> |
11 | - <h:outputText value="Menu principal"/> | 25 | + <h:panelGrid columns="3" styleClass="half"> |
26 | + <h:outputLabel for="searchString" value="Filtre" styleClass="req"/> | ||
27 | + <h:inputText id="searchString" value="#{userListMgr.searchString}" styleClass="req"/> | ||
28 | + <h:commandButton id="find" value="OK" action="#{userListMgr.find}" styleClass="lanceReq"><!--<s:defaultAction/>--></h:commandButton> | ||
29 | + </h:panelGrid> | ||
30 | + <h:outputText value="Pas d'lment respectant ce critre dans la base" | ||
31 | + rendered="#{elementList.rowCount==0}"/> | ||
32 | + </div> | ||
33 | + | ||
34 | + <h:messages globalOnly="true" errorClass="errorMsg" infoClass="infoMsg"/> | ||
35 | + | ||
36 | + <div id="listElements"> | ||
37 | + | ||
38 | + <h:commandLink styleClass="fRight acLink" action="#{userListMgr.goToCreate('user')}" > | ||
39 | + <img src="/images/structure/vide.gif" class="icAddC" alt="" title="Crer un nouvel utilisateur" /> | ||
40 | + Nouvel Utilisateur | ||
12 | </h:commandLink> | 41 | </h:commandLink> |
42 | + | ||
43 | + <p:dataTable id="tableElements" rendered="#{elementList.rowCount>0}" | ||
44 | + var="user" value="#{elementList}" rows="#{userListMgr.pageSize}" | ||
45 | + styleClass="results" rowClasses="altRichRow,altRow"> | ||
46 | + <f:facet name="header"> | ||
47 | + <p:dataScroller for="tableElements" | ||
48 | + stepControls="auto" boundaryControls="auto" fastControls="auto"> | ||
49 | + <f:facet name="first">Premiers</f:facet> | ||
50 | + <f:facet name="last">Derniers</f:facet> | ||
51 | + <f:facet name="fastforward">Suivants</f:facet> | ||
52 | + <f:facet name="fastrewind">Prcdents</f:facet> | ||
53 | + <f:facet name="pages" > </f:facet> | ||
54 | + </p:dataScroller> | ||
55 | + </f:facet> | ||
56 | + <p:column rendered="#{s:hasRole('ADMINISTRATEUR')}"> | ||
57 | + <h:commandLink id="delete" onclick="return confirm('Voulez vous vraiment supprimer cet lment ?');" action="#{userListMgr.delete}"> | ||
58 | + <img src="/images/structure/vide.gif" class="icDel" alt="" title="Effacer" /> | ||
59 | + </h:commandLink> | ||
60 | + </p:column> | ||
61 | + <p:column rendered="#{s:hasRole('ADMINISTRATEUR')}"> | ||
62 | + <h:commandLink action="#{userListMgr.goToUpdate('user', user.pk)}"> | ||
63 | + <img src="/images/structure/vide.gif" class="icEdit" alt="" title="Modifier" /> | ||
64 | + </h:commandLink> | ||
65 | + </p:column> | ||
66 | + <p:column styleClass="third" sortBy="#{user.username}"> | ||
67 | + <f:facet name="header">Identifiant</f:facet> | ||
68 | + <h:outputLink value="#{user.traceable.urlRewrite}"> | ||
69 | + <h:outputText value="#{user.username}" /> | ||
70 | + </h:outputLink> | ||
71 | + </p:column> | ||
72 | + <p:column styleClass="third" sortBy="#{user.firstName} #{user.lastName}"> | ||
73 | + <f:facet name="header">Nom</f:facet> | ||
74 | + <h:outputLink value="#{user.traceable.urlRewrite}"> | ||
75 | + <h:outputText value="#{user.firstName} #{user.lastName}" /> | ||
76 | + </h:outputLink> | ||
77 | + </p:column> | ||
78 | + <p:column styleClass="third" sortBy="#{user.email}"> | ||
79 | + <f:facet name="header">Email</f:facet> | ||
80 | + <h:outputText value="#{user.email}" /> | ||
81 | + </p:column> | ||
82 | + <p:column> | ||
83 | + <h:graphicImage value="/images/structure/dVert.gif" rendered="#{user.visible and user.activated}" title="Utilisateur activ" /> | ||
84 | + <h:graphicImage value="/images/structure/dOrange.gif" rendered="#{(not user.visible) and user.activated}" title="Utilisateur dsactiv" /> | ||
85 | + <h:graphicImage value="/images/structure/dRouge.gif" rendered="#{not user.activated}" title="Utilisateur non enregistr" /> | ||
86 | + </p:column> | ||
87 | + <f:facet name="footer"> | ||
88 | + <h:commandLink action="#{userListMgr.goToCreate('user')}" value="Crer un nouvel utilisateur" > | ||
89 | + </h:commandLink> | ||
90 | + </f:facet> | ||
91 | + </p:dataTable> | ||
92 | + <p> | ||
93 | + <h:commandLink action="#{userListMgr.goToCreate('user')}" value="Crer un nouvel utilisateur" | ||
94 | + rendered="#{elementList.rowCount==0}"> | ||
95 | + </h:commandLink> | ||
96 | + </p> | ||
97 | + </div> | ||
13 | </h:form> | 98 | </h:form> |
14 | - <f:metadata> | 99 | + |
15 | - <f:event type="preRenderView" listener="#{userBean.onload}" /> | 100 | + </ui:define> |
16 | - </f:metadata> | 101 | + |
17 | - <ul> | 102 | + <!-- sidebars --> |
18 | - <ui:repeat value="#{userBean.users}" var="user"> | 103 | + <ui:define name="sidebar"> |
19 | - <li>#{user.username}</li> | 104 | + <ui:include src="/includes/top-sidebar-admin.include"/> |
20 | - </ui:repeat> | 105 | + |
21 | - </ul> | 106 | + </ui:define> |
22 | -</f:view> | 107 | + |
23 | -</html> | 108 | +</ui:composition> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
src/main/webapp/listUsers_short.xhtml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
3 | + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
4 | +<html xmlns="http://www.w3.org/1999/xhtml" | ||
5 | + xmlns:h="http://xmlns.jcp.org/jsf/html" | ||
6 | + xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | ||
7 | + xmlns:f="http://xmlns.jcp.org/jsf/core"> | ||
8 | +<f:view> | ||
9 | + <h:form> | ||
10 | + <h:commandLink action="home"> | ||
11 | + <h:outputText value="Menu principal"/> | ||
12 | + </h:commandLink> | ||
13 | + </h:form> | ||
14 | + <f:metadata> | ||
15 | + <f:event type="preRenderView" listener="#{addUserBean.onload}" /> | ||
16 | + </f:metadata> | ||
17 | + <ul> | ||
18 | + <ui:repeat value="#{addUserBean.users}" var="user"> | ||
19 | + <li>#{user.username}</li> | ||
20 | + </ui:repeat> | ||
21 | + </ul> | ||
22 | +</f:view> | ||
23 | +</html> |
src/main/webapp/updateUser.xhtml
0 → 100644
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment