-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from babastienne/develop
Release v1
- Loading branch information
Showing
61 changed files
with
32,545 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" output="target/classes" path="src/main/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"> | ||
<attributes> | ||
<attribute name="optional" value="true"/> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"> | ||
<attributes> | ||
<attribute name="maven.pomderived" value="true"/> | ||
</attributes> | ||
</classpathentry> | ||
<classpathentry kind="output" path="target/classes"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>IMT-JEE-TP-Association</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.common.project.facet.core.builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.m2e.core.maven2Builder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.wst.validation.validationbuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> | ||
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
<nature>org.eclipse.m2e.core.maven2Nature</nature> | ||
<nature>org.eclipse.wst.common.project.facet.core.nature</nature> | ||
<nature>org.eclipse.wst.jsdt.core.jsNature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning | ||
org.eclipse.jdt.core.compiler.source=1.8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jpt.core.platform=generic2_0 | ||
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> | ||
<wb-module deploy-name="IMT-JEE-TP-Association-0.0.1-SNAPSHOT"> | ||
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> | ||
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> | ||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> | ||
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> | ||
<property name="context-root" value="IMT-JEE-TP-Association"/> | ||
<property name="java-output-path" value="/IMT-JEE-TP-Association/target/classes"/> | ||
</wb-module> | ||
</project-modules> |
7 changes: 7 additions & 0 deletions
7
.settings/org.eclipse.wst.common.project.facet.core.prefs.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<root> | ||
<facet id="jpt.jpa"> | ||
<node name="libprov"> | ||
<attribute name="provider-id" value="jpa-no-op-library-provider"/> | ||
</node> | ||
</facet> | ||
</root> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<faceted-project> | ||
<fixed facet="wst.jsdt.web"/> | ||
<installed facet="java" version="1.8"/> | ||
<installed facet="jst.web" version="2.5"/> | ||
<installed facet="wst.jsdt.web" version="1.0"/> | ||
<installed facet="jpt.jpa" version="2.0"/> | ||
</faceted-project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
disabled=06target | ||
eclipse.preferences.version=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="EclipseModuleManager"> | ||
<conelement value="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" /> | ||
<src_description expected_position="0"> | ||
<src_folder value="file://$MODULE_DIR$/src/main/java" expected_position="0" /> | ||
<src_folder value="file://$MODULE_DIR$/src/main/resources" expected_position="1" /> | ||
<src_folder value="file://$MODULE_DIR$/src/test/java" expected_position="2" /> | ||
<src_folder value="file://$MODULE_DIR$/src/test/resources" expected_position="3" /> | ||
</src_description> | ||
</component> | ||
<component name="FacetManager"> | ||
<facet type="web" name="Web"> | ||
<configuration> | ||
<descriptors> | ||
<deploymentDescriptor name="web.xml" url="file://$MODULE_DIR$/src/main/webapp/WEB-INF/web.xml" /> | ||
</descriptors> | ||
<webroots> | ||
<root url="file://$MODULE_DIR$/src/main/webapp" relative="/" /> | ||
</webroots> | ||
</configuration> | ||
</facet> | ||
<facet type="javaeeApplication" name="javaEEApplication"> | ||
<configuration> | ||
<descriptors> | ||
<deploymentDescriptor name="application.xml" url="file://$MODULE_DIR$/META-INF/application.xml" /> | ||
</descriptors> | ||
</configuration> | ||
</facet> | ||
</component> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" isTestSource="false" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER" level="application" /> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-entitymanager:5.0.7.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.jboss.logging:jboss-logging:3.3.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate:hibernate-core:5.0.7.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: antlr:antlr:2.7.7" level="project" /> | ||
<orderEntry type="library" name="Maven: org.jboss:jandex:2.0.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" /> | ||
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate.common:hibernate-commons-annotations:5.0.1.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" /> | ||
<orderEntry type="library" name="Maven: org.javassist:javassist:3.18.1-GA" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.geronimo.specs:geronimo-jta_1.1_spec:1.1.1" level="project" /> | ||
<orderEntry type="library" name="Maven: org.apache.derby:derbyclient:10.11.1.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet:javax.servlet-api:3.0.1" level="project" /> | ||
<orderEntry type="library" scope="PROVIDED" name="Maven: javax.servlet.jsp:javax.servlet.jsp-api:2.2.1" level="project" /> | ||
<orderEntry type="library" name="Maven: jstl:jstl:1.2" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<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"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>imt.vegassociation</groupId> | ||
<artifactId>IMT-JEE-TP-Association</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<packaging>war</packaging> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.0</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-entitymanager</artifactId> | ||
<version>5.0.7.Final</version> | ||
</dependency> | ||
|
||
<!-- DERBY Database --> | ||
<dependency> | ||
<groupId>org.apache.derby</groupId> | ||
<artifactId>derbyclient</artifactId> | ||
<version>10.11.1.1</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet</groupId> | ||
<artifactId>javax.servlet-api</artifactId> | ||
<version>3.0.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>javax.servlet.jsp</groupId> | ||
<artifactId>javax.servlet.jsp-api</artifactId> | ||
<version>2.2.1</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>jstl</groupId> | ||
<artifactId>jstl</artifactId> | ||
<version>1.2</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
create table AuthUser (id varchar(255) not null, hashPassword varchar(255), token varchar(255), serviceUser_id bigint, primary key (id)) | ||
create table hibernate_sequence (next_val bigint) | ||
insert into hibernate_sequence values ( 1 ) | ||
insert into hibernate_sequence values ( 1 ) | ||
insert into hibernate_sequence values ( 1 ) | ||
insert into hibernate_sequence values ( 1 ) | ||
create table Item (code bigint not null, name varchar(255), price double not null, stock integer not null, primary key (code)) | ||
create table OrderLine (orderLineId bigint not null, quantityItem integer not null, item_code bigint, order_orderId bigint, primary key (orderLineId)) | ||
create table ServiceOrder (orderId bigint not null, user_id bigint, primary key (orderId)) | ||
create table ServiceUser (id bigint not null, adress varchar(255), city varchar(255), firstName varchar(255) not null, identifiant varchar(255) not null, lastName varchar(255) not null, zip integer, order_orderId bigint, primary key (id)) | ||
alter table ServiceUser add constraint UK_kk4g5o9xb96v7yy4hhru9nhbv unique (identifiant) | ||
alter table AuthUser add constraint FKh8yl1dl7kovfdvl7cg04f9wsu foreign key (serviceUser_id) references ServiceUser | ||
alter table OrderLine add constraint FKkxdmp90fp1etbip9r0g905j32 foreign key (item_code) references Item | ||
alter table OrderLine add constraint FKb125mp4i5a65skuirkvq8uy42 foreign key (order_orderId) references ServiceOrder | ||
alter table ServiceOrder add constraint FKh6o59pr3f1kx73mp35s1qe15m foreign key (user_id) references ServiceUser | ||
alter table ServiceUser add constraint FK7npr8721077guh6s7y7rj82k8 foreign key (order_orderId) references ServiceOrder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
alter table AuthUser drop constraint FKh8yl1dl7kovfdvl7cg04f9wsu | ||
alter table OrderLine drop constraint FKkxdmp90fp1etbip9r0g905j32 | ||
alter table OrderLine drop constraint FKb125mp4i5a65skuirkvq8uy42 | ||
alter table ServiceOrder drop constraint FKh6o59pr3f1kx73mp35s1qe15m | ||
alter table ServiceUser drop constraint FK7npr8721077guh6s7y7rj82k8 | ||
drop table AuthUser | ||
drop table hibernate_sequence | ||
drop table Item | ||
drop table OrderLine | ||
drop table ServiceOrder | ||
drop table ServiceUser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import java.io.IOException; | ||
import java.io.PrintWriter; | ||
|
||
import javax.servlet.ServletException; | ||
import javax.servlet.annotation.WebServlet; | ||
import javax.servlet.http.HttpServlet; | ||
import javax.servlet.http.HttpServletRequest; | ||
import javax.servlet.http.HttpServletResponse; | ||
|
||
import models.Authentification.AuthManager; | ||
import servlets.util.TokenChecker; | ||
|
||
@WebServlet("/hello") | ||
public class Hello extends HttpServlet { | ||
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException { | ||
TokenChecker.checkConnection(request, response); | ||
process(request, response); | ||
} | ||
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException | ||
{ | ||
TokenChecker.checkConnection(request, response); | ||
process(request, response); | ||
} | ||
|
||
public void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{ | ||
response.setContentType("text/html"); | ||
PrintWriter out = response.getWriter(); | ||
out.println("<h1>Hello world ! </h1>"); | ||
out.println("<h1>getServletName() : " + | ||
getServletName() + "</h1>"); | ||
|
||
out.println("<h1>URI : " + | ||
|
||
request.getRequestURI() + "</h1>"); | ||
|
||
out.println("<h1> Connection:"+request.getAttribute("isConnected")+ " </h1>"); | ||
|
||
boolean isChecked = AuthManager.checkToken(request.getParameter("authToken")); | ||
|
||
|
||
out.println("<h1> Token is valid: "+Boolean.toString(isChecked)+ " </h1>"); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package database; | ||
|
||
import javax.persistence.EntityManager; | ||
import javax.persistence.EntityManagerFactory; | ||
import javax.persistence.Persistence; | ||
|
||
|
||
/** | ||
* Singleton d'EntityManager | ||
*/ | ||
public class Entity { | ||
|
||
public static Entity ENTITY = new Entity(); | ||
|
||
|
||
private EntityManager entityManager; | ||
|
||
public EntityManager getEntity(){ | ||
if(this.entityManager != null){ // i don't know if java use lazy valuation (avoid null pointer exception) | ||
if(this.entityManager.isOpen()){ | ||
return this.entityManager; | ||
} | ||
}else{ | ||
EntityManagerFactory emf = Persistence.createEntityManagerFactory("association"); | ||
EntityManager em = emf.createEntityManager(); | ||
this.entityManager = em; | ||
return em; | ||
} | ||
return null; | ||
} | ||
|
||
public void create(Object object){ | ||
this.getEntity().getTransaction().begin(); | ||
this.getEntity().persist(object); | ||
this.getEntity().getTransaction().commit(); | ||
} | ||
|
||
public void update(Object object){ | ||
this.getEntity().getTransaction().begin(); | ||
this.getEntity().merge(object); | ||
this.getEntity().getTransaction().commit(); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package devonly; | ||
|
||
import javax.persistence.EntityManager; | ||
import javax.persistence.Persistence; | ||
|
||
public class InitDatabase { | ||
|
||
/** | ||
* Cette méthode consiste à utiliser une persistence qui s'occupe de créer la base de donnée en fonction | ||
* de nos classes modèles | ||
* | ||
*/ | ||
public static void main(String[] args){ | ||
//Persistence.generateSchema("association", null); | ||
EntityManager em = Persistence.createEntityManagerFactory("association_create").createEntityManager(); | ||
em.close(); | ||
System.out.println("Database created"); | ||
} | ||
} |
Oops, something went wrong.