Jean-Francois Leveque

https://tree.taiga.io/project/jr-utily-grog-v3/us/44 Implementer l'historisation pour les éditeurs

https://tree.taiga.io/project/jr-utily-grog-v3/task/83 Ajouter les commentaires de début de classe
https://tree.taiga.io/project/jr-utily-grog-v3/task/84 Réusinage de Revision en Version
......@@ -2,10 +2,13 @@ package org.legrog.entities;
import javax.persistence.*;
/*
Entité persistante repésentant un pays.
Simplement composée d'un identitiant et d'un libellé.
*/
@Entity
public class Country /* extends org.roliste.data.DbEntity */ {
@Id
// @GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="COUNTRY_ID")
private int countryId;
......@@ -27,21 +30,9 @@ public class Country /* extends org.roliste.data.DbEntity */ {
this.countryName = countryName;
}
/**
* Returns a string representation of this country definition.
* @return a string representing this country definition.
* @hidden
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("ID_PAYS=");
sb.append(countryId);
sb.append(" LIB_PAYS=");
sb.append(countryName);
return sb.toString();
return "ID_PAYS=" + countryId + " LIB_PAYS=" + countryName;
}
}
\ No newline at end of file
......
......@@ -6,6 +6,9 @@ package org.legrog.entities;
* capabilities, that may be "masked", thus shown in some specific way depending on chosen
* NameMask.
*/
/*
v3 {@link org.legrog.entities.DisplayNameConfigurable}
*/
public enum DisplayNameMask
{
PRENOMNOM("Prénom Nom")
......@@ -113,8 +116,7 @@ public enum DisplayNameMask
private final String symbol;
private DisplayNameMask(String symbol)
{
DisplayNameMask(String symbol) {
this.symbol = symbol;
}
......
......@@ -4,6 +4,11 @@ import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Set;
/*
Entité persistante correspondant à un éditeur.
Pointe vers la version valide si elle existe, ainsi que son validateur et la date de validation.
Pointe vers l'ensemble de ses versions.
*/
@Entity
//@Table(name = "editeur")
public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
......@@ -15,7 +20,7 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
private int publisherId;
@OneToOne
private PublisherRevision validatedRevision;
private PublisherVersion validatedVersion;
@OneToOne
private User validator;
......@@ -23,7 +28,7 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
private Timestamp validationDateTime;
@OneToMany(mappedBy = "publisher", fetch = FetchType.EAGER)
private Set<PublisherRevision> revisions;
private Set<PublisherVersion> versions;
public int getPublisherId() {
return publisherId;
......@@ -33,20 +38,20 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
this.publisherId = publisherId;
}
public PublisherRevision getValidatedRevision() {
return validatedRevision;
public PublisherVersion getValidatedVersion() {
return validatedVersion;
}
public void setValidatedRevision(PublisherRevision activeRevision) {
this.validatedRevision = activeRevision;
public void setValidatedVersion(PublisherVersion activeVersion) {
this.validatedVersion = activeVersion;
}
public Set<PublisherRevision> getRevisions() {
return revisions;
public Set<PublisherVersion> getVersions() {
return versions;
}
public void setRevisions(Set<PublisherRevision> revisions) {
this.revisions = revisions;
public void setVersions(Set<PublisherVersion> versions) {
this.versions = versions;
}
public User getValidator() {
......@@ -67,6 +72,6 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
@Override
public String toString() {
return "PUBLISHER_ID = " + publisherId + ", Active Revision = " + validatedRevision + ", Validator = " + validator + ", Validation DateTime = " + validationDateTime;
return "PUBLISHER_ID = " + publisherId + ", Validated Version = " + validatedVersion + ", Validator = " + validator + ", Validation DateTime = " + validationDateTime;
}
}
......
package org.legrog.entities;
import javax.persistence.*;
import java.sql.Date;
import java.sql.Timestamp;
/*
Entité persistente représentant une version d'un éditeur.
Contient les données représentant un éditeur.
Adresse découpée en suivant http://schema.org/PostalAddress.
Pointe vers l'éditeur auquel elle correspond.
Pointe vers l'auteur de la version et contient la date et heure de celle-ci.
*/
@Entity
public class PublisherRevision {
public class PublisherVersion {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "PUBLISHER_REVISION_ID")
private int publisherRevisionId;
@Column(name = "PUBLISHER_VERSION_ID")
private int publisherVersionId;
@ManyToOne
private Publisher publisher;
private String publisherName;
......@@ -26,15 +32,15 @@ public class PublisherRevision {
private boolean publisherActive;
private String publisherHistory;
@ManyToOne
private User publisherRevisionAuthor;
private Timestamp publisherRevisionDatetime;
private User publisherVersionAuthor;
private Timestamp publisherVersionDatetime;
public Timestamp getPublisherRevisionDatetime() {
return publisherRevisionDatetime;
public Timestamp getPublisherVersionDatetime() {
return publisherVersionDatetime;
}
public void setPublisherRevisionDatetime(Timestamp publisherRevisionDatetime) {
this.publisherRevisionDatetime = publisherRevisionDatetime;
public void setPublisherVersionDatetime(Timestamp publisherVersionDatetime) {
this.publisherVersionDatetime = publisherVersionDatetime;
}
public boolean isPublisherActive() {
......@@ -117,12 +123,12 @@ public class PublisherRevision {
this.publisherURL = publisherURL;
}
public int getPublisherRevisionId() {
return publisherRevisionId;
public int getPublisherVersionId() {
return publisherVersionId;
}
public void setPublisherRevisionId(int publisherRevisionId) {
this.publisherRevisionId = publisherRevisionId;
public void setPublisherVersionId(int publisherVersionId) {
this.publisherVersionId = publisherVersionId;
}
public String getPublisherName() {
......@@ -141,22 +147,22 @@ public class PublisherRevision {
this.publisherAddressCountry = publisherAddressCountry;
}
public User getPublisherRevisionAuthor() {
return publisherRevisionAuthor;
public User getPublisherVersionAuthor() {
return publisherVersionAuthor;
}
public void setPublisherRevisionAuthor(User publisherRevisionAuthor) {
this.publisherRevisionAuthor = publisherRevisionAuthor;
public void setPublisherVersionAuthor(User publisherVersionAuthor) {
this.publisherVersionAuthor = publisherVersionAuthor;
}
@Override
public String toString() {
return "PUBLISHER_REVISION_ID = " + publisherRevisionId + ", Name = " + publisherName + ", St Address = " +
return "PUBLISHER_VERSION_ID = " + publisherVersionId + ", Name = " + publisherName + ", St Address = " +
publisherStreetAddress + ", CP = " + publisherPostalCode + ", BP = " + publisherPostOfficeBoxNumber +
", Region = " + publisherAddressRegion + ", Ville = " + publisherAddressLocality + ", Pays = " +
publisherAddressCountry + ", Telephone = " + publisherTelephone + ", email = " + publisherEmail +
", URL = " + publisherURL + ", actif = " + publisherActive + ", History = " + publisherHistory +
", Revision Author = " + publisherRevisionAuthor + ", Revision DateTime = " + publisherRevisionDatetime;
", Version Author = " + publisherVersionAuthor + ", Version DateTime = " + publisherVersionDatetime;
}
public Publisher getPublisher() {
......
......@@ -2,5 +2,5 @@ package org.legrog.entities;
import org.springframework.data.jpa.repository.JpaRepository;
public interface PublisherRevisionRepository extends JpaRepository<PublisherRevision, Integer> {
public interface PublisherVersionRepository extends JpaRepository<PublisherVersion, Integer> {
}
......
......@@ -2,18 +2,20 @@ package org.legrog.entities;
import javax.persistence.*;
import java.util.*;
// TODO Evaluer l'interet de ces imports
//import org.roliste.data.DbMaskableEntity;
// TODO Evaluer l'interet de cet import
//import org.roliste.data.DbValidationEntity;
// TODO Vérifier les extends
// TODO NameMask et DbMaskableEntity à traiter ensemble
/*
Entité persistante représentant un utilisateur.
Migréee depuis la v2.
*/
@Entity
@Table(name="UserTable")
public class User /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="USER_ID")
private int userId;
......@@ -36,7 +38,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
return _traceRoot;
}
*/
// TODO NameMask et DbMaskableEntity à traiter ensemble
/**
* The mask used for user name.
*/
......@@ -68,7 +70,7 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
* column="MASQUE_NOM_UTILISATEUR"
* access="property"
* length="50"
* @hibernate.type
* hibernate.type
* name="org.roliste.data.util.NameMaskUserType"
*/
public DisplayNameMask getDisplayNameMask() {
......@@ -773,33 +775,10 @@ public class User /* extends org.roliste.data.DbTraceableEntity */ implements Di
this.creationDate = date;
}
/**
* Returns a string representation of this user definition.
* @return a string representing this user definition.
* hidden
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("ID_UTILISATEUR=");
sb.append(userId);
sb.append(" LOGIN_UTILISATEUR=");
sb.append(username);
sb.append(" EMAIL_UTILISATEUR=");
sb.append(email);
sb.append(" PRENOM_UTILISATEUR=");
sb.append(firstName);
sb.append(" NOM_UTILISATEUR=");
sb.append(lastName);
sb.append(" PSEUDO_UTILISATEUR=");
sb.append(nickname);
return sb.toString();
return "ID_UTILISATEUR=" + userId + " LOGIN_UTILISATEUR=" + username + " EMAIL_UTILISATEUR=" + email +
" PRENOM_UTILISATEUR=" + firstName + " NOM_UTILISATEUR=" + lastName + " PSEUDO_UTILISATEUR=" + nickname;
}
}
\ No newline at end of file
......
......@@ -2,6 +2,10 @@ package org.legrog.entities;
import javax.persistence.*;
/*
Entité persistante représentant les propriétés qui sont paramétrées pour un utilisateur.
Migréee depuis la v2.
*/
@Entity
public class UserAttribute {
@Id
......@@ -21,7 +25,7 @@ public class UserAttribute {
/**
* Retrieve the user this attribute is attached to.
* @hibernate.many-to-one
* hibernate.many-to-one
* column="ID_UTILISATEUR"
* class="org.roliste.data.db.User"
* not-null="true"
......@@ -55,7 +59,7 @@ public class UserAttribute {
/**
* Retrieve the property this attribute is attached to.
* @hibernate.many-to-one
* hibernate.many-to-one
* column="ID_PROP"
* class="org.roliste.data.db.UserProperty"
* not-null="true"
......@@ -91,7 +95,7 @@ public class UserAttribute {
* convert it yourself. May be <code>null</code>, in cases where the sole existence of the attribute
* is the value, or for unset attributes.
* @see #setValue(String)
* @hibernate.property
* hibernate.property
* column="ATTR_VALUE"
* access="property"
* length="200"
......@@ -112,22 +116,12 @@ public class UserAttribute {
/**
* Returns a string representation of this user attribute definition.
* @return a string representing this user attribute definition.
* @hidden
* hidden
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("ID_ATTR=");
sb.append(getUserAttributeId());
sb.append(" ATTR_PROP=");
sb.append(userProperty);
sb.append(" ATTR_VALUE=");
sb.append(value);
return sb.toString();
return "ID_ATTR=" + getUserAttributeId() + " ATTR_PROP=" + userProperty + " ATTR_VALUE=" + value;
}
}
......
......@@ -2,10 +2,14 @@ package org.legrog.entities;
import javax.persistence.*;
/*
Entité persistente représentant la codification des propriétés qui peuvent être paramétrées pour un utilisateur.
Importée depuis la v2.
*/
@Entity
public class UserProperty {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */
@GeneratedValue(strategy = GenerationType.AUTO) /* Permet la population */
@Column(name="USER_PROPERTY_ID")
private int userPropertyId;
......@@ -110,23 +114,11 @@ public class UserProperty {
* @return a string representing this property definition.
* hidden
*/
@Override
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("ID_PROP=");
sb.append(getUserPropertyId());
sb.append(" PROP_NAME=");
sb.append(name);
sb.append(" PROP_TAG=");
sb.append(tag);
sb.append(" IND_VISIBLE=");
sb.append(visible);
return sb.toString();
return "ID_PROP=" + getUserPropertyId() + "PROP_NAME=" + name + " PROP_TAG=" + tag + " IND_VISIBLE=" + visible;
}
}
\ No newline at end of file
......
......@@ -14,12 +14,15 @@ import javax.persistence.*;
* alias UserRole
*
*/
/*
Importé depuis la v2.
*/
@Entity
// TODO évaluer extend v2
public class UserRole /* extends org.roliste.data.DbEntity */
{
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name="USER_ROLE_ID")
private int userRoleId;
......@@ -150,19 +153,8 @@ public class UserRole /* extends org.roliste.data.DbEntity */
* @return a string representing this user role definition.
* hidden
*/
public String toString()
{
StringBuilder sb = new StringBuilder();
sb.append("ID_ROLE=");
sb.append(getUserRoleId());
sb.append(" NOM_ROLE=");
sb.append(rolename);
sb.append(" IND_VISIBLE=");
sb.append(visible);
return sb.toString();
@Override
public String toString() {
return "ID_ROLE=" + getUserRoleId() + " NOM_ROLE=" + rolename + " IND_VISIBLE=" + visible;
}
}
\ No newline at end of file
......
package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/*
Vue de listPublisherVersions.xhtml
Permet de voir l'ensemble des versions des éditeurs.
Permet de voir l'ensemble des versions d'un éditeur et de valider l'une d'elles.
*/
@Named
@RequestScoped
public class ListPublisherVersionsView {
Logger logger = LoggerFactory.getLogger(getClass());
@Inject
PublisherService publisherService;
private Integer publisherId;
private boolean viewAll;
private List<PublisherVersion> publisherVersions;
public void validate() {
logger.debug("validate");
Publisher publisher = publisherService.getPublisher(publisherId);
logger.debug("publisher (pre-validate) = {}", publisher);
Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
Integer publisherVersionId = new Integer(params.get("publisherVersionId"));
publisherService.validatePublisherVersion(publisher, publisherVersionId);
// TODO : comprendre pourquoi ceci est nécessaire
publisherVersions = publisherService.getAllPublisherVersions();
publisherVersions = filter();
logger.debug("publisher (post-validate) = {}", publisher);
}
@PostConstruct
public void init() {
publisherVersions = publisherService.getAllPublisherVersions();
logger.debug("init");
}
protected List<PublisherVersion> filter() {
ArrayList<PublisherVersion> filteredPublisherVersions = new ArrayList<PublisherVersion>();
for(PublisherVersion publisherVersion : publisherVersions) {
if (publisherVersion.getPublisher().getPublisherId() == publisherId) {
filteredPublisherVersions.add(publisherVersion);
}
}
return filteredPublisherVersions;
}
public void setView() {
logger.debug("setView");
logger.debug("publisherId = " + publisherId);
viewAll = ( publisherId == null ) ;
if (!viewAll) {
logger.debug("!viewAll");
publisherVersions = filter();
}
}
// get, set et is
public List<PublisherVersion> getPublisherVersions() {
return publisherVersions;
}
public Integer getPublisherId() {
return publisherId;
}
public void setPublisherId(Integer publisherId) {
this.publisherId = publisherId;
}
public boolean isViewAll() {
return viewAll;
}
}
\ No newline at end of file
package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRevision;
import org.legrog.entities.PublisherVersion;
import java.util.List;
......@@ -11,15 +11,15 @@ import java.util.List;
*/
public interface PublisherService {
void addPublisherWithRevision(Publisher publisher, PublisherRevision publisherRevision);
void addPublisherWithVersion(Publisher publisher, PublisherVersion publisherVersion);
void addRevisionToPublisher(Publisher publisher, PublisherRevision publisherRevision);
void addVersionToPublisher(Publisher publisher, PublisherVersion publisherVersion);
void validatePublisherRevision(Publisher publisher, Integer publisherRevisionId);
void validatePublisherVersion(Publisher publisher, Integer publisherVersionId);
Publisher getPublisher(Integer publisherId);
List<PublisherRevision> getAllPublisherRevisions();
List<PublisherVersion> getAllPublisherVersions();
PublisherRevision getPublisherRevision(Integer publisherRevisionId);
PublisherVersion getPublisherVersion(Integer publisherVersionId);
}
......
......@@ -3,8 +3,8 @@ package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRepository;
import org.legrog.entities.PublisherRevision;
import org.legrog.entities.PublisherRevisionRepository;
import org.legrog.entities.PublisherVersion;
import org.legrog.entities.PublisherVersionRepository;
import org.legrog.web.xyz.SharedService;
import javax.ejb.Stateless;
......@@ -25,42 +25,42 @@ public class PublisherServiceSpring implements PublisherService {
PublisherRepository publisherRepository;
@Inject
PublisherRevisionRepository publisherRevisionRepository;
PublisherVersionRepository publisherVersionRepository;
@Inject
SharedService sharedService;
public void addPublisherWithRevision(Publisher publisher, PublisherRevision publisherRevision) {
Set<PublisherRevision> publisherRevisions = new HashSet<PublisherRevision>();
publisherRevisions.add(publisherRevision);
publisher.setRevisions(publisherRevisions);
publisherRevision.setPublisher(publisher);
publisherRevision.setPublisherRevisionAuthor(sharedService.getCurrentUser());
publisherRevision.setPublisherRevisionDatetime(new Timestamp(new Date().getTime()));
this.savePublisherRevision(publisherRevision);
public void addPublisherWithVersion(Publisher publisher, PublisherVersion publisherVersion) {
Set<PublisherVersion> publisherVersions = new HashSet<PublisherVersion>();
publisherVersions.add(publisherVersion);
publisher.setVersions(publisherVersions);
publisherVersion.setPublisher(publisher);
publisherVersion.setPublisherVersionAuthor(sharedService.getCurrentUser());
publisherVersion.setPublisherVersionDatetime(new Timestamp(new Date().getTime()));
this.savePublisherVersion(publisherVersion);
this.savePublisher(publisher);
}
public void addRevisionToPublisher(Publisher publisher, PublisherRevision publisherRevision) {
Set<PublisherRevision> publisherRevisionSet = publisher.getRevisions();
publisherRevisionSet.add(publisherRevision);
publisher.setRevisions(publisherRevisionSet);
publisherRevision.setPublisher(publisher);
publisherRevision.setPublisherRevisionAuthor(sharedService.getCurrentUser());
publisherRevision.setPublisherRevisionDatetime(new Timestamp(new Date().getTime()));
this.savePublisherRevision(publisherRevision);
public void addVersionToPublisher(Publisher publisher, PublisherVersion publisherVersion) {
Set<PublisherVersion> publisherVersionSet = publisher.getVersions();
publisherVersionSet.add(publisherVersion);
publisher.setVersions(publisherVersionSet);
publisherVersion.setPublisher(publisher);
publisherVersion.setPublisherVersionAuthor(sharedService.getCurrentUser());
publisherVersion.setPublisherVersionDatetime(new Timestamp(new Date().getTime()));
this.savePublisherVersion(publisherVersion);
this.savePublisher(publisher);
}
public void validatePublisherRevision(Publisher publisher, Integer publisherRevisionId) {
publisher.setValidatedRevision(this.getPublisherRevision(publisherRevisionId));
public void validatePublisherVersion(Publisher publisher, Integer publisherVersionId) {
publisher.setValidatedVersion(this.getPublisherVersion(publisherVersionId));
publisher.setValidator(sharedService.getCurrentUser());
publisher.setValidationDateTime(new Timestamp(new Date().getTime()));
this.savePublisher(publisher);
}
protected void savePublisherRevision(PublisherRevision publisherRevision) {
publisherRevisionRepository.save(publisherRevision);
protected void savePublisherVersion(PublisherVersion publisherVersion) {
publisherVersionRepository.save(publisherVersion);
}
protected void savePublisher(Publisher publisher) {
......@@ -68,12 +68,12 @@ public class PublisherServiceSpring implements PublisherService {
}
// get
public List<PublisherRevision> getAllPublisherRevisions() {
return publisherRevisionRepository.findAll();
public List<PublisherVersion> getAllPublisherVersions() {
return publisherVersionRepository.findAll();
}
public PublisherRevision getPublisherRevision(Integer publisherRevisionId) {
return publisherRevisionRepository.findOne(publisherRevisionId);
public PublisherVersion getPublisherVersion(Integer publisherVersionId) {
return publisherVersionRepository.findOne(publisherVersionId);
}
public Publisher getPublisher(Integer publisherId) {
......
......@@ -6,8 +6,8 @@
xmlns:jsf="http://xmlns.jcp.org/jsf"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:metadata>
<f:viewParam name="publisherId" value="#{listPublisherRevisionsView.publisherId}"/>
<f:viewAction action="#{listPublisherRevisionsView.setView}"/>
<f:viewParam name="publisherId" value="#{listPublisherVersionsView.publisherId}"/>
<f:viewAction action="#{listPublisherVersionsView.setView}"/>
</f:metadata>
<body>
<ul>
......@@ -15,86 +15,86 @@
<a jsf:outcome="/index">Menu principal</a>
</li>
<li>
<a jsf:outcome="publisherRevision">Ajouter un éditeur</a>
<a jsf:outcome="publisherVersion">Ajouter un éditeur</a>
</li>
</ul>
<a jsf:outcome="listPublisherRevisions" jsf:rendered="#{not listPublisherRevisionsView.viewAll}">Voir tous les éditeurs</a>
<p jsf:rendered="#{listPublisherRevisionsView.publisherRevisions.isEmpty()}">Liste des révisions est vide</p>
<h:dataTable value="#{listPublisherRevisionsView.publisherRevisions}" var="revision">
<a jsf:outcome="listPublisherVersions" jsf:rendered="#{not listPublisherVersionsView.viewAll}">Voir tous les éditeurs</a>
<p jsf:rendered="#{listPublisherVersionsView.publisherVersions.isEmpty()}">Liste des révisions est vide</p>
<h:dataTable value="#{listPublisherVersionsView.publisherVersions}" var="version">
<h:column>
<f:facet name="header">Visualiser ou Modifier</f:facet>
<a jsf:outcome="publisherRevision">Visualiser ou Modifier Version
<f:param name="publisherRevisionId" value="#{revision.publisherRevisionId}"/>
<a jsf:outcome="publisherVersion">Visualiser ou Modifier Version
<f:param name="publisherVersionId" value="#{version.publisherVersionId}"/>
</a>
</h:column>
<h:column rendered="#{listPublisherRevisionsView.viewAll}">
<h:column rendered="#{listPublisherVersionsView.viewAll}">
<f:facet name="header">Editeur</f:facet>
<a jsf:outcome="listPublisherRevisions">Visualiser ou valider version éditeur
<f:param name="publisherId" value="#{revision.publisher.publisherId}"/>
<a jsf:outcome="listPublisherVersions">Visualiser ou valider version éditeur
<f:param name="publisherId" value="#{version.publisher.publisherId}"/>
</a>
</h:column>
<h:column>
<f:facet name="header">Valide</f:facet>
<p jsf:rendered="#{revision.publisherRevisionId == revision.publisher.validatedRevision.publisherRevisionId}">Validé</p>
<p jsf:rendered="#{listPublisherRevisionsView.viewAll and revision.publisherRevisionId != revision.publisher.validatedRevision.publisherRevisionId}">Non validé</p>
<p jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">Validé</p>
<p jsf:rendered="#{listPublisherVersionsView.viewAll and version.publisherVersionId != version.publisher.validatedVersion.publisherVersionId}">Non validé</p>
<!-- https://www.mkyong.com/jsf2/4-ways-to-pass-parameter-from-jsf-page-to-backing-bean/ f:param, problème avec Method expression -->
<form action="" jsf:rendered="#{not listPublisherRevisionsView.viewAll and revision.publisherRevisionId != revision.publisher.validatedRevision.publisherRevisionId}">
<button jsf:action="#{listPublisherRevisionsView.validate()}">Valider
<f:param name="publisherRevisionId" value="#{revision.publisherRevisionId}"/>
<form action="" jsf:rendered="#{not listPublisherVersionsView.viewAll and version.publisherVersionId != version.publisher.validatedVersion.publisherVersionId}">
<button jsf:action="#{listPublisherVersionsView.validate()}">Valider
<f:param name="publisherVersionId" value="#{version.publisherVersionId}"/>
</button>
</form>
</h:column>
<h:column>
<f:facet name="header">Name</f:facet>
${revision.publisherName}
${version.publisherName}
</h:column>
<h:column>
<f:facet name="header">Address</f:facet>
${revision.publisherPostOfficeBoxNumber}<br />
${revision.publisherStreetAddress}<br />
${revision.publisherPostalCode} ${revision.publisherAddressLocality}<br />
${revision.publisherAddressRegion}<br />
${revision.publisherAddressCountry.countryName}
${version.publisherPostOfficeBoxNumber}<br />
${version.publisherStreetAddress}<br />
${version.publisherPostalCode} ${version.publisherAddressLocality}<br />
${version.publisherAddressRegion}<br />
${version.publisherAddressCountry.countryName}
</h:column>
<h:column>
<f:facet name="header">Telephone</f:facet>
${revision.publisherTelephone}
${version.publisherTelephone}
</h:column>
<h:column>
<f:facet name="header">Email</f:facet>
${revision.publisherEmail}
${version.publisherEmail}
</h:column>
<h:column>
<f:facet name="header">URL</f:facet>
${revision.publisherURL}
${version.publisherURL}
</h:column>
<h:column>
<f:facet name="header">Active ?</f:facet>
${revision.publisherActive}
${version.publisherActive}
</h:column>
<h:column>
<f:facet name="header">History</f:facet>
${revision.publisherHistory}
${version.publisherHistory}
</h:column>
<h:column>
<f:facet name="header">Revision Author</f:facet>
${revision.publisherRevisionAuthor.displayName}
<f:facet name="header">Version Author</f:facet>
${version.publisherVersionAuthor.displayName}
</h:column>
<h:column>
<f:facet name="header">Revision Datetime</f:facet>
${revision.publisherRevisionDatetime}
<f:facet name="header">Version Datetime</f:facet>
${version.publisherVersionDatetime}
</h:column>
<h:column>
<f:facet name="header">Validation author</f:facet>
<div jsf:rendered="#{revision.publisherRevisionId == revision.publisher.validatedRevision.publisherRevisionId}">
${revision.publisher.validator.displayName}
<div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
${version.publisher.validator.displayName}
</div>
</h:column>
<h:column>
<f:facet name="header">Validation Datetime</f:facet>
<div jsf:rendered="#{revision.publisherRevisionId == revision.publisher.validatedRevision.publisherRevisionId}">
${revision.publisher.validationDateTime}
<div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
${version.publisher.validationDateTime}
</div>
</h:column>
</h:dataTable>
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<head>
<f:metadata>
<f:viewParam name="publisherRevisionId" value="#{publisherRevisionView.publisherRevisionId}" />
<f:viewAction action="#{publisherRevisionView.loadData}" />
</f:metadata>
</head>
<body>
<form jsf:id="publisherRevision" action="">
<ul>
<li>
<a jsf:outcome="/index">Menu principal</a>
</li>
<li>
<a jsf:outcome="listPublisherRevisions">Versions des éditeurs</a>
</li>
</ul>
<h:panelGrid columns="2">
<label for="publisherName">publisherName</label>
<input type="text" id="publisherName" jsf:value='#{publisherRevisionView.publisherName}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherStreetAddress">publisherStreetAddress</label>
<input type="text" id="publisherStreetAddress" jsf:value='#{publisherRevisionView.publisherStreetAddress}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherPostalCode">publisherPostalCode</label>
<input type="text" id="publisherPostalCode" jsf:value='#{publisherRevisionView.publisherPostalCode}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherPostOfficeBoxNumber">publisherPostOfficeBoxNumber</label>
<input type="text" id="publisherPostOfficeBoxNumber" jsf:value='#{publisherRevisionView.publisherPostOfficeBoxNumber}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherAddressRegion">publisherAddressRegion</label>
<input type="text" id="publisherAddressRegion" jsf:value='#{publisherRevisionView.publisherAddressRegion}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherAddressLocality">publisherAddressLocality</label>
<input type="text" id="publisherAddressLocality" jsf:value='#{publisherRevisionView.publisherAddressLocality}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherAddressCountry">publisherAddressCountry</label>
<h:selectOneMenu id="publisherAddressCountry" value="#{publisherRevisionView.publisherAddressCountry}" converter="omnifaces.SelectItemsConverter" disabled="#{not publisherRevisionView.editMode}">
<f:selectItems value="#{publisherRevisionView.availableCountries}" var="country" itemLabel="#{country.countryName}"/>
</h:selectOneMenu>
<label for="publisherTelephone">publisherTelephone</label>
<input type="text" id="publisherTelephone" jsf:value='#{publisherRevisionView.publisherTelephone}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherEmail">publisherEmail</label>
<input type="text" id="publisherEmail" jsf:value='#{publisherRevisionView.publisherEmail}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherURL">publisherURL</label>
<input type="text" id="publisherURL" jsf:value='#{publisherRevisionView.publisherURL}' jsf:disabled="#{not publisherRevisionView.editMode}"/>
<label for="publisherActive">publisherActive</label>
<input type="checkbox" id="publisherActive" jsf:disabled="#{not publisherRevisionView.editMode}" jsf:value="#{publisherRevisionView.publisherActive}"/>
<label for="publisherHistory">publisherHistory</label>
<textarea id="publisherHistory" rows="" cols="" jsf:disabled="#{not publisherRevisionView.editMode}" jsf:value="#{publisherRevisionView.publisherHistory}"/>
<div jsf:rendered="#{not publisherRevisionView.newPublisher}">publisherRevisionAuthor</div>
<div jsf:rendered="#{not publisherRevisionView.newPublisher}">#{publisherRevisionView.publisherRevisionAuthor.displayName}</div>
<div jsf:rendered="#{not publisherRevisionView.newPublisher}">publisherRevisionDatetime</div>
<div jsf:rendered="#{not publisherRevisionView.newPublisher}">#{publisherRevisionView.publisherRevisionDatetime}</div>
<button jsf:rendered="#{not publisherRevisionView.editMode}" jsf:action="#{publisherRevisionView.edit}">Edit</button>
<button jsf:rendered="#{publisherRevisionView.editMode}" jsf:action="#{publisherRevisionView.save}">Save</button>
<button jsf:rendered="#{publisherRevisionView.editMode}" jsf:action="#{publisherRevisionView.cancel}">Cancel</button>
</h:panelGrid>
</form>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<head>
<f:metadata>
<f:viewParam name="publisherVersionId" value="#{publisherVersionView.publisherVersionId}" />
<f:viewAction action="#{publisherVersionView.loadData}" />
</f:metadata>
</head>
<body>
<form jsf:id="publisherVersion" action="">
<ul>
<li>
<a jsf:outcome="/index">Menu principal</a>
</li>
<li>
<a jsf:outcome="listPublisherVersions">Versions des éditeurs</a>
</li>
</ul>
<h:panelGrid columns="2">
<label for="publisherName">publisherName</label>
<input type="text" id="publisherName" jsf:value='#{publisherVersionView.publisherName}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherStreetAddress">publisherStreetAddress</label>
<input type="text" id="publisherStreetAddress" jsf:value='#{publisherVersionView.publisherStreetAddress}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherPostalCode">publisherPostalCode</label>
<input type="text" id="publisherPostalCode" jsf:value='#{publisherVersionView.publisherPostalCode}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherPostOfficeBoxNumber">publisherPostOfficeBoxNumber</label>
<input type="text" id="publisherPostOfficeBoxNumber" jsf:value='#{publisherVersionView.publisherPostOfficeBoxNumber}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherAddressRegion">publisherAddressRegion</label>
<input type="text" id="publisherAddressRegion" jsf:value='#{publisherVersionView.publisherAddressRegion}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherAddressLocality">publisherAddressLocality</label>
<input type="text" id="publisherAddressLocality" jsf:value='#{publisherVersionView.publisherAddressLocality}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherAddressCountry">publisherAddressCountry</label>
<h:selectOneMenu id="publisherAddressCountry" value="#{publisherVersionView.publisherAddressCountry}" converter="omnifaces.SelectItemsConverter" disabled="#{not publisherVersionView.editMode}">
<f:selectItems value="#{publisherVersionView.availableCountries}" var="country" itemLabel="#{country.countryName}"/>
</h:selectOneMenu>
<label for="publisherTelephone">publisherTelephone</label>
<input type="text" id="publisherTelephone" jsf:value='#{publisherVersionView.publisherTelephone}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherEmail">publisherEmail</label>
<input type="text" id="publisherEmail" jsf:value='#{publisherVersionView.publisherEmail}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherURL">publisherURL</label>
<input type="text" id="publisherURL" jsf:value='#{publisherVersionView.publisherURL}' jsf:disabled="#{not publisherVersionView.editMode}"/>
<label for="publisherActive">publisherActive</label>
<input type="checkbox" id="publisherActive" jsf:disabled="#{not publisherVersionView.editMode}" jsf:value="#{publisherVersionView.publisherActive}"/>
<label for="publisherHistory">publisherHistory</label>
<textarea id="publisherHistory" rows="" cols="" jsf:disabled="#{not publisherVersionView.editMode}" jsf:value="#{publisherVersionView.publisherHistory}"/>
<div jsf:rendered="#{not publisherVersionView.newPublisher}">publisherVerisionAuthor</div>
<div jsf:rendered="#{not publisherVersionView.newPublisher}">#{publisherVersionView.publisherVerisionAuthor.displayName}</div>
<div jsf:rendered="#{not publisherVersionView.newPublisher}">publisherVersionDatetime</div>
<div jsf:rendered="#{not publisherVersionView.newPublisher}">#{publisherVersionView.publisherVersionDatetime}</div>
<button jsf:rendered="#{not publisherVersionView.editMode}" jsf:action="#{publisherVersionView.edit}">Edit</button>
<button jsf:rendered="#{publisherVersionView.editMode}" jsf:action="#{publisherVersionView.save}">Save</button>
<button jsf:rendered="#{publisherVersionView.editMode}" jsf:action="#{publisherVersionView.cancel}">Cancel</button>
</h:panelGrid>
</form>
</body>
</html>
\ No newline at end of file
......@@ -23,30 +23,30 @@ INSERT INTO Publisher VALUES ();
INSERT INTO Publisher VALUES ();
INSERT INTO Publisher VALUES ();
INSERT INTO PublisherRevision (publisher_PUBLISHER_ID, publisherName, publisherStreetAddress, publisherPostalCode,
INSERT INTO PublisherVersion (publisher_PUBLISHER_ID, publisherName, publisherStreetAddress, publisherPostalCode,
publisherPostOfficeBoxNumber, publisherAddressRegion, publisherAddressLocality, publisherAddressCountry_COUNTRY_ID,
publisherTelephone, publisherEmail, publisherURL, publisherActive, publisherHistory, publisherRevisionAuthor_USER_ID,
publisherRevisionDatetime) VALUES
publisherTelephone, publisherEmail, publisherURL, publisherActive, publisherHistory, publisherVersionAuthor_USER_ID,
publisherVersionDatetime) 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 validatedRevision_PUBLISHER_REVISION_ID = 1, validator_USER_ID = 2, validationDateTime = {ts '2000-05-08 12:00:28'} WHERE PUBLISHER_ID = 1;
UPDATE Publisher SET validatedRevision_PUBLISHER_REVISION_ID = 2, validator_USER_ID = 1, validationDateTime = {ts '2010-06-20 14:27:35'} WHERE PUBLISHER_ID = 2;
UPDATE Publisher SET validatedRevision_PUBLISHER_REVISION_ID = 4, validator_USER_ID = 1, validationDateTime = {ts '2015-01-01 16:18:17'} WHERE PUBLISHER_ID = 3;
UPDATE Publisher SET validatedVersion_PUBLISHER_VERSION_ID = 1, validator_USER_ID = 2, validationDateTime = {ts '2000-05-08 12:00:28'} WHERE PUBLISHER_ID = 1;
UPDATE Publisher SET validatedVersion_PUBLISHER_VERSION_ID = 2, validator_USER_ID = 1, validationDateTime = {ts '2010-06-20 14:27:35'} WHERE PUBLISHER_ID = 2;
UPDATE Publisher SET validatedVersion_PUBLISHER_VERSION_ID = 4, validator_USER_ID = 1, validationDateTime = {ts '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);
INSERT INTO UserRole VALUES (4, 'ADMINISTRATEUR', TRUE);
INSERT INTO UserRole VALUES (5, 'RETRAITE', TRUE);
INSERT INTO UserRole VALUES (6, 'ASSOCE', TRUE);
INSERT INTO UserProperty VALUES (1, 'nb_vignettes', 'Nombre de vignettes en home', TRUE);
INSERT INTO UserProperty VALUES (2, 'avatar', 'Lien vers une icône ou une photo', TRUE);
INSERT INTO UserProperty VALUES (3, 'tagline', 'Ligne de présentation pour les contributeurs', TRUE);
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 UserRole (rolename, visible) VALUES ('VISITEUR', TRUE);
INSERT INTO UserRole (rolename, visible) VALUES ('RECRUE', TRUE);
INSERT INTO UserRole (rolename, visible) VALUES ('CONTRIBUTEUR', TRUE);
INSERT INTO UserRole (rolename, visible) VALUES ('ADMINISTRATEUR', TRUE);
INSERT INTO UserRole (rolename, visible) VALUES ('RETRAITE', TRUE);
INSERT INTO UserRole (rolename, visible) VALUES ('ASSOCE', TRUE);
INSERT INTO UserProperty (name, tag, visible) VALUES ('nb_vignettes', 'Nombre de vignettes en home', TRUE);
INSERT INTO UserProperty (name, tag, visible) VALUES ('avatar', 'Lien vers une icône ou une photo', TRUE);
INSERT INTO UserProperty (name, tag, visible) VALUES ('tagline', 'Ligne de présentation pour les contributeurs', TRUE);
INSERT INTO UserProperty (name, tag, visible) VALUES ('taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE);
INSERT INTO UserProperty (name, tag, visible) VALUES ('skin', 'Thème visuel', TRUE);
INSERT INTO UserTable_UserRole VALUES (1,2);
INSERT INTO UserTable_UserRole VALUES (2,2);
......
......@@ -6,11 +6,11 @@
<body>
<ul>
<li>
<a jsf:outcome="publisher/publisherRevision">Ajouter un éditeur</a>
<a jsf:outcome="publisher/publisherVersion">Ajouter un éditeur</a>
</li>
<li>
<a jsf:outcome="publisher/listPublisherRevisions">Liste des versions des éditeurs</a>
<a jsf:outcome="publisher/listPublisherVersions">Liste des versions des éditeurs</a>
</li>
</ul>
</body>
</html>
</html>
\ No newline at end of file
......