Commit 5e2f002516e76646cf3562a7a113a37a23b1afcd
Merge branch 'master' of archives.plil.fr:LeClubInfo/etunicorn-server
Showing
15 changed files
with
259 additions
and
36 deletions
Show diff stats
... | ... | @@ -0,0 +1,11 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project version="4"> | |
3 | + <component name="dataSourceStorageLocal"> | |
4 | + <data-source name="etunicorn.db" uuid="ebfeef5a-f196-4340-9424-14e4e8aaadbb"> | |
5 | + <database-info product="SQLite" version="3.8.11" jdbc-version="2.1" driver-name="SQLiteJDBC" driver-version="native" /> | |
6 | + <case-sensitivity plain-identifiers="mixed" quoted-identifiers="mixed" /> | |
7 | + <secret-storage>master_key</secret-storage> | |
8 | + <auth-required>false</auth-required> | |
9 | + </data-source> | |
10 | + </component> | |
11 | +</project> | |
0 | 12 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,11 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project version="4"> | |
3 | + <component name="DataSourceManagerImpl" format="xml" multifile-model="true"> | |
4 | + <data-source source="LOCAL" name="etunicorn.db" uuid="ebfeef5a-f196-4340-9424-14e4e8aaadbb"> | |
5 | + <driver-ref>sqlite.xerial</driver-ref> | |
6 | + <synchronize>true</synchronize> | |
7 | + <jdbc-driver>org.sqlite.JDBC</jdbc-driver> | |
8 | + <jdbc-url>jdbc:sqlite:$PROJECT_DIR$/etunicorn.db</jdbc-url> | |
9 | + </data-source> | |
10 | + </component> | |
11 | +</project> | |
0 | 12 | \ No newline at end of file | ... | ... |
.idea/dataSources/0d8f27ad-8161-4ee1-8557-56db7fbf44cc/storage.xml
0 → 100644
.idea/dataSources/a06fd1f6-5928-4430-a317-e5ebc0e00a82/storage.xml
0 → 100644
.idea/dataSources/a88dec51-cb33-4875-a137-6d17703d6d6c/storage.xml
0 → 100644
.idea/dataSources/ebfeef5a-f196-4340-9424-14e4e8aaadbb.xml
0 → 100644
... | ... | @@ -0,0 +1,30 @@ |
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<dataSource name="etunicorn.db"> | |
3 | + <database-model serializer="dbm" rdbms="SQLITE" format-version="4.0"> | |
4 | + <root id="1"/> | |
5 | + <schema id="2" parent="1"> | |
6 | + <Current>1</Current> | |
7 | + <Visible>1</Visible> | |
8 | + </schema> | |
9 | + <table id="3" parent="2" name="personne"/> | |
10 | + <column id="4" parent="3" name="id"> | |
11 | + <DataType>INTEGER(0,-1)|4</DataType> | |
12 | + </column> | |
13 | + <column id="5" parent="3" name="carte"> | |
14 | + <Position>1</Position> | |
15 | + <DataType>VARCHAR(0,-1)|12</DataType> | |
16 | + </column> | |
17 | + <column id="6" parent="3" name="login"> | |
18 | + <Position>2</Position> | |
19 | + <DataType>VARCHAR(0,-1)|12</DataType> | |
20 | + </column> | |
21 | + <column id="7" parent="3" name="naissance"> | |
22 | + <Position>3</Position> | |
23 | + <DataType>TIMESTAMP(0,-1)|12</DataType> | |
24 | + </column> | |
25 | + <key id="8" parent="3"> | |
26 | + <ColNames>id</ColNames> | |
27 | + <Primary>1</Primary> | |
28 | + </key> | |
29 | + </database-model> | |
30 | +</dataSource> | |
0 | 31 | \ No newline at end of file | ... | ... |
.idea/dataSources/ebfeef5a-f196-4340-9424-14e4e8aaadbb/storage.xml
0 → 100644
.idea/modules.xml
... | ... | @@ -3,7 +3,6 @@ |
3 | 3 | <component name="ProjectModuleManager"> |
4 | 4 | <modules> |
5 | 5 | <module fileurl="file://$PROJECT_DIR$/etunicorn-server.iml" filepath="$PROJECT_DIR$/etunicorn-server.iml" /> |
6 | - <module fileurl="file://$PROJECT_DIR$/src/main/main.iml" filepath="$PROJECT_DIR$/src/main/main.iml" /> | |
7 | 6 | </modules> |
8 | 7 | </component> |
9 | 8 | </project> |
10 | 9 | \ No newline at end of file | ... | ... |
etunicorn-server.iml
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | -<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | |
2 | +<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" version="4"> | |
3 | 3 | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false"> |
4 | 4 | <output url="file://$MODULE_DIR$/target/classes" /> |
5 | 5 | <output-test url="file://$MODULE_DIR$/target/test-classes" /> |
6 | 6 | <content url="file://$MODULE_DIR$"> |
7 | 7 | <sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> |
8 | + <sourceFolder url="file://$MODULE_DIR$/src/main/ressources" type="java-resource" /> | |
8 | 9 | <excludeFolder url="file://$MODULE_DIR$/target" /> |
9 | 10 | </content> |
10 | 11 | <orderEntry type="inheritedJdk" /> |
11 | 12 | <orderEntry type="sourceFolder" forTests="false" /> |
13 | + <orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.16.1" level="project" /> | |
12 | 14 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter-data-rest:1.4.4.RELEASE" level="project" /> |
13 | 15 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-starter:1.4.4.RELEASE" level="project" /> |
14 | 16 | <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" /> |
... | ... | @@ -83,6 +85,6 @@ |
83 | 85 | <orderEntry type="library" name="Maven: net.minidev:accessors-smart:1.1" level="project" /> |
84 | 86 | <orderEntry type="library" name="Maven: org.ow2.asm:asm:5.0.3" level="project" /> |
85 | 87 | <orderEntry type="library" name="Maven: org.slf4j:slf4j-api:1.7.22" level="project" /> |
86 | - <orderEntry type="library" name="Maven: com.h2database:h2:1.4.193" level="project" /> | |
88 | + <orderEntry type="library" name="Maven: org.xerial:sqlite-jdbc:3.16.1" level="project" /> | |
87 | 89 | </component> |
88 | 90 | -</module> |
91 | +</module> | |
89 | 92 | \ No newline at end of file | ... | ... |
pom.xml
... | ... | @@ -30,10 +30,13 @@ |
30 | 30 | <groupId>com.jayway.jsonpath</groupId> |
31 | 31 | <artifactId>json-path</artifactId> |
32 | 32 | </dependency> |
33 | + | |
33 | 34 | <dependency> |
34 | - <groupId>com.h2database</groupId> | |
35 | - <artifactId>h2</artifactId> | |
35 | + <groupId>org.xerial</groupId> | |
36 | + <artifactId>sqlite-jdbc</artifactId> | |
37 | + <version>3.16.1</version> | |
36 | 38 | </dependency> |
39 | + | |
37 | 40 | </dependencies> |
38 | 41 | |
39 | 42 | <properties> |
... | ... | @@ -42,6 +45,13 @@ |
42 | 45 | |
43 | 46 | |
44 | 47 | <build> |
48 | + <resources> | |
49 | + <resource> | |
50 | + <directory> | |
51 | + src/main/ressources | |
52 | + </directory> | |
53 | + </resource> | |
54 | + </resources> | |
45 | 55 | <plugins> |
46 | 56 | <plugin> |
47 | 57 | <groupId>org.springframework.boot</groupId> | ... | ... |
src/main/java/etunicorn/Application.java
... | ... | @@ -2,14 +2,24 @@ package etunicorn; |
2 | 2 | |
3 | 3 | import org.springframework.boot.CommandLineRunner; |
4 | 4 | import org.springframework.boot.SpringApplication; |
5 | +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | |
5 | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
7 | +<<<<<<< HEAD | |
6 | 8 | import org.springframework.context.annotation.Bean; |
9 | +======= | |
10 | +import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; | |
11 | +import org.springframework.context.annotation.Bean; | |
12 | + | |
13 | +import javax.sql.DataSource; | |
14 | +>>>>>>> 8cbe108cd842b37e3fe6c969ad942e5651d557b3 | |
7 | 15 | |
8 | 16 | /** |
9 | 17 | * Created by geoffrey on 28/01/17. |
10 | 18 | */ |
11 | 19 | @SpringBootApplication |
20 | +@EnableAutoConfiguration | |
12 | 21 | public class Application { |
22 | + | |
13 | 23 | public static void main(String[] args) { |
14 | 24 | SpringApplication.run(Application.class, args); |
15 | 25 | } |
... | ... | @@ -23,4 +33,11 @@ public class Application { |
23 | 33 | // ... |
24 | 34 | }; |
25 | 35 | } |
36 | + | |
37 | + public DataSource dataSource(){ | |
38 | + DataSourceBuilder dataSourceBuilder = DataSourceBuilder.create(); | |
39 | + dataSourceBuilder.driverClassName("org.sqlite.JDBC"); | |
40 | + dataSourceBuilder.url("jdbc:sqlite:etunicorn.db"); | |
41 | + return dataSourceBuilder.build(); | |
42 | + } | |
26 | 43 | } | ... | ... |
src/main/java/etunicorn/Personne.java
src/main/java/etunicorn/databaseConfiguration/SQLiteDialect.java
0 → 100644
... | ... | @@ -0,0 +1,159 @@ |
1 | +package etunicorn.databaseConfiguration; | |
2 | + | |
3 | +/** | |
4 | + * Created by badet on 29/01/2017. | |
5 | + */ | |
6 | + | |
7 | +import org.hibernate.dialect.Dialect; | |
8 | +import org.hibernate.dialect.function.SQLFunctionTemplate; | |
9 | +import org.hibernate.dialect.function.StandardSQLFunction; | |
10 | +import org.hibernate.dialect.function.VarArgsSQLFunction; | |
11 | +import org.hibernate.type.StringType; | |
12 | + | |
13 | +import java.sql.Types; | |
14 | + | |
15 | +public class SQLiteDialect extends Dialect { | |
16 | + public SQLiteDialect() { | |
17 | + registerColumnType(Types.BIT, "integer"); | |
18 | + registerColumnType(Types.TINYINT, "tinyint"); | |
19 | + registerColumnType(Types.SMALLINT, "smallint"); | |
20 | + registerColumnType(Types.INTEGER, "integer"); | |
21 | + registerColumnType(Types.BIGINT, "bigint"); | |
22 | + registerColumnType(Types.FLOAT, "float"); | |
23 | + registerColumnType(Types.REAL, "real"); | |
24 | + registerColumnType(Types.DOUBLE, "double"); | |
25 | + registerColumnType(Types.NUMERIC, "numeric"); | |
26 | + registerColumnType(Types.DECIMAL, "decimal"); | |
27 | + registerColumnType(Types.CHAR, "char"); | |
28 | + registerColumnType(Types.VARCHAR, "varchar"); | |
29 | + registerColumnType(Types.LONGVARCHAR, "longvarchar"); | |
30 | + registerColumnType(Types.DATE, "date"); | |
31 | + registerColumnType(Types.TIME, "time"); | |
32 | + registerColumnType(Types.TIMESTAMP, "timestamp"); | |
33 | + registerColumnType(Types.BINARY, "blob"); | |
34 | + registerColumnType(Types.VARBINARY, "blob"); | |
35 | + registerColumnType(Types.LONGVARBINARY, "blob"); | |
36 | + // registerColumnType(Types.NULL, "null"); | |
37 | + registerColumnType(Types.BLOB, "blob"); | |
38 | + registerColumnType(Types.CLOB, "clob"); | |
39 | + registerColumnType(Types.BOOLEAN, "integer"); | |
40 | + | |
41 | + registerFunction( "concat", new VarArgsSQLFunction(StringType.INSTANCE, "", "||", "") ); | |
42 | + registerFunction( "mod", new SQLFunctionTemplate( StringType.INSTANCE, "?1 % ?2" ) ); | |
43 | + registerFunction( "substr", new StandardSQLFunction("substr", StringType.INSTANCE) ); | |
44 | + registerFunction( "substring", new StandardSQLFunction( "substr", StringType.INSTANCE) ); | |
45 | + } | |
46 | + | |
47 | + public boolean supportsIdentityColumns() { | |
48 | + return true; | |
49 | + } | |
50 | + | |
51 | + /* | |
52 | + public boolean supportsInsertSelectIdentity() { | |
53 | + return true; // As specify in NHibernate dialect | |
54 | + } | |
55 | + */ | |
56 | + | |
57 | + public boolean hasDataTypeInIdentityColumn() { | |
58 | + return false; // As specify in NHibernate dialect | |
59 | + } | |
60 | + | |
61 | + /* | |
62 | + public String appendIdentitySelectToInsert(String insertString) { | |
63 | + return new StringBuffer(insertString.length()+30). // As specify in NHibernate dialect | |
64 | + append(insertString). | |
65 | + append("; ").append(getIdentitySelectString()). | |
66 | + toString(); | |
67 | + } | |
68 | + */ | |
69 | + | |
70 | + public String getIdentityColumnString() { | |
71 | + // return "integer primary key autoincrement"; | |
72 | + return "integer"; | |
73 | + } | |
74 | + | |
75 | + public String getIdentitySelectString() { | |
76 | + return "select last_insert_rowid()"; | |
77 | + } | |
78 | + | |
79 | + public boolean supportsLimit() { | |
80 | + return true; | |
81 | + } | |
82 | + | |
83 | + protected String getLimitString(String query, boolean hasOffset) { | |
84 | + return new StringBuffer(query.length()+20). | |
85 | + append(query). | |
86 | + append(hasOffset ? " limit ? offset ?" : " limit ?"). | |
87 | + toString(); | |
88 | + } | |
89 | + | |
90 | + public boolean supportsTemporaryTables() { | |
91 | + return true; | |
92 | + } | |
93 | + | |
94 | + public String getCreateTemporaryTableString() { | |
95 | + return "create temporary table if not exists"; | |
96 | + } | |
97 | + | |
98 | + public boolean dropTemporaryTableAfterUse() { | |
99 | + return false; | |
100 | + } | |
101 | + | |
102 | + public boolean supportsCurrentTimestampSelection() { | |
103 | + return true; | |
104 | + } | |
105 | + | |
106 | + public boolean isCurrentTimestampSelectStringCallable() { | |
107 | + return false; | |
108 | + } | |
109 | + | |
110 | + public String getCurrentTimestampSelectString() { | |
111 | + return "select current_timestamp"; | |
112 | + } | |
113 | + | |
114 | + public boolean supportsUnionAll() { | |
115 | + return true; | |
116 | + } | |
117 | + | |
118 | + public boolean hasAlterTable() { | |
119 | + return false; // As specify in NHibernate dialect | |
120 | + } | |
121 | + | |
122 | + public boolean dropConstraints() { | |
123 | + return false; | |
124 | + } | |
125 | + | |
126 | + public String getAddColumnString() { | |
127 | + return "add column"; | |
128 | + } | |
129 | + | |
130 | + public String getForUpdateString() { | |
131 | + return ""; | |
132 | + } | |
133 | + | |
134 | + public boolean supportsOuterJoinForUpdate() { | |
135 | + return false; | |
136 | + } | |
137 | + | |
138 | + public String getDropForeignKeyString() { | |
139 | + throw new UnsupportedOperationException("No drop foreign key syntax supported by SQLiteDialect"); | |
140 | + } | |
141 | + | |
142 | + public String getAddForeignKeyConstraintString(String constraintName, | |
143 | + String[] foreignKey, String referencedTable, String[] primaryKey, | |
144 | + boolean referencesPrimaryKey) { | |
145 | + throw new UnsupportedOperationException("No add foreign key syntax supported by SQLiteDialect"); | |
146 | + } | |
147 | + | |
148 | + public String getAddPrimaryKeyConstraintString(String constraintName) { | |
149 | + throw new UnsupportedOperationException("No add primary key syntax supported by SQLiteDialect"); | |
150 | + } | |
151 | + | |
152 | + public boolean supportsIfExistsBeforeTableName() { | |
153 | + return true; | |
154 | + } | |
155 | + | |
156 | + public boolean supportsCascadeDelete() { | |
157 | + return false; | |
158 | + } | |
159 | +} | |
0 | 160 | \ No newline at end of file | ... | ... |
src/main/main.iml deleted
... | ... | @@ -1,30 +0,0 @@ |
1 | -<?xml version="1.0" encoding="UTF-8"?> | |
2 | -<module type="JAVA_MODULE" version="4"> | |
3 | - <component name="FacetManager"> | |
4 | - <facet type="Spring" name="Spring"> | |
5 | - <configuration /> | |
6 | - </facet> | |
7 | - </component> | |
8 | - <component name="NewModuleRootManager" inherit-compiler-output="true"> | |
9 | - <exclude-output /> | |
10 | - <content url="file://$MODULE_DIR$"> | |
11 | - <sourceFolder url="file://$MODULE_DIR$/java" isTestSource="false" /> | |
12 | - </content> | |
13 | - <orderEntry type="inheritedJdk" /> | |
14 | - <orderEntry type="sourceFolder" forTests="false" /> | |
15 | - <orderEntry type="library" name="Maven: org.springframework:spring-web:4.3.6.RELEASE" level="project" /> | |
16 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot:1.4.4.RELEASE" level="project" /> | |
17 | - <orderEntry type="library" name="Maven: org.springframework.boot:spring-boot-autoconfigure:1.4.4.RELEASE" level="project" /> | |
18 | - <orderEntry type="library" name="Maven: org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final" level="project" /> | |
19 | - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-commons:1.12.7.RELEASE" level="project" /> | |
20 | - <orderEntry type="library" name="Maven: org.springframework.data:spring-data-rest-core:2.5.7.RELEASE" level="project" /> | |
21 | - <orderEntry type="library" name="Maven: org.springframework:spring-webmvc:4.3.6.RELEASE" level="project" /> | |
22 | - <orderEntry type="library" name="Maven: org.apache.tomcat.embed:tomcat-embed-core:8.5.11" level="project" /> | |
23 | - <orderEntry type="library" name="Maven: org.springframework:spring-beans:4.3.6.RELEASE" level="project" /> | |
24 | - <orderEntry type="library" name="Maven: net.minidev:json-smart:2.2.1" level="project" /> | |
25 | - <orderEntry type="library" name="Maven: org.springframework:spring-context:4.3.6.RELEASE" level="project" /> | |
26 | - <orderEntry type="library" name="Maven: ch.qos.logback:logback-classic:1.1.9" level="project" /> | |
27 | - <orderEntry type="library" name="Maven: org.slf4j:log4j-over-slf4j:1.7.22" level="project" /> | |
28 | - <orderEntry type="library" name="Maven: org.springframework:spring-tx:4.3.6.RELEASE" level="project" /> | |
29 | - </component> | |
30 | -</module> | |
31 | 0 | \ No newline at end of file |