Showing
3 changed files
with
1076 additions
and
0 deletions
1 | +package org.legrog.entities; | ||
2 | + | ||
3 | +import javax.persistence.*; | ||
4 | +import java.util.Set; | ||
5 | + | ||
6 | +@Entity | ||
7 | +//@Table(name = "editeur") | ||
8 | +public class Publisher /* extends org.roliste.data.DbLinkableEntity */ { | ||
9 | +// TODO L'éventuel usage de Linkable reste à confirmer https://tree.taiga.io/project/jr-utily-grog-v3/us/48 | ||
10 | +// TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué | ||
11 | + @Id | ||
12 | +// @Column(name = "ID_EDITEUR") | ||
13 | + @GeneratedValue(strategy = GenerationType.AUTO) | ||
14 | + private int publisherId; | ||
15 | + | ||
16 | + @OneToOne | ||
17 | + private PublisherRevision activeRevision; | ||
18 | + | ||
19 | + @OneToOne | ||
20 | + private User activeValidator; | ||
21 | + | ||
22 | + @OneToMany | ||
23 | + private Set<PublisherRevision> revisions; | ||
24 | + | ||
25 | + public int getPublisherId() { | ||
26 | + return publisherId; | ||
27 | + } | ||
28 | + | ||
29 | + public void setPublisherId(int publisherId) { | ||
30 | + this.publisherId = publisherId; | ||
31 | + } | ||
32 | + | ||
33 | + public PublisherRevision getActiveRevision() { | ||
34 | + return activeRevision; | ||
35 | + } | ||
36 | + | ||
37 | + public void setActiveRevision(PublisherRevision activeRevision) { | ||
38 | + this.activeRevision = activeRevision; | ||
39 | + } | ||
40 | + | ||
41 | + public Set<PublisherRevision> getRevisions() { | ||
42 | + return revisions; | ||
43 | + } | ||
44 | + | ||
45 | + public void setRevisions(Set<PublisherRevision> revisions) { | ||
46 | + this.revisions = revisions; | ||
47 | + } | ||
48 | + | ||
49 | + public User getActiveValidator() { | ||
50 | + return activeValidator; | ||
51 | + } | ||
52 | + | ||
53 | + public void setActiveValidator(User activeValidator) { | ||
54 | + this.activeValidator = activeValidator; | ||
55 | + } | ||
56 | +} |
1 | +package org.legrog.entities; | ||
2 | + | ||
3 | +import javax.persistence.*; | ||
4 | +import java.sql.Timestamp; | ||
5 | + | ||
6 | +@Entity | ||
7 | +public class PublisherRevision { | ||
8 | + @Id | ||
9 | + @GeneratedValue(strategy = GenerationType.AUTO) | ||
10 | + private int publisherRevisionId; | ||
11 | + private String publisherName; | ||
12 | + private String publisherStreetAddress; | ||
13 | + private String publisherPostalCode; | ||
14 | + private String publisherPostOfficeBoxNumber; | ||
15 | + private String publisherAddressRegion; | ||
16 | + private String publisherAddressLocality; | ||
17 | + // TODO Créer l'entité Country | ||
18 | +// private Country publisherAddressCountry; | ||
19 | + private String publisherTelephone; | ||
20 | + private String publisherEmail; | ||
21 | + private String publisherURL; | ||
22 | + private boolean publisherActive; | ||
23 | + private String publisherHistory; | ||
24 | + @OneToOne | ||
25 | + private User publisherRevisionAuthor; | ||
26 | + private Timestamp publisherRevisionDatetime; | ||
27 | + | ||
28 | + public Timestamp getPublisherRevisionDatetime() { | ||
29 | + return publisherRevisionDatetime; | ||
30 | + } | ||
31 | + | ||
32 | + public void setPublisherRevisionDatetime(Timestamp publisherRevisionDatetime) { | ||
33 | + this.publisherRevisionDatetime = publisherRevisionDatetime; | ||
34 | + } | ||
35 | + | ||
36 | + public boolean isPublisherActive() { | ||
37 | + return publisherActive; | ||
38 | + } | ||
39 | + | ||
40 | + public void setPublisherActive(boolean publisherActive) { | ||
41 | + this.publisherActive = publisherActive; | ||
42 | + } | ||
43 | + | ||
44 | + public String getPublisherHistory() { | ||
45 | + return publisherHistory; | ||
46 | + } | ||
47 | + | ||
48 | + public void setPublisherHistory(String publisherHistory) { | ||
49 | + this.publisherHistory = publisherHistory; | ||
50 | + } | ||
51 | + | ||
52 | + public String getPublisherStreetAddress() { | ||
53 | + return publisherStreetAddress; | ||
54 | + } | ||
55 | + | ||
56 | + public void setPublisherStreetAddress(String publisherStreetAddress) { | ||
57 | + this.publisherStreetAddress = publisherStreetAddress; | ||
58 | + } | ||
59 | + | ||
60 | + public String getPublisherPostalCode() { | ||
61 | + return publisherPostalCode; | ||
62 | + } | ||
63 | + | ||
64 | + public void setPublisherPostalCode(String publisherPostalCode) { | ||
65 | + this.publisherPostalCode = publisherPostalCode; | ||
66 | + } | ||
67 | + | ||
68 | + public String getPublisherPostOfficeBoxNumber() { | ||
69 | + return publisherPostOfficeBoxNumber; | ||
70 | + } | ||
71 | + | ||
72 | + public void setPublisherPostOfficeBoxNumber(String publisherPostOfficeBoxNumber) { | ||
73 | + this.publisherPostOfficeBoxNumber = publisherPostOfficeBoxNumber; | ||
74 | + } | ||
75 | + | ||
76 | + public String getPublisherAddressRegion() { | ||
77 | + return publisherAddressRegion; | ||
78 | + } | ||
79 | + | ||
80 | + public void setPublisherAddressRegion(String publisherAddressRegion) { | ||
81 | + this.publisherAddressRegion = publisherAddressRegion; | ||
82 | + } | ||
83 | + | ||
84 | + public String getPublisherAddressLocality() { | ||
85 | + return publisherAddressLocality; | ||
86 | + } | ||
87 | + | ||
88 | + public void setPublisherAddressLocality(String publisherAddressLocality) { | ||
89 | + this.publisherAddressLocality = publisherAddressLocality; | ||
90 | + } | ||
91 | + | ||
92 | + public String getPublisherTelephone() { | ||
93 | + return publisherTelephone; | ||
94 | + } | ||
95 | + | ||
96 | + public void setPublisherTelephone(String publisherTelephone) { | ||
97 | + this.publisherTelephone = publisherTelephone; | ||
98 | + } | ||
99 | + | ||
100 | + public String getPublisherEmail() { | ||
101 | + return publisherEmail; | ||
102 | + } | ||
103 | + | ||
104 | + public void setPublisherEmail(String publisherEmail) { | ||
105 | + this.publisherEmail = publisherEmail; | ||
106 | + } | ||
107 | + | ||
108 | + public String getPublisherURL() { | ||
109 | + return publisherURL; | ||
110 | + } | ||
111 | + | ||
112 | + public void setPublisherURL(String publisherURL) { | ||
113 | + this.publisherURL = publisherURL; | ||
114 | + } | ||
115 | + | ||
116 | + public int getPublisherRevisionId() { | ||
117 | + return publisherRevisionId; | ||
118 | + } | ||
119 | + | ||
120 | + public void setPublisherRevisionId(int publisherRevisionId) { | ||
121 | + this.publisherRevisionId = publisherRevisionId; | ||
122 | + } | ||
123 | + | ||
124 | + public String getPublisherName() { | ||
125 | + return publisherName; | ||
126 | + } | ||
127 | + | ||
128 | + public void setPublisherName(String publisherName) { | ||
129 | + this.publisherName = publisherName; | ||
130 | + } | ||
131 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/main/java/org/legrog/entities/User.java
0 → 100644
1 | +package org.legrog.entities; | ||
2 | + | ||
3 | +import javax.persistence.*; | ||
4 | +import java.util.*; | ||
5 | +// TODO Evaluer l'interet de ces imports | ||
6 | +//import org.roliste.data.DbMaskableEntity; | ||
7 | +//import org.roliste.data.DbValidationEntity; | ||
8 | + | ||
9 | +@NamedQueries({ | ||
10 | +@NamedQuery( | ||
11 | + name="findById", | ||
12 | + query="SELECT u FROM User u WHERE u.userId=:id" | ||
13 | +), | ||
14 | + @NamedQuery( | ||
15 | + name="listByPattern", | ||
16 | + query="SELECT u FROM User u WHERE lower(u.username) LIKE :pattern or lower(u.email) LIKE :pattern or lower(u.firstName) LIKE :pattern or lower(u.lastName) LIKE :pattern or lower(u.nickname) LIKE :pattern ORDER BY u.userId DESC" | ||
17 | +), | ||
18 | +@NamedQuery( | ||
19 | + name="listVisibleByPattern", | ||
20 | + query="SELECT u FROM User u WHERE u.visible = true AND u.activated = true AND (lower(u.username) LIKE :pattern or lower(u.email) LIKE :pattern)" | ||
21 | +), | ||
22 | +@NamedQuery( | ||
23 | + name="findByUsername", | ||
24 | + query="SELECT u FROM User u WHERE u.username=:username" | ||
25 | +), | ||
26 | +@NamedQuery( | ||
27 | + name="findByEmail", | ||
28 | + query="SELECT u FROM User u WHERE u.email=:email" | ||
29 | +), | ||
30 | +/* TODO Régler le problème avec elements | ||
31 | +@NamedQuery( | ||
32 | + name="listByRolename", | ||
33 | + query="SELECT u FROM User u, UserRole r WHERE r in elements(u.roles) AND r.rolename=:rolename AND u.visible is true AND u.activated is true" | ||
34 | +), | ||
35 | +*/ | ||
36 | +@NamedQuery( | ||
37 | + name="listForEmailSend", | ||
38 | + query="SELECT u FROM User u WHERE u.visible = true AND u.activated = true" | ||
39 | +), | ||
40 | +@NamedQuery( | ||
41 | + name="listWithExactUserName", | ||
42 | + query="SELECT u FROM User u WHERE u.visible = true AND u.activated = true AND u.username in (:usernames)" | ||
43 | +), | ||
44 | +@NamedQuery( | ||
45 | + name="listVisibleCriticsProviders", | ||
46 | + query="SELECT u FROM User u WHERE u.visible = true AND u.activated = true AND u.criticProvider = true" | ||
47 | +), | ||
48 | +/* TODO Régler le problème avec elements | ||
49 | +@NamedQuery( | ||
50 | + name="listPublisherDelegationsByUser", | ||
51 | + query="SELECT p FROM Publisher p, User u WHERE u=:user AND p.traceable IN ELEMENTS(u.delegations) ORDER BY p.pubName" | ||
52 | +), | ||
53 | +*/ | ||
54 | +/* TODO Régler le problème avec elements | ||
55 | +@NamedQuery( | ||
56 | + name="listAuthorDelegationsByUser", | ||
57 | + query="SELECT a FROM Author a, User u WHERE u=:user AND a.traceable IN ELEMENTS(u.delegations) ORDER BY a.lastName, a.firstName" | ||
58 | +), | ||
59 | +*/ | ||
60 | + /* TODO Régler le problème avec elements | ||
61 | +@NamedQuery( | ||
62 | + name="listPartnerDelegationsByUser", | ||
63 | + query="SELECT p FROM Partner p, User u WHERE u=:user AND p.traceable IN ELEMENTS(u.delegations) ORDER BY p.name" | ||
64 | +), | ||
65 | + */ | ||
66 | + /* TODO Régler le problème avec elements | ||
67 | + @NamedQuery( | ||
68 | + name="listIndieGameDelegationsByUser", | ||
69 | + query="SELECT i FROM IndieGame i, User u WHERE u=:user AND i.traceable IN ELEMENTS(u.delegations) ORDER BY i.title" | ||
70 | + ), | ||
71 | + */ | ||
72 | + @NamedQuery( | ||
73 | + name="listToCleanup", | ||
74 | + query="SELECT u FROM User u WHERE u.activated = false AND u.creationDate < :limitDate" | ||
75 | + ), | ||
76 | + @NamedQuery( | ||
77 | + name="listAll", | ||
78 | + query="SELECT u FROM User u ORDER BY u.userId" | ||
79 | + ) | ||
80 | + /* TODO Pas de traceable pour l'instant, remplacé ou réutilisé ? | ||
81 | + , | ||
82 | + @NamedQuery( | ||
83 | + name="userNotActivatedWithJournalisable", | ||
84 | + query="SELECT u FROM Traceable t, User u WHERE t.creator = u.pk and u.activated = false" | ||
85 | + ), | ||
86 | + @NamedQuery( | ||
87 | + name="findByUrl", | ||
88 | + query="SELECT u FROM User u WHERE u.traceable.urlRewrite=:url" | ||
89 | + ) | ||
90 | + */ | ||
91 | +}) | ||
92 | +// TODO Vérifier les extends | ||
93 | +// TODO NameMask et DbMaskableEntity à traiter ensemble | ||
94 | +@Entity | ||
95 | +//@Table(name="utilisateur") | ||
96 | +public class User /* extends org.roliste.data.DbTraceableEntity implements DbMaskableEntity, DbValidationEntity */ { | ||
97 | + | ||
98 | +// @Column(name="ID_UTILISATEUR") | ||
99 | + @Id | ||
100 | + @GeneratedValue(strategy = GenerationType.AUTO) | ||
101 | + private int userId; | ||
102 | + | ||
103 | + // TODO traiter Traceable | ||
104 | + /** | ||
105 | + * Retrieve this object's Traceable. | ||
106 | + * @hibernate.many-to-one | ||
107 | + * column="ID_JOURNALISABLE" | ||
108 | + * class="org.roliste.data.db.Traceable" | ||
109 | + * access="property" | ||
110 | + * lazy="false" | ||
111 | + * cascade="all" | ||
112 | + * foreign-key="FK_THEME_JOURNALISABLE" | ||
113 | + * @return the {@link org.roliste.data.db.Traceable} record corresponding to this object. May be <code>null</code>. | ||
114 | + * @see #setTraceable(org.roliste.data.db.Traceable) | ||
115 | + */ | ||
116 | + /* | ||
117 | + public Traceable getTraceable() | ||
118 | + { | ||
119 | + return _traceRoot; | ||
120 | + } | ||
121 | +*/ | ||
122 | + // TODO NameMask et DbMaskableEntity à traiter ensemble | ||
123 | + /** | ||
124 | + * The mask used for user name. | ||
125 | + */ | ||
126 | +// private NameMask _mask; | ||
127 | +/* | ||
128 | + @Override | ||
129 | + public String getUrlKey() | ||
130 | + { | ||
131 | + return "/utilisateurs/" + getScreenName(); | ||
132 | + } | ||
133 | +*/ | ||
134 | + /** | ||
135 | + * @return the user's name as desired. By default, return the complete name. | ||
136 | + * @see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity) | ||
137 | + */ | ||
138 | + /* | ||
139 | + public String getScreenName() | ||
140 | + { | ||
141 | + if (_mask != null) | ||
142 | + return _mask.mask(this); | ||
143 | + else | ||
144 | + return NameMask.COMPLET.mask(this); | ||
145 | + } | ||
146 | +*/ | ||
147 | + /** | ||
148 | + * Returns the user's name mask. | ||
149 | + * @return the mask. | ||
150 | + * @see #setNameMask(NameMask) | ||
151 | + * hibernate.property | ||
152 | + * column="MASQUE_NOM_UTILISATEUR" | ||
153 | + * access="property" | ||
154 | + * length="50" | ||
155 | + * @hibernate.type | ||
156 | + * name="org.roliste.data.util.NameMaskUserType" | ||
157 | + */ | ||
158 | + /* | ||
159 | + public NameMask getNameMask() { | ||
160 | + return _mask; | ||
161 | + } | ||
162 | +*/ | ||
163 | + /** | ||
164 | + * Initializes the user's name mask. | ||
165 | + * @param mask the new {@link org.roliste.data.db.NameMask}. | ||
166 | + * @see #getNameMask() | ||
167 | + */ | ||
168 | + /* | ||
169 | + public void setNameMask(NameMask mask) { | ||
170 | + _mask = mask; | ||
171 | + } | ||
172 | +*/ | ||
173 | + | ||
174 | + | ||
175 | + // TODO Faire ailleurs les contrôles de chaîne vide sur : username, password, firstname, lastname, nickname, email, text | ||
176 | + /** | ||
177 | + * The user identifier. | ||
178 | + */ | ||
179 | + private String username; | ||
180 | + | ||
181 | + /** | ||
182 | + * The user password. | ||
183 | + */ | ||
184 | + private String password; | ||
185 | + | ||
186 | + /** | ||
187 | + * The user first name. | ||
188 | + */ | ||
189 | + private String firstName; | ||
190 | + | ||
191 | + /** | ||
192 | + * The user last name. | ||
193 | + */ | ||
194 | + private String lastName; | ||
195 | + | ||
196 | + /** | ||
197 | + * The user screen name. | ||
198 | + */ | ||
199 | + private String nickname; | ||
200 | + | ||
201 | + /** | ||
202 | + * The user email address. | ||
203 | + */ | ||
204 | + private String email; | ||
205 | + | ||
206 | + /** | ||
207 | + * The {@link org.roliste.data.db.UserRole}s for this user. | ||
208 | + */ | ||
209 | +// private List<UserRole> _roles; | ||
210 | + | ||
211 | + /** | ||
212 | + * Retrieves the list of {@link UserRole}s for this user. | ||
213 | + * SHALL be used as a read-only attribute. In particular, avoid | ||
214 | + * using {@link List#add(Object)} or {@link List#remove(Object)} on | ||
215 | + * the returned value without caution. | ||
216 | + * @return a {@link List} of {@link UserRole}. Shall not be <code>null</code>. | ||
217 | + * @see #setRoles(List) | ||
218 | + * @see #addToRole(UserRole) | ||
219 | + * @see #removeFromRole(UserRole) | ||
220 | + * @hibernate.many-to-many | ||
221 | + * column="ROLE_FK" | ||
222 | + * class="org.roliste.data.db.UserRole" | ||
223 | + * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" | ||
224 | + * @hibernate.key | ||
225 | + * column="UTILISATEUR_FK" | ||
226 | + * not-null="true" | ||
227 | + * foreign-key="FK_UTILISATEURROLE_UTILISATEUR" | ||
228 | + * @hibernate.bag | ||
229 | + * cascade="save-update" | ||
230 | + * access="property" | ||
231 | + * table="role_utilisateur" | ||
232 | + * lazy="true" | ||
233 | + */ | ||
234 | + /* | ||
235 | + public List<UserRole> getRoles() { | ||
236 | + return _roles; | ||
237 | + } | ||
238 | +*/ | ||
239 | + /** | ||
240 | + * Lists the list of {@link UserRole}s for this user. | ||
241 | + * @param roles the new {@link List} of {@link UserRole}s. Shall not be <code>null</code>. | ||
242 | + * @throws NullPointerException if roles is <code>null</code>. | ||
243 | + * @see #getRoles() | ||
244 | + * @see #addToRole(UserRole) | ||
245 | + * @see #removeFromRole(UserRole) | ||
246 | + */ | ||
247 | + /* | ||
248 | + public void setRoles(List<UserRole> roles) { | ||
249 | + if (roles == null) | ||
250 | + { | ||
251 | + throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur"); | ||
252 | + } | ||
253 | + _roles = roles; | ||
254 | + } | ||
255 | +*/ | ||
256 | + /** | ||
257 | + * Add the user to a given {@link UserRole}s. | ||
258 | + * @param role the new {@link UserRole}. Ignored if <code>null</code>. | ||
259 | + * @see #getRoles() | ||
260 | + * @see #setRoles(List) | ||
261 | + * @see #removeFromRole(UserRole) | ||
262 | + */ | ||
263 | + /* | ||
264 | + public void addToRole(UserRole role) { | ||
265 | + synchronized (this) | ||
266 | + { | ||
267 | + if ((role != null) && !(getRoles().contains(role)) ) | ||
268 | + { | ||
269 | + role.getUsers().add(this); | ||
270 | + getRoles().add(role); | ||
271 | + } | ||
272 | + } | ||
273 | + } | ||
274 | +*/ | ||
275 | + /** | ||
276 | + * Remove the user from a given {@link UserRole}s. | ||
277 | + * @param role the {@link UserRole} this {@link User} will lose. Ignored if <code>null</code>. | ||
278 | + * @see #getRoles() | ||
279 | + * @see #setRoles(List) | ||
280 | + * @see #addToRole(UserRole) | ||
281 | + */ | ||
282 | + /* | ||
283 | + public void removeFromRole(UserRole role) { | ||
284 | + synchronized (this) | ||
285 | + { | ||
286 | + if ((role != null) && (getRoles().contains(role)) ) | ||
287 | + { | ||
288 | + role.getUsers().remove(this); | ||
289 | + getRoles().remove(role); | ||
290 | + } | ||
291 | + } | ||
292 | + } | ||
293 | +*/ | ||
294 | + /** | ||
295 | + * The user anonymous status. | ||
296 | + * If anonymous, user cannot be contacted through email. | ||
297 | + */ | ||
298 | + private boolean anonymous; | ||
299 | + | ||
300 | + /** | ||
301 | + * The user validation status. | ||
302 | + */ | ||
303 | + private boolean visible; | ||
304 | + | ||
305 | + /** | ||
306 | + * The user was activated at least once. | ||
307 | + */ | ||
308 | + private boolean activated; | ||
309 | + | ||
310 | + /** | ||
311 | + * The user provides critics for archive. | ||
312 | + */ | ||
313 | + private boolean criticProvider; | ||
314 | + | ||
315 | + /** | ||
316 | + * Presentation text. | ||
317 | + */ | ||
318 | + private String text; | ||
319 | + | ||
320 | + /** | ||
321 | + * The {@link org.roliste.data.db.BookDetails}s in this user's collection. | ||
322 | + */ | ||
323 | +// private List<BookDetails> _collection; | ||
324 | + | ||
325 | + /** | ||
326 | + * Retrieves the list of {@link org.roliste.data.db.BookDetails}s in this user's collection. | ||
327 | + * SHALL be used as a read-only attribute. In particular, avoid using {@link List#add(Object)} | ||
328 | + * or {@link List#remove(Object)} on the returned value without caution. | ||
329 | + * @return a {@link List} of {@link org.roliste.data.db.BookDetails}. Shall not be <code>null</code>. | ||
330 | + * @see #setCollection(List) | ||
331 | + * @see #addToCollection(BookDetails) | ||
332 | + * @see #removeFromCollection(BookDetails) | ||
333 | + * @hibernate.many-to-many | ||
334 | + * column="DETAILS_FK" | ||
335 | + * class="org.roliste.data.db.BookDetails" | ||
336 | + * foreign-key="FK_COLLECTION_DETAIL" | ||
337 | + * @hibernate.key | ||
338 | + * column="UTILISATEUR_FK" | ||
339 | + * not-null="true" | ||
340 | + * foreign-key="FK_COLLECTION_UTILISATEUR" | ||
341 | + * @hibernate.bag | ||
342 | + * access="property" | ||
343 | + * table="collection" | ||
344 | + * lazy="true" | ||
345 | + */ | ||
346 | + /* | ||
347 | + public List<BookDetails> getCollection() { | ||
348 | + return _collection; | ||
349 | + } | ||
350 | +*/ | ||
351 | + /** | ||
352 | + * Lists the list of {@link org.roliste.data.db.BookDetails}s in this user's collection. | ||
353 | + * @param collec the new {@link List} of {@link org.roliste.data.db.BookDetails}s. Shall not be <code>null</code>. | ||
354 | + * @throws NullPointerException if collec is <code>null</code>. | ||
355 | + * @see #getCollection() | ||
356 | + * @see #addToCollection(BookDetails) | ||
357 | + * @see #removeFromCollection(BookDetails) | ||
358 | + */ | ||
359 | + /* | ||
360 | + public void setCollection(List<BookDetails> collec) { | ||
361 | + if (collec == null) | ||
362 | + { | ||
363 | + throw new NullPointerException("Impossible d'affecter un ensemble nul pour la collection d'un utilisateur"); | ||
364 | + } | ||
365 | + _collection = collec; | ||
366 | + } | ||
367 | +*/ | ||
368 | + /** | ||
369 | + * Add a book to the user's collection. | ||
370 | + * @param book the new {@link org.roliste.data.db.BookDetails}. Ignored if <code>null</code>. | ||
371 | + * @see #getCollection() | ||
372 | + * @see #setCollection(List) | ||
373 | + * @see #removeFromCollection(BookDetails) | ||
374 | + */ | ||
375 | + /* | ||
376 | + public void addToCollection(BookDetails book) { | ||
377 | + synchronized (this) | ||
378 | + { | ||
379 | + if ((book != null) && !(getCollection().contains(book)) ) | ||
380 | + { | ||
381 | + book.getOwners().add(this); | ||
382 | + getCollection().add(book); | ||
383 | + } | ||
384 | + } | ||
385 | + } | ||
386 | +*/ | ||
387 | + /** | ||
388 | + * Remove a book from user's collection. | ||
389 | + * @param book the {@link org.roliste.data.db.BookDetails} this {@link User} will lose. Ignored if <code>null</code>. | ||
390 | + * @see #getCollection() | ||
391 | + * @see #setCollection(List) | ||
392 | + * @see #addToCollection(BookDetails) | ||
393 | + */ | ||
394 | + /* | ||
395 | + public void removeFromCollection(BookDetails book) { | ||
396 | + synchronized (this) | ||
397 | + { | ||
398 | + if ((book != null) && (getCollection().contains(book)) ) | ||
399 | + { | ||
400 | + book.getOwners().remove(this); | ||
401 | + getCollection().remove(book); | ||
402 | + } | ||
403 | + } | ||
404 | + } | ||
405 | +*/ | ||
406 | + /** | ||
407 | + * The {@link org.roliste.data.db.Traceable}s delegated to this user. | ||
408 | + */ | ||
409 | +// private List<Traceable> _delegations; | ||
410 | + | ||
411 | + /** | ||
412 | + * Retrieves the list of delegations for this user. | ||
413 | + * Each delegation is a link to a {@link org.roliste.data.db.Traceable} object. | ||
414 | + * A user having delegation may update field values for delegated object. | ||
415 | + * @return a {@link List} of {@link UserRole}. Shall not be <code>null</code>. SHALL be used as a | ||
416 | + * read-only attribute. In particular, avoid using {@link List#add(Object)} or {@link List#remove(Object)} | ||
417 | + * on the returned value without caution. | ||
418 | + * @see #setDelegations(List) | ||
419 | + * @see #giveDelegation(Traceable) | ||
420 | + * @see #removeDelegation(Traceable) | ||
421 | + * @hibernate.many-to-many | ||
422 | + * column="ID_JOURNALISABLE" | ||
423 | + * class="org.roliste.data.db.Traceable" | ||
424 | + * foreign-key="FK_DELEGATION_JOURNALISABLE" | ||
425 | + * @hibernate.key | ||
426 | + * column="ID_UTILISATEUR" | ||
427 | + * not-null="true" | ||
428 | + * foreign-key="FK_DELEGATION_UTILISATEUR" | ||
429 | + * @hibernate.bag | ||
430 | + * cascade="save-update" | ||
431 | + * access="property" | ||
432 | + * table="delegation_utilisateur" | ||
433 | + * lazy="true" | ||
434 | + */ | ||
435 | + /* | ||
436 | + public List<Traceable> getDelegations() { | ||
437 | + return _delegations; | ||
438 | + } | ||
439 | +*/ | ||
440 | + /** | ||
441 | + * Sets the list of delegations for this user. | ||
442 | + * @param objects the new {@link List} of delegated {@link Traceable}. Shall not be <code>null</code>. | ||
443 | + * @throws NullPointerException if objects is <code>null</code>. | ||
444 | + * @see #getDelegations() | ||
445 | + * @see #giveDelegation(Traceable) | ||
446 | + * @see #removeDelegation(Traceable) | ||
447 | + */ | ||
448 | + /* | ||
449 | + public void setDelegations(List<Traceable> objects) { | ||
450 | + if (_delegations == null) | ||
451 | + { | ||
452 | + throw new NullPointerException("Impossible d'affecter un ensemble nul aux d�l�gations d'un utilisateur"); | ||
453 | + } | ||
454 | + _delegations = objects; | ||
455 | + } | ||
456 | +*/ | ||
457 | + /** | ||
458 | + * Give delegation on a given {@link Traceable} to this user. | ||
459 | + * @param object the new delegation. Ignored if <code>null</code>. | ||
460 | + * @see #getDelegations() | ||
461 | + * @see #setDelegations(List) | ||
462 | + * @see #removeDelegation(Traceable) | ||
463 | + */ | ||
464 | + /* | ||
465 | + public void giveDelegation(Traceable object) { | ||
466 | + synchronized (this) | ||
467 | + { | ||
468 | + if ((object != null) && !(getDelegations().contains(object)) ) | ||
469 | + { | ||
470 | + object.getDelegates().add(this); | ||
471 | + getDelegations().add(object); | ||
472 | + } | ||
473 | + } | ||
474 | + } | ||
475 | +*/ | ||
476 | + /** | ||
477 | + * Remove delegation on a given {@link Traceable} from this user. | ||
478 | + * @param object the delegation this {@link User} will lose. Ignored if <code>null</code>. | ||
479 | + * @see #getDelegations() | ||
480 | + * @see #setDelegations(List) | ||
481 | + * @see #giveDelegation(Traceable) | ||
482 | + */ | ||
483 | + /* | ||
484 | + public void removeDelegation(Traceable object) { | ||
485 | + synchronized (this) | ||
486 | + { | ||
487 | + if ((object != null) && (getDelegations().contains(object)) ) | ||
488 | + { | ||
489 | + object.getDelegates().remove(this); | ||
490 | + getDelegations().remove(object); | ||
491 | + } | ||
492 | + } | ||
493 | + } | ||
494 | +*/ | ||
495 | + /** | ||
496 | + * Clear all delegations for this user. | ||
497 | + */ | ||
498 | + /* | ||
499 | + public void clearDelegations() | ||
500 | + { | ||
501 | + synchronized (this) | ||
502 | + { | ||
503 | + for (Traceable root : getDelegations()) | ||
504 | + { | ||
505 | + root.getDelegates().remove(this); | ||
506 | + } | ||
507 | + getDelegations().clear(); | ||
508 | + } | ||
509 | + } | ||
510 | +*/ | ||
511 | + /** | ||
512 | + * The list of attributes / properties for this user. | ||
513 | + */ | ||
514 | +// private List<UserAttribute> _attrs; | ||
515 | + | ||
516 | + /** | ||
517 | + * Retrieve this user's attributes. | ||
518 | + * @hibernate.one-to-many | ||
519 | + * class="org.roliste.data.db.UserAttribute" | ||
520 | + * @hibernate.bag | ||
521 | + * cascade="all" | ||
522 | + * lazy="true" | ||
523 | + * inverse="true" | ||
524 | + * @hibernate.key | ||
525 | + * column="ID_UTILISATEUR" | ||
526 | + * @return a {@link java.util.List} of user attributes linked to this. Shall not be <code>null</code>. | ||
527 | + * @see #setAttributes(java.util.List) | ||
528 | + */ | ||
529 | + /* | ||
530 | + public List<UserAttribute> getAttributes() | ||
531 | + { | ||
532 | + return _attrs; | ||
533 | + } | ||
534 | +*/ | ||
535 | + /** | ||
536 | + * @param attribs the List of attributes for this user. | ||
537 | + * @see #getAttributes() | ||
538 | + */ | ||
539 | + /* | ||
540 | + public void setAttributes(List<UserAttribute> attribs) | ||
541 | + { | ||
542 | + _attrs = attribs; | ||
543 | + } | ||
544 | +*/ | ||
545 | + /** | ||
546 | + * The {@link org.roliste.data.db.GamingEvent}s this user's visited. | ||
547 | + */ | ||
548 | +// private Set<GamingEvent> _visitedEvents = new HashSet<GamingEvent>(); | ||
549 | + | ||
550 | + /** | ||
551 | + * Retrieves the list of {@link GamingEvent}s visited by this user. | ||
552 | + * SHALL be used as a read-only attribute. In particular, avoid | ||
553 | + * using {@link Set#add(Object)} or {@link Set#remove(Object)} on | ||
554 | + * the returned value without caution. | ||
555 | + * @return a {@link Set} of {@link GamingEvent}s. May be <code>null</code>. | ||
556 | + * @see #setVisitedEvents(Set) | ||
557 | + * @hibernate.many-to-many | ||
558 | + * column="MANIF_FK" | ||
559 | + * class="org.roliste.data.db.GamingEvent" | ||
560 | + * @hibernate.key | ||
561 | + * column="UTILISATEUR_FK" | ||
562 | + * not-null="true" | ||
563 | + * @hibernate.set | ||
564 | + * access="property" | ||
565 | + * table="manif_utilisateur" | ||
566 | + * inverse="true" | ||
567 | + * lazy="true" | ||
568 | + */ | ||
569 | + /* | ||
570 | + public Set<GamingEvent> getVisitedEvents() { | ||
571 | + return _visitedEvents; | ||
572 | + } | ||
573 | +*/ | ||
574 | + /** | ||
575 | + * Sets the list of {link GamingEvent}s for this user. | ||
576 | + * param events the new {@link Set} of {link GamingEvent}s. May be | ||
577 | + * <code>null</code> (we don't handle the relation from this side). | ||
578 | + * see #getVisitedEvents() | ||
579 | + */ | ||
580 | + /* | ||
581 | + protected void setVisitedEvents(Set<GamingEvent> events) { | ||
582 | + _visitedEvents = events; | ||
583 | + } | ||
584 | +*/ | ||
585 | + | ||
586 | + public int getUserId() { | ||
587 | + return userId; | ||
588 | + } | ||
589 | + | ||
590 | + public void setUserId(int userId) { | ||
591 | + this.userId = userId; | ||
592 | + } | ||
593 | + | ||
594 | + /** | ||
595 | + * Returns the user identifier. | ||
596 | + * @return the {@link String} identifier. | ||
597 | + * @see #setUsername(String) | ||
598 | + * hibernate.property | ||
599 | + * column="LOGIN_UTILISATEUR" | ||
600 | + * not-null="true" | ||
601 | + * unique="true" | ||
602 | + * access="property" | ||
603 | + * length="50" | ||
604 | + */ | ||
605 | + public String getUsername() { | ||
606 | + return username; | ||
607 | + } | ||
608 | + | ||
609 | + /** | ||
610 | + * Initializes the user identifier. | ||
611 | + * @param name the new {@link String} identifier. | ||
612 | + * @see #getUsername() | ||
613 | + */ | ||
614 | + public void setUsername(String name) { | ||
615 | + this.username = name; | ||
616 | + } | ||
617 | + /** | ||
618 | + * Returns the user password. | ||
619 | + * @return the {@link String} password. | ||
620 | + * @see #setPassword(String) | ||
621 | + * hibernate.property | ||
622 | + * column="PASS_UTILISATEUR" | ||
623 | + * not-null="true" | ||
624 | + * access="property" | ||
625 | + * length="50" | ||
626 | + */ | ||
627 | + public String getPassword() { | ||
628 | + return password; | ||
629 | + } | ||
630 | + | ||
631 | + /** | ||
632 | + * Initializes the user password. | ||
633 | + * @param pwd the new {@link String} password. | ||
634 | + * @see #getPassword() | ||
635 | + */ | ||
636 | + public void setPassword(String pwd) { | ||
637 | + this.password = pwd; | ||
638 | + } | ||
639 | + | ||
640 | + /** | ||
641 | + * Returns the user full first name. | ||
642 | + * @return the {@link String} first name. | ||
643 | + * @see #setFirstName(String) | ||
644 | + * hibernate.property | ||
645 | + * column="PRENOM_UTILISATEUR" | ||
646 | + * not-null="true" | ||
647 | + * access="property" | ||
648 | + * length="50" | ||
649 | + */ | ||
650 | + public String getFirstName() { | ||
651 | + return firstName; | ||
652 | + } | ||
653 | + | ||
654 | + /** | ||
655 | + * Initializes the user first name. | ||
656 | + * @param name the new {@link String} first name. | ||
657 | + * @see #getFirstName() | ||
658 | + */ | ||
659 | + public void setFirstName(String name) { | ||
660 | + this.firstName = name; | ||
661 | + } | ||
662 | + | ||
663 | + /** | ||
664 | + * Returns the user full last name. | ||
665 | + * @return the {@link String} last name. | ||
666 | + * @see #setLastName(String) | ||
667 | + * hibernate.property | ||
668 | + * column="NOM_UTILISATEUR" | ||
669 | + * not-null="true" | ||
670 | + * access="property" | ||
671 | + * length="50" | ||
672 | + */ | ||
673 | + public String getLastName() { | ||
674 | + return lastName; | ||
675 | + } | ||
676 | + | ||
677 | + /** | ||
678 | + * Initializes the user last name. | ||
679 | + * @param name the new {@link String} last name. | ||
680 | + * @see #getLastName() | ||
681 | + */ | ||
682 | + public void setLastName(String name) { | ||
683 | + this.lastName = name; | ||
684 | + } | ||
685 | + | ||
686 | + /** | ||
687 | + * Returns the user full screen name. | ||
688 | + * @return the {@link String} screen name. | ||
689 | + * @see #setNickName(String) | ||
690 | + * hibernate.property | ||
691 | + * column="PSEUDO_UTILISATEUR" | ||
692 | + * access="property" | ||
693 | + * length="50" | ||
694 | + */ | ||
695 | + public String getNickName() { | ||
696 | + return nickname; | ||
697 | + } | ||
698 | + | ||
699 | + /** | ||
700 | + * Initializes the user screen name. | ||
701 | + * @param name the new {@link String} screen name. | ||
702 | + * @see #getNickName() | ||
703 | + */ | ||
704 | + public void setNickName(String name) { | ||
705 | + this.nickname = name; | ||
706 | + } | ||
707 | + | ||
708 | + /** | ||
709 | + * Returns the user email. | ||
710 | + * @return the {@link String} email. | ||
711 | + * @see #setEmail(String) | ||
712 | + * hibernate.property | ||
713 | + * column="EMAIL_UTILISATEUR" | ||
714 | + * unique="true" | ||
715 | + * not-null="true" | ||
716 | + * access="property" | ||
717 | + * length="100" | ||
718 | + */ | ||
719 | + public String getEmail() { | ||
720 | + return email; | ||
721 | + } | ||
722 | + | ||
723 | + /** | ||
724 | + * Initializes the user email. | ||
725 | + * @param address the new {@link String} email. | ||
726 | + * @see #getEmail() | ||
727 | + */ | ||
728 | + public void setEmail(String address) { | ||
729 | + this.email = address; | ||
730 | + } | ||
731 | + | ||
732 | + /** | ||
733 | + * Indicates if the user is anonymous. | ||
734 | + * Anonymous users' email and first/last name won't be shown. | ||
735 | + * @return the anonymous flag. | ||
736 | + * @see #setAnonymous(boolean) | ||
737 | + * hibernate.property | ||
738 | + * column="IND_ANONYME" | ||
739 | + * access="property" | ||
740 | + */ | ||
741 | + public boolean isAnonymous() { | ||
742 | + return anonymous; | ||
743 | + } | ||
744 | + | ||
745 | + /** | ||
746 | + * Initializes the user anonymous flag. | ||
747 | + * @param anonymous the new flag value. | ||
748 | + * @see #isAnonymous | ||
749 | + */ | ||
750 | + public void setAnonymous(boolean anonymous) { | ||
751 | + this.anonymous = anonymous; | ||
752 | + } | ||
753 | + | ||
754 | + /** | ||
755 | + * hibernate.property | ||
756 | + * column="IND_VISIBLE" | ||
757 | + * access="property" | ||
758 | + */ | ||
759 | + public boolean isVisible() { | ||
760 | + // WARNING: Method documentation copied from DbValidationEntity | ||
761 | + return visible; | ||
762 | + } | ||
763 | + | ||
764 | + public void setVisible(boolean visible) { | ||
765 | + // WARNING: Method documentation copied from DbValidationEntity | ||
766 | + this.visible = visible; | ||
767 | + } | ||
768 | + | ||
769 | + /** | ||
770 | + * Indicates if the user was activated at least once. | ||
771 | + * @return the activation flag. | ||
772 | + * @see #setCriticProvider(boolean) | ||
773 | + * hibernate.property | ||
774 | + * column="IND_ACTIVE" | ||
775 | + * access="property" | ||
776 | + */ | ||
777 | + public boolean isActivated() { | ||
778 | + return activated; | ||
779 | + } | ||
780 | + | ||
781 | + /** | ||
782 | + * Initializes the user activation flag. | ||
783 | + * @param active the new flag value. | ||
784 | + * @see #isActivated | ||
785 | + */ | ||
786 | + public void setActivated(boolean active) { | ||
787 | + this.activated = active; | ||
788 | + } | ||
789 | + | ||
790 | + /** | ||
791 | + * Indicates if the user provides critics for archives. | ||
792 | + * @return the critics provider flag. | ||
793 | + * @see #setCriticProvider(boolean) | ||
794 | + * hibernate.property | ||
795 | + * column="IND_CRITIQUES" | ||
796 | + * access="property" | ||
797 | + */ | ||
798 | + public boolean isCriticProvider() { | ||
799 | + return criticProvider; | ||
800 | + } | ||
801 | + | ||
802 | + /** | ||
803 | + * Initializes the critics provider flag. | ||
804 | + * @param flag the new flag value. | ||
805 | + * @see #isCriticProvider | ||
806 | + */ | ||
807 | + public void setCriticProvider(boolean flag) { | ||
808 | + this.criticProvider = flag; | ||
809 | + } | ||
810 | + | ||
811 | + /** | ||
812 | + * Returns the HTML text presentation for this user. | ||
813 | + * @return the {@link String} HTML text. | ||
814 | + * @see #setPresentation(String) | ||
815 | + * hibernate.property | ||
816 | + * column="PRESENTATION" | ||
817 | + * access="property" | ||
818 | + * type="text" | ||
819 | + * length="2147483647" | ||
820 | + */ | ||
821 | + public String getPresentation() { | ||
822 | + return text; | ||
823 | + } | ||
824 | + | ||
825 | + /** | ||
826 | + * Initializes the HTML text presentation. | ||
827 | + * @param text the new {@link String} HTML text. | ||
828 | + * @see #getPresentation() | ||
829 | + */ | ||
830 | + public void setPresentation(String text) { | ||
831 | + this.text = text; | ||
832 | + } | ||
833 | + | ||
834 | + /** | ||
835 | + * The user submission date. | ||
836 | + */ | ||
837 | + private Date creationDate; | ||
838 | + | ||
839 | + /** | ||
840 | + * Returns this object creation {@link Date}. | ||
841 | + * @return the object creation {@link Date}. | ||
842 | + * @see #setCreationDate(Date) | ||
843 | + * hibernate.property | ||
844 | + * column="DATE_ENREGISTREMENT" | ||
845 | + * access="property" | ||
846 | + */ | ||
847 | + public Date getCreationDate() { | ||
848 | + return creationDate; | ||
849 | + } | ||
850 | + | ||
851 | + /** | ||
852 | + * Initializes the object creation {@link Date}. | ||
853 | + * @param date the new object creation {@link Date}. | ||
854 | + * @see #getCreationDate() | ||
855 | + */ | ||
856 | + public void setCreationDate(Date date) { | ||
857 | + this.creationDate = date; | ||
858 | + } | ||
859 | + | ||
860 | + /** | ||
861 | + * Returns a string representation of this user definition. | ||
862 | + * @return a string representing this user definition. | ||
863 | + * hidden | ||
864 | + */ | ||
865 | + public String toString() | ||
866 | + { | ||
867 | + StringBuilder sb = new StringBuilder(); | ||
868 | + | ||
869 | + sb.append("ID_UTILISATEUR="); | ||
870 | + sb.append(userId); | ||
871 | + | ||
872 | + sb.append(" LOGIN_UTILISATEUR="); | ||
873 | + sb.append(username); | ||
874 | + | ||
875 | + sb.append(" EMAIL_UTILISATEUR="); | ||
876 | + sb.append(email); | ||
877 | + | ||
878 | + sb.append(" PRENOM_UTILISATEUR="); | ||
879 | + sb.append(firstName); | ||
880 | + | ||
881 | + sb.append(" NOM_UTILISATEUR="); | ||
882 | + sb.append(lastName); | ||
883 | + | ||
884 | + sb.append(" PSEUDO_UTILISATEUR="); | ||
885 | + sb.append(nickname); | ||
886 | + | ||
887 | + return sb.toString(); | ||
888 | + } | ||
889 | +} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
-
Please register or login to post a comment