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 482 additions and 415 deletions
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.legrog</groupId>
<artifactId>grog-cubi</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>GRoG Cubi Webapp (TomEE dev)</name>
<url>http://tomee.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.platform-bom.version>2.0.7.RELEASE</spring.platform-bom.version>
<omnifaces.version>2.5.1</omnifaces.version>
<primefaces.version>6.0</primefaces.version>
<myfaces.version>2.2.10</myfaces.version>
<tomee.javaee-api.version>7.0</tomee.javaee-api.version>
<assertj-core.version>1.6.1</assertj-core.version>
<openjpa.version>2.4.1</openjpa.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<!-- Nécessaire à la compilation -->
<version>${spring.platform-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- **** PREREQUIS MIGRATION **** -->
<!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces -->
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<!-- Nécessaire à la compilation -->
<version>${omnifaces.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<!-- Nécessaire à la compilation -->
<version>${primefaces.version}</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<!-- Nécessaire à la compilation -->
<version>${myfaces.version}</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<!-- Nécessaire à l'exécution -->
<version>${myfaces.version}</version>
</dependency>
<!-- **** FRAMEWORK : JSF + CDI **** -->
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>javaee-api</artifactId>
<!-- Nécessaire à la compilation -->
<version>${tomee.javaee-api.version}</version>
<scope>provided</scope>
</dependency>
<!-- **** TOOLS : LOGS + UTILS **** -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- **** DATA MANAGEMENT **** -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<!-- **** TEST SCOPE **** -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpa.version}</version>
<scope>test</scope>
</dependency>
-->
<!-- to test with TomEE and Arquillian
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>arquillian-tomee-remote</artifactId>
<version>7.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.10.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
-->
<!-- to test with OpenEJB embedded and Arquillian
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>arquillian-openejb-embedded</artifactId>
<version>{project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.10.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
-->
<!-- Hibernate -->
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
<!-- <version>2.7.7</version>-->
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<!-- <version>1.6.1</version>-->
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<!-- Nécessaire -->
<version>5.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<!-- Nécessaire -->
<version>1.0.0.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<!-- <version>5.2.3.Final</version>-->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<!-- <version>5.2.3.Final</version>-->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<!-- <version>5.2.3.Final</version>-->
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<!-- <version>5.2.3.Final</version>-->
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<!-- <version>3.3.0.Final</version>-->
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<!-- <version>3.20.0-GA</version>-->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>7.0.1</version>
<configuration>
<context>ROOT</context>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>${openjpa.version}</version>
<configuration>
<includes>**/entities/*.class</includes>
<excludes>**/entities/XML*.class</excludes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<modelVersion>4.0.0</modelVersion>
<groupId>org.legrog</groupId>
<artifactId>grog-cubi</artifactId>
<version>3.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>Web-application of GROG</name>
<url>http://legrog.org</url>
<description>
Le Guide du Roliste Galactique (GROG) est une encyclopedie en ligne référençant tous les jeux de rôles connus.
Cette version CUBI est la 3e mouture du site.
</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.platform-bom.version>2.0.7.RELEASE</spring.platform-bom.version>
<omnifaces.version>2.5.1</omnifaces.version>
<primefaces.version>6.0</primefaces.version>
<myfaces.version>2.2.10</myfaces.version>
<tomee.javaee-api.version>7.0</tomee.javaee-api.version>
<assertj-core.version>1.6.1</assertj-core.version>
<openjpa.version>2.4.1</openjpa.version>
<rewrite.version>3.4.1.Final</rewrite.version>
<hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version>
<hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<- set the version to be the same as the level in your runtime
<version>${openjpa.version}</version>
</dependency>
<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>${spring.platform-bom.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</plugin>
-->
</plugins>
</build>
<repositories>
<repository>
<id>apache-snapshot</id>
<name>Apache Snapshot Repository</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
</repository>
</repositories>
</dependencyManagement>
<dependencies>
<!-- **** FRAMEWORK : JSF + CDI **** -->
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>javaee-api</artifactId>
<version>${tomee.javaee-api.version}</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces -->
<dependency>
<groupId>org.omnifaces</groupId>
<artifactId>omnifaces</artifactId>
<version>${omnifaces.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.primefaces/primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-api</artifactId>
<version>${myfaces.version}</version>
</dependency>
<dependency>
<groupId>org.apache.myfaces.core</groupId>
<artifactId>myfaces-impl</artifactId>
<version>${myfaces.version}</version>
<scope>runtime</scope>
</dependency>
<!-- Rewriting tool -->
<!--<dependency>-->
<!--<groupId>com.ocpsoft</groupId>-->
<!--<artifactId>prettyfaces-jsf2</artifactId>-->
<!--<version>3.3.3</version>-->
<!--</dependency>-->
<!-- -->
<!-- **** TOOLS : LOGS + UTILS **** -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<!-- **** DATA MANAGEMENT **** -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<!-- **** TEST SCOPE **** -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<!--
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<version>${openjpa.version}</version>
<scope>test</scope>
</dependency>
-->
<!-- to test with TomEE and Arquillian
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>arquillian-tomee-remote</artifactId>
<version>7.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.10.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
-->
<!-- to test with OpenEJB embedded and Arquillian
<dependency>
<groupId>org.apache.tomee</groupId>
<artifactId>arquillian-openejb-embedded</artifactId>
<version>{project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.10.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
-->
<!-- Hibernate -->
<dependency>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernate-commons-annotations.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>${hibernate-jpa-2.1-api.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>src/main/java/org/legrog/web</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomee.maven</groupId>
<artifactId>tomee-maven-plugin</artifactId>
<version>7.0.1</version>
<configuration>
<context>ROOT</context>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>${openjpa.version}</version>
<configuration>
<includes>**/entities/*.class</includes>
<excludes>**/entities/XML*.class</excludes>
<addDefaultConstructor>true</addDefaultConstructor>
<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
</configuration>
<executions>
<execution>
<id>enhancer</id>
<phase>process-classes</phase>
<goals>
<goal>enhance</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa</artifactId>
<- set the version to be the same as the level in your runtime
<version>${openjpa.version}</version>
</dependency>
</dependencies>
</plugin>
-->
</plugins>
</build>
<repositories>
<repository>
<id>apache-snapshot</id>
<name>Apache Snapshot Repository</name>
<url>https://repository.apache.org/content/groups/snapshots/</url>
</repository>
</repositories>
</project>
......
package org.legrog.application;
import org.legrog.entities.PublisherRevision;
import java.util.List;
public interface PublisherRevisionService {
void addPublisherRevision(PublisherRevision publisherRevision);
List<PublisherRevision> getAllPublisherRevisions();
PublisherRevision getPublisherRevision(Integer publisherRevisionId);
}
package org.legrog.application;
import org.legrog.entities.PublisherRevision;
import org.legrog.entities.PublisherRevisionRepository;
import javax.ejb.Stateless;
import javax.inject.Inject;
import java.util.List;
@Stateless
public class PublisherRevisionServiceSpring implements PublisherRevisionService {
@Inject
PublisherRevisionRepository publisherRevisionRepository;
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
package org.legrog.presentation;
package org.legrog.web.book;
import org.legrog.application.BookService;
import org.legrog.entities.Book;
import javax.enterprise.context.RequestScoped;
......
package org.legrog.application;
package org.legrog.web.book;
import org.legrog.entities.Book;
......
package org.legrog.application;
package org.legrog.web.book;
import org.legrog.entities.Book;
import org.slf4j.Logger;
......@@ -8,7 +8,6 @@ import javax.ejb.Stateless;
import javax.enterprise.inject.Alternative;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.criteria.CriteriaQuery;
import java.util.List;
......
package org.legrog.application;
package org.legrog.web.book;
import org.legrog.entities.Book;
import org.legrog.entities.BookRepository;
import org.legrog.web.book.BookService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ejb.Stateless;
import javax.enterprise.inject.Alternative;
import javax.inject.Inject;
import java.util.List;
......
package org.legrog.presentation;
package org.legrog.web.publisher;
import org.legrog.application.PublisherRevisionService;
import org.legrog.application.PublisherService;
import org.legrog.application.SharedService;
import org.legrog.application.UserService;
import org.legrog.web.xyz.SharedService;
import org.legrog.web.user.UserService;
import org.legrog.entities.Country;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRevision;
......@@ -15,9 +13,8 @@ import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.Date;
import java.sql.Timestamp;
import java.time.ZoneId;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
......@@ -33,8 +30,7 @@ public class AddPublisherBean {
private UserService userService;
@Inject
private PublisherService publisherService;
@Inject
private PublisherRevisionService publisherRevisionService;
private String publisherName;
private String publisherStreetAddress;
......@@ -82,8 +78,11 @@ public class AddPublisherBean {
// End TODO
publisherRevision.setPublisherRevisionAuthor(user);
logger.info(publisherRevision.toString());
// FIXME un seul appel logique à faire (pour la gestion du rollback)
publisherService.addPublisher(publisher);
publisherRevisionService.addPublisherRevision(publisherRevision);
publisherService.addPublisherRevision(publisherRevision);
// Test de récupération de l'Id
logger.info(publisherRevision.toString());
return "success";
......
package org.legrog.presentation;
package org.legrog.web.publisher;
import org.legrog.application.PublisherRevisionService;
import org.legrog.application.PublisherService;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRevision;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -11,8 +8,6 @@ import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@Named
......@@ -21,7 +16,7 @@ public class ListPublisherRevisionsView {
Logger logger = LoggerFactory.getLogger(getClass());
@Inject
PublisherRevisionService publisherRevisionService;
PublisherService publisherService;
private Integer publisherId;
......@@ -48,17 +43,14 @@ public class ListPublisherRevisionsView {
*/
@PostConstruct
public void init() {
publisherRevisions = publisherRevisionService.getAllPublisherRevisions();
publisherRevisions = publisherService.getAllPublisherRevisions();
logger.info("init");
}
public void setView() {
logger.info("setView");
logger.info("publisherId = " + publisherId);
viewAll = false;
if (publisherId == null) {
viewAll = true;
}
viewAll = ( publisherId == null ) ;
}
public Integer getPublisherId() {
......
package org.legrog.presentation;
package org.legrog.web.publisher;
import org.legrog.application.PublisherRevisionService;
import org.legrog.application.PublisherService;
import org.legrog.application.SharedService;
import org.legrog.application.UserService;
import org.legrog.web.xyz.SharedService;
import org.legrog.web.user.UserService;
import org.legrog.entities.Country;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRevision;
......@@ -17,7 +15,11 @@ import javax.inject.Inject;
import javax.inject.Named;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.*;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Random;
import java.util.Set;
@Named
@ViewScoped
......@@ -26,8 +28,7 @@ public class PublisherRevisionView implements Serializable {
@Inject
private PublisherService publisherService;
@Inject
PublisherRevisionService publisherRevisionService;
@Inject
UserService userService;
@Inject
......@@ -111,7 +112,7 @@ public class PublisherRevisionView implements Serializable {
public void add() {
Publisher publisher = new Publisher();
PublisherRevision publisherRevision = new PublisherRevision();
HashSet<PublisherRevision> publisherRevisions = new HashSet<PublisherRevision>();
Set<PublisherRevision> publisherRevisions = new HashSet<PublisherRevision>();
publisherRevisions.add(publisherRevision);
publisher.setRevisions(publisherRevisions);
......@@ -119,8 +120,10 @@ public class PublisherRevisionView implements Serializable {
setValues(publisherRevision);
// FIXME un seul appel logique à faire (pour la gestion du rollback)
publisherService.addPublisher(publisher);
publisherRevisionService.addPublisherRevision(publisherRevision);
publisherService.addPublisherRevision(publisherRevision);
newPublisher = false;
publisherRevisionId = publisherRevision.getPublisherRevisionId();
publisherId = publisher.getPublisherId();
......@@ -135,8 +138,10 @@ public class PublisherRevisionView implements Serializable {
setValues(publisherRevision);
// FIXME un seul appel logique à faire (pour la gestion du rollback)
publisherService.addRevisionToPublisher(publisher, publisherRevision);
publisherRevisionService.addPublisherRevision(publisherRevision);
publisherService.addPublisherRevision(publisherRevision);
editMode = false;
}
......@@ -144,7 +149,8 @@ public class PublisherRevisionView implements Serializable {
logger.debug("publisherRevisionId = {}", this.publisherRevisionId);
if (publisherRevisionId != 0) {
PublisherRevision publisherRevision = publisherRevisionService.getPublisherRevision(publisherRevisionId);
PublisherRevision publisherRevision = publisherService.getPublisherRevision(publisherRevisionId);
logger.debug("Found a publisher revision : {}", publisherRevision.toString());
......
package org.legrog.application;
package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRevision;
......@@ -6,6 +6,7 @@ import org.legrog.entities.PublisherRevision;
import java.util.List;
public interface PublisherService {
void addPublisher(Publisher publisher);
void addRevisionToPublisher(Publisher publisher, PublisherRevision publisherRevision);
......@@ -13,4 +14,10 @@ public interface PublisherService {
List<Publisher> getAllPublishers();
Publisher getPublisher(Integer publisherId);
void addPublisherRevision(PublisherRevision publisherRevision);
List<PublisherRevision> getAllPublisherRevisions();
PublisherRevision getPublisherRevision(Integer publisherRevisionId);
}
......
package org.legrog.application;
package org.legrog.web.publisher;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRepository;
import org.legrog.entities.PublisherRevision;
import org.legrog.entities.PublisherRevisionRepository;
import javax.ejb.Stateless;
import javax.inject.Inject;
......@@ -15,6 +16,21 @@ public class PublisherServiceSpring implements PublisherService {
@Inject
PublisherRepository publisherRepository;
@Inject
PublisherRevisionRepository publisherRevisionRepository;
public void addPublisherRevision(PublisherRevision publisherRevision) {
publisherRevisionRepository.save(publisherRevision);
}
public List<PublisherRevision> getAllPublisherRevisions() {
return publisherRevisionRepository.findAll();
}
public PublisherRevision getPublisherRevision(Integer publisherRevisionId) {
return publisherRevisionRepository.findOne(publisherRevisionId);
}
public void addPublisher(Publisher publisher) {
publisherRepository.save(publisher);
}
......
package org.legrog.presentation;
package org.legrog.web.user;
import org.legrog.application.UserService;
import org.legrog.entities.User;
import javax.annotation.PostConstruct;
......
package org.legrog.presentation;
package org.legrog.web.user;
import org.legrog.application.SharedService;
import org.legrog.application.UserService;
import org.legrog.web.xyz.SharedService;
import org.legrog.entities.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.PostConstruct;
import javax.enterprise.context.RequestScoped;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......
package org.legrog.application;
package org.legrog.web.user;
import org.legrog.entities.User;
......
package org.legrog.application;
package org.legrog.web.user;
import org.legrog.entities.User;
import org.legrog.entities.UserRepository;
......
package org.legrog.presentation;
package org.legrog.web.xyz;
import org.legrog.application.SharedService;
import org.legrog.entities.Country;
import javax.enterprise.context.RequestScoped;
......
package org.legrog.presentation;
package org.legrog.web.xyz;
import org.legrog.application.SharedService;
import org.legrog.entities.Country;
import javax.annotation.PostConstruct;
......
package org.legrog.application;
package org.legrog.web.xyz;
import org.legrog.entities.Country;
import org.legrog.entities.DisplayNameMask;
......
package org.legrog.application;
package org.legrog.web.xyz;
import org.legrog.entities.*;
//import org.slf4j.Logger;
......
<?xml version="1.0" encoding="UTF-8"?>
<body jsf:id="root-body" xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:jsf="http://xmlns.jcp.org/jsf">
<p>
I'm looking for something
</p>
<p>
And this is my string : #{testRootView.foo}
</p>
<p>
And this is another string : #{testRootView.bar}
</p>
</body>
package org.legrog.web.xyz;
import javax.inject.Named;
import java.io.Serializable;
@Named
@javax.enterprise.context.RequestScoped
//@URLMapping(id = "testroot", pattern = "/testRoot/#{bar : testRootView.bar}", viewId = "xyz/TestRoot.jsf")
public class TestRootView implements Serializable {
String foo = "my first String";
String bar ="";
//
// public void init() {
// if (number == null) {
// foo = "my second String";
// } else {
// foo = "my string #"+number;
// }
//
// }
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
}
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="org.legrog" level="DEBUG"/>
<root level="warn">
<appender-ref ref="STDOUT" />
</root>
</configuration>
\ No newline at end of file
......@@ -17,92 +17,92 @@
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>addBook</from-outcome>
<to-view-id>/book.xhtml</to-view-id>
<to-view-id>/book/book.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>listBooks</from-outcome>
<to-view-id>/result.xhtml</to-view-id>
<to-view-id>/book/result.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>addCountry</from-outcome>
<to-view-id>/addCountry.xhtml</to-view-id>
<to-view-id>/xyz/addCountry.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>listCountries</from-outcome>
<to-view-id>/listCountries.xhtml</to-view-id>
<to-view-id>/xyz/listCountries.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>addUser</from-outcome>
<to-view-id>/updateUser.xhtml</to-view-id>
<to-view-id>/user/updateUser.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>listUsers</from-outcome>
<to-view-id>/listUsers.xhtml</to-view-id>
<to-view-id>/user/listUsers.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/addPublisher.xhtml</from-view-id>
<from-view-id>/publisher/addPublisher.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/listPublisherRevisions.xhtml</to-view-id>
<to-view-id>/publisher/listPublisherRevisions.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/addCountry.xhtml</from-view-id>
<from-view-id>/xyz/addCountry.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/listCountries.xhtml</to-view-id>
<to-view-id>/xyz/listCountries.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/addUser_short.xhtml</from-view-id>
<from-view-id>/user/addUser_short.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/listUsers_short.xhtml</to-view-id>
<to-view-id>/user/listUsers_short.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/book.xhtml</from-view-id>
<from-view-id>/book/book.xhtml</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/result.xhtml</to-view-id>
<to-view-id>/book/result.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/result.xhtml</from-view-id>
<from-view-id>/book/result.xhtml</from-view-id>
<navigation-case>
<from-outcome>back</from-outcome>
<to-view-id>/book.xhtml</to-view-id>
<to-view-id>/book/book.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/updateUser.xhtml</from-view-id>
<from-view-id>/user/updateUser.xhtml</from-view-id>
<navigation-case>
<from-outcome>cancel</from-outcome>
<to-view-id>/listUsers.xhtml</to-view-id>
<to-view-id>/user/listUsers.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/listUsers.xhtml</to-view-id>
<to-view-id>/user/listUsers.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/listUsers.xhtml</from-view-id>
<from-view-id>/user/listUsers.xhtml</from-view-id>
<navigation-case>
<from-outcome>add</from-outcome>
<to-view-id>/updateUser.xhtml</to-view-id>
<to-view-id>/user/updateUser.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/listPublisherRevisions.xhtml</from-view-id>
<from-view-id>/publisher/listPublisherRevisions.xhtml</from-view-id>
<navigation-case>
<from-outcome>view</from-outcome>
<to-view-id>/publisherRevision.xhtml</to-view-id>
<to-view-id>/publisher/publisherRevision.xhtml</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>
\ No newline at end of file
......
package org.legrog.application;
package org.legrog.web.book;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.legrog.entities.Book;
import org.legrog.web.book.BookServiceOld;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.Mockito;
......