Showing
3 changed files
with
52 additions
and
21 deletions
... | @@ -8,6 +8,8 @@ import javax.annotation.PostConstruct; | ... | @@ -8,6 +8,8 @@ import javax.annotation.PostConstruct; |
8 | import javax.enterprise.context.RequestScoped; | 8 | import javax.enterprise.context.RequestScoped; |
9 | import javax.inject.Inject; | 9 | import javax.inject.Inject; |
10 | import javax.inject.Named; | 10 | import javax.inject.Named; |
11 | +import java.util.ArrayList; | ||
12 | +import java.util.Iterator; | ||
11 | import java.util.List; | 13 | import java.util.List; |
12 | 14 | ||
13 | @Named | 15 | @Named |
... | @@ -28,29 +30,31 @@ public class ListPublisherRevisionsView { | ... | @@ -28,29 +30,31 @@ public class ListPublisherRevisionsView { |
28 | return publisherRevisions; | 30 | return publisherRevisions; |
29 | } | 31 | } |
30 | /* | 32 | /* |
31 | - if (!viewAll) { | ||
32 | - logger.info("!viewAll"); | ||
33 | - ArrayList<PublisherRevision> filteredPublisherRevisions= new ArrayList<PublisherRevision>(); | ||
34 | - Iterator<PublisherRevision> publisherRevisionIterator = filteredPublisherRevisions.iterator(); | ||
35 | - while (publisherRevisionIterator.hasNext()) { | ||
36 | - PublisherRevision publisherRevision = publisherRevisionIterator.next(); | ||
37 | - if (publisherRevision.getPublisher().getPublisherId() == publisherId.intValue()) { | ||
38 | - filteredPublisherRevisions.add(publisherRevision); | ||
39 | - } | ||
40 | - } | ||
41 | - publisherRevisions = filteredPublisherRevisions; | ||
42 | - } | ||
43 | */ | 33 | */ |
44 | @PostConstruct | 34 | @PostConstruct |
45 | public void init() { | 35 | public void init() { |
46 | publisherRevisions = publisherService.getAllPublisherRevisions(); | 36 | publisherRevisions = publisherService.getAllPublisherRevisions(); |
47 | logger.info("init"); | 37 | logger.info("init"); |
38 | + | ||
48 | } | 39 | } |
49 | 40 | ||
50 | public void setView() { | 41 | public void setView() { |
51 | logger.info("setView"); | 42 | logger.info("setView"); |
52 | logger.info("publisherId = " + publisherId); | 43 | logger.info("publisherId = " + publisherId); |
53 | viewAll = ( publisherId == null ) ; | 44 | viewAll = ( publisherId == null ) ; |
45 | + if (!viewAll) { | ||
46 | + logger.info("!viewAll"); | ||
47 | + ArrayList<PublisherRevision> filteredPublisherRevisions= new ArrayList<PublisherRevision>(); | ||
48 | + | ||
49 | + Iterator<PublisherRevision> publisherRevisionIterator = publisherRevisions.iterator(); | ||
50 | + | ||
51 | + for(PublisherRevision publisherRevision : publisherRevisions) { | ||
52 | + if (publisherRevision.getPublisher().getPublisherId() == publisherId.intValue()) { | ||
53 | + filteredPublisherRevisions.add(publisherRevision); | ||
54 | + } | ||
55 | + } | ||
56 | + publisherRevisions = filteredPublisherRevisions; | ||
57 | + } | ||
54 | } | 58 | } |
55 | 59 | ||
56 | public Integer getPublisherId() { | 60 | public Integer getPublisherId() { | ... | ... |
... | @@ -36,11 +36,15 @@ | ... | @@ -36,11 +36,15 @@ |
36 | </h:column> | 36 | </h:column> |
37 | <h:column rendered="#{listPublisherRevisionsView.viewAll}"> | 37 | <h:column rendered="#{listPublisherRevisionsView.viewAll}"> |
38 | <f:facet name="header">Editeur</f:facet> | 38 | <f:facet name="header">Editeur</f:facet> |
39 | - #{revision.publisher.publisherId} | ||
40 | <h:link outcome="/listPublisherRevisions"> | 39 | <h:link outcome="/listPublisherRevisions"> |
40 | + #{revision.publisher.publisherId} | ||
41 | <f:param name="publisherId" value="#{revision.publisher.publisherId}"/> | 41 | <f:param name="publisherId" value="#{revision.publisher.publisherId}"/> |
42 | </h:link> | 42 | </h:link> |
43 | </h:column> | 43 | </h:column> |
44 | + <h:column rendered="#{not listPublisherRevisionsView.viewAll}"> | ||
45 | + <f:facet name="header">Valide</f:facet> | ||
46 | + #{revision.publisherRevisionId == revision.publisher.activeRevision} | ||
47 | + </h:column> | ||
44 | <h:column> | 48 | <h:column> |
45 | <f:facet name="header">Name</f:facet> | 49 | <f:facet name="header">Name</f:facet> |
46 | #{revision.publisherName} | 50 | #{revision.publisherName} |
... | @@ -81,6 +85,12 @@ | ... | @@ -81,6 +85,12 @@ |
81 | <f:facet name="header">Revision Datetime</f:facet> | 85 | <f:facet name="header">Revision Datetime</f:facet> |
82 | #{revision.publisherRevisionDatetime} | 86 | #{revision.publisherRevisionDatetime} |
83 | </h:column> | 87 | </h:column> |
88 | + <h:column> | ||
89 | + <f:facet name="header"></f:facet> | ||
90 | + </h:column> | ||
91 | + <h:column> | ||
92 | + <f:facet name="header"></f:facet> | ||
93 | + </h:column> | ||
84 | </h:dataTable> | 94 | </h:dataTable> |
85 | </h:body> | 95 | </h:body> |
86 | </html> | 96 | </html> | ... | ... |
... | @@ -10,6 +10,31 @@ INSERT INTO Country (countryName) VALUES ('Royaume-Uni'); | ... | @@ -10,6 +10,31 @@ INSERT INTO Country (countryName) VALUES ('Royaume-Uni'); |
10 | INSERT INTO Country (countryName) VALUES ('Allemagne'); | 10 | INSERT INTO Country (countryName) VALUES ('Allemagne'); |
11 | INSERT INTO Country (countryName) VALUES ('Pologne'); | 11 | INSERT INTO Country (countryName) VALUES ('Pologne'); |
12 | INSERT INTO Country (countryName) VALUES ('Italie'); | 12 | INSERT INTO Country (countryName) VALUES ('Italie'); |
13 | +INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES | ||
14 | + (1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
15 | + (2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
16 | + (3, 'three', 'three', 'Marcus', 'Boone', 'three', 'three@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
17 | + (4, 'four', 'four', 'Ryo', 'Tetsuda', 'four', 'four@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
18 | + (5, 'five', 'five', 'Emily', 'Kolburn', 'five', 'five@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
19 | + (6, 'six', 'six', 'Kal', 'Varrik', 'six', 'six@raza.org', TRUE, FALSE, TRUE, TRUE); | ||
20 | + | ||
21 | +INSERT INTO Publisher () VALUES (); | ||
22 | +INSERT INTO Publisher () VALUES (); | ||
23 | +INSERT INTO Publisher () VALUES (); | ||
24 | +INSERT INTO Publisher () VALUES (); | ||
25 | +INSERT INTO PublisherRevision (publisher_PUBLISHER_ID, publisherName, publisherStreetAddress, publisherPostalCode, | ||
26 | + publisherPostOfficeBoxNumber, publisherAddressRegion, publisherAddressLocality, publisherAddressCountry_COUNTRY_ID, | ||
27 | + publisherTelephone, publisherEmail, publisherURL, publisherActive, publisherHistory, publisherRevisionAuthor_USER_ID, | ||
28 | + publisherRevisionDatetime) VALUES | ||
29 | + (1, 'GRôG', '', '', '', '', '', 1, '', 'passerelle@legrog.org', 'www.legrog.org', TRUE, 'Ouvert…', 1, {ts '2000-05-08 00:00:47'}), | ||
30 | + (2, 'Rôliste TV', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 'www.rolistetv.com', TRUE, 'Ouvert…', 3, {ts '2010-05-20 08:43:16'}), | ||
31 | + (3, 'La Vouivre', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 'la-vouivre.com', TRUE, 'Ouvert…', 1, {ts '2000-01-01 00:02:33'}), | ||
32 | + (3, 'La Vouivre', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 'la-vouivre.com', FALSE, '… en 2015', 2, {ts '2015-01-01 00:05:22'}), | ||
33 | + (4, 'Archmagus', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 'archimage.net', TRUE, 'Ouvert…', 4, {ts '2016-10-14 10:56:03'}); | ||
34 | +UPDATE Publisher SET (activeRevision_PUBLISHER_REVISION_ID, activeValidator_USER_ID, validationDateTime) VALUES (1, 2, {ts '2000-05-08 12:00:28'}) WHERE PUBLISHER_ID = 1; | ||
35 | +UPDATE Publisher SET (activeRevision_PUBLISHER_REVISION_ID, activeValidator_USER_ID, validationDateTime) VALUES (2, 1, TIMESTAMP '2010-06-20 14:27:35') WHERE PUBLISHER_ID = 2; | ||
36 | +UPDATE Publisher SET (activeRevision_PUBLISHER_REVISION_ID, activeValidator_USER_ID, validationDateTime) VALUES (4, 1, TIMESTAMP '2015-01-01 16:18:17') WHERE PUBLISHER_ID = 3; | ||
37 | + | ||
13 | INSERT INTO UserRole VALUES (1, 'VISITEUR', TRUE); | 38 | INSERT INTO UserRole VALUES (1, 'VISITEUR', TRUE); |
14 | INSERT INTO UserRole VALUES (2, 'RECRUE', TRUE); | 39 | INSERT INTO UserRole VALUES (2, 'RECRUE', TRUE); |
15 | INSERT INTO UserRole VALUES (3, 'CONTRIBUTEUR', TRUE); | 40 | INSERT INTO UserRole VALUES (3, 'CONTRIBUTEUR', TRUE); |
... | @@ -22,14 +47,6 @@ INSERT INTO UserProperty VALUES (3, 'tagline', 'Ligne de présentation pour les | ... | @@ -22,14 +47,6 @@ INSERT INTO UserProperty VALUES (3, 'tagline', 'Ligne de présentation pour les |
22 | INSERT INTO UserProperty VALUES (4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE); | 47 | INSERT INTO UserProperty VALUES (4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE); |
23 | INSERT INTO UserProperty VALUES (5, 'skin', 'Thème visuel', TRUE); | 48 | INSERT INTO UserProperty VALUES (5, 'skin', 'Thème visuel', TRUE); |
24 | 49 | ||
25 | -INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES | ||
26 | - (1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
27 | - (2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
28 | - (3, 'three', 'three', 'Marcus', 'Boone', 'three', 'three@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
29 | - (4, 'four', 'four', 'Ryo', 'Tetsuda', 'four', 'four@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
30 | - (5, 'five', 'five', 'Emily', 'Kolburn', 'five', 'five@raza.org', TRUE, FALSE, TRUE, TRUE), | ||
31 | - (6, 'six', 'six', 'Kal', 'Varrik', 'six', 'six@raza.org', TRUE, FALSE, TRUE, TRUE); | ||
32 | - | ||
33 | INSERT INTO UserTable_UserRole VALUES (1,2); | 50 | INSERT INTO UserTable_UserRole VALUES (1,2); |
34 | INSERT INTO UserTable_UserRole VALUES (2,2); | 51 | INSERT INTO UserTable_UserRole VALUES (2,2); |
35 | INSERT INTO UserTable_UserRole VALUES (3,2); | 52 | INSERT INTO UserTable_UserRole VALUES (3,2); | ... | ... |
-
Please register or login to post a comment