Skip to content
Snippets Groups Projects
Commit ff779090 authored by Emmanuel Bruno's avatar Emmanuel Bruno
Browse files

fixes certs.

parents 50b659fe f5debcd1
No related branches found
No related tags found
No related merge requests found
Showing
with 391 additions and 4 deletions
File moved
...@@ -8,7 +8,7 @@ import java.util.List; ...@@ -8,7 +8,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
public class PersonDAO { public class PersonDAO {
private EntityManager entityManager; private final EntityManager entityManager;
@Inject @Inject
public PersonDAO(@H2Database EntityManager entityManager) { public PersonDAO(@H2Database EntityManager entityManager) {
...@@ -16,7 +16,7 @@ public class PersonDAO { ...@@ -16,7 +16,7 @@ public class PersonDAO {
} }
public List<Person> findAll() { public List<Person> findAll() {
return entityManager.createNamedQuery("Person.findAll").getResultList(); return entityManager.createNamedQuery("Person.findAll", Person.class).getResultList();
} }
public UUID persist(Person person) { public UUID persist(Person person) {
......
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
bean-discovery-mode="all">
</beans>
\ No newline at end of file
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jee9.1</artifactId>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>restApp</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>wsApp</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>jsf</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>dao</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>common-persistence</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>personManager</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<version>8</version>
<displayName>Person manager</displayName>
<!-- If I want maven to generate the application.xml, set this to true -->
<generateApplicationXml>true</generateApplicationXml>
<defaultLibBundleDir>lib/</defaultLibBundleDir>
<skinnyWars>true</skinnyWars>
<modules>
<webModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>restApp</artifactId>
<!--bundleFileName>restApp.war</bundleFileName-->
</webModule>
<webModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>jsf</artifactId>
<!--bundleFileName>jsf.war</bundleFileName-->
</webModule>
<webModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>wsApp</artifactId>
<!--bundleFileName>wsApp.war</bundleFileName-->
</webModule>
<ejbModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId>
<!--bundleFileName>business.jar</bundleFileName-->
</ejbModule>
<jarModule>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>common-persistence</artifactId>
<bundleDir>lib</bundleDir>
</jarModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jee9.1</artifactId>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jsf</artifactId>
<packaging>war</packaging>
<properties>
<primefaces.version>11.0.0-RC2</primefaces.version>
<all-themes.version>1.0.10</all-themes.version>
</properties>
<dependencies>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>business</artifactId>
<version>1.0-SNAPSHOT</version>
<type>ejb</type>
<!--type>ejb-client</type-->
</dependency>
<dependency>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<artifactId>dao</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>${primefaces.version}</version>
<classifier>jakarta</classifier>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package fr.univtln.bruno.jee91.jsf;
import fr.univtln.bruno.samples.jee91.dao.Person;
import fr.univtln.bruno.samples.jee91.dao.PersonDAO;
import jakarta.faces.application.FacesMessage;
import jakarta.faces.context.FacesContext;
import jakarta.faces.view.ViewScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.transaction.Transactional;
import lombok.Getter;
import java.io.Serializable;
@Named
@ViewScoped
public class AddPersonView implements Serializable {
private static final long serialVersionUID = 1L;
@Inject
private transient PersonDAO personDAO;
@Getter
private final Person newPerson = new Person();
@Getter
private Person addedPerson = new Person();
@Transactional
public void addPerson() {
addedPerson = Person.builder().name(newPerson.getName()).build();
personDAO.persist(addedPerson);
FacesContext.getCurrentInstance().addMessage("growl-id", new FacesMessage(FacesMessage.SEVERITY_INFO, "Person added", addedPerson.getName() + "(" + addedPerson.getUuid() + ")"));
}
}
package fr.univtln.bruno.jee91.jsf;
import fr.univtln.bruno.samples.jee91.dao.Person;
import fr.univtln.bruno.samples.jee91.dao.PersonDAO;
import jakarta.enterprise.context.RequestScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import java.util.List;
@Named
@RequestScoped
public class ViewPersonBean {
@Inject
PersonDAO personDAO;
private final String message = "Hello";
public String getMessage() {
return this.message;
}
public List<Person> getPersons() {
return personDAO.findAll();
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/beans_3_0.xsd"
bean-discovery-mode="all">
</beans>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="https://jakarta.ee/xml/ns/jakartaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-facesconfig_3_0.xsd"
version="3.0"
>
<!-- Your faces config here. -->
</faces-config>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd"
version="5.0">
<!--context-param>
<param-name>jakarta.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param-->
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>jakarta.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!--La servlet de JSF est configurée pour répondre à toutes les requêtes de fichiers XHTML-->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
<mime-mapping>
<extension>woff</extension>
<mime-type>application/font-woff</mime-type>
</mime-mapping>
<mime-mapping>
<extension>ttf</extension>
<mime-type>application/x-font-ttf</mime-type>
</mime-mapping>
<mime-mapping>
<extension>eot</extension>
<mime-type>application/vnd.ms-fontobject</mime-type>
</mime-mapping>
</web-app>
\ No newline at end of file
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head></h:head>
<h:body>
<div class="card">
<h:form>
<h3 class="p-mt-0">Add a person</h3>
<p:growl id="growl" for="growl-id" showDetail="true" skipDetailIfEqualsSummary="true"/>
<h:panelGrid columns="3" cellpadding="7">
<p:outputLabel for="fieldName" value="Name"/>
<p:inputText id="fieldName" value="#{addPersonView.newPerson.name}"/>
<p:message for="fieldName"/>
<p:commandButton value="Save" ajax="false" icon="pi pi-check" validateClient="true" styleClass="p-mr-3" action="#{addPersonView.addPerson}"/>
</h:panelGrid>
</h:form>
</div>
</h:body>
</html>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xml:lang="en">
<h:head>
<title>Person list</title>
</h:head>
<h:body>
<h3 style="text-align: center"><h:outputText value="#{viewPersonBean.message}"/></h3>
<div class="card">
<p:dataTable var="person" value="#{viewPersonBean.persons}" lazy="true">
<p:column headerText="UUID">
<h:outputText value="#{person.uuid}"/>
</p:column>
<p:column headerText="Name">
<h:outputText value="#{person.name}"/>
</p:column>
</p:dataTable>
</div>
</h:body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:spinner />
</h:body>
</html>
\ No newline at end of file
<?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/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>fr.univtln.bruno.samples.jee91</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jee9.1</artifactId>
<packaging>pom</packaging>
<properties>
<failOnMissingWebXml>false</failOnMissingWebXml>
</properties>
<modules>
<module>business</module>
<module>dao</module>
<module>jsf</module>
<module>restApp</module>
<module>wsApp</module>
<module>ear</module>
<module>common-persistence</module>
</modules>
<dependencies>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment