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
* The {link org.roliste.data.db.UserRole}s for this user.
*/
@ManyToMany(fetch = FetchType.EAGER)
@Column(name = "USER_ROLE_ID")
private List<UserRole> roles;
/**
......@@ -426,7 +425,7 @@ public class Person /* extends org.roliste.data.DbTraceableEntity */ implements
/**
* The list of attributes / properties for this user.
*/
@OneToMany(mappedBy = "user")
@OneToMany(mappedBy = "person")
private List<UserAttribute> userAttributes;
/**
......
......@@ -10,7 +10,6 @@ import java.util.Set;
Pointe vers l'ensemble de ses versions.
*/
@Entity
//@Table(name = "editeur")
public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
// TODO L'éventuel usage de Linkable reste à confirmer https://tree.taiga.io/project/jr-utily-grog-v3/us/48
// TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué
......
package org.legrog.entities;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
public interface PublisherActionRepository extends JpaRepository<PublisherAction, Integer> {
@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)")
PublisherAction publisherLastValidate(Publisher publisher);
}
......
......@@ -20,7 +20,6 @@ public class UserAttribute {
* The linked person.
*/
@ManyToOne
@JoinColumn(name = "USER_ID")
private Person person;
/**
......@@ -54,7 +53,6 @@ public class UserAttribute {
* The linked property.
*/
@ManyToOne
@JoinColumn(name = "USER_PROPERTY_ID")
private UserProperty userProperty;
/**
......
package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherAction;
import org.legrog.entities.PublisherVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -37,6 +39,9 @@ public class ListPublisherVersionsView implements Serializable {
ListPublisherVersionsView() {
}
public PublisherAction getLastValidate(Publisher publisher) {
return publisherService.getLastValidate(publisher);
}
// View Action being executed at view loading
public void setView() {
......
package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherAction;
import org.legrog.entities.PublisherVersion;
import java.util.List;
......@@ -20,4 +21,6 @@ public interface PublisherService {
List<PublisherVersion> getAllPublisherVersions();
PublisherVersion getPublisherVersion(Integer publisherVersionId);
PublisherAction getLastValidate(Publisher publisher);
}
......
......@@ -101,4 +101,9 @@ public class PublisherServiceSpring implements PublisherService {
return publisherVersionRepository.findOne(publisherVersionId);
}
@Override
public PublisherAction getLastValidate(Publisher publisher) {
return publisherActionRepository.publisherLastValidate(publisher);
}
}
......
......@@ -98,13 +98,13 @@
<h:column>
<f:facet name="header">Validation author</f:facet>
<div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
${version.publisher.validator.displayName}
${listPublisherVersionsView.getLastValidate(version.publisher).publisherActionAuthor.displayName}
</div>
</h:column>
<h:column>
<f:facet name="header">Validation Datetime</f:facet>
<div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
${version.publisher.validationDateTime}
${listPublisherVersionsView.getLastValidate(version.publisher).publisherActionDatetime}
</div>
</h:column>
</h:dataTable>
......
......@@ -13,7 +13,7 @@ INSERT INTO Country (countryId, countryName) VALUES
(10, 'Allemagne'),
(11, 'Pologne'),
(12, 'Italie');
INSERT INTO UserTable (userId, username, password, firstName, lastName, nickname, email, activated, anonymous, visible,
INSERT INTO Person (userId, username, password, firstName, lastName, nickname, email, activated, anonymous, visible,
criticProvider) VALUES
(1, 'one', 'one', 'Derrick', 'Moss', 'one', 'one@raza.org', TRUE, FALSE, TRUE, TRUE),
(2, 'two', 'two', 'Portia', 'Lin', 'two', 'two@raza.org', TRUE, FALSE, TRUE, TRUE),
......@@ -58,10 +58,10 @@ INSERT INTO UserProperty (userPropertyId, name, tag, visible) VALUES
(4, 'taille_listes', 'Nombre d''éléments affichés dans les listes', TRUE),
(5,'skin', 'Thème visuel', TRUE);
INSERT INTO UserTable_UserRole VALUES (1,2);
INSERT INTO UserTable_UserRole VALUES (2,2);
INSERT INTO UserTable_UserRole VALUES (3,2);
INSERT INTO UserTable_UserRole VALUES (4,2);
INSERT INTO UserTable_UserRole VALUES (5,2);
INSERT INTO UserTable_UserRole VALUES (6,2);
INSERT INTO UserTable_UserRole VALUES (5,4);
\ No newline at end of file
INSERT INTO Person_UserRole VALUES (1,2);
INSERT INTO Person_UserRole VALUES (2,2);
INSERT INTO Person_UserRole VALUES (3,2);
INSERT INTO Person_UserRole VALUES (4,2);
INSERT INTO Person_UserRole VALUES (5,2);
INSERT INTO Person_UserRole VALUES (6,2);
INSERT INTO Person_UserRole VALUES (5,4);
\ No newline at end of file
......