JR Utily

Merge branch 'infra' into historiqueEditeur

Conflicts:
	src/main/java/org/legrog/presentation/ListPublisherRevisionsBean.java
	src/main/java/org/legrog/presentation/ListPublisherRevisionsView.java
	src/main/java/org/legrog/web/publisher/ListPublisherRevisionsBean.java
	src/main/java/org/legrog/web/publisher/PublisherRevisionView.java
	src/main/java/org/legrog/web/publisher/PublisherService.java
Showing 37 changed files with 224 additions and 157 deletions
...@@ -5,10 +5,16 @@ ...@@ -5,10 +5,16 @@
5 5
6 <groupId>org.legrog</groupId> 6 <groupId>org.legrog</groupId>
7 <artifactId>grog-cubi</artifactId> 7 <artifactId>grog-cubi</artifactId>
8 - <version>1.0-SNAPSHOT</version> 8 + <version>3.0-SNAPSHOT</version>
9 <packaging>war</packaging> 9 <packaging>war</packaging>
10 - <name>GRoG Cubi Webapp (TomEE dev)</name> 10 +
11 - <url>http://tomee.apache.org</url> 11 + <name>Web-application of GROG</name>
12 + <url>http://legrog.org</url>
13 + <description>
14 + Le Guide du Roliste Galactique (GROG) est une encyclopedie en ligne référençant tous les jeux de rôles connus.
15 + Cette version CUBI est la 3e mouture du site.
16 + </description>
17 +
12 18
13 <properties> 19 <properties>
14 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 20 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
...@@ -19,6 +25,9 @@ ...@@ -19,6 +25,9 @@
19 <tomee.javaee-api.version>7.0</tomee.javaee-api.version> 25 <tomee.javaee-api.version>7.0</tomee.javaee-api.version>
20 <assertj-core.version>1.6.1</assertj-core.version> 26 <assertj-core.version>1.6.1</assertj-core.version>
21 <openjpa.version>2.4.1</openjpa.version> 27 <openjpa.version>2.4.1</openjpa.version>
28 + <rewrite.version>3.4.1.Final</rewrite.version>
29 + <hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version>
30 + <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version>
22 </properties> 31 </properties>
23 32
24 <dependencyManagement> 33 <dependencyManagement>
...@@ -26,7 +35,6 @@ ...@@ -26,7 +35,6 @@
26 <dependency> 35 <dependency>
27 <groupId>io.spring.platform</groupId> 36 <groupId>io.spring.platform</groupId>
28 <artifactId>platform-bom</artifactId> 37 <artifactId>platform-bom</artifactId>
29 - <!-- Nécessaire à la compilation -->
30 <version>${spring.platform-bom.version}</version> 38 <version>${spring.platform-bom.version}</version>
31 <type>pom</type> 39 <type>pom</type>
32 <scope>import</scope> 40 <scope>import</scope>
...@@ -35,12 +43,21 @@ ...@@ -35,12 +43,21 @@
35 </dependencyManagement> 43 </dependencyManagement>
36 44
37 <dependencies> 45 <dependencies>
38 - <!-- **** PREREQUIS MIGRATION **** --> 46 +
47 +
48 + <!-- **** FRAMEWORK : JSF + CDI **** -->
49 +
50 + <dependency>
51 + <groupId>org.apache.tomee</groupId>
52 + <artifactId>javaee-api</artifactId>
53 + <version>${tomee.javaee-api.version}</version>
54 + <scope>provided</scope>
55 + </dependency>
56 +
39 <!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces --> 57 <!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces -->
40 <dependency> 58 <dependency>
41 <groupId>org.omnifaces</groupId> 59 <groupId>org.omnifaces</groupId>
42 <artifactId>omnifaces</artifactId> 60 <artifactId>omnifaces</artifactId>
43 - <!-- Nécessaire à la compilation -->
44 <version>${omnifaces.version}</version> 61 <version>${omnifaces.version}</version>
45 </dependency> 62 </dependency>
46 63
...@@ -48,34 +65,35 @@ ...@@ -48,34 +65,35 @@
48 <dependency> 65 <dependency>
49 <groupId>org.primefaces</groupId> 66 <groupId>org.primefaces</groupId>
50 <artifactId>primefaces</artifactId> 67 <artifactId>primefaces</artifactId>
51 - <!-- Nécessaire à la compilation -->
52 <version>${primefaces.version}</version> 68 <version>${primefaces.version}</version>
53 </dependency> 69 </dependency>
54 70
55 <dependency> 71 <dependency>
56 <groupId>org.apache.myfaces.core</groupId> 72 <groupId>org.apache.myfaces.core</groupId>
57 <artifactId>myfaces-api</artifactId> 73 <artifactId>myfaces-api</artifactId>
58 - <!-- Nécessaire à la compilation -->
59 <version>${myfaces.version}</version> 74 <version>${myfaces.version}</version>
60 </dependency> 75 </dependency>
61 <dependency> 76 <dependency>
62 <groupId>org.apache.myfaces.core</groupId> 77 <groupId>org.apache.myfaces.core</groupId>
63 <artifactId>myfaces-impl</artifactId> 78 <artifactId>myfaces-impl</artifactId>
64 - <!-- Nécessaire à l'exécution -->
65 <version>${myfaces.version}</version> 79 <version>${myfaces.version}</version>
80 + <scope>runtime</scope>
66 </dependency> 81 </dependency>
67 - <!-- **** FRAMEWORK : JSF + CDI **** -->
68 82
69 - <dependency>
70 - <groupId>org.apache.tomee</groupId>
71 - <artifactId>javaee-api</artifactId>
72 - <!-- Nécessaire à la compilation -->
73 - <version>${tomee.javaee-api.version}</version>
74 - <scope>provided</scope>
75 - </dependency>
76 83
77 84
78 - <!-- **** TOOLS : LOGS + UTILS **** --> 85 +
86 + <!-- Rewriting tool -->
87 +
88 + <!--<dependency>-->
89 + <!--<groupId>com.ocpsoft</groupId>-->
90 + <!--<artifactId>prettyfaces-jsf2</artifactId>-->
91 + <!--<version>3.3.3</version>-->
92 + <!--</dependency>-->
93 + <!-- -->
94 +
95 +<!-- **** TOOLS : LOGS + UTILS **** -->
96 +
79 <dependency> 97 <dependency>
80 <groupId>org.slf4j</groupId> 98 <groupId>org.slf4j</groupId>
81 <artifactId>slf4j-api</artifactId> 99 <artifactId>slf4j-api</artifactId>
...@@ -121,14 +139,14 @@ ...@@ -121,14 +139,14 @@
121 <version>${assertj-core.version}</version> 139 <version>${assertj-core.version}</version>
122 <scope>test</scope> 140 <scope>test</scope>
123 </dependency> 141 </dependency>
124 -<!-- 142 + <!--
125 <dependency> 143 <dependency>
126 <groupId>org.apache.openjpa</groupId> 144 <groupId>org.apache.openjpa</groupId>
127 <artifactId>openjpa</artifactId> 145 <artifactId>openjpa</artifactId>
128 <version>${openjpa.version}</version> 146 <version>${openjpa.version}</version>
129 <scope>test</scope> 147 <scope>test</scope>
130 </dependency> 148 </dependency>
131 ---> 149 + -->
132 <!-- to test with TomEE and Arquillian 150 <!-- to test with TomEE and Arquillian
133 <dependency> 151 <dependency>
134 <groupId>org.apache.tomee</groupId> 152 <groupId>org.apache.tomee</groupId>
...@@ -174,55 +192,44 @@ ...@@ -174,55 +192,44 @@
174 <dependency> 192 <dependency>
175 <groupId>antlr</groupId> 193 <groupId>antlr</groupId>
176 <artifactId>antlr</artifactId> 194 <artifactId>antlr</artifactId>
177 -<!-- <version>2.7.7</version>-->
178 </dependency> 195 </dependency>
179 <dependency> 196 <dependency>
180 <groupId>dom4j</groupId> 197 <groupId>dom4j</groupId>
181 <artifactId>dom4j</artifactId> 198 <artifactId>dom4j</artifactId>
182 -<!-- <version>1.6.1</version>-->
183 </dependency> 199 </dependency>
184 <dependency> 200 <dependency>
185 <groupId>org.hibernate.common</groupId> 201 <groupId>org.hibernate.common</groupId>
186 <artifactId>hibernate-commons-annotations</artifactId> 202 <artifactId>hibernate-commons-annotations</artifactId>
187 - <!-- Nécessaire --> 203 + <version>${hibernate-commons-annotations.version}</version>
188 - <version>5.0.1.Final</version>
189 </dependency> 204 </dependency>
190 <dependency> 205 <dependency>
191 <groupId>org.hibernate.javax.persistence</groupId> 206 <groupId>org.hibernate.javax.persistence</groupId>
192 <artifactId>hibernate-jpa-2.1-api</artifactId> 207 <artifactId>hibernate-jpa-2.1-api</artifactId>
193 - <!-- Nécessaire --> 208 + <version>${hibernate-jpa-2.1-api.version}</version>
194 - <version>1.0.0.Final</version>
195 - <scope>compile</scope>
196 </dependency> 209 </dependency>
197 <dependency> 210 <dependency>
198 <groupId>org.hibernate</groupId> 211 <groupId>org.hibernate</groupId>
199 <artifactId>hibernate-core</artifactId> 212 <artifactId>hibernate-core</artifactId>
200 -<!-- <version>5.2.3.Final</version>-->
201 </dependency> 213 </dependency>
202 <dependency> 214 <dependency>
203 <groupId>org.hibernate</groupId> 215 <groupId>org.hibernate</groupId>
204 <artifactId>hibernate-ehcache</artifactId> 216 <artifactId>hibernate-ehcache</artifactId>
205 -<!-- <version>5.2.3.Final</version>-->
206 </dependency> 217 </dependency>
207 <dependency> 218 <dependency>
208 <groupId>org.hibernate</groupId> 219 <groupId>org.hibernate</groupId>
209 <artifactId>hibernate-entitymanager</artifactId> 220 <artifactId>hibernate-entitymanager</artifactId>
210 -<!-- <version>5.2.3.Final</version>-->
211 </dependency> 221 </dependency>
212 <dependency> 222 <dependency>
213 <groupId>org.hibernate</groupId> 223 <groupId>org.hibernate</groupId>
214 <artifactId>hibernate-validator</artifactId> 224 <artifactId>hibernate-validator</artifactId>
215 -<!-- <version>5.2.3.Final</version>-->
216 </dependency> 225 </dependency>
217 <dependency> 226 <dependency>
218 <groupId>org.jboss.logging</groupId> 227 <groupId>org.jboss.logging</groupId>
219 <artifactId>jboss-logging</artifactId> 228 <artifactId>jboss-logging</artifactId>
220 -<!-- <version>3.3.0.Final</version>-->
221 </dependency> 229 </dependency>
222 <dependency> 230 <dependency>
223 <groupId>org.javassist</groupId> 231 <groupId>org.javassist</groupId>
224 <artifactId>javassist</artifactId> 232 <artifactId>javassist</artifactId>
225 -<!-- <version>3.20.0-GA</version>-->
226 </dependency> 233 </dependency>
227 </dependencies> 234 </dependencies>
228 235
...@@ -244,6 +251,17 @@ ...@@ -244,6 +251,17 @@
244 <version>2.6</version> 251 <version>2.6</version>
245 <configuration> 252 <configuration>
246 <failOnMissingWebXml>false</failOnMissingWebXml> 253 <failOnMissingWebXml>false</failOnMissingWebXml>
254 + <webResources>
255 + <resource>
256 + <!-- this is relative to the pom.xml directory -->
257 + <directory>src/main/java/org/legrog/web</directory>
258 + <excludes>
259 + <exclude>**/*.java</exclude>
260 + </excludes>
261 +
262 + </resource>
263 + </webResources>
264 +
247 </configuration> 265 </configuration>
248 </plugin> 266 </plugin>
249 <plugin> 267 <plugin>
...@@ -252,6 +270,8 @@ ...@@ -252,6 +270,8 @@
252 <version>7.0.1</version> 270 <version>7.0.1</version>
253 <configuration> 271 <configuration>
254 <context>ROOT</context> 272 <context>ROOT</context>
273 +
274 +
255 </configuration> 275 </configuration>
256 </plugin> 276 </plugin>
257 <!-- 277 <!--
......
1 -package org.legrog.application;
2 -
3 -import org.legrog.entities.PublisherRevision;
4 -
5 -import java.util.List;
6 -
7 -public interface PublisherRevisionService {
8 - void addPublisherRevision(PublisherRevision publisherRevision);
9 -
10 - List<PublisherRevision> getAllPublisherRevisions();
11 -
12 - PublisherRevision getPublisherRevision(Integer publisherRevisionId);
13 -}
1 -package org.legrog.application;
2 -
3 -import org.legrog.entities.PublisherRevision;
4 -import org.legrog.entities.PublisherRevisionRepository;
5 -
6 -import javax.ejb.Stateless;
7 -import javax.inject.Inject;
8 -import java.util.List;
9 -
10 -@Stateless
11 -public class PublisherRevisionServiceSpring implements PublisherRevisionService {
12 - @Inject
13 - PublisherRevisionRepository publisherRevisionRepository;
14 -
15 - public void addPublisherRevision(PublisherRevision publisherRevision) {
16 - publisherRevisionRepository.save(publisherRevision);
17 - }
18 -
19 - public List<PublisherRevision> getAllPublisherRevisions() {
20 - return publisherRevisionRepository.findAll();
21 - }
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
1 -package org.legrog.presentation; 1 +package org.legrog.web.book;
2 2
3 -import org.legrog.application.BookService;
4 import org.legrog.entities.Book; 3 import org.legrog.entities.Book;
5 4
6 import javax.enterprise.context.RequestScoped; 5 import javax.enterprise.context.RequestScoped;
......
1 -package org.legrog.application; 1 +package org.legrog.web.book;
2 2
3 import org.legrog.entities.Book; 3 import org.legrog.entities.Book;
4 4
......
1 -package org.legrog.application; 1 +package org.legrog.web.book;
2 2
3 import org.legrog.entities.Book; 3 import org.legrog.entities.Book;
4 import org.slf4j.Logger; 4 import org.slf4j.Logger;
...@@ -8,7 +8,6 @@ import javax.ejb.Stateless; ...@@ -8,7 +8,6 @@ import javax.ejb.Stateless;
8 import javax.enterprise.inject.Alternative; 8 import javax.enterprise.inject.Alternative;
9 import javax.inject.Inject; 9 import javax.inject.Inject;
10 import javax.persistence.EntityManager; 10 import javax.persistence.EntityManager;
11 -import javax.persistence.PersistenceContext;
12 import javax.persistence.criteria.CriteriaQuery; 11 import javax.persistence.criteria.CriteriaQuery;
13 import java.util.List; 12 import java.util.List;
14 13
......
1 -package org.legrog.application; 1 +package org.legrog.web.book;
2 2
3 3
4 import org.legrog.entities.Book; 4 import org.legrog.entities.Book;
5 import org.legrog.entities.BookRepository; 5 import org.legrog.entities.BookRepository;
6 +import org.legrog.web.book.BookService;
6 import org.slf4j.Logger; 7 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 8 import org.slf4j.LoggerFactory;
8 9
9 import javax.ejb.Stateless; 10 import javax.ejb.Stateless;
10 -import javax.enterprise.inject.Alternative;
11 import javax.inject.Inject; 11 import javax.inject.Inject;
12 import java.util.List; 12 import java.util.List;
13 13
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.publisher;
2 2
3 -import org.legrog.application.PublisherRevisionService; 3 +import org.legrog.web.xyz.SharedService;
4 -import org.legrog.application.PublisherService; 4 +import org.legrog.web.user.UserService;
5 -import org.legrog.application.SharedService;
6 -import org.legrog.application.UserService;
7 import org.legrog.entities.Country; 5 import org.legrog.entities.Country;
8 import org.legrog.entities.Publisher; 6 import org.legrog.entities.Publisher;
9 import org.legrog.entities.PublisherRevision; 7 import org.legrog.entities.PublisherRevision;
...@@ -15,9 +13,8 @@ import javax.annotation.PostConstruct; ...@@ -15,9 +13,8 @@ import javax.annotation.PostConstruct;
15 import javax.enterprise.context.RequestScoped; 13 import javax.enterprise.context.RequestScoped;
16 import javax.inject.Inject; 14 import javax.inject.Inject;
17 import javax.inject.Named; 15 import javax.inject.Named;
18 -import java.util.Date;
19 import java.sql.Timestamp; 16 import java.sql.Timestamp;
20 -import java.time.ZoneId; 17 +import java.util.Date;
21 import java.util.HashSet; 18 import java.util.HashSet;
22 import java.util.List; 19 import java.util.List;
23 import java.util.Random; 20 import java.util.Random;
...@@ -33,8 +30,7 @@ public class AddPublisherBean { ...@@ -33,8 +30,7 @@ public class AddPublisherBean {
33 private UserService userService; 30 private UserService userService;
34 @Inject 31 @Inject
35 private PublisherService publisherService; 32 private PublisherService publisherService;
36 - @Inject 33 +
37 - private PublisherRevisionService publisherRevisionService;
38 34
39 private String publisherName; 35 private String publisherName;
40 private String publisherStreetAddress; 36 private String publisherStreetAddress;
...@@ -82,8 +78,11 @@ public class AddPublisherBean { ...@@ -82,8 +78,11 @@ public class AddPublisherBean {
82 // End TODO 78 // End TODO
83 publisherRevision.setPublisherRevisionAuthor(user); 79 publisherRevision.setPublisherRevisionAuthor(user);
84 logger.info(publisherRevision.toString()); 80 logger.info(publisherRevision.toString());
81 +
82 + // FIXME un seul appel logique à faire (pour la gestion du rollback)
85 publisherService.addPublisher(publisher); 83 publisherService.addPublisher(publisher);
86 - publisherRevisionService.addPublisherRevision(publisherRevision); 84 + publisherService.addPublisherRevision(publisherRevision);
85 +
87 // Test de récupération de l'Id 86 // Test de récupération de l'Id
88 logger.info(publisherRevision.toString()); 87 logger.info(publisherRevision.toString());
89 return "success"; 88 return "success";
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.publisher;
2 2
3 -import org.legrog.application.PublisherRevisionService;
4 -import org.legrog.application.PublisherService;
5 -import org.legrog.entities.Publisher;
6 import org.legrog.entities.PublisherRevision; 3 import org.legrog.entities.PublisherRevision;
7 import org.slf4j.Logger; 4 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 5 import org.slf4j.LoggerFactory;
...@@ -11,8 +8,6 @@ import javax.annotation.PostConstruct; ...@@ -11,8 +8,6 @@ import javax.annotation.PostConstruct;
11 import javax.enterprise.context.RequestScoped; 8 import javax.enterprise.context.RequestScoped;
12 import javax.inject.Inject; 9 import javax.inject.Inject;
13 import javax.inject.Named; 10 import javax.inject.Named;
14 -import java.util.ArrayList;
15 -import java.util.Iterator;
16 import java.util.List; 11 import java.util.List;
17 12
18 @Named 13 @Named
...@@ -21,7 +16,7 @@ public class ListPublisherRevisionsView { ...@@ -21,7 +16,7 @@ public class ListPublisherRevisionsView {
21 Logger logger = LoggerFactory.getLogger(getClass()); 16 Logger logger = LoggerFactory.getLogger(getClass());
22 17
23 @Inject 18 @Inject
24 - PublisherRevisionService publisherRevisionService; 19 + PublisherService publisherService;
25 20
26 private Integer publisherId; 21 private Integer publisherId;
27 22
...@@ -48,17 +43,14 @@ public class ListPublisherRevisionsView { ...@@ -48,17 +43,14 @@ public class ListPublisherRevisionsView {
48 */ 43 */
49 @PostConstruct 44 @PostConstruct
50 public void init() { 45 public void init() {
51 - publisherRevisions = publisherRevisionService.getAllPublisherRevisions(); 46 + publisherRevisions = publisherService.getAllPublisherRevisions();
52 logger.info("init"); 47 logger.info("init");
53 } 48 }
54 49
55 public void setView() { 50 public void setView() {
56 logger.info("setView"); 51 logger.info("setView");
57 logger.info("publisherId = " + publisherId); 52 logger.info("publisherId = " + publisherId);
58 - viewAll = false; 53 + viewAll = ( publisherId == null ) ;
59 - if (publisherId == null) {
60 - viewAll = true;
61 - }
62 } 54 }
63 55
64 public Integer getPublisherId() { 56 public Integer getPublisherId() {
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.publisher;
2 2
3 -import org.legrog.application.PublisherRevisionService; 3 +import org.legrog.web.xyz.SharedService;
4 -import org.legrog.application.PublisherService; 4 +import org.legrog.web.user.UserService;
5 -import org.legrog.application.SharedService;
6 -import org.legrog.application.UserService;
7 import org.legrog.entities.Country; 5 import org.legrog.entities.Country;
8 import org.legrog.entities.Publisher; 6 import org.legrog.entities.Publisher;
9 import org.legrog.entities.PublisherRevision; 7 import org.legrog.entities.PublisherRevision;
...@@ -17,7 +15,11 @@ import javax.inject.Inject; ...@@ -17,7 +15,11 @@ import javax.inject.Inject;
17 import javax.inject.Named; 15 import javax.inject.Named;
18 import java.io.Serializable; 16 import java.io.Serializable;
19 import java.sql.Timestamp; 17 import java.sql.Timestamp;
20 -import java.util.*; 18 +import java.util.Date;
19 +import java.util.HashSet;
20 +import java.util.List;
21 +import java.util.Random;
22 +import java.util.Set;
21 23
22 @Named 24 @Named
23 @ViewScoped 25 @ViewScoped
...@@ -26,8 +28,7 @@ public class PublisherRevisionView implements Serializable { ...@@ -26,8 +28,7 @@ public class PublisherRevisionView implements Serializable {
26 28
27 @Inject 29 @Inject
28 private PublisherService publisherService; 30 private PublisherService publisherService;
29 - @Inject 31 +
30 - PublisherRevisionService publisherRevisionService;
31 @Inject 32 @Inject
32 UserService userService; 33 UserService userService;
33 @Inject 34 @Inject
...@@ -111,7 +112,7 @@ public class PublisherRevisionView implements Serializable { ...@@ -111,7 +112,7 @@ public class PublisherRevisionView implements Serializable {
111 public void add() { 112 public void add() {
112 Publisher publisher = new Publisher(); 113 Publisher publisher = new Publisher();
113 PublisherRevision publisherRevision = new PublisherRevision(); 114 PublisherRevision publisherRevision = new PublisherRevision();
114 - HashSet<PublisherRevision> publisherRevisions = new HashSet<PublisherRevision>(); 115 + Set<PublisherRevision> publisherRevisions = new HashSet<PublisherRevision>();
115 publisherRevisions.add(publisherRevision); 116 publisherRevisions.add(publisherRevision);
116 publisher.setRevisions(publisherRevisions); 117 publisher.setRevisions(publisherRevisions);
117 118
...@@ -119,8 +120,10 @@ public class PublisherRevisionView implements Serializable { ...@@ -119,8 +120,10 @@ public class PublisherRevisionView implements Serializable {
119 120
120 setValues(publisherRevision); 121 setValues(publisherRevision);
121 122
123 + // FIXME un seul appel logique à faire (pour la gestion du rollback)
122 publisherService.addPublisher(publisher); 124 publisherService.addPublisher(publisher);
123 - publisherRevisionService.addPublisherRevision(publisherRevision); 125 + publisherService.addPublisherRevision(publisherRevision);
126 +
124 newPublisher = false; 127 newPublisher = false;
125 publisherRevisionId = publisherRevision.getPublisherRevisionId(); 128 publisherRevisionId = publisherRevision.getPublisherRevisionId();
126 publisherId = publisher.getPublisherId(); 129 publisherId = publisher.getPublisherId();
...@@ -135,8 +138,10 @@ public class PublisherRevisionView implements Serializable { ...@@ -135,8 +138,10 @@ public class PublisherRevisionView implements Serializable {
135 138
136 setValues(publisherRevision); 139 setValues(publisherRevision);
137 140
141 + // FIXME un seul appel logique à faire (pour la gestion du rollback)
138 publisherService.addRevisionToPublisher(publisher, publisherRevision); 142 publisherService.addRevisionToPublisher(publisher, publisherRevision);
139 - publisherRevisionService.addPublisherRevision(publisherRevision); 143 + publisherService.addPublisherRevision(publisherRevision);
144 +
140 editMode = false; 145 editMode = false;
141 } 146 }
142 147
...@@ -144,7 +149,8 @@ public class PublisherRevisionView implements Serializable { ...@@ -144,7 +149,8 @@ public class PublisherRevisionView implements Serializable {
144 logger.debug("publisherRevisionId = {}", this.publisherRevisionId); 149 logger.debug("publisherRevisionId = {}", this.publisherRevisionId);
145 150
146 if (publisherRevisionId != 0) { 151 if (publisherRevisionId != 0) {
147 - PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(publisherRevisionId); 152 +
153 + PublisherRevision publisherRevision = publisherService.getPublisherRevision(publisherRevisionId);
148 154
149 logger.debug("Found a publisher revision : {}", publisherRevision.toString()); 155 logger.debug("Found a publisher revision : {}", publisherRevision.toString());
150 156
......
1 -package org.legrog.application; 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.PublisherRevision;
...@@ -6,6 +6,7 @@ import org.legrog.entities.PublisherRevision; ...@@ -6,6 +6,7 @@ import org.legrog.entities.PublisherRevision;
6 import java.util.List; 6 import java.util.List;
7 7
8 public interface PublisherService { 8 public interface PublisherService {
9 +
9 void addPublisher(Publisher publisher); 10 void addPublisher(Publisher publisher);
10 11
11 void addRevisionToPublisher(Publisher publisher, PublisherRevision publisherRevision); 12 void addRevisionToPublisher(Publisher publisher, PublisherRevision publisherRevision);
...@@ -13,4 +14,10 @@ public interface PublisherService { ...@@ -13,4 +14,10 @@ public interface PublisherService {
13 List<Publisher> getAllPublishers(); 14 List<Publisher> getAllPublishers();
14 15
15 Publisher getPublisher(Integer publisherId); 16 Publisher getPublisher(Integer publisherId);
17 +
18 + void addPublisherRevision(PublisherRevision publisherRevision);
19 +
20 + List<PublisherRevision> getAllPublisherRevisions();
21 +
22 + PublisherRevision getPublisherRevision(Integer publisherRevisionId);
16 } 23 }
......
1 -package org.legrog.application; 1 +package org.legrog.web.publisher;
2 2
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.PublisherRevision;
7 +import org.legrog.entities.PublisherRevisionRepository;
7 8
8 import javax.ejb.Stateless; 9 import javax.ejb.Stateless;
9 import javax.inject.Inject; 10 import javax.inject.Inject;
...@@ -15,6 +16,21 @@ public class PublisherServiceSpring implements PublisherService { ...@@ -15,6 +16,21 @@ public class PublisherServiceSpring implements PublisherService {
15 @Inject 16 @Inject
16 PublisherRepository publisherRepository; 17 PublisherRepository publisherRepository;
17 18
19 + @Inject
20 + PublisherRevisionRepository publisherRevisionRepository;
21 +
22 + public void addPublisherRevision(PublisherRevision publisherRevision) {
23 + publisherRevisionRepository.save(publisherRevision);
24 + }
25 +
26 + public List<PublisherRevision> getAllPublisherRevisions() {
27 + return publisherRevisionRepository.findAll();
28 + }
29 +
30 + public PublisherRevision getPublisherRevision(Integer publisherRevisionId) {
31 + return publisherRevisionRepository.findOne(publisherRevisionId);
32 + }
33 +
18 public void addPublisher(Publisher publisher) { 34 public void addPublisher(Publisher publisher) {
19 publisherRepository.save(publisher); 35 publisherRepository.save(publisher);
20 } 36 }
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.user;
2 2
3 -import org.legrog.application.UserService;
4 import org.legrog.entities.User; 3 import org.legrog.entities.User;
5 4
6 import javax.annotation.PostConstruct; 5 import javax.annotation.PostConstruct;
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.user;
2 2
3 -import org.legrog.application.SharedService; 3 +import org.legrog.web.xyz.SharedService;
4 -import org.legrog.application.UserService;
5 import org.legrog.entities.*; 4 import org.legrog.entities.*;
6 import org.slf4j.Logger; 5 import org.slf4j.Logger;
7 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
8 7
9 import javax.annotation.PostConstruct; 8 import javax.annotation.PostConstruct;
10 -import javax.enterprise.context.RequestScoped;
11 import javax.faces.bean.ManagedProperty; 9 import javax.faces.bean.ManagedProperty;
12 import javax.faces.bean.SessionScoped; 10 import javax.faces.bean.SessionScoped;
13 -import javax.faces.context.ExternalContext;
14 -import javax.faces.context.FacesContext;
15 -import javax.faces.view.ViewScoped;
16 import javax.inject.Inject; 11 import javax.inject.Inject;
17 import javax.inject.Named; 12 import javax.inject.Named;
18 -import java.io.IOException;
19 import java.util.ArrayList; 13 import java.util.ArrayList;
20 import java.util.Date; 14 import java.util.Date;
21 import java.util.List; 15 import java.util.List;
......
1 -package org.legrog.application; 1 +package org.legrog.web.user;
2 2
3 import org.legrog.entities.User; 3 import org.legrog.entities.User;
4 4
......
1 -package org.legrog.application; 1 +package org.legrog.web.user;
2 2
3 import org.legrog.entities.User; 3 import org.legrog.entities.User;
4 import org.legrog.entities.UserRepository; 4 import org.legrog.entities.UserRepository;
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.xyz;
2 2
3 -import org.legrog.application.SharedService;
4 import org.legrog.entities.Country; 3 import org.legrog.entities.Country;
5 4
6 import javax.enterprise.context.RequestScoped; 5 import javax.enterprise.context.RequestScoped;
......
1 -package org.legrog.presentation; 1 +package org.legrog.web.xyz;
2 2
3 -import org.legrog.application.SharedService;
4 import org.legrog.entities.Country; 3 import org.legrog.entities.Country;
5 4
6 import javax.annotation.PostConstruct; 5 import javax.annotation.PostConstruct;
......
1 -package org.legrog.application; 1 +package org.legrog.web.xyz;
2 2
3 import org.legrog.entities.Country; 3 import org.legrog.entities.Country;
4 import org.legrog.entities.DisplayNameMask; 4 import org.legrog.entities.DisplayNameMask;
......
1 -package org.legrog.application; 1 +package org.legrog.web.xyz;
2 2
3 import org.legrog.entities.*; 3 import org.legrog.entities.*;
4 //import org.slf4j.Logger; 4 //import org.slf4j.Logger;
......
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +
3 +<body jsf:id="root-body" xmlns="http://www.w3.org/1999/xhtml"
4 + xmlns:h="http://xmlns.jcp.org/jsf/html"
5 + xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
6 + xmlns:f="http://xmlns.jcp.org/jsf/core"
7 + xmlns:jsf="http://xmlns.jcp.org/jsf">
8 +<p>
9 + I'm looking for something
10 +</p>
11 +
12 +<p>
13 +And this is my string : #{testRootView.foo}
14 +</p>
15 +
16 +
17 +<p>
18 + And this is another string : #{testRootView.bar}
19 +</p>
20 +
21 +</body>
1 +package org.legrog.web.xyz;
2 +
3 +import javax.inject.Named;
4 +import java.io.Serializable;
5 +
6 +@Named
7 +@javax.enterprise.context.RequestScoped
8 +//@URLMapping(id = "testroot", pattern = "/testRoot/#{bar : testRootView.bar}", viewId = "xyz/TestRoot.jsf")
9 +public class TestRootView implements Serializable {
10 +
11 + String foo = "my first String";
12 +
13 + String bar ="";
14 +
15 +//
16 +// public void init() {
17 +// if (number == null) {
18 +// foo = "my second String";
19 +// } else {
20 +// foo = "my string #"+number;
21 +// }
22 +//
23 +// }
24 +
25 + public String getFoo() {
26 + return foo;
27 + }
28 +
29 + public void setFoo(String foo) {
30 + this.foo = foo;
31 + }
32 +
33 + public String getBar() {
34 + return bar;
35 + }
36 +
37 + public void setBar(String bar) {
38 + this.bar = bar;
39 + }
40 +}
1 +<?xml version="1.0" encoding="UTF-8"?>
2 +<configuration>
3 +
4 + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
5 + <layout class="ch.qos.logback.classic.PatternLayout">
6 + <Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
7 + </layout>
8 + </appender>
9 +
10 + <logger name="org.legrog" level="DEBUG"/>
11 +
12 + <root level="warn">
13 + <appender-ref ref="STDOUT" />
14 + </root>
15 +</configuration>
...\ No newline at end of file ...\ No newline at end of file
...@@ -17,92 +17,92 @@ ...@@ -17,92 +17,92 @@
17 <from-view-id>/index.xhtml</from-view-id> 17 <from-view-id>/index.xhtml</from-view-id>
18 <navigation-case> 18 <navigation-case>
19 <from-outcome>addBook</from-outcome> 19 <from-outcome>addBook</from-outcome>
20 - <to-view-id>/book.xhtml</to-view-id> 20 + <to-view-id>/book/book.xhtml</to-view-id>
21 </navigation-case> 21 </navigation-case>
22 <navigation-case> 22 <navigation-case>
23 <from-outcome>listBooks</from-outcome> 23 <from-outcome>listBooks</from-outcome>
24 - <to-view-id>/result.xhtml</to-view-id> 24 + <to-view-id>/book/result.xhtml</to-view-id>
25 </navigation-case> 25 </navigation-case>
26 <navigation-case> 26 <navigation-case>
27 <from-outcome>addCountry</from-outcome> 27 <from-outcome>addCountry</from-outcome>
28 - <to-view-id>/addCountry.xhtml</to-view-id> 28 + <to-view-id>/xyz/addCountry.xhtml</to-view-id>
29 </navigation-case> 29 </navigation-case>
30 <navigation-case> 30 <navigation-case>
31 <from-outcome>listCountries</from-outcome> 31 <from-outcome>listCountries</from-outcome>
32 - <to-view-id>/listCountries.xhtml</to-view-id> 32 + <to-view-id>/xyz/listCountries.xhtml</to-view-id>
33 </navigation-case> 33 </navigation-case>
34 <navigation-case> 34 <navigation-case>
35 <from-outcome>addUser</from-outcome> 35 <from-outcome>addUser</from-outcome>
36 - <to-view-id>/updateUser.xhtml</to-view-id> 36 + <to-view-id>/user/updateUser.xhtml</to-view-id>
37 </navigation-case> 37 </navigation-case>
38 <navigation-case> 38 <navigation-case>
39 <from-outcome>listUsers</from-outcome> 39 <from-outcome>listUsers</from-outcome>
40 - <to-view-id>/listUsers.xhtml</to-view-id> 40 + <to-view-id>/user/listUsers.xhtml</to-view-id>
41 </navigation-case> 41 </navigation-case>
42 </navigation-rule> 42 </navigation-rule>
43 <navigation-rule> 43 <navigation-rule>
44 - <from-view-id>/addPublisher.xhtml</from-view-id> 44 + <from-view-id>/publisher/addPublisher.xhtml</from-view-id>
45 <navigation-case> 45 <navigation-case>
46 <from-outcome>success</from-outcome> 46 <from-outcome>success</from-outcome>
47 - <to-view-id>/listPublisherRevisions.xhtml</to-view-id> 47 + <to-view-id>/publisher/listPublisherRevisions.xhtml</to-view-id>
48 </navigation-case> 48 </navigation-case>
49 </navigation-rule> 49 </navigation-rule>
50 <navigation-rule> 50 <navigation-rule>
51 - <from-view-id>/addCountry.xhtml</from-view-id> 51 + <from-view-id>/xyz/addCountry.xhtml</from-view-id>
52 <navigation-case> 52 <navigation-case>
53 <from-outcome>success</from-outcome> 53 <from-outcome>success</from-outcome>
54 - <to-view-id>/listCountries.xhtml</to-view-id> 54 + <to-view-id>/xyz/listCountries.xhtml</to-view-id>
55 </navigation-case> 55 </navigation-case>
56 </navigation-rule> 56 </navigation-rule>
57 57
58 <navigation-rule> 58 <navigation-rule>
59 - <from-view-id>/addUser_short.xhtml</from-view-id> 59 + <from-view-id>/user/addUser_short.xhtml</from-view-id>
60 <navigation-case> 60 <navigation-case>
61 <from-outcome>success</from-outcome> 61 <from-outcome>success</from-outcome>
62 - <to-view-id>/listUsers_short.xhtml</to-view-id> 62 + <to-view-id>/user/listUsers_short.xhtml</to-view-id>
63 </navigation-case> 63 </navigation-case>
64 </navigation-rule> 64 </navigation-rule>
65 65
66 <navigation-rule> 66 <navigation-rule>
67 - <from-view-id>/book.xhtml</from-view-id> 67 + <from-view-id>/book/book.xhtml</from-view-id>
68 <navigation-case> 68 <navigation-case>
69 <from-outcome>success</from-outcome> 69 <from-outcome>success</from-outcome>
70 - <to-view-id>/result.xhtml</to-view-id> 70 + <to-view-id>/book/result.xhtml</to-view-id>
71 </navigation-case> 71 </navigation-case>
72 </navigation-rule> 72 </navigation-rule>
73 73
74 <navigation-rule> 74 <navigation-rule>
75 - <from-view-id>/result.xhtml</from-view-id> 75 + <from-view-id>/book/result.xhtml</from-view-id>
76 <navigation-case> 76 <navigation-case>
77 <from-outcome>back</from-outcome> 77 <from-outcome>back</from-outcome>
78 - <to-view-id>/book.xhtml</to-view-id> 78 + <to-view-id>/book/book.xhtml</to-view-id>
79 </navigation-case> 79 </navigation-case>
80 </navigation-rule> 80 </navigation-rule>
81 81
82 <navigation-rule> 82 <navigation-rule>
83 - <from-view-id>/updateUser.xhtml</from-view-id> 83 + <from-view-id>/user/updateUser.xhtml</from-view-id>
84 <navigation-case> 84 <navigation-case>
85 <from-outcome>cancel</from-outcome> 85 <from-outcome>cancel</from-outcome>
86 - <to-view-id>/listUsers.xhtml</to-view-id> 86 + <to-view-id>/user/listUsers.xhtml</to-view-id>
87 </navigation-case> 87 </navigation-case>
88 <navigation-case> 88 <navigation-case>
89 <from-outcome>success</from-outcome> 89 <from-outcome>success</from-outcome>
90 - <to-view-id>/listUsers.xhtml</to-view-id> 90 + <to-view-id>/user/listUsers.xhtml</to-view-id>
91 </navigation-case> 91 </navigation-case>
92 </navigation-rule> 92 </navigation-rule>
93 <navigation-rule> 93 <navigation-rule>
94 - <from-view-id>/listUsers.xhtml</from-view-id> 94 + <from-view-id>/user/listUsers.xhtml</from-view-id>
95 <navigation-case> 95 <navigation-case>
96 <from-outcome>add</from-outcome> 96 <from-outcome>add</from-outcome>
97 - <to-view-id>/updateUser.xhtml</to-view-id> 97 + <to-view-id>/user/updateUser.xhtml</to-view-id>
98 </navigation-case> 98 </navigation-case>
99 </navigation-rule> 99 </navigation-rule>
100 100
101 <navigation-rule> 101 <navigation-rule>
102 - <from-view-id>/listPublisherRevisions.xhtml</from-view-id> 102 + <from-view-id>/publisher/listPublisherRevisions.xhtml</from-view-id>
103 <navigation-case> 103 <navigation-case>
104 <from-outcome>view</from-outcome> 104 <from-outcome>view</from-outcome>
105 - <to-view-id>/publisherRevision.xhtml</to-view-id> 105 + <to-view-id>/publisher/publisherRevision.xhtml</to-view-id>
106 </navigation-case> 106 </navigation-case>
107 </navigation-rule> 107 </navigation-rule>
108 </faces-config> 108 </faces-config>
...\ No newline at end of file ...\ No newline at end of file
......
1 -package org.legrog.application; 1 +package org.legrog.web.book;
2 2
3 import org.junit.Before; 3 import org.junit.Before;
4 import org.junit.Test; 4 import org.junit.Test;
5 import org.junit.runner.RunWith; 5 import org.junit.runner.RunWith;
6 import org.legrog.entities.Book; 6 import org.legrog.entities.Book;
7 +import org.legrog.web.book.BookServiceOld;
7 import org.mockito.Answers; 8 import org.mockito.Answers;
8 import org.mockito.Mock; 9 import org.mockito.Mock;
9 import org.mockito.Mockito; 10 import org.mockito.Mockito;
......