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