Jean-Francois Leveque

Merge

......@@ -8,6 +8,8 @@ import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@Named
......@@ -28,29 +30,31 @@ public class ListPublisherRevisionsView {
return publisherRevisions;
}
/*
if (!viewAll) {
logger.info("!viewAll");
ArrayList<PublisherRevision> filteredPublisherRevisions= new ArrayList<PublisherRevision>();
Iterator<PublisherRevision> publisherRevisionIterator = filteredPublisherRevisions.iterator();
while (publisherRevisionIterator.hasNext()) {
PublisherRevision publisherRevision = publisherRevisionIterator.next();
if (publisherRevision.getPublisher().getPublisherId() == publisherId.intValue()) {
filteredPublisherRevisions.add(publisherRevision);
}
}
publisherRevisions = filteredPublisherRevisions;
}
*/
@PostConstruct
public void init() {
publisherRevisions = publisherService.getAllPublisherRevisions();
logger.info("init");
}
public void setView() {
logger.info("setView");
logger.info("publisherId = " + publisherId);
viewAll = ( publisherId == null ) ;
if (!viewAll) {
logger.info("!viewAll");
ArrayList<PublisherRevision> filteredPublisherRevisions= new ArrayList<PublisherRevision>();
Iterator<PublisherRevision> publisherRevisionIterator = publisherRevisions.iterator();
for(PublisherRevision publisherRevision : publisherRevisions) {
if (publisherRevision.getPublisher().getPublisherId() == publisherId.intValue()) {
filteredPublisherRevisions.add(publisherRevision);
}
}
publisherRevisions = filteredPublisherRevisions;
}
}
public Integer getPublisherId() {
......
......@@ -36,11 +36,15 @@
</h:column>
<h:column rendered="#{listPublisherRevisionsView.viewAll}">
<f:facet name="header">Editeur</f:facet>
#{revision.publisher.publisherId}
<h:link outcome="/listPublisherRevisions">
#{revision.publisher.publisherId}
<f:param name="publisherId" value="#{revision.publisher.publisherId}"/>
</h:link>
</h:column>
<h:column rendered="#{not listPublisherRevisionsView.viewAll}">
<f:facet name="header">Valide</f:facet>
#{revision.publisherRevisionId == revision.publisher.activeRevision}
</h:column>
<h:column>
<f:facet name="header">Name</f:facet>
#{revision.publisherName}
......@@ -81,6 +85,12 @@
<f:facet name="header">Revision Datetime</f:facet>
#{revision.publisherRevisionDatetime}
</h:column>
<h:column>
<f:facet name="header"></f:facet>
</h:column>
<h:column>
<f:facet name="header"></f:facet>
</h:column>
</h:dataTable>
</h:body>
</html>
......
......@@ -10,6 +10,31 @@ INSERT INTO Country (countryName) VALUES ('Royaume-Uni');
INSERT INTO Country (countryName) VALUES ('Allemagne');
INSERT INTO Country (countryName) VALUES ('Pologne');
INSERT INTO Country (countryName) VALUES ('Italie');
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES
(1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE),
(2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE),
(3, 'three', 'three', 'Marcus', 'Boone', 'three', 'three@raza.org', TRUE, FALSE, TRUE, TRUE),
(4, 'four', 'four', 'Ryo', 'Tetsuda', 'four', 'four@raza.org', TRUE, FALSE, TRUE, TRUE),
(5, 'five', 'five', 'Emily', 'Kolburn', 'five', 'five@raza.org', TRUE, FALSE, TRUE, TRUE),
(6, 'six', 'six', 'Kal', 'Varrik', 'six', 'six@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO Publisher () VALUES ();
INSERT INTO Publisher () VALUES ();
INSERT INTO Publisher () VALUES ();
INSERT INTO Publisher () VALUES ();
INSERT INTO PublisherRevision (publisher_PUBLISHER_ID, publisherName, publisherStreetAddress, publisherPostalCode,
publisherPostOfficeBoxNumber, publisherAddressRegion, publisherAddressLocality, publisherAddressCountry_COUNTRY_ID,
publisherTelephone, publisherEmail, publisherURL, publisherActive, publisherHistory, publisherRevisionAuthor_USER_ID,
publisherRevisionDatetime) VALUES
(1, 'GRôG', '', '', '', '', '', 1, '', 'passerelle@legrog.org', 'www.legrog.org', TRUE, 'Ouvert…', 1, {ts '2000-05-08 00:00:47'}),
(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'}),
(3, 'La Vouivre', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 'la-vouivre.com', TRUE, 'Ouvert…', 1, {ts '2000-01-01 00:02:33'}),
(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'}),
(4, 'Archmagus', NULL, NULL, NULL, NULL, NULL, 1, NULL, NULL, 'archimage.net', TRUE, 'Ouvert…', 4, {ts '2016-10-14 10:56:03'});
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;
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;
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;
INSERT INTO UserRole VALUES (1, 'VISITEUR', TRUE);
INSERT INTO UserRole VALUES (2, 'RECRUE', TRUE);
INSERT INTO UserRole VALUES (3, 'CONTRIBUTEUR', TRUE);
......@@ -22,14 +47,6 @@ INSERT INTO UserProperty VALUES (3, 'tagline', 'Ligne de présentation pour les
INSERT INTO UserProperty VALUES (4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE);
INSERT INTO UserProperty VALUES (5, 'skin', 'Thème visuel', TRUE);
INSERT INTO UserTable (USER_ID, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, criticProvider) VALUES
(1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE),
(2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE),
(3, 'three', 'three', 'Marcus', 'Boone', 'three', 'three@raza.org', TRUE, FALSE, TRUE, TRUE),
(4, 'four', 'four', 'Ryo', 'Tetsuda', 'four', 'four@raza.org', TRUE, FALSE, TRUE, TRUE),
(5, 'five', 'five', 'Emily', 'Kolburn', 'five', 'five@raza.org', TRUE, FALSE, TRUE, TRUE),
(6, 'six', 'six', 'Kal', 'Varrik', 'six', 'six@raza.org', TRUE, FALSE, TRUE, TRUE);
INSERT INTO UserTable_UserRole VALUES (1,2);
INSERT INTO UserTable_UserRole VALUES (2,2);
INSERT INTO UserTable_UserRole VALUES (3,2);
......