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; ...@@ -5,7 +5,9 @@ import org.legrog.entities.PublisherRevision;
5 import java.util.List; 5 import java.util.List;
6 6
7 public interface PublisherRevisionService { 7 public interface PublisherRevisionService {
8 - void addPublisherRevission(PublisherRevision publisherRevision); 8 + void addPublisherRevision(PublisherRevision publisherRevision);
9 9
10 List<PublisherRevision> getAllPublisherRevisions(); 10 List<PublisherRevision> getAllPublisherRevisions();
11 +
12 + PublisherRevision getPublisherRevision(Integer publisherRevisionId);
11 } 13 }
......
...@@ -12,11 +12,15 @@ public class PublisherRevisionServiceSpring implements PublisherRevisionService ...@@ -12,11 +12,15 @@ public class PublisherRevisionServiceSpring implements PublisherRevisionService
12 @Inject 12 @Inject
13 PublisherRevisionRepository publisherRevisionRepository; 13 PublisherRevisionRepository publisherRevisionRepository;
14 14
15 - public void addPublisherRevission(PublisherRevision publisherRevision) { 15 + public void addPublisherRevision(PublisherRevision publisherRevision) {
16 publisherRevisionRepository.save(publisherRevision); 16 publisherRevisionRepository.save(publisherRevision);
17 } 17 }
18 18
19 public List<PublisherRevision> getAllPublisherRevisions() { 19 public List<PublisherRevision> getAllPublisherRevisions() {
20 return publisherRevisionRepository.findAll(); 20 return publisherRevisionRepository.findAll();
21 } 21 }
22 -} 22 +
23 + public PublisherRevision getPublisherRevision(Integer publisherRevisionId) {
24 + return publisherRevisionRepository.findOne(publisherRevisionId);
25 + }
26 +}
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -82,8 +82,10 @@ public class AddPublisherBean { ...@@ -82,8 +82,10 @@ public class AddPublisherBean {
82 // End TODO 82 // End TODO
83 publisherRevision.setPublisherRevisionAuthor(user); 83 publisherRevision.setPublisherRevisionAuthor(user);
84 logger.info(publisherRevision.toString()); 84 logger.info(publisherRevision.toString());
85 - publisherRevisionService.addPublisherRevission(publisherRevision); 85 + publisherRevisionService.addPublisherRevision(publisherRevision);
86 publisherService.addPublisher(publisher); 86 publisherService.addPublisher(publisher);
87 + // Test de récupération de l'Id
88 + logger.info(publisherRevision.toString());
87 return "success"; 89 return "success";
88 } 90 }
89 91
......
1 +package org.legrog.presentation;
2 +
3 +import org.legrog.application.PublisherRevisionService;
4 +import org.legrog.entities.Country;
5 +import org.legrog.entities.PublisherRevision;
6 +import org.legrog.entities.User;
7 +import org.slf4j.Logger;
8 +import org.slf4j.LoggerFactory;
9 +
10 +import javax.enterprise.context.RequestScoped;
11 +import javax.faces.bean.ViewScoped;
12 +import javax.faces.context.FacesContext;
13 +import javax.inject.Inject;
14 +import javax.inject.Named;
15 +import java.sql.Timestamp;
16 +import java.util.Map;
17 +
18 +@Named
19 +@ViewScoped
20 +public class PublisherRevisionView {
21 + Logger logger = LoggerFactory.getLogger(getClass());
22 +
23 + @Inject
24 + PublisherRevisionService publisherRevisionService;
25 +
26 + private int publisherRevisionId;
27 + private String publisherName;
28 + private String publisherStreetAddress;
29 + private String publisherPostalCode;
30 + private String publisherPostOfficeBoxNumber;
31 + private String publisherAddressRegion;
32 + private String publisherAddressLocality;
33 + private Country publisherAddressCountry;
34 + private String publisherTelephone;
35 + private String publisherEmail;
36 + private String publisherURL;
37 + private boolean publisherActive;
38 + private String publisherHistory;
39 + private User publisherRevisionAuthor;
40 + private Timestamp publisherRevisionDatetime;
41 +
42 + public void loadData() {
43 + Map<String,String> params = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
44 +
45 + PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(new Integer(params.get("publisherRevisionId")));
46 + setPublisherRevisionId(publisherRevision.getPublisherRevisionId());
47 + logger.info("publisherRevisionId = " + getPublisherRevisionId());
48 + }
49 +
50 + public int getPublisherRevisionId() {
51 + return publisherRevisionId;
52 + }
53 +
54 + public void setPublisherRevisionId(int publisherRevisionId) {
55 + this.publisherRevisionId = publisherRevisionId;
56 + }
57 +
58 + public String getPublisherName() {
59 + return publisherName;
60 + }
61 +
62 + public void setPublisherName(String publisherName) {
63 + this.publisherName = publisherName;
64 + }
65 +
66 + public String getPublisherStreetAddress() {
67 + return publisherStreetAddress;
68 + }
69 +
70 + public void setPublisherStreetAddress(String publisherStreetAddress) {
71 + this.publisherStreetAddress = publisherStreetAddress;
72 + }
73 +
74 + public String getPublisherPostalCode() {
75 + return publisherPostalCode;
76 + }
77 +
78 + public void setPublisherPostalCode(String publisherPostalCode) {
79 + this.publisherPostalCode = publisherPostalCode;
80 + }
81 +
82 + public String getPublisherPostOfficeBoxNumber() {
83 + return publisherPostOfficeBoxNumber;
84 + }
85 +
86 + public void setPublisherPostOfficeBoxNumber(String publisherPostOfficeBoxNumber) {
87 + this.publisherPostOfficeBoxNumber = publisherPostOfficeBoxNumber;
88 + }
89 +
90 + public String getPublisherAddressRegion() {
91 + return publisherAddressRegion;
92 + }
93 +
94 + public void setPublisherAddressRegion(String publisherAddressRegion) {
95 + this.publisherAddressRegion = publisherAddressRegion;
96 + }
97 +
98 + public String getPublisherAddressLocality() {
99 + return publisherAddressLocality;
100 + }
101 +
102 + public void setPublisherAddressLocality(String publisherAddressLocality) {
103 + this.publisherAddressLocality = publisherAddressLocality;
104 + }
105 +
106 + public Country getPublisherAddressCountry() {
107 + return publisherAddressCountry;
108 + }
109 +
110 + public void setPublisherAddressCountry(Country publisherAddressCountry) {
111 + this.publisherAddressCountry = publisherAddressCountry;
112 + }
113 +
114 + public String getPublisherTelephone() {
115 + return publisherTelephone;
116 + }
117 +
118 + public void setPublisherTelephone(String publisherTelephone) {
119 + this.publisherTelephone = publisherTelephone;
120 + }
121 +
122 + public String getPublisherEmail() {
123 + return publisherEmail;
124 + }
125 +
126 + public void setPublisherEmail(String publisherEmail) {
127 + this.publisherEmail = publisherEmail;
128 + }
129 +
130 + public String getPublisherURL() {
131 + return publisherURL;
132 + }
133 +
134 + public void setPublisherURL(String publisherURL) {
135 + this.publisherURL = publisherURL;
136 + }
137 +
138 + public boolean isPublisherActive() {
139 + return publisherActive;
140 + }
141 +
142 + public void setPublisherActive(boolean publisherActive) {
143 + this.publisherActive = publisherActive;
144 + }
145 +
146 + public String getPublisherHistory() {
147 + return publisherHistory;
148 + }
149 +
150 + public void setPublisherHistory(String publisherHistory) {
151 + this.publisherHistory = publisherHistory;
152 + }
153 +
154 + public User getPublisherRevisionAuthor() {
155 + return publisherRevisionAuthor;
156 + }
157 +
158 + public void setPublisherRevisionAuthor(User publisherRevisionAuthor) {
159 + this.publisherRevisionAuthor = publisherRevisionAuthor;
160 + }
161 +
162 + public Timestamp getPublisherRevisionDatetime() {
163 + return publisherRevisionDatetime;
164 + }
165 +
166 + public void setPublisherRevisionDatetime(Timestamp publisherRevisionDatetime) {
167 + this.publisherRevisionDatetime = publisherRevisionDatetime;
168 + }
169 +}
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
11 <h:column> 11 <h:column>
12 <f:facet name="header">Visualiser<!--ou Modifier--></f:facet> 12 <f:facet name="header">Visualiser<!--ou Modifier--></f:facet>
13 <h:link outcome="view">Visualiser<!--ou Modifier--> 13 <h:link outcome="view">Visualiser<!--ou Modifier-->
14 - <f:param id="publisherRevisionId" value="#{revision.publisherRevisionId}"/> 14 + <f:param name="publisherRevisionId" value="#{revision.publisherRevisionId}"/>
15 </h:link> 15 </h:link>
16 </h:column> 16 </h:column>
17 <h:column> 17 <h:column>
......
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
5 xmlns:h="http://xmlns.jcp.org/jsf/html" 5 xmlns:h="http://xmlns.jcp.org/jsf/html"
6 xmlns:ui="http://xmlns.jcp.org/jsf/facelets" 6 xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
7 xmlns:f="http://xmlns.jcp.org/jsf/core"> 7 xmlns:f="http://xmlns.jcp.org/jsf/core">
8 +<f:metadata>
9 + <f:viewParam name="publisherRevisionId" value="#{publisherRevisionView.publisherRevisionId}" />
10 + <f:event type="preRenderView" listener="#{publisherRevisionView.loadData}" />
11 +</f:metadata>
8 <body> 12 <body>
9 -<h:outputText value="#{param['publisherRevisionId']}" /> 13 +<p>Depuis le paramètre : <h:outputText value="#{param['publisherRevisionId']}" /></p>
14 +<p>En passant par la vue : <h:outputText value="#{publisherRevisionView.publisherRevisionId}" /></p>
15 +
10 </body> 16 </body>
11 -</html> 17 +</html>
...\ No newline at end of file ...\ No newline at end of file
......