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/52 Affichage saisie

Le paramètre arrive dans la page, passe dans la vue, mais ne revient pas dans la page depuis la vue.
......@@ -5,7 +5,9 @@ import org.legrog.entities.PublisherRevision;
import java.util.List;
public interface PublisherRevisionService {
void addPublisherRevission(PublisherRevision publisherRevision);
void addPublisherRevision(PublisherRevision publisherRevision);
List<PublisherRevision> getAllPublisherRevisions();
PublisherRevision getPublisherRevision(Integer publisherRevisionId);
}
......
......@@ -12,11 +12,15 @@ public class PublisherRevisionServiceSpring implements PublisherRevisionService
@Inject
PublisherRevisionRepository publisherRevisionRepository;
public void addPublisherRevission(PublisherRevision publisherRevision) {
public void addPublisherRevision(PublisherRevision publisherRevision) {
publisherRevisionRepository.save(publisherRevision);
}
public List<PublisherRevision> getAllPublisherRevisions() {
return publisherRevisionRepository.findAll();
}
}
public PublisherRevision getPublisherRevision(Integer publisherRevisionId) {
return publisherRevisionRepository.findOne(publisherRevisionId);
}
}
\ No newline at end of file
......
......@@ -82,8 +82,10 @@ public class AddPublisherBean {
// End TODO
publisherRevision.setPublisherRevisionAuthor(user);
logger.info(publisherRevision.toString());
publisherRevisionService.addPublisherRevission(publisherRevision);
publisherRevisionService.addPublisherRevision(publisherRevision);
publisherService.addPublisher(publisher);
// Test de récupération de l'Id
logger.info(publisherRevision.toString());
return "success";
}
......
package org.legrog.presentation;
import org.legrog.application.PublisherRevisionService;
import org.legrog.entities.Country;
import org.legrog.entities.PublisherRevision;
import org.legrog.entities.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
import javax.inject.Inject;
import javax.inject.Named;
import java.sql.Timestamp;
import java.util.Map;
@Named
@ViewScoped
public class PublisherRevisionView {
Logger logger = LoggerFactory.getLogger(getClass());
@Inject
PublisherRevisionService publisherRevisionService;
private int publisherRevisionId;
private String publisherName;
private String publisherStreetAddress;
private String publisherPostalCode;
private String publisherPostOfficeBoxNumber;
private String publisherAddressRegion;
private String publisherAddressLocality;
private Country publisherAddressCountry;
private String publisherTelephone;
private String publisherEmail;
private String publisherURL;
private boolean publisherActive;
private String publisherHistory;
private User publisherRevisionAuthor;
private Timestamp publisherRevisionDatetime;
public void loadData() {
Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(new Integer(params.get("publisherRevisionId")));
setPublisherRevisionId(publisherRevision.getPublisherRevisionId());
logger.info("publisherRevisionId = " + getPublisherRevisionId());
}
public int getPublisherRevisionId() {
return publisherRevisionId;
}
public void setPublisherRevisionId(int publisherRevisionId) {
this.publisherRevisionId = publisherRevisionId;
}
public String getPublisherName() {
return publisherName;
}
public void setPublisherName(String publisherName) {
this.publisherName = publisherName;
}
public String getPublisherStreetAddress() {
return publisherStreetAddress;
}
public void setPublisherStreetAddress(String publisherStreetAddress) {
this.publisherStreetAddress = publisherStreetAddress;
}
public String getPublisherPostalCode() {
return publisherPostalCode;
}
public void setPublisherPostalCode(String publisherPostalCode) {
this.publisherPostalCode = publisherPostalCode;
}
public String getPublisherPostOfficeBoxNumber() {
return publisherPostOfficeBoxNumber;
}
public void setPublisherPostOfficeBoxNumber(String publisherPostOfficeBoxNumber) {
this.publisherPostOfficeBoxNumber = publisherPostOfficeBoxNumber;
}
public String getPublisherAddressRegion() {
return publisherAddressRegion;
}
public void setPublisherAddressRegion(String publisherAddressRegion) {
this.publisherAddressRegion = publisherAddressRegion;
}
public String getPublisherAddressLocality() {
return publisherAddressLocality;
}
public void setPublisherAddressLocality(String publisherAddressLocality) {
this.publisherAddressLocality = publisherAddressLocality;
}
public Country getPublisherAddressCountry() {
return publisherAddressCountry;
}
public void setPublisherAddressCountry(Country publisherAddressCountry) {
this.publisherAddressCountry = publisherAddressCountry;
}
public String getPublisherTelephone() {
return publisherTelephone;
}
public void setPublisherTelephone(String publisherTelephone) {
this.publisherTelephone = publisherTelephone;
}
public String getPublisherEmail() {
return publisherEmail;
}
public void setPublisherEmail(String publisherEmail) {
this.publisherEmail = publisherEmail;
}
public String getPublisherURL() {
return publisherURL;
}
public void setPublisherURL(String publisherURL) {
this.publisherURL = publisherURL;
}
public boolean isPublisherActive() {
return publisherActive;
}
public void setPublisherActive(boolean publisherActive) {
this.publisherActive = publisherActive;
}
public String getPublisherHistory() {
return publisherHistory;
}
public void setPublisherHistory(String publisherHistory) {
this.publisherHistory = publisherHistory;
}
public User getPublisherRevisionAuthor() {
return publisherRevisionAuthor;
}
public void setPublisherRevisionAuthor(User publisherRevisionAuthor) {
this.publisherRevisionAuthor = publisherRevisionAuthor;
}
public Timestamp getPublisherRevisionDatetime() {
return publisherRevisionDatetime;
}
public void setPublisherRevisionDatetime(Timestamp publisherRevisionDatetime) {
this.publisherRevisionDatetime = publisherRevisionDatetime;
}
}
......@@ -11,7 +11,7 @@
<h:column>
<f:facet name="header">Visualiser<!--ou Modifier--></f:facet>
<h:link outcome="view">Visualiser<!--ou Modifier-->
<f:param id="publisherRevisionId" value="#{revision.publisherRevisionId}"/>
<f:param name="publisherRevisionId" value="#{revision.publisherRevisionId}"/>
</h:link>
</h:column>
<h:column>
......
......@@ -5,7 +5,13 @@
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<f:metadata>
<f:viewParam name="publisherRevisionId" value="#{publisherRevisionView.publisherRevisionId}" />
<f:event type="preRenderView" listener="#{publisherRevisionView.loadData}" />
</f:metadata>
<body>
<h:outputText value="#{param['publisherRevisionId']}" />
<p>Depuis le paramètre : <h:outputText value="#{param['publisherRevisionId']}" /></p>
<p>En passant par la vue : <h:outputText value="#{publisherRevisionView.publisherRevisionId}" /></p>
</body>
</html>
</html>
\ No newline at end of file
......