Jean-Francois Leveque

Récupération des attributs auteur et moment de validation

Ajout d'une requête fait main publisherLastValidate dans PublisherActionRepository.
Appels intermédiares dans ListPublisherVersionsView, PublisherService et PublisherServiceSpring.
Retrait d'annotations @Column, @Table, @JoinColumn.
Révision des mappedBy suite au refactoring de user en person.
Adaptation d'import.sql.
...@@ -120,7 +120,6 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements ...@@ -120,7 +120,6 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements
120 * The {link org.roliste.data.db.UserRole}s for this user. 120 * The {link org.roliste.data.db.UserRole}s for this user.
121 */ 121 */
122 @ManyToMany(fetch = FetchType.EAGER) 122 @ManyToMany(fetch = FetchType.EAGER)
123 - @Column(name = "USER_ROLE_ID")
124 private List<UserRole> roles; 123 private List<UserRole> roles;
125 124
126 /** 125 /**
...@@ -426,7 +425,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements ...@@ -426,7 +425,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements
426 /** 425 /**
427 * The list of attributes / properties for this user. 426 * The list of attributes / properties for this user.
428 */ 427 */
429 - @OneToMany(mappedBy = "user") 428 + @OneToMany(mappedBy = "person")
430 private List<UserAttribute> userAttributes; 429 private List<UserAttribute> userAttributes;
431 430
432 /** 431 /**
......
...@@ -10,7 +10,6 @@ import java.util.Set; ...@@ -10,7 +10,6 @@ import java.util.Set;
10 Pointe vers l'ensemble de ses versions. 10 Pointe vers l'ensemble de ses versions.
11 */ 11 */
12 @Entity 12 @Entity
13 -//@Table(name = "editeur")
14 public class Publisher /* extends org.roliste.data.DbLinkableEntity */ { 13 public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
15 // TODO L'éventuel usage de Linkable reste à confirmer https://tree.taiga.io/project/jr-utily-grog-v3/us/48 14 // TODO L'éventuel usage de Linkable reste à confirmer https://tree.taiga.io/project/jr-utily-grog-v3/us/48
16 // TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué 15 // TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué
......
1 package org.legrog.entities; 1 package org.legrog.entities;
2 2
3 import org.springframework.data.jpa.repository.JpaRepository; 3 import org.springframework.data.jpa.repository.JpaRepository;
4 +import org.springframework.data.jpa.repository.Query;
4 5
5 public interface PublisherActionRepository extends JpaRepository<PublisherAction, Integer> { 6 public interface PublisherActionRepository extends JpaRepository<PublisherAction, Integer> {
7 + @Query("select pa from PublisherAction pa where pa.userAction = (select ua from UserAction ua where ua.userActionName = 'Validate') and pa.publisherActionDatetime = ( select max(pa2.publisherActionDatetime) from PublisherAction pa2 where pa2.publisher =?1)")
8 + PublisherAction publisherLastValidate(Publisher publisher);
6 } 9 }
......
...@@ -20,7 +20,6 @@ public class UserAttribute { ...@@ -20,7 +20,6 @@ public class UserAttribute {
20 * The linked person. 20 * The linked person.
21 */ 21 */
22 @ManyToOne 22 @ManyToOne
23 - @JoinColumn(name = "USER_ID")
24 private Person person; 23 private Person person;
25 24
26 /** 25 /**
...@@ -54,7 +53,6 @@ public class UserAttribute { ...@@ -54,7 +53,6 @@ public class UserAttribute {
54 * The linked property. 53 * The linked property.
55 */ 54 */
56 @ManyToOne 55 @ManyToOne
57 - @JoinColumn(name = "USER_PROPERTY_ID")
58 private UserProperty userProperty; 56 private UserProperty userProperty;
59 57
60 /** 58 /**
......
1 package org.legrog.web.publisher; 1 package org.legrog.web.publisher;
2 2
3 +import org.legrog.entities.Publisher;
4 +import org.legrog.entities.PublisherAction;
3 import org.legrog.entities.PublisherVersion; 5 import org.legrog.entities.PublisherVersion;
4 import org.slf4j.Logger; 6 import org.slf4j.Logger;
5 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
...@@ -37,6 +39,9 @@ public class ListPublisherVersionsView implements Serializable { ...@@ -37,6 +39,9 @@ public class ListPublisherVersionsView implements Serializable {
37 ListPublisherVersionsView() { 39 ListPublisherVersionsView() {
38 } 40 }
39 41
42 + public PublisherAction getLastValidate(Publisher publisher) {
43 + return publisherService.getLastValidate(publisher);
44 + }
40 45
41 // View Action being executed at view loading 46 // View Action being executed at view loading
42 public void setView() { 47 public void setView() {
......
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.PublisherAction;
4 import org.legrog.entities.PublisherVersion; 5 import org.legrog.entities.PublisherVersion;
5 6
6 import java.util.List; 7 import java.util.List;
...@@ -20,4 +21,6 @@ public interface PublisherService { ...@@ -20,4 +21,6 @@ public interface PublisherService {
20 List<PublisherVersion> getAllPublisherVersions(); 21 List<PublisherVersion> getAllPublisherVersions();
21 22
22 PublisherVersion getPublisherVersion(Integer publisherVersionId); 23 PublisherVersion getPublisherVersion(Integer publisherVersionId);
24 +
25 + PublisherAction getLastValidate(Publisher publisher);
23 } 26 }
......
...@@ -101,4 +101,9 @@ public class PublisherServiceSpring implements PublisherService { ...@@ -101,4 +101,9 @@ public class PublisherServiceSpring implements PublisherService {
101 return publisherVersionRepository.findOne(publisherVersionId); 101 return publisherVersionRepository.findOne(publisherVersionId);
102 } 102 }
103 103
104 + @Override
105 + public PublisherAction getLastValidate(Publisher publisher) {
106 + return publisherActionRepository.publisherLastValidate(publisher);
107 + }
108 +
104 } 109 }
......
...@@ -98,13 +98,13 @@ ...@@ -98,13 +98,13 @@
98 <h:column> 98 <h:column>
99 <f:facet name="header">Validation author</f:facet> 99 <f:facet name="header">Validation author</f:facet>
100 <div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}"> 100 <div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
101 - ${version.publisher.validator.displayName} 101 + ${listPublisherVersionsView.getLastValidate(version.publisher).publisherActionAuthor.displayName}
102 </div> 102 </div>
103 </h:column> 103 </h:column>
104 <h:column> 104 <h:column>
105 <f:facet name="header">Validation Datetime</f:facet> 105 <f:facet name="header">Validation Datetime</f:facet>
106 <div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}"> 106 <div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
107 - ${version.publisher.validationDateTime} 107 + ${listPublisherVersionsView.getLastValidate(version.publisher).publisherActionDatetime}
108 </div> 108 </div>
109 </h:column> 109 </h:column>
110 </h:dataTable> 110 </h:dataTable>
......
...@@ -13,7 +13,7 @@ INSERT INTO Country (countryId, countryName) VALUES ...@@ -13,7 +13,7 @@ INSERT INTO Country (countryId, countryName) VALUES
13 (10, 'Allemagne'), 13 (10, 'Allemagne'),
14 (11, 'Pologne'), 14 (11, 'Pologne'),
15 (12, 'Italie'); 15 (12, 'Italie');
16 -INSERT INTO UserTable (userId, username, password, firstName, lastName, nickname, email, activated, anonymous, visible, 16 +INSERT INTO Person (userId, username, password, firstName, lastName, nickname, email, activated, anonymous, visible,
17 criticProvider) VALUES 17 criticProvider) VALUES
18 (1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE), 18 (1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE),
19 (2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE), 19 (2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE),
...@@ -58,10 +58,10 @@ INSERT INTO UserProperty (userPropertyId, name, tag, visible) VALUES ...@@ -58,10 +58,10 @@ INSERT INTO UserProperty (userPropertyId, name, tag, visible) VALUES
58 (4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE), 58 (4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE),
59 (5,'skin', 'Thème visuel', TRUE); 59 (5,'skin', 'Thème visuel', TRUE);
60 60
61 -INSERT INTO UserTable_UserRole VALUES (1,2);
62 -INSERT INTO UserTable_UserRole VALUES (2,2);
63 -INSERT INTO UserTable_UserRole VALUES (3,2);
64 -INSERT INTO UserTable_UserRole VALUES (4,2);
65 -INSERT INTO UserTable_UserRole VALUES (5,2);
66 -INSERT INTO UserTable_UserRole VALUES (6,2);
67 -INSERT INTO UserTable_UserRole VALUES (5,4);
...\ No newline at end of file ...\ No newline at end of file
61 +INSERT INTO Person_UserRole VALUES (1,2);
62 +INSERT INTO Person_UserRole VALUES (2,2);
63 +INSERT INTO Person_UserRole VALUES (3,2);
64 +INSERT INTO Person_UserRole VALUES (4,2);
65 +INSERT INTO Person_UserRole VALUES (5,2);
66 +INSERT INTO Person_UserRole VALUES (6,2);
67 +INSERT INTO Person_UserRole VALUES (5,4);
...\ No newline at end of file ...\ No newline at end of file
......