Showing
100 changed files
with
434 additions
and
3142 deletions
1 | -grogEE.iml | ||
2 | -.idea/ | ||
3 | lib/ | 1 | lib/ |
4 | target/ | 2 | target/ |
3 | +!.mvn/wrapper/maven-wrapper.jar | ||
4 | + | ||
5 | +### STS ### | ||
6 | +.apt_generated | ||
7 | +.classpath | ||
8 | +.factorypath | ||
9 | +.project | ||
10 | +.settings | ||
11 | +.springBeans | ||
12 | + | ||
13 | +### IntelliJ IDEA ### | ||
14 | +.idea | ||
15 | +*.iws | ||
16 | +*.iml | ||
17 | +*.ipr | ||
18 | + | ||
19 | +### NetBeans ### | ||
20 | +nbproject/private/ | ||
21 | +build/ | ||
22 | +nbbuild/ | ||
23 | +dist/ | ||
24 | +nbdist/ | ||
25 | +.nb-gradle/ | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
grog-entities/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + | ||
6 | + <name>Data layer of GROG</name> | ||
7 | + <url>http://legrog.org</url> | ||
8 | + | ||
9 | + <parent> | ||
10 | + <groupId>org.legrog</groupId> | ||
11 | + <artifactId>grog-cubi</artifactId> | ||
12 | + <version>3.0-SNAPSHOT</version> | ||
13 | + </parent> | ||
14 | + <artifactId>grog-entities</artifactId> | ||
15 | + <packaging>jar</packaging> | ||
16 | + | ||
17 | + <properties> | ||
18 | + <hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version> | ||
19 | + <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version> | ||
20 | + <solr.version>6.3.0</solr.version> | ||
21 | + </properties> | ||
22 | + | ||
23 | + | ||
24 | + <dependencies> | ||
25 | + | ||
26 | + <dependency> | ||
27 | + <groupId>org.apache.solr</groupId> | ||
28 | + <artifactId>solr-solrj</artifactId> | ||
29 | + <version>${solr.version}</version> | ||
30 | + </dependency> | ||
31 | + | ||
32 | + | ||
33 | + <!-- **** TOOLS : LOGS + UTILS **** --> | ||
34 | + | ||
35 | + <dependency> | ||
36 | + <groupId>org.slf4j</groupId> | ||
37 | + <artifactId>slf4j-api</artifactId> | ||
38 | + </dependency> | ||
39 | + | ||
40 | + <dependency> | ||
41 | + <groupId>ch.qos.logback</groupId> | ||
42 | + <artifactId>logback-classic</artifactId> | ||
43 | + </dependency> | ||
44 | + | ||
45 | + | ||
46 | + <dependency> | ||
47 | + <groupId>org.springframework.data</groupId> | ||
48 | + <artifactId>spring-data-jpa</artifactId> | ||
49 | + </dependency> | ||
50 | + | ||
51 | + <!-- ** Hibernate deps ** --> | ||
52 | + <dependency> | ||
53 | + <groupId>antlr</groupId> | ||
54 | + <artifactId>antlr</artifactId> | ||
55 | + </dependency> | ||
56 | + <dependency> | ||
57 | + <groupId>dom4j</groupId> | ||
58 | + <artifactId>dom4j</artifactId> | ||
59 | + </dependency> | ||
60 | + <dependency> | ||
61 | + <groupId>org.hibernate.common</groupId> | ||
62 | + <artifactId>hibernate-commons-annotations</artifactId> | ||
63 | + <version>${hibernate-commons-annotations.version}</version> | ||
64 | + </dependency> | ||
65 | + <dependency> | ||
66 | + <groupId>org.hibernate.javax.persistence</groupId> | ||
67 | + <artifactId>hibernate-jpa-2.1-api</artifactId> | ||
68 | + <version>${hibernate-jpa-2.1-api.version}</version> | ||
69 | + </dependency> | ||
70 | + <dependency> | ||
71 | + <groupId>org.hibernate</groupId> | ||
72 | + <artifactId>hibernate-core</artifactId> | ||
73 | + </dependency> | ||
74 | + <dependency> | ||
75 | + <groupId>org.hibernate</groupId> | ||
76 | + <artifactId>hibernate-ehcache</artifactId> | ||
77 | + </dependency> | ||
78 | + <dependency> | ||
79 | + <groupId>org.hibernate</groupId> | ||
80 | + <artifactId>hibernate-entitymanager</artifactId> | ||
81 | + </dependency> | ||
82 | + <dependency> | ||
83 | + <groupId>org.hibernate</groupId> | ||
84 | + <artifactId>hibernate-validator</artifactId> | ||
85 | + </dependency> | ||
86 | + <dependency> | ||
87 | + <groupId>org.jboss.logging</groupId> | ||
88 | + <artifactId>jboss-logging</artifactId> | ||
89 | + </dependency> | ||
90 | + <dependency> | ||
91 | + <groupId>org.javassist</groupId> | ||
92 | + <artifactId>javassist</artifactId> | ||
93 | + </dependency> | ||
94 | + | ||
95 | + </dependencies> | ||
96 | + | ||
97 | +</project> |
migration/db-generator/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + | ||
6 | + <name>Executable to import empty DB of GROG</name> | ||
7 | + <url>http://legrog.org</url> | ||
8 | + | ||
9 | + <parent> | ||
10 | + <groupId>org.legrog</groupId> | ||
11 | + <artifactId>grog-cubi</artifactId> | ||
12 | + <version>3.0-SNAPSHOT</version> | ||
13 | + <relativePath>../..</relativePath> | ||
14 | + </parent> | ||
15 | + <artifactId>grog-db-generator</artifactId> | ||
16 | + <packaging>jar</packaging> | ||
17 | + | ||
18 | + <dependencies> | ||
19 | + <dependency> | ||
20 | + <groupId>org.springframework.boot</groupId> | ||
21 | + <artifactId>spring-boot-starter-data-jpa</artifactId> | ||
22 | + </dependency> | ||
23 | + | ||
24 | + <dependency> | ||
25 | + <groupId>org.springframework.boot</groupId> | ||
26 | + <artifactId>spring-boot-starter-test</artifactId> | ||
27 | + <scope>test</scope> | ||
28 | + </dependency> | ||
29 | + | ||
30 | + <dependency> | ||
31 | + <groupId>org.legrog</groupId> | ||
32 | + <artifactId>grog-entities</artifactId> | ||
33 | + <version>3.0-SNAPSHOT</version> | ||
34 | + </dependency> | ||
35 | + | ||
36 | + </dependencies> | ||
37 | + | ||
38 | + <build> | ||
39 | + <plugins> | ||
40 | + <plugin> | ||
41 | + <groupId>org.springframework.boot</groupId> | ||
42 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
43 | + </plugin> | ||
44 | + </plugins> | ||
45 | + </build> | ||
46 | + | ||
47 | +</project> |
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | <groupId>org.legrog</groupId> | 6 | <groupId>org.legrog</groupId> |
7 | <artifactId>grog-cubi</artifactId> | 7 | <artifactId>grog-cubi</artifactId> |
8 | <version>3.0-SNAPSHOT</version> | 8 | <version>3.0-SNAPSHOT</version> |
9 | - <packaging>war</packaging> | 9 | + <packaging>pom</packaging> |
10 | 10 | ||
11 | <name>Web-application of GROG</name> | 11 | <name>Web-application of GROG</name> |
12 | <url>http://legrog.org</url> | 12 | <url>http://legrog.org</url> |
... | @@ -15,61 +15,28 @@ | ... | @@ -15,61 +15,28 @@ |
15 | Cette version CUBI est la 3e mouture du site. | 15 | Cette version CUBI est la 3e mouture du site. |
16 | </description> | 16 | </description> |
17 | 17 | ||
18 | + <modules> | ||
19 | + <module>webapp</module> | ||
20 | + <module>migration/db-generator</module> | ||
21 | + <module>grog-entities</module> | ||
22 | + </modules> | ||
18 | 23 | ||
19 | <properties> | 24 | <properties> |
20 | - <!-- dependencies version --> | 25 | + <!-- SPECS --> |
21 | <spring.platform-bom.version>Athens-SR1</spring.platform-bom.version> | 26 | <spring.platform-bom.version>Athens-SR1</spring.platform-bom.version> |
22 | - <omnifaces.version>2.5.1</omnifaces.version> | ||
23 | - <primefaces.version>6.0</primefaces.version> | ||
24 | - <myfaces.version>2.2.10</myfaces.version> | ||
25 | <tomee.javaee-api.version>7.0</tomee.javaee-api.version> | 27 | <tomee.javaee-api.version>7.0</tomee.javaee-api.version> |
26 | - <assertj-core.version>1.6.1</assertj-core.version> | 28 | + |
27 | - <openjpa.version>2.4.1</openjpa.version> | 29 | + <!-- TEST --> |
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> | ||
31 | <junit.platform.version>1.0.0-M3</junit.platform.version> | 30 | <junit.platform.version>1.0.0-M3</junit.platform.version> |
32 | <junit.jupiter.version>5.0.0-M3</junit.jupiter.version> | 31 | <junit.jupiter.version>5.0.0-M3</junit.jupiter.version> |
33 | <mockito-core.version>2.2.16</mockito-core.version> | 32 | <mockito-core.version>2.2.16</mockito-core.version> |
34 | - <spring-data-solr.version>3.0.0.M1</spring-data-solr.version> | 33 | + <assertj-core.version>1.6.1</assertj-core.version> |
35 | - <solr.version>6.3.0</solr.version> | ||
36 | - | ||
37 | - <!-- paths --> | ||
38 | - <custom.web.dir>src/main/java/org/legrog/web</custom.web.dir> | ||
39 | 34 | ||
40 | - <!-- misc --> | ||
41 | - <debug.jvm.args /> | ||
42 | - <tomee.autoreload /> | ||
43 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | 35 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
44 | <maven.compiler.source>1.8</maven.compiler.source> | 36 | <maven.compiler.source>1.8</maven.compiler.source> |
45 | <maven.compiler.target>1.8</maven.compiler.target> | 37 | <maven.compiler.target>1.8</maven.compiler.target> |
46 | - | ||
47 | - | ||
48 | </properties> | 38 | </properties> |
49 | 39 | ||
50 | - <profiles> | ||
51 | - <profile> | ||
52 | - <id>debug</id> | ||
53 | - <!-- | ||
54 | - activate this one to be able to attach a remote debbuger on tomee | ||
55 | - --> | ||
56 | - <properties> | ||
57 | - <debug.jvm.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.jvm.args> | ||
58 | - </properties> | ||
59 | - </profile> | ||
60 | - | ||
61 | - <profile> | ||
62 | - <id>autoreload</id> | ||
63 | - <!-- | ||
64 | - activate this one for tomee to reload (takes times) every times it detect a synchro | ||
65 | - reminder : you can always force a reload by typing reload in the console while tomee:run is active | ||
66 | - --> | ||
67 | - <properties> | ||
68 | - <tomee.autoreload>true</tomee.autoreload> | ||
69 | - </properties> | ||
70 | - </profile> | ||
71 | - </profiles> | ||
72 | - | ||
73 | <dependencyManagement> | 40 | <dependencyManagement> |
74 | <dependencies> | 41 | <dependencies> |
75 | <dependency> | 42 | <dependency> |
... | @@ -81,34 +48,10 @@ | ... | @@ -81,34 +48,10 @@ |
81 | </dependency> | 48 | </dependency> |
82 | </dependencies> | 49 | </dependencies> |
83 | </dependencyManagement> | 50 | </dependencyManagement> |
84 | - <dependencies> | ||
85 | 51 | ||
86 | - <dependency> | 52 | + <dependencies> |
87 | - <groupId>org.apache.solr</groupId> | ||
88 | - <artifactId>solr-solrj</artifactId> | ||
89 | - <version>${solr.version}</version> | ||
90 | - </dependency> | ||
91 | - <!-- | ||
92 | - <dependency> | ||
93 | - <groupId>org.apache.solr</groupId> | ||
94 | - <artifactId>solr-core</artifactId> | ||
95 | - <version>${solr.version}</version> | ||
96 | - </dependency> | ||
97 | - <dependency> | ||
98 | - <artifactId>solr-solrj</artifactId> | ||
99 | - <groupId>org.apache.solr</groupId> | ||
100 | - <version>${solr.version}</version> | ||
101 | - <type>jar</type> | ||
102 | - <scope>compile</scope> | ||
103 | - </dependency> | ||
104 | - <dependency> | ||
105 | - <groupId>org.springframework.data</groupId> | ||
106 | - <artifactId>spring-data-solr</artifactId> | ||
107 | - <version>${spring-data-solr.version}</version> | ||
108 | - </dependency> | ||
109 | - --> | ||
110 | - <!-- **** FRAMEWORK : JSF + CDI **** --> | ||
111 | 53 | ||
54 | + <!-- SPECS JEE --> | ||
112 | <dependency> | 55 | <dependency> |
113 | <groupId>org.apache.tomee</groupId> | 56 | <groupId>org.apache.tomee</groupId> |
114 | <artifactId>javaee-api</artifactId> | 57 | <artifactId>javaee-api</artifactId> |
... | @@ -116,145 +59,6 @@ | ... | @@ -116,145 +59,6 @@ |
116 | <scope>provided</scope> | 59 | <scope>provided</scope> |
117 | </dependency> | 60 | </dependency> |
118 | 61 | ||
119 | - <!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces --> | ||
120 | - <dependency> | ||
121 | - <groupId>org.omnifaces</groupId> | ||
122 | - <artifactId>omnifaces</artifactId> | ||
123 | - <version>${omnifaces.version}</version> | ||
124 | - </dependency> | ||
125 | - | ||
126 | - <!-- https://mvnrepository.com/artifact/org.primefaces/primefaces --> | ||
127 | - <dependency> | ||
128 | - <groupId>org.primefaces</groupId> | ||
129 | - <artifactId>primefaces</artifactId> | ||
130 | - <version>${primefaces.version}</version> | ||
131 | - </dependency> | ||
132 | - | ||
133 | - <dependency> | ||
134 | - <groupId>org.apache.myfaces.core</groupId> | ||
135 | - <artifactId>myfaces-api</artifactId> | ||
136 | - <version>${myfaces.version}</version> | ||
137 | - </dependency> | ||
138 | - <dependency> | ||
139 | - <groupId>org.apache.myfaces.core</groupId> | ||
140 | - <artifactId>myfaces-impl</artifactId> | ||
141 | - <version>${myfaces.version}</version> | ||
142 | - <scope>runtime</scope> | ||
143 | - </dependency> | ||
144 | - | ||
145 | - | ||
146 | - <!-- Rewriting tool --> | ||
147 | - | ||
148 | - <dependency> | ||
149 | - <groupId>org.ocpsoft.rewrite</groupId> | ||
150 | - <artifactId>rewrite-servlet</artifactId> | ||
151 | - <version>${rewrite.version}</version> | ||
152 | - </dependency> | ||
153 | - | ||
154 | - <dependency> | ||
155 | - <groupId>org.ocpsoft.rewrite</groupId> | ||
156 | - <artifactId>rewrite-integration-faces</artifactId> | ||
157 | - <version>${rewrite.version}</version> | ||
158 | - </dependency> | ||
159 | - | ||
160 | - <dependency> | ||
161 | - <groupId>org.ocpsoft.rewrite</groupId> | ||
162 | - <artifactId>rewrite-integration-cdi</artifactId> | ||
163 | - <version>${rewrite.version}</version> | ||
164 | - </dependency> | ||
165 | - | ||
166 | - <!--<dependency>--> | ||
167 | - <!--<groupId>com.ocpsoft</groupId>--> | ||
168 | - <!--<artifactId>prettyfaces-jsf2</artifactId>--> | ||
169 | - <!--<version>3.3.3</version>--> | ||
170 | - <!--</dependency>--> | ||
171 | - <!--<dependency>--> | ||
172 | - <!--<groupId>org.ocpsoft.rewrite</groupId>--> | ||
173 | - <!--<artifactId>rewrite-config-prettyfaces</artifactId>--> | ||
174 | - <!--<version>${rewrite.version}</version>--> | ||
175 | - <!--</dependency> --> | ||
176 | - | ||
177 | - | ||
178 | - | ||
179 | - <!-- **** TOOLS : LOGS + UTILS **** --> | ||
180 | - | ||
181 | - <dependency> | ||
182 | - <groupId>org.slf4j</groupId> | ||
183 | - <artifactId>slf4j-api</artifactId> | ||
184 | - </dependency> | ||
185 | - | ||
186 | - <dependency> | ||
187 | - <groupId>ch.qos.logback</groupId> | ||
188 | - <artifactId>logback-classic</artifactId> | ||
189 | - </dependency> | ||
190 | - | ||
191 | - | ||
192 | - <!-- **** DATA MANAGEMENT **** --> | ||
193 | - | ||
194 | - <dependency> | ||
195 | - <groupId>com.h2database</groupId> | ||
196 | - <artifactId>h2</artifactId> | ||
197 | - </dependency> | ||
198 | - | ||
199 | - <dependency> | ||
200 | - <groupId>mysql</groupId> | ||
201 | - <artifactId>mysql-connector-java</artifactId> | ||
202 | - <!-- | ||
203 | - <version>5.1.6</version> | ||
204 | - --> | ||
205 | - </dependency> | ||
206 | - | ||
207 | - <dependency> | ||
208 | - <groupId>org.springframework.data</groupId> | ||
209 | - <artifactId>spring-data-jpa</artifactId> | ||
210 | - </dependency> | ||
211 | - | ||
212 | - <!-- ** Hibernate deps ** --> | ||
213 | - <dependency> | ||
214 | - <groupId>antlr</groupId> | ||
215 | - <artifactId>antlr</artifactId> | ||
216 | - </dependency> | ||
217 | - <dependency> | ||
218 | - <groupId>dom4j</groupId> | ||
219 | - <artifactId>dom4j</artifactId> | ||
220 | - </dependency> | ||
221 | - <dependency> | ||
222 | - <groupId>org.hibernate.common</groupId> | ||
223 | - <artifactId>hibernate-commons-annotations</artifactId> | ||
224 | - <version>${hibernate-commons-annotations.version}</version> | ||
225 | - </dependency> | ||
226 | - <dependency> | ||
227 | - <groupId>org.hibernate.javax.persistence</groupId> | ||
228 | - <artifactId>hibernate-jpa-2.1-api</artifactId> | ||
229 | - <version>${hibernate-jpa-2.1-api.version}</version> | ||
230 | - </dependency> | ||
231 | - <dependency> | ||
232 | - <groupId>org.hibernate</groupId> | ||
233 | - <artifactId>hibernate-core</artifactId> | ||
234 | - </dependency> | ||
235 | - <dependency> | ||
236 | - <groupId>org.hibernate</groupId> | ||
237 | - <artifactId>hibernate-ehcache</artifactId> | ||
238 | - </dependency> | ||
239 | - <dependency> | ||
240 | - <groupId>org.hibernate</groupId> | ||
241 | - <artifactId>hibernate-entitymanager</artifactId> | ||
242 | - </dependency> | ||
243 | - <dependency> | ||
244 | - <groupId>org.hibernate</groupId> | ||
245 | - <artifactId>hibernate-validator</artifactId> | ||
246 | - </dependency> | ||
247 | - <dependency> | ||
248 | - <groupId>org.jboss.logging</groupId> | ||
249 | - <artifactId>jboss-logging</artifactId> | ||
250 | - </dependency> | ||
251 | - <dependency> | ||
252 | - <groupId>org.javassist</groupId> | ||
253 | - <artifactId>javassist</artifactId> | ||
254 | - </dependency> | ||
255 | - <!-- ** Hibernate deps ** --> | ||
256 | - | ||
257 | - | ||
258 | 62 | ||
259 | <!-- **** TEST SCOPE **** --> | 63 | <!-- **** TEST SCOPE **** --> |
260 | <dependency> | 64 | <dependency> |
... | @@ -333,58 +137,9 @@ | ... | @@ -333,58 +137,9 @@ |
333 | <version>${assertj-core.version}</version> | 137 | <version>${assertj-core.version}</version> |
334 | <scope>test</scope> | 138 | <scope>test</scope> |
335 | </dependency> | 139 | </dependency> |
336 | - <!-- | ||
337 | - <dependency> | ||
338 | - <groupId>org.apache.openjpa</groupId> | ||
339 | - <artifactId>openjpa</artifactId> | ||
340 | - <version>${openjpa.version}</version> | ||
341 | - <scope>test</scope> | ||
342 | - </dependency> | ||
343 | - --> | ||
344 | - <!-- to test with TomEE and Arquillian | ||
345 | - <dependency> | ||
346 | - <groupId>org.apache.tomee</groupId> | ||
347 | - <artifactId>arquillian-tomee-remote</artifactId> | ||
348 | - <version>7.0.1</version> | ||
349 | - <scope>test</scope> | ||
350 | - </dependency> | ||
351 | - <dependency> | ||
352 | - <groupId>org.jboss.arquillian.junit</groupId> | ||
353 | - <artifactId>arquillian-junit-container</artifactId> | ||
354 | - <version>1.1.10.Final</version> | ||
355 | - <scope>test</scope> | ||
356 | - </dependency> | ||
357 | - <dependency> | ||
358 | - <groupId>junit</groupId> | ||
359 | - <artifactId>junit</artifactId> | ||
360 | - <version>4.12</version> | ||
361 | - <scope>test</scope> | ||
362 | - </dependency> | ||
363 | - --> | ||
364 | - | ||
365 | - <!-- to test with OpenEJB embedded and Arquillian | ||
366 | - <dependency> | ||
367 | - <groupId>org.apache.tomee</groupId> | ||
368 | - <artifactId>arquillian-openejb-embedded</artifactId> | ||
369 | - <version>{project.version}</version> | ||
370 | - <scope>test</scope> | ||
371 | - </dependency> | ||
372 | - <dependency> | ||
373 | - <groupId>org.jboss.arquillian.junit</groupId> | ||
374 | - <artifactId>arquillian-junit-container</artifactId> | ||
375 | - <version>1.1.10.Final</version> | ||
376 | - <scope>test</scope> | ||
377 | - </dependency> | ||
378 | - <dependency> | ||
379 | - <groupId>junit</groupId> | ||
380 | - <artifactId>junit</artifactId> | ||
381 | - <version>4.12</version> | ||
382 | - <scope>test</scope> | ||
383 | - </dependency> | ||
384 | - --> | ||
385 | - | ||
386 | </dependencies> | 140 | </dependencies> |
387 | 141 | ||
142 | + | ||
388 | <build> | 143 | <build> |
389 | <plugins> | 144 | <plugins> |
390 | <plugin> | 145 | <plugin> |
... | @@ -400,98 +155,7 @@ | ... | @@ -400,98 +155,7 @@ |
400 | <trimStackTrace>false</trimStackTrace> | 155 | <trimStackTrace>false</trimStackTrace> |
401 | </configuration> | 156 | </configuration> |
402 | </plugin> | 157 | </plugin> |
403 | - <plugin> | ||
404 | - <groupId>org.apache.maven.plugins</groupId> | ||
405 | - <artifactId>maven-war-plugin</artifactId> | ||
406 | - <version>2.6</version> | ||
407 | - <configuration> | ||
408 | - <failOnMissingWebXml>false</failOnMissingWebXml> | ||
409 | - <webResources> | ||
410 | - <resource> | ||
411 | - <!-- this is relative to the pom.xml directory --> | ||
412 | - <directory>${custom.web.dir}</directory> | ||
413 | - <excludes> | ||
414 | - <exclude>**/*.java</exclude> | ||
415 | - </excludes> | ||
416 | - | ||
417 | - </resource> | ||
418 | - </webResources> | ||
419 | - | ||
420 | - </configuration> | ||
421 | - </plugin> | ||
422 | 158 | ||
423 | - | ||
424 | - <!-- **** TOMEE **** --> | ||
425 | - <!-- For now we just get a generic one from the repo and put it in target dir --> | ||
426 | - <!-- For production release, we will need another pom doing a real provisionning and build it with grog-cubi already inside --> | ||
427 | - <!-- | ||
428 | - see http://tomee.apache.org/ng/developer/tools/maven/tomee.html | ||
429 | - and http://tomee.apache.org/maven/index.html | ||
430 | - for conf references (I love when a new reference page doesn't get the same info as the former one) | ||
431 | - --> | ||
432 | - <plugin> | ||
433 | - <groupId>org.apache.tomee.maven</groupId> | ||
434 | - <artifactId>tomee-maven-plugin</artifactId> | ||
435 | - <version>7.0.1</version> | ||
436 | - <configuration> | ||
437 | - <context>ROOT</context> | ||
438 | - | ||
439 | - <!-- debug agent to attach a remote debbuger, activate profile for that --> | ||
440 | - <args>${debug.jvm.args}</args> | ||
441 | - | ||
442 | - <systemVariables> | ||
443 | - <!-- | ||
444 | - taken from http://tomee-openejb.979440.n4.nabble.com/7-0-0-M3-synchronization-td4677806.html for synchro to work | ||
445 | - --> | ||
446 | - <openejb.system.apps>true</openejb.system.apps> | ||
447 | - <tomee.serialization.class.blacklist>-</tomee.serialization.class.blacklist> | ||
448 | - </systemVariables> | ||
449 | - | ||
450 | - | ||
451 | - <synchronization> | ||
452 | - <resourcesDir>${custom.web.dir}</resourcesDir> | ||
453 | - <extensions> | ||
454 | - <extension>.class</extension> <!-- update each time you build with mvn compile --> | ||
455 | - <extension>.xhtml</extension> <!-- update each time you save an xhtml in custom web dir --> | ||
456 | - </extensions> | ||
457 | - </synchronization> | ||
458 | - <reloadOnUpdate>${tomee.autoreload}</reloadOnUpdate> | ||
459 | - | ||
460 | - </configuration> | ||
461 | - </plugin> | ||
462 | - | ||
463 | - | ||
464 | - | ||
465 | - <!-- | ||
466 | - <plugin> | ||
467 | - <groupId>org.apache.openjpa</groupId> | ||
468 | - <artifactId>openjpa-maven-plugin</artifactId> | ||
469 | - <version>${openjpa.version}</version> | ||
470 | - <configuration> | ||
471 | - <includes>**/entities/*.class</includes> | ||
472 | - <excludes>**/entities/XML*.class</excludes> | ||
473 | - <addDefaultConstructor>true</addDefaultConstructor> | ||
474 | - <enforcePropertyRestrictions>true</enforcePropertyRestrictions> | ||
475 | - </configuration> | ||
476 | - <executions> | ||
477 | - <execution> | ||
478 | - <id>enhancer</id> | ||
479 | - <phase>process-classes</phase> | ||
480 | - <goals> | ||
481 | - <goal>enhance</goal> | ||
482 | - </goals> | ||
483 | - </execution> | ||
484 | - </executions> | ||
485 | - <dependencies> | ||
486 | - <dependency> | ||
487 | - <groupId>org.apache.openjpa</groupId> | ||
488 | - <artifactId>openjpa</artifactId> | ||
489 | - <- set the version to be the same as the level in your runtime | ||
490 | - <version>${openjpa.version}</version> | ||
491 | - </dependency> | ||
492 | - </dependencies> | ||
493 | - </plugin> | ||
494 | - --> | ||
495 | <plugin> | 159 | <plugin> |
496 | <groupId>org.jacoco</groupId> | 160 | <groupId>org.jacoco</groupId> |
497 | <artifactId>jacoco-maven-plugin</artifactId> | 161 | <artifactId>jacoco-maven-plugin</artifactId> | ... | ... |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | -import java.util.*; | ||
5 | -// TODO Evaluer l'interet de cet import | ||
6 | -//import org.roliste.data.DbValidationEntity; | ||
7 | - | ||
8 | -// TODO Vérifier les extends | ||
9 | -/* | ||
10 | - Entité persistante représentant un utilisateur. | ||
11 | - Migréee depuis la v2. | ||
12 | - */ | ||
13 | -@Entity | ||
14 | -public class Account /* extends org.roliste.data.DbTraceableEntity */ implements DisplayNameConfigurable /*, DbValidationEntity */ { | ||
15 | - | ||
16 | - @Id | ||
17 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
18 | - private int userId; | ||
19 | - | ||
20 | - // TODO traiter Traceable | ||
21 | - /** | ||
22 | - * Retrieve this object's Traceable. | ||
23 | - * @hibernate.many-to-one | ||
24 | - * column="ID_JOURNALISABLE" | ||
25 | - * class="org.roliste.data.db.Traceable" | ||
26 | - * access="property" | ||
27 | - * lazy="false" | ||
28 | - * cascade="all" | ||
29 | - * foreign-key="FK_THEME_JOURNALISABLE" | ||
30 | - * @return the {@link org.roliste.data.db.Traceable} record corresponding to this object. May be <code>null</code>. | ||
31 | - * @see #setTraceable(org.roliste.data.db.Traceable) | ||
32 | - */ | ||
33 | - /* | ||
34 | - public Traceable getTraceable() | ||
35 | - { | ||
36 | - return _traceRoot; | ||
37 | - } | ||
38 | -*/ | ||
39 | - | ||
40 | - /** | ||
41 | - * The mask used for account name. | ||
42 | - */ | ||
43 | - private DisplayNameMask displayNameMask; | ||
44 | -/* | ||
45 | - @Override | ||
46 | - public String getUrlKey() | ||
47 | - { | ||
48 | - return "/utilisateurs/" + getScreenName(); | ||
49 | - } | ||
50 | -*/ | ||
51 | - /** | ||
52 | - * @return the account's name as desired. By default, return the complete name. | ||
53 | - * see org.roliste.data.db.NameMask#mask(org.roliste.data.DbMaskableEntity) | ||
54 | - */ | ||
55 | - public String getDisplayName() | ||
56 | - { | ||
57 | - if (displayNameMask != null) | ||
58 | - return displayNameMask.getDisplayName(this); | ||
59 | - else | ||
60 | - return DisplayNameMask.COMPLET.getDisplayName(this); | ||
61 | - } | ||
62 | - | ||
63 | - /** | ||
64 | - * Returns the account's name mask. | ||
65 | - * @return the mask. | ||
66 | - * see #setNameMask(NameMask) | ||
67 | - * hibernate.property | ||
68 | - * column="MASQUE_NOM_UTILISATEUR" | ||
69 | - * access="property" | ||
70 | - * length="50" | ||
71 | - * hibernate.type | ||
72 | - * name="org.roliste.data.util.NameMaskUserType" | ||
73 | - */ | ||
74 | - public DisplayNameMask getDisplayNameMask() { | ||
75 | - return displayNameMask; | ||
76 | - } | ||
77 | - | ||
78 | - /** | ||
79 | - * Initializes the account's name mask. | ||
80 | - * @param mask the new {link org.roliste.data.db.NameMask}. | ||
81 | - * see #getNameMask() | ||
82 | - */ | ||
83 | - public void setDisplayNameMask(DisplayNameMask mask) { | ||
84 | - this.displayNameMask = mask; | ||
85 | - } | ||
86 | - | ||
87 | - | ||
88 | - // TODO Faire ailleurs les contrôles de chaîne vide sur : username, password, firstname, lastname, nickname, email, text | ||
89 | - /** | ||
90 | - * The account identifier. | ||
91 | - */ | ||
92 | - private String username; | ||
93 | - | ||
94 | - /** | ||
95 | - * The account password. | ||
96 | - */ | ||
97 | - private String password; | ||
98 | - | ||
99 | - /** | ||
100 | - * The account first name. | ||
101 | - */ | ||
102 | - private String firstName; | ||
103 | - | ||
104 | - /** | ||
105 | - * The account last name. | ||
106 | - */ | ||
107 | - private String lastName; | ||
108 | - | ||
109 | - /** | ||
110 | - * The account nick name. | ||
111 | - */ | ||
112 | - private String nickname; | ||
113 | - | ||
114 | - /** | ||
115 | - * The account email address. | ||
116 | - */ | ||
117 | - private String email; | ||
118 | - | ||
119 | - /** | ||
120 | - * The {link org.roliste.data.db.AccountRole}s for this account. | ||
121 | - */ | ||
122 | - @ManyToMany(fetch = FetchType.EAGER) | ||
123 | - private List<AccountRole> roles; | ||
124 | - | ||
125 | - /** | ||
126 | - * Retrieves the list of {@link AccountRole}s for this account. | ||
127 | - * SHALL be used as a read-only attribute. In particular, avoid | ||
128 | - * using {@link List#add(Object)} or {@link List#remove(Object)} on | ||
129 | - * the returned value without caution. | ||
130 | - * @return a {@link List} of {@link AccountRole}. Shall not be <code>null</code>. | ||
131 | - * @see #setRoles(List) | ||
132 | - * see #addToRole(AccountRole) | ||
133 | - * see #removeFromRole(AccountRole) | ||
134 | - * hibernate.many-to-many | ||
135 | - * column="ROLE_FK" | ||
136 | - * class="org.roliste.data.db.AccountRole" | ||
137 | - * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" | ||
138 | - * @hibernate.key | ||
139 | - * column="UTILISATEUR_FK" | ||
140 | - * not-null="true" | ||
141 | - * foreign-key="FK_UTILISATEURROLE_UTILISATEUR" | ||
142 | - * @hibernate.bag | ||
143 | - * cascade="save-update" | ||
144 | - * access="property" | ||
145 | - * table="role_utilisateur" | ||
146 | - * lazy="true" | ||
147 | - */ | ||
148 | - | ||
149 | - public List<AccountRole> getRoles() { | ||
150 | - return roles; | ||
151 | - } | ||
152 | - | ||
153 | - /** | ||
154 | - * Lists the list of {@link AccountRole}s for this account. | ||
155 | - * @param roles the new {@link List} of {@link AccountRole}s. Shall not be <code>null</code>. | ||
156 | - * @throws NullPointerException if roles is <code>null</code>. | ||
157 | - * @see #getRoles() | ||
158 | - * see #addToRole(AccountRole) | ||
159 | - * see #removeFromRole(AccountRole) | ||
160 | - */ | ||
161 | - | ||
162 | - public void setRoles(List<AccountRole> roles) { | ||
163 | - if (roles == null) | ||
164 | - { | ||
165 | - throw new NullPointerException("Impossible d'affecter un ensemble nul aux r�les d'un utilisateur"); | ||
166 | - } | ||
167 | - this.roles = roles; | ||
168 | - } | ||
169 | - | ||
170 | - /** | ||
171 | - * Add the account to a given {@link AccountRole}s. | ||
172 | - * @param role the new {@link AccountRole}. Ignored if <code>null</code>. | ||
173 | - * @see #getRoles() | ||
174 | - * @see #setRoles(List) | ||
175 | - * @see #removeFromRole(AccountRole) | ||
176 | - */ | ||
177 | - /* | ||
178 | - public void addToRole(AccountRole role) { | ||
179 | - synchronized (this) | ||
180 | - { | ||
181 | - if ((role != null) && !(getRoles().contains(role)) ) | ||
182 | - { | ||
183 | - role.getAccounts().add(this); | ||
184 | - getRoles().add(role); | ||
185 | - } | ||
186 | - } | ||
187 | - } | ||
188 | -*/ | ||
189 | - /** | ||
190 | - * Remove the account from a given {@link AccountRole}s. | ||
191 | - * @param role the {@link AccountRole} this {@link Account} will lose. Ignored if <code>null</code>. | ||
192 | - * @see #getRoles() | ||
193 | - * @see #setRoles(List) | ||
194 | - * @see #addToRole(AccountRole) | ||
195 | - */ | ||
196 | - /* | ||
197 | - public void removeFromRole(AccountRole role) { | ||
198 | - synchronized (this) | ||
199 | - { | ||
200 | - if ((role != null) && (getRoles().contains(role)) ) | ||
201 | - { | ||
202 | - role.getAccounts().remove(this); | ||
203 | - getRoles().remove(role); | ||
204 | - } | ||
205 | - } | ||
206 | - } | ||
207 | -*/ | ||
208 | - /** | ||
209 | - * The account anonymous status. | ||
210 | - * If anonymous, account cannot be contacted through email. | ||
211 | - */ | ||
212 | - private boolean anonymous; | ||
213 | - | ||
214 | - /** | ||
215 | - * The account validation status. | ||
216 | - */ | ||
217 | - private boolean visible; | ||
218 | - | ||
219 | - /** | ||
220 | - * The account was activated at least once. | ||
221 | - */ | ||
222 | - private boolean activated; | ||
223 | - | ||
224 | - /** | ||
225 | - * The account provides critics for archive. | ||
226 | - */ | ||
227 | - private boolean criticProvider; | ||
228 | - | ||
229 | - /** | ||
230 | - * Presentation text. | ||
231 | - */ | ||
232 | - @Lob | ||
233 | - private String presentation; | ||
234 | - | ||
235 | - /** | ||
236 | - * The {@link org.roliste.data.db.BookDetails}s in this account's collection. | ||
237 | - */ | ||
238 | -// private List<BookDetails> _collection; | ||
239 | - | ||
240 | - /** | ||
241 | - * Retrieves the list of {@link org.roliste.data.db.BookDetails}s in this account's collection. | ||
242 | - * SHALL be used as a read-only attribute. In particular, avoid using {@link List#add(Object)} | ||
243 | - * or {@link List#remove(Object)} on the returned value without caution. | ||
244 | - * @return a {@link List} of {@link org.roliste.data.db.BookDetails}. Shall not be <code>null</code>. | ||
245 | - * @see #setCollection(List) | ||
246 | - * @see #addToCollection(BookDetails) | ||
247 | - * @see #removeFromCollection(BookDetails) | ||
248 | - * @hibernate.many-to-many | ||
249 | - * column="DETAILS_FK" | ||
250 | - * class="org.roliste.data.db.BookDetails" | ||
251 | - * foreign-key="FK_COLLECTION_DETAIL" | ||
252 | - * @hibernate.key | ||
253 | - * column="UTILISATEUR_FK" | ||
254 | - * not-null="true" | ||
255 | - * foreign-key="FK_COLLECTION_UTILISATEUR" | ||
256 | - * @hibernate.bag | ||
257 | - * access="property" | ||
258 | - * table="collection" | ||
259 | - * lazy="true" | ||
260 | - */ | ||
261 | - /* | ||
262 | - public List<BookDetails> getCollection() { | ||
263 | - return _collection; | ||
264 | - } | ||
265 | -*/ | ||
266 | - /** | ||
267 | - * Lists the list of {@link org.roliste.data.db.BookDetails}s in this account's collection. | ||
268 | - * @param collec the new {@link List} of {@link org.roliste.data.db.BookDetails}s. Shall not be <code>null</code>. | ||
269 | - * @throws NullPointerException if collec is <code>null</code>. | ||
270 | - * @see #getCollection() | ||
271 | - * @see #addToCollection(BookDetails) | ||
272 | - * @see #removeFromCollection(BookDetails) | ||
273 | - */ | ||
274 | - /* | ||
275 | - public void setCollection(List<BookDetails> collec) { | ||
276 | - if (collec == null) | ||
277 | - { | ||
278 | - throw new NullPointerException("Impossible d'affecter un ensemble nul pour la collection d'un utilisateur"); | ||
279 | - } | ||
280 | - _collection = collec; | ||
281 | - } | ||
282 | -*/ | ||
283 | - /** | ||
284 | - * Add a book to the account's collection. | ||
285 | - * @param book the new {@link org.roliste.data.db.BookDetails}. Ignored if <code>null</code>. | ||
286 | - * @see #getCollection() | ||
287 | - * @see #setCollection(List) | ||
288 | - * @see #removeFromCollection(BookDetails) | ||
289 | - */ | ||
290 | - /* | ||
291 | - public void addToCollection(BookDetails book) { | ||
292 | - synchronized (this) | ||
293 | - { | ||
294 | - if ((book != null) && !(getCollection().contains(book)) ) | ||
295 | - { | ||
296 | - book.getOwners().add(this); | ||
297 | - getCollection().add(book); | ||
298 | - } | ||
299 | - } | ||
300 | - } | ||
301 | -*/ | ||
302 | - /** | ||
303 | - * Remove a book from account's collection. | ||
304 | - * @param book the {@link org.roliste.data.db.BookDetails} this {@link Account} will lose. Ignored if <code>null</code>. | ||
305 | - * @see #getCollection() | ||
306 | - * @see #setCollection(List) | ||
307 | - * @see #addToCollection(BookDetails) | ||
308 | - */ | ||
309 | - /* | ||
310 | - public void removeFromCollection(BookDetails book) { | ||
311 | - synchronized (this) | ||
312 | - { | ||
313 | - if ((book != null) && (getCollection().contains(book)) ) | ||
314 | - { | ||
315 | - book.getOwners().remove(this); | ||
316 | - getCollection().remove(book); | ||
317 | - } | ||
318 | - } | ||
319 | - } | ||
320 | -*/ | ||
321 | - /** | ||
322 | - * The {@link org.roliste.data.db.Traceable}s delegated to this account. | ||
323 | - */ | ||
324 | -// private List<Traceable> _delegations; | ||
325 | - | ||
326 | - /** | ||
327 | - * Retrieves the list of delegations for this account. | ||
328 | - * Each delegation is a link to a {@link org.roliste.data.db.Traceable} object. | ||
329 | - * A account having delegation may update field values for delegated object. | ||
330 | - * @return a {@link List} of {@link AccountRole}. Shall not be <code>null</code>. SHALL be used as a | ||
331 | - * read-only attribute. In particular, avoid using {@link List#add(Object)} or {@link List#remove(Object)} | ||
332 | - * on the returned value without caution. | ||
333 | - * @see #setDelegations(List) | ||
334 | - * @see #giveDelegation(Traceable) | ||
335 | - * @see #removeDelegation(Traceable) | ||
336 | - * @hibernate.many-to-many | ||
337 | - * column="ID_JOURNALISABLE" | ||
338 | - * class="org.roliste.data.db.Traceable" | ||
339 | - * foreign-key="FK_DELEGATION_JOURNALISABLE" | ||
340 | - * @hibernate.key | ||
341 | - * column="ID_UTILISATEUR" | ||
342 | - * not-null="true" | ||
343 | - * foreign-key="FK_DELEGATION_UTILISATEUR" | ||
344 | - * @hibernate.bag | ||
345 | - * cascade="save-update" | ||
346 | - * access="property" | ||
347 | - * table="delegation_utilisateur" | ||
348 | - * lazy="true" | ||
349 | - */ | ||
350 | - /* | ||
351 | - public List<Traceable> getDelegations() { | ||
352 | - return _delegations; | ||
353 | - } | ||
354 | -*/ | ||
355 | - /** | ||
356 | - * Sets the list of delegations for this account. | ||
357 | - * @param objects the new {@link List} of delegated {@link Traceable}. Shall not be <code>null</code>. | ||
358 | - * @throws NullPointerException if objects is <code>null</code>. | ||
359 | - * @see #getDelegations() | ||
360 | - * @see #giveDelegation(Traceable) | ||
361 | - * @see #removeDelegation(Traceable) | ||
362 | - */ | ||
363 | - /* | ||
364 | - public void setDelegations(List<Traceable> objects) { | ||
365 | - if (_delegations == null) | ||
366 | - { | ||
367 | - throw new NullPointerException("Impossible d'affecter un ensemble nul aux d�l�gations d'un utilisateur"); | ||
368 | - } | ||
369 | - _delegations = objects; | ||
370 | - } | ||
371 | -*/ | ||
372 | - /** | ||
373 | - * Give delegation on a given {@link Traceable} to this account. | ||
374 | - * @param object the new delegation. Ignored if <code>null</code>. | ||
375 | - * @see #getDelegations() | ||
376 | - * @see #setDelegations(List) | ||
377 | - * @see #removeDelegation(Traceable) | ||
378 | - */ | ||
379 | - /* | ||
380 | - public void giveDelegation(Traceable object) { | ||
381 | - synchronized (this) | ||
382 | - { | ||
383 | - if ((object != null) && !(getDelegations().contains(object)) ) | ||
384 | - { | ||
385 | - object.getDelegates().add(this); | ||
386 | - getDelegations().add(object); | ||
387 | - } | ||
388 | - } | ||
389 | - } | ||
390 | -*/ | ||
391 | - /** | ||
392 | - * Remove delegation on a given {@link Traceable} from this account. | ||
393 | - * @param object the delegation this {@link Account} will lose. Ignored if <code>null</code>. | ||
394 | - * @see #getDelegations() | ||
395 | - * @see #setDelegations(List) | ||
396 | - * @see #giveDelegation(Traceable) | ||
397 | - */ | ||
398 | - /* | ||
399 | - public void removeDelegation(Traceable object) { | ||
400 | - synchronized (this) | ||
401 | - { | ||
402 | - if ((object != null) && (getDelegations().contains(object)) ) | ||
403 | - { | ||
404 | - object.getDelegates().remove(this); | ||
405 | - getDelegations().remove(object); | ||
406 | - } | ||
407 | - } | ||
408 | - } | ||
409 | -*/ | ||
410 | - /** | ||
411 | - * Clear all delegations for this account. | ||
412 | - */ | ||
413 | - /* | ||
414 | - public void clearDelegations() | ||
415 | - { | ||
416 | - synchronized (this) | ||
417 | - { | ||
418 | - for (Traceable root : getDelegations()) | ||
419 | - { | ||
420 | - root.getDelegates().remove(this); | ||
421 | - } | ||
422 | - getDelegations().clear(); | ||
423 | - } | ||
424 | - } | ||
425 | -*/ | ||
426 | - /** | ||
427 | - * The list of attributes / properties for this account. | ||
428 | - */ | ||
429 | - @OneToMany(mappedBy = "account") | ||
430 | - private List<AccountAttribute> accountAttributes; | ||
431 | - | ||
432 | - /** | ||
433 | - * Retrieve this account's attributes. | ||
434 | - * @hibernate.one-to-many | ||
435 | - * class="org.roliste.data.db.AccountAttribute" | ||
436 | - * @hibernate.bag | ||
437 | - * cascade="all" | ||
438 | - * lazy="true" | ||
439 | - * inverse="true" | ||
440 | - * @hibernate.key | ||
441 | - * column="ID_UTILISATEUR" | ||
442 | - * @return a {@link java.util.List} of account attributes linked to this. Shall not be <code>null</code>. | ||
443 | - * @see #setAttributes(java.util.List) | ||
444 | - */ | ||
445 | - | ||
446 | - public List<AccountAttribute> getAttributes() | ||
447 | - { | ||
448 | - return accountAttributes; | ||
449 | - } | ||
450 | - | ||
451 | - /** | ||
452 | - * @param attribs the List of attributes for this account. | ||
453 | - * @see #getAttributes() | ||
454 | - */ | ||
455 | - | ||
456 | - public void setAttributes(List<AccountAttribute> attribs) | ||
457 | - { | ||
458 | - this.accountAttributes = attribs; | ||
459 | - } | ||
460 | - | ||
461 | - /** | ||
462 | - * The {@link org.roliste.data.db.GamingEvent}s this account's visited. | ||
463 | - */ | ||
464 | -// private Set<GamingEvent> _visitedEvents = new HashSet<GamingEvent>(); | ||
465 | - | ||
466 | - /** | ||
467 | - * Retrieves the list of {@link GamingEvent}s visited by this account. | ||
468 | - * SHALL be used as a read-only attribute. In particular, avoid | ||
469 | - * using {@link Set#add(Object)} or {@link Set#remove(Object)} on | ||
470 | - * the returned value without caution. | ||
471 | - * @return a {@link Set} of {@link GamingEvent}s. May be <code>null</code>. | ||
472 | - * @see #setVisitedEvents(Set) | ||
473 | - * @hibernate.many-to-many | ||
474 | - * column="MANIF_FK" | ||
475 | - * class="org.roliste.data.db.GamingEvent" | ||
476 | - * @hibernate.key | ||
477 | - * column="UTILISATEUR_FK" | ||
478 | - * not-null="true" | ||
479 | - * @hibernate.set | ||
480 | - * access="property" | ||
481 | - * table="manif_utilisateur" | ||
482 | - * inverse="true" | ||
483 | - * lazy="true" | ||
484 | - */ | ||
485 | - /* | ||
486 | - public Set<GamingEvent> getVisitedEvents() { | ||
487 | - return _visitedEvents; | ||
488 | - } | ||
489 | -*/ | ||
490 | - /** | ||
491 | - * Sets the list of {link GamingEvent}s for this account. | ||
492 | - * param events the new {@link Set} of {link GamingEvent}s. May be | ||
493 | - * <code>null</code> (we don't handle the relation from this side). | ||
494 | - * see #getVisitedEvents() | ||
495 | - */ | ||
496 | - /* | ||
497 | - protected void setVisitedEvents(Set<GamingEvent> events) { | ||
498 | - _visitedEvents = events; | ||
499 | - } | ||
500 | -*/ | ||
501 | - | ||
502 | - public int getUserId() { | ||
503 | - return userId; | ||
504 | - } | ||
505 | - | ||
506 | - public void setUserId(int userId) { | ||
507 | - this.userId = userId; | ||
508 | - } | ||
509 | - | ||
510 | - /** | ||
511 | - * Returns the account identifier. | ||
512 | - * @return the {@link String} identifier. | ||
513 | - * @see #setUsername(String) | ||
514 | - * hibernate.property | ||
515 | - * column="LOGIN_UTILISATEUR" | ||
516 | - * not-null="true" | ||
517 | - * unique="true" | ||
518 | - * access="property" | ||
519 | - * length="50" | ||
520 | - */ | ||
521 | - public String getUsername() { | ||
522 | - return username; | ||
523 | - } | ||
524 | - | ||
525 | - /** | ||
526 | - * Initializes the account identifier. | ||
527 | - * @param name the new {@link String} identifier. | ||
528 | - * @see #getUsername() | ||
529 | - */ | ||
530 | - public void setUsername(String name) { | ||
531 | - this.username = name; | ||
532 | - } | ||
533 | - /** | ||
534 | - * Returns the account password. | ||
535 | - * @return the {@link String} password. | ||
536 | - * @see #setPassword(String) | ||
537 | - * hibernate.property | ||
538 | - * column="PASS_UTILISATEUR" | ||
539 | - * not-null="true" | ||
540 | - * access="property" | ||
541 | - * length="50" | ||
542 | - */ | ||
543 | - public String getPassword() { | ||
544 | - return password; | ||
545 | - } | ||
546 | - | ||
547 | - /** | ||
548 | - * Initializes the account password. | ||
549 | - * @param pwd the new {@link String} password. | ||
550 | - * @see #getPassword() | ||
551 | - */ | ||
552 | - public void setPassword(String pwd) { | ||
553 | - this.password = pwd; | ||
554 | - } | ||
555 | - | ||
556 | - /** | ||
557 | - * Returns the account full first name. | ||
558 | - * @return the {@link String} first name. | ||
559 | - * @see #setFirstName(String) | ||
560 | - * hibernate.property | ||
561 | - * column="PRENOM_UTILISATEUR" | ||
562 | - * not-null="true" | ||
563 | - * access="property" | ||
564 | - * length="50" | ||
565 | - */ | ||
566 | - public String getFirstName() { | ||
567 | - return firstName; | ||
568 | - } | ||
569 | - | ||
570 | - /** | ||
571 | - * Initializes the account first name. | ||
572 | - * @param name the new {@link String} first name. | ||
573 | - * @see #getFirstName() | ||
574 | - */ | ||
575 | - public void setFirstName(String name) { | ||
576 | - this.firstName = name; | ||
577 | - } | ||
578 | - | ||
579 | - /** | ||
580 | - * Returns the account full last name. | ||
581 | - * @return the {@link String} last name. | ||
582 | - * @see #setLastName(String) | ||
583 | - * hibernate.property | ||
584 | - * column="NOM_UTILISATEUR" | ||
585 | - * not-null="true" | ||
586 | - * access="property" | ||
587 | - * length="50" | ||
588 | - */ | ||
589 | - public String getLastName() { | ||
590 | - return lastName; | ||
591 | - } | ||
592 | - | ||
593 | - /** | ||
594 | - * Initializes the account last name. | ||
595 | - * @param name the new {@link String} last name. | ||
596 | - * @see #getLastName() | ||
597 | - */ | ||
598 | - public void setLastName(String name) { | ||
599 | - this.lastName = name; | ||
600 | - } | ||
601 | - | ||
602 | - /** | ||
603 | - * Returns the account full screen name. | ||
604 | - * @return the {@link String} screen name. | ||
605 | - * @see #setNickName(String) | ||
606 | - * hibernate.property | ||
607 | - * column="PSEUDO_UTILISATEUR" | ||
608 | - * access="property" | ||
609 | - * length="50" | ||
610 | - */ | ||
611 | - public String getNickName() { | ||
612 | - return nickname; | ||
613 | - } | ||
614 | - | ||
615 | - /** | ||
616 | - * Initializes the account screen name. | ||
617 | - * @param name the new {@link String} screen name. | ||
618 | - * @see #getNickName() | ||
619 | - */ | ||
620 | - public void setNickName(String name) { | ||
621 | - this.nickname = name; | ||
622 | - } | ||
623 | - | ||
624 | - /** | ||
625 | - * Returns the account email. | ||
626 | - * @return the {@link String} email. | ||
627 | - * @see #setEmail(String) | ||
628 | - * hibernate.property | ||
629 | - * column="EMAIL_UTILISATEUR" | ||
630 | - * unique="true" | ||
631 | - * not-null="true" | ||
632 | - * access="property" | ||
633 | - * length="100" | ||
634 | - */ | ||
635 | - public String getEmail() { | ||
636 | - return email; | ||
637 | - } | ||
638 | - | ||
639 | - /** | ||
640 | - * Initializes the account email. | ||
641 | - * @param address the new {@link String} email. | ||
642 | - * @see #getEmail() | ||
643 | - */ | ||
644 | - public void setEmail(String address) { | ||
645 | - this.email = address; | ||
646 | - } | ||
647 | - | ||
648 | - /** | ||
649 | - * Indicates if the account is anonymous. | ||
650 | - * Anonymous users' email and first/last name won't be shown. | ||
651 | - * @return the anonymous flag. | ||
652 | - * @see #setAnonymous(boolean) | ||
653 | - * hibernate.property | ||
654 | - * column="IND_ANONYME" | ||
655 | - * access="property" | ||
656 | - */ | ||
657 | - public boolean isAnonymous() { | ||
658 | - return anonymous; | ||
659 | - } | ||
660 | - | ||
661 | - /** | ||
662 | - * Initializes the account anonymous flag. | ||
663 | - * @param anonymous the new flag value. | ||
664 | - * @see #isAnonymous | ||
665 | - */ | ||
666 | - public void setAnonymous(boolean anonymous) { | ||
667 | - this.anonymous = anonymous; | ||
668 | - } | ||
669 | - | ||
670 | - /** | ||
671 | - * hibernate.property | ||
672 | - * column="IND_VISIBLE" | ||
673 | - * access="property" | ||
674 | - */ | ||
675 | - public boolean isVisible() { | ||
676 | - // WARNING: Method documentation copied from DbValidationEntity | ||
677 | - return visible; | ||
678 | - } | ||
679 | - | ||
680 | - public void setVisible(boolean visible) { | ||
681 | - // WARNING: Method documentation copied from DbValidationEntity | ||
682 | - this.visible = visible; | ||
683 | - } | ||
684 | - | ||
685 | - /** | ||
686 | - * Indicates if the account was activated at least once. | ||
687 | - * @return the activation flag. | ||
688 | - * @see #setCriticProvider(boolean) | ||
689 | - * hibernate.property | ||
690 | - * column="IND_ACTIVE" | ||
691 | - * access="property" | ||
692 | - */ | ||
693 | - public boolean isActivated() { | ||
694 | - return activated; | ||
695 | - } | ||
696 | - | ||
697 | - /** | ||
698 | - * Initializes the account activation flag. | ||
699 | - * @param active the new flag value. | ||
700 | - * @see #isActivated | ||
701 | - */ | ||
702 | - public void setActivated(boolean active) { | ||
703 | - this.activated = active; | ||
704 | - } | ||
705 | - | ||
706 | - /** | ||
707 | - * Indicates if the account provides critics for archives. | ||
708 | - * @return the critics provider flag. | ||
709 | - * @see #setCriticProvider(boolean) | ||
710 | - * hibernate.property | ||
711 | - * column="IND_CRITIQUES" | ||
712 | - * access="property" | ||
713 | - */ | ||
714 | - public boolean isCriticProvider() { | ||
715 | - return criticProvider; | ||
716 | - } | ||
717 | - | ||
718 | - /** | ||
719 | - * Initializes the critics provider flag. | ||
720 | - * @param flag the new flag value. | ||
721 | - * @see #isCriticProvider | ||
722 | - */ | ||
723 | - public void setCriticProvider(boolean flag) { | ||
724 | - this.criticProvider = flag; | ||
725 | - } | ||
726 | - | ||
727 | - /** | ||
728 | - * Returns the HTML text presentation for this account. | ||
729 | - * @return the {@link String} HTML text. | ||
730 | - * @see #setPresentation(String) | ||
731 | - * hibernate.property | ||
732 | - * column="PRESENTATION" | ||
733 | - * access="property" | ||
734 | - * type="text" | ||
735 | - * length="2147483647" | ||
736 | - */ | ||
737 | - public String getPresentation() { | ||
738 | - return presentation; | ||
739 | - } | ||
740 | - | ||
741 | - /** | ||
742 | - * Initializes the HTML text presentation. | ||
743 | - * @param presentation the new {@link String} HTML text. | ||
744 | - * @see #getPresentation() | ||
745 | - */ | ||
746 | - public void setPresentation(String presentation) { | ||
747 | - this.presentation = presentation; | ||
748 | - } | ||
749 | - | ||
750 | - /** | ||
751 | - * The account submission date. | ||
752 | - */ | ||
753 | - private Date creationDate; | ||
754 | - | ||
755 | - /** | ||
756 | - * Returns this object creation {@link Date}. | ||
757 | - * @return the object creation {@link Date}. | ||
758 | - * @see #setCreationDate(Date) | ||
759 | - * hibernate.property | ||
760 | - * column="DATE_ENREGISTREMENT" | ||
761 | - * access="property" | ||
762 | - */ | ||
763 | - public Date getCreationDate() { | ||
764 | - return creationDate; | ||
765 | - } | ||
766 | - | ||
767 | - /** | ||
768 | - * Initializes the object creation {@link Date}. | ||
769 | - * @param date the new object creation {@link Date}. | ||
770 | - * @see #getCreationDate() | ||
771 | - */ | ||
772 | - public void setCreationDate(Date date) { | ||
773 | - this.creationDate = date; | ||
774 | - } | ||
775 | - | ||
776 | - @Override | ||
777 | - public String toString() | ||
778 | - { | ||
779 | - return "ID_UTILISATEUR=" + userId + " LOGIN_UTILISATEUR=" + username + " EMAIL_UTILISATEUR=" + email + | ||
780 | - " PRENOM_UTILISATEUR=" + firstName + " NOM_UTILISATEUR=" + lastName + " PSEUDO_UTILISATEUR=" + nickname; | ||
781 | - } | ||
782 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | - | ||
5 | -/* | ||
6 | - Entité persistante représentant les propriétés qui sont paramétrées pour un utilisateur. | ||
7 | - Migréee depuis la v2. | ||
8 | - */ | ||
9 | -@Entity | ||
10 | -public class AccountAttribute { | ||
11 | - @Id | ||
12 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
13 | - private int userAttributeId; | ||
14 | - | ||
15 | - public int getUserAttributeId() { | ||
16 | - return userAttributeId; | ||
17 | - } | ||
18 | - | ||
19 | - /** | ||
20 | - * The linked account. | ||
21 | - */ | ||
22 | - @ManyToOne | ||
23 | - private Account account; | ||
24 | - | ||
25 | - /** | ||
26 | - * Retrieve the account this attribute is attached to. | ||
27 | - * hibernate.many-to-one | ||
28 | - * column="ID_UTILISATEUR" | ||
29 | - * class="org.roliste.data.db.Account" | ||
30 | - * not-null="true" | ||
31 | - * access="property" | ||
32 | - * lazy="proxy" | ||
33 | - * properties-name="PropertyPerUser" | ||
34 | - * foreign-key="FK_ATTRIBUTUTILISATEUR_UTILISATEUR" | ||
35 | - * @return the {link org.roliste.data.db.Account} this attribute is attached to. | ||
36 | - * Shall not be <code>null</code>. | ||
37 | - * see #setAccount(org.roliste.data.db.Account) | ||
38 | - */ | ||
39 | - public Account getAccount() { | ||
40 | - return account; | ||
41 | - } | ||
42 | - | ||
43 | - /** | ||
44 | - * Set the account this attribute is attached to. | ||
45 | - * @param account the new {link org.roliste.data.db.Account} this attribute will be attached to. Shall not be <code>null</code>. | ||
46 | - * @see #getAccount() | ||
47 | - */ | ||
48 | - public void setAccount(Account account) { | ||
49 | - this.account = account; | ||
50 | - } | ||
51 | - | ||
52 | - /** | ||
53 | - * The linked property. | ||
54 | - */ | ||
55 | - @ManyToOne | ||
56 | - private AccountProperty accountProperty; | ||
57 | - | ||
58 | - /** | ||
59 | - * Retrieve the property this attribute is attached to. | ||
60 | - * hibernate.many-to-one | ||
61 | - * column="ID_PROP" | ||
62 | - * class="org.roliste.data.db.AccountProperty" | ||
63 | - * not-null="true" | ||
64 | - * access="property" | ||
65 | - * lazy="false" | ||
66 | - * properties-name="PropertyPerUser" | ||
67 | - * foreign-key="FK_ATTRIBUTUTILISATEUR_PROPRIETE" | ||
68 | - * @return the {link org.roliste.data.db.AccountProperty} this attribute is attached to. | ||
69 | - * Shall not be <code>null</code>. | ||
70 | - * see #setProperty(org.roliste.data.db.AccountProperty) | ||
71 | - */ | ||
72 | - public AccountProperty getProperty() { | ||
73 | - return accountProperty; | ||
74 | - } | ||
75 | - | ||
76 | - /** | ||
77 | - * Set the property this attribute is attached to. | ||
78 | - * @param prop the new {link org.roliste.data.db.AccountProperty} this attribute will be attached to. Shall not be <code>null</code>. | ||
79 | - * @see #getProperty() | ||
80 | - */ | ||
81 | - public void setProperty(AccountProperty prop) { | ||
82 | - accountProperty = prop; | ||
83 | - } | ||
84 | - | ||
85 | - /** | ||
86 | - * The property value. | ||
87 | - */ | ||
88 | - private String value; | ||
89 | - | ||
90 | - /** | ||
91 | - * Returns the property value. | ||
92 | - * @return the {@link String} value. If property is known to be some other kind of value, you shall | ||
93 | - * convert it yourself. May be <code>null</code>, in cases where the sole existence of the attribute | ||
94 | - * is the value, or for unset attributes. | ||
95 | - * @see #setValue(String) | ||
96 | - * hibernate.property | ||
97 | - * column="ATTR_VALUE" | ||
98 | - * access="property" | ||
99 | - * length="200" | ||
100 | - */ | ||
101 | - public String getValue() { | ||
102 | - return value; | ||
103 | - } | ||
104 | - | ||
105 | - /** | ||
106 | - * Initializes attribute value. | ||
107 | - * @param value the new {@link String} value. | ||
108 | - * @see #getValue() | ||
109 | - */ | ||
110 | - public void setValue(String value) { | ||
111 | - this.value = value; | ||
112 | - } | ||
113 | - | ||
114 | - /** | ||
115 | - * Returns a string representation of this account attribute definition. | ||
116 | - * @return a string representing this account attribute definition. | ||
117 | - * hidden | ||
118 | - */ | ||
119 | - @Override | ||
120 | - public String toString() | ||
121 | - { | ||
122 | - return "ID_ATTR=" + getUserAttributeId() + " ATTR_PROP=" + accountProperty + " ATTR_VALUE=" + value; | ||
123 | - } | ||
124 | - | ||
125 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | - | ||
5 | -/* | ||
6 | - Entité persistente représentant la codification des propriétés qui peuvent être paramétrées pour un utilisateur. | ||
7 | - Importée depuis la v2. | ||
8 | - */ | ||
9 | -@Entity | ||
10 | -public class AccountProperty { | ||
11 | - @Id | ||
12 | - @GeneratedValue(strategy = GenerationType.IDENTITY) /* Permet la population */ | ||
13 | - private int userPropertyId; | ||
14 | - | ||
15 | - /** | ||
16 | - * | ||
17 | - * hibernate.id | ||
18 | - * generator-class="identity" | ||
19 | - * column="ID_PROP" | ||
20 | - * access="property" | ||
21 | - */ | ||
22 | - public Integer getUserPropertyId() { | ||
23 | - return userPropertyId; | ||
24 | - } | ||
25 | - | ||
26 | - /** | ||
27 | - * The property name. | ||
28 | - */ | ||
29 | - private String name; | ||
30 | - | ||
31 | - /** | ||
32 | - * Returns the property name. | ||
33 | - * @return the {@link String} attribute identifier. | ||
34 | - * @see #setName(String) | ||
35 | - * hibernate.property | ||
36 | - * column="ATTR_NAME" | ||
37 | - * not-null="true" | ||
38 | - * unique="true" | ||
39 | - * access="property" | ||
40 | - * length="50" | ||
41 | - */ | ||
42 | - public String getName() { | ||
43 | - return name; | ||
44 | - } | ||
45 | - | ||
46 | - /** | ||
47 | - * Initializes the property name. | ||
48 | - * @param name the new {@link String} identifier. | ||
49 | - * @see #getName() | ||
50 | - */ | ||
51 | - public void setName(String name) { | ||
52 | - this.name = name; | ||
53 | - } | ||
54 | - | ||
55 | - /** | ||
56 | - * The property tag. | ||
57 | - */ | ||
58 | - private String tag; | ||
59 | - | ||
60 | - /** | ||
61 | - * Returns the property tag. | ||
62 | - * @return the {@link String} value. | ||
63 | - * @see #setTag(String) | ||
64 | - * hibernate.property | ||
65 | - * column="PROP_TAG" | ||
66 | - * access="property" | ||
67 | - * length="100" | ||
68 | - */ | ||
69 | - public String getTag() { | ||
70 | - return tag; | ||
71 | - } | ||
72 | - | ||
73 | - /** | ||
74 | - * Initializes property tag. | ||
75 | - * @param tag the new {@link String} tag. | ||
76 | - * @see #getTag() | ||
77 | - */ | ||
78 | - public void setTag(String tag) { | ||
79 | - this.tag = tag; | ||
80 | - } | ||
81 | - | ||
82 | - /** | ||
83 | - * The property validation status. | ||
84 | - * A property may be temporarily deactivated. | ||
85 | - */ | ||
86 | - private boolean visible; | ||
87 | - | ||
88 | - /** | ||
89 | - * Indicates if the property is visible / usable. | ||
90 | - * If not, users should not be able to access the privileges | ||
91 | - * they inherit from having this property set. | ||
92 | - * @return the visible flag. | ||
93 | - * @see #setVisible(boolean) | ||
94 | - * hibernate.property | ||
95 | - * column="IND_VISIBLE" | ||
96 | - * access="property" | ||
97 | - */ | ||
98 | - public boolean isVisible() { | ||
99 | - return visible; | ||
100 | - } | ||
101 | - | ||
102 | - /** | ||
103 | - * Initializes the property visible flag. | ||
104 | - * @param visible the new flag value. | ||
105 | - * @see #isVisible | ||
106 | - */ | ||
107 | - public void setVisible(boolean visible) { | ||
108 | - this.visible = visible; | ||
109 | - } | ||
110 | - | ||
111 | - /** | ||
112 | - * Returns a string representation of this property definition. | ||
113 | - * @return a string representing this property definition. | ||
114 | - * hidden | ||
115 | - */ | ||
116 | - @Override | ||
117 | - public String toString() | ||
118 | - { | ||
119 | - | ||
120 | - return "ID_PROP=" + getUserPropertyId() + "PROP_NAME=" + name + " PROP_TAG=" + tag + " IND_VISIBLE=" + visible; | ||
121 | - } | ||
122 | - | ||
123 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.springframework.data.jpa.repository.JpaRepository; | ||
4 | - | ||
5 | -import java.util.List; | ||
6 | - | ||
7 | -public interface AccountRepository extends JpaRepository<Account, Integer> { | ||
8 | - /** | ||
9 | - * | ||
10 | - * @param integers list of Ids for the Accounts we're looking for | ||
11 | - * @return Accounts looked for | ||
12 | - */ | ||
13 | - List<Account> findByUserIdIn(List<Integer> integers); | ||
14 | - | ||
15 | - /** | ||
16 | - * | ||
17 | - * @return accounts that have a presentation | ||
18 | - */ | ||
19 | - List<Account> findByPresentationIsNotNull(); | ||
20 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import java.util.HashSet; | ||
4 | -import java.util.Set; | ||
5 | - | ||
6 | -import javax.persistence.*; | ||
7 | - | ||
8 | -/** | ||
9 | - * The database representation of a account role or group. | ||
10 | - * A given {@link Account} may be part of one or more {@link AccountRole}. | ||
11 | - * <br/> | ||
12 | - * Warning: due to laziness of mapped objects, private attributes of all DB entities shall never be used directly. | ||
13 | - * You shall always use the getter/setter methods. | ||
14 | - * alias AccountRole | ||
15 | - * | ||
16 | - */ | ||
17 | -/* | ||
18 | - Importé depuis la v2. | ||
19 | - */ | ||
20 | -@Entity | ||
21 | -// TODO évaluer extend v2 | ||
22 | -public class AccountRole /* extends org.roliste.data.DbEntity */ | ||
23 | -{ | ||
24 | - @Id | ||
25 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
26 | - private int userRoleId; | ||
27 | - | ||
28 | - /** | ||
29 | - * The role identifier. | ||
30 | - */ | ||
31 | - private String rolename; | ||
32 | - | ||
33 | - /** | ||
34 | - * The {@link Account}s for this account role. | ||
35 | - */ | ||
36 | - @ManyToMany(mappedBy = "roles") | ||
37 | - private Set<Account> accounts; | ||
38 | - | ||
39 | - /** | ||
40 | - * Builds a new and empty account role definition. | ||
41 | - * All attributes are set to their default value. | ||
42 | - * <br/> | ||
43 | - * Needed by Hibernate for Java reflection. | ||
44 | - */ | ||
45 | - public AccountRole() { | ||
46 | - super(); | ||
47 | - rolename = null; | ||
48 | - visible = true; | ||
49 | - // no need to synchronize this | ||
50 | - accounts = new HashSet<Account>(); | ||
51 | - } | ||
52 | - | ||
53 | - public int getUserRoleId() { | ||
54 | - return userRoleId; | ||
55 | - } | ||
56 | - | ||
57 | - public void setUserRoleId(int userRoleId) { | ||
58 | - this.userRoleId = userRoleId; | ||
59 | - } | ||
60 | - | ||
61 | - /** | ||
62 | - * Returns the role identifier. | ||
63 | - * @return the {@link String} identifier. | ||
64 | - * @see #setRolename(String) | ||
65 | - * hibernate.property | ||
66 | - * column="NOM_ROLE" | ||
67 | - * not-null="true" | ||
68 | - * unique="true" | ||
69 | - * access="property" | ||
70 | - * length="50" | ||
71 | - */ | ||
72 | - public String getRolename() { | ||
73 | - return rolename; | ||
74 | - } | ||
75 | - | ||
76 | - /** | ||
77 | - * Initializes the role identifier. | ||
78 | - * @param name the new {@link String} identifier. | ||
79 | - * @see #getRolename() | ||
80 | - */ | ||
81 | - public void setRolename(String name) { | ||
82 | - rolename = name; | ||
83 | - } | ||
84 | - | ||
85 | - /** | ||
86 | - * The role validation status. | ||
87 | - * A role may be temporarily deactivated. | ||
88 | - */ | ||
89 | - private boolean visible; | ||
90 | - | ||
91 | - /** | ||
92 | - * Indicates if the role is visible. | ||
93 | - * If not, accounts should not be able to access the privileges | ||
94 | - * they inherit from being part of this role. | ||
95 | - * @return the visible flag. | ||
96 | - * @see #setVisible(boolean) | ||
97 | - * hibernate.property | ||
98 | - * column="IND_VISIBLE" | ||
99 | - * access="property" | ||
100 | - */ | ||
101 | - public boolean isVisible() { | ||
102 | - return visible; | ||
103 | - } | ||
104 | - | ||
105 | - /** | ||
106 | - * Initializes the account visible flag. | ||
107 | - * @param visible the new flag value. | ||
108 | - * @see #isVisible | ||
109 | - */ | ||
110 | - public void setVisible(boolean visible) { | ||
111 | - this.visible = visible; | ||
112 | - } | ||
113 | - | ||
114 | - /** | ||
115 | - * Retrieves the list of {@link Account}s for this account role. | ||
116 | - * SHALL be used as a read-only attribute. In particular, avoid | ||
117 | - * using {@link Set#add(Object)} or {@link Set#remove(Object)} on | ||
118 | - * the returned value without caution. | ||
119 | - * @return a {@link Set} of {@link Account}. May be <code>null</code>. | ||
120 | - * @see #setAccounts(Set) | ||
121 | - * hibernate.many-to-many | ||
122 | - * column="UTILISATEUR_FK" | ||
123 | - * class="org.roliste.data.db.Person" | ||
124 | - * foreign-key="FK_UTILISATEURROLE_UTILISATEUR" | ||
125 | - * hibernate.key | ||
126 | - * column="ROLE_FK" | ||
127 | - * not-null="true" | ||
128 | - * foreign-key="FK_UTILISATEURROLE_ROLEUTILISATEUR" | ||
129 | - * hibernate.set | ||
130 | - * access="property" | ||
131 | - * table="role_utilisateur" | ||
132 | - * lazy="true" | ||
133 | - * inverse="true" | ||
134 | - */ | ||
135 | - public Set<Account> getAccounts() { | ||
136 | - return accounts; | ||
137 | - } | ||
138 | - | ||
139 | - /** | ||
140 | - * Sets the list of {@link Account}s for this account role. | ||
141 | - * @param accounts the new {@link Set} of {@link Account}s. May be | ||
142 | - * <code>null</code> (we don't handle the relation from this side). | ||
143 | - * @see #getAccounts() | ||
144 | - */ | ||
145 | - protected void setAccounts(Set<Account> accounts) { | ||
146 | - this.accounts = accounts; | ||
147 | - } | ||
148 | - | ||
149 | - /** | ||
150 | - * Returns a string representation of this account role definition. | ||
151 | - * @return a string representing this account role definition. | ||
152 | - * hidden | ||
153 | - */ | ||
154 | - @Override | ||
155 | - public String toString() { | ||
156 | - return "ID_ROLE=" + getUserRoleId() + " NOM_ROLE=" + rolename + " IND_VISIBLE=" + visible; | ||
157 | - } | ||
158 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import java.util.List; | ||
4 | - | ||
5 | -/** | ||
6 | - * Search interface for IndexedAccount | ||
7 | - */ | ||
8 | -public interface AccountSearchRepository { | ||
9 | - /** | ||
10 | - * | ||
11 | - * @param string String searched in indexed Accounts | ||
12 | - * @return Accounts that match the string | ||
13 | - */ | ||
14 | - List<IndexedAccount> search(String string) throws SearchingException; | ||
15 | - | ||
16 | - /** | ||
17 | - * | ||
18 | - * @param indexedAccounts IndexedAccounts to reindex | ||
19 | - */ | ||
20 | - public void reindex(List<IndexedAccount> indexedAccounts) throws IndexingException; | ||
21 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.apache.solr.client.solrj.SolrClient; | ||
4 | -import org.apache.solr.client.solrj.SolrQuery; | ||
5 | -import org.apache.solr.client.solrj.SolrServerException; | ||
6 | -import org.apache.solr.client.solrj.response.QueryResponse; | ||
7 | -import org.apache.solr.client.solrj.response.UpdateResponse; | ||
8 | -import org.slf4j.Logger; | ||
9 | -import org.slf4j.LoggerFactory; | ||
10 | - | ||
11 | -import javax.inject.Inject; | ||
12 | -import java.io.IOException; | ||
13 | -import java.util.ArrayList; | ||
14 | -import java.util.List; | ||
15 | - | ||
16 | -/** | ||
17 | - * Implementation of AccountSearchRepository using SolrJ | ||
18 | - */ | ||
19 | -public class AccountSearchRepositorySolrj implements AccountSearchRepository { | ||
20 | - Logger logger = LoggerFactory.getLogger(getClass()); | ||
21 | - | ||
22 | - SolrClient solrClient; | ||
23 | - | ||
24 | - protected static String collectionName = "accounts"; | ||
25 | - | ||
26 | - @Inject | ||
27 | - AccountSearchRepositorySolrj(SolrClient solrClient) { | ||
28 | - this.solrClient = solrClient; | ||
29 | - } | ||
30 | - | ||
31 | - //no args constructor to make it proxyable | ||
32 | - AccountSearchRepositorySolrj() { | ||
33 | - } | ||
34 | - | ||
35 | - @Override | ||
36 | - public List<IndexedAccount> search(String string) throws SearchingException { | ||
37 | - SolrQuery solrQuery = new SolrQuery(string); | ||
38 | - QueryResponse queryResponse; | ||
39 | - try { | ||
40 | - queryResponse = solrClient.query(collectionName, solrQuery); | ||
41 | - } catch (IOException ioe) { | ||
42 | - throw new SearchingException(ioe); | ||
43 | - } catch (SolrServerException sse) { | ||
44 | - logger.error("SolrServerException {}", sse); | ||
45 | - throw new SearchingException(sse.getRootCause()); | ||
46 | - } | ||
47 | - | ||
48 | - if (queryResponse != null) { | ||
49 | - return queryResponse.getBeans(IndexedAccount.class); | ||
50 | - } else { | ||
51 | - return new ArrayList<>(); | ||
52 | - } | ||
53 | - } | ||
54 | - | ||
55 | - @Override | ||
56 | - public void reindex(List<IndexedAccount> indexedAccounts) throws IndexingException { | ||
57 | - try { | ||
58 | - UpdateResponse updateResponse = solrClient.addBeans(collectionName, indexedAccounts); | ||
59 | - solrClient.commit(collectionName); | ||
60 | - logger.trace("reindex indexedAccounts SolrJ UpdateResponse {}", updateResponse); | ||
61 | - } catch (IOException ioe) { | ||
62 | - throw new IndexingException(ioe); | ||
63 | - } catch (SolrServerException sse) { | ||
64 | - logger.error("SolrServerException {}", sse); | ||
65 | - throw new IndexingException(sse.getRootCause()); | ||
66 | - } | ||
67 | - } | ||
68 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | - | ||
5 | -/** | ||
6 | - * Country persistence entity | ||
7 | - * Id and name seem enough | ||
8 | - */ | ||
9 | -@Entity | ||
10 | -public class Country { | ||
11 | - @Id | ||
12 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
13 | - private Integer countryId; | ||
14 | - private String countryName; | ||
15 | - | ||
16 | - public Integer getCountryId() { | ||
17 | - return countryId; | ||
18 | - } | ||
19 | - | ||
20 | - public void setCountryId(Integer countryId) { | ||
21 | - this.countryId = countryId; | ||
22 | - } | ||
23 | - | ||
24 | - public String getCountryName() { | ||
25 | - return countryName; | ||
26 | - } | ||
27 | - | ||
28 | - public void setCountryName(String countryName) { | ||
29 | - this.countryName = countryName; | ||
30 | - } | ||
31 | - | ||
32 | - @Override | ||
33 | - public String toString() | ||
34 | - { | ||
35 | - return "ID_PAYS=" + countryId + " LIB_PAYS=" + countryName; | ||
36 | - } | ||
37 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -/* DbMaskableEntity en v2, mais je pense le nouveau nom plus clair */ | ||
4 | -public interface DisplayNameConfigurable { | ||
5 | - String getFirstName(); | ||
6 | - | ||
7 | - String getLastName(); | ||
8 | - | ||
9 | - String getNickName(); | ||
10 | - | ||
11 | -/* ScreenName en v2, mais je pense la nouveau nom plus clair */ | ||
12 | - String getDisplayName(); | ||
13 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -/** | ||
4 | - * This enumeration provide options for name masking of authors and users. | ||
5 | - * Every {link org.roliste.data.DbMaskableEntity} provide first name, last name and nickname | ||
6 | - * capabilities, that may be "masked", thus shown in some specific way depending on chosen | ||
7 | - * NameMask. | ||
8 | - */ | ||
9 | -/* | ||
10 | - v3 {@link org.legrog.entities.DisplayNameConfigurable} | ||
11 | - */ | ||
12 | -public enum DisplayNameMask | ||
13 | -{ | ||
14 | - PRENOMNOM("Prénom Nom") | ||
15 | - { | ||
16 | - public String listMask(DisplayNameConfigurable person) | ||
17 | - { | ||
18 | - return NOMPRENOM.getDisplayName(person); | ||
19 | - } | ||
20 | - | ||
21 | - public String getDisplayName(DisplayNameConfigurable person) | ||
22 | - { | ||
23 | - StringBuilder sb = new StringBuilder(); | ||
24 | - if (person.getFirstName() != null) | ||
25 | - { | ||
26 | - sb.append(person.getFirstName()); | ||
27 | - } | ||
28 | - if (person.getLastName() != null) | ||
29 | - { | ||
30 | - sb.append(' '); | ||
31 | - sb.append(person.getLastName()); | ||
32 | - } | ||
33 | - return sb.toString(); | ||
34 | - } | ||
35 | - }, | ||
36 | - | ||
37 | - NOMPRENOM("Nom, Prénom") | ||
38 | - { | ||
39 | - public String listMask(DisplayNameConfigurable person) | ||
40 | - { | ||
41 | - return NOMPRENOM.getDisplayName(person); | ||
42 | - } | ||
43 | - | ||
44 | - public String getDisplayName(DisplayNameConfigurable person) | ||
45 | - { | ||
46 | - StringBuilder sb = new StringBuilder(); | ||
47 | - if (person.getLastName() != null) | ||
48 | - { | ||
49 | - sb.append(person.getLastName()); | ||
50 | - if (person.getFirstName() != null) | ||
51 | - { | ||
52 | - sb.append(", "); | ||
53 | - sb.append(person.getFirstName()); | ||
54 | - } | ||
55 | - } | ||
56 | - else | ||
57 | - { | ||
58 | - sb.append("!Pas de nom"); | ||
59 | - } | ||
60 | - return sb.toString(); | ||
61 | - } | ||
62 | - }, | ||
63 | - | ||
64 | - PSEUDO("Pseudo") | ||
65 | - { | ||
66 | - public String listMask(DisplayNameConfigurable person) | ||
67 | - { | ||
68 | - return PSEUDO.getDisplayName(person); | ||
69 | - } | ||
70 | - | ||
71 | - public String getDisplayName(DisplayNameConfigurable person) | ||
72 | - { | ||
73 | - StringBuilder sb = new StringBuilder(); | ||
74 | - if (person.getNickName() != null) | ||
75 | - { | ||
76 | - sb.append(person.getNickName()); | ||
77 | - } | ||
78 | - else | ||
79 | - { | ||
80 | - sb.append("!Pas de pseudo"); | ||
81 | - } | ||
82 | - return sb.toString(); | ||
83 | - } | ||
84 | - }, | ||
85 | - | ||
86 | - COMPLET("Prénom 'Pseudo' Nom") | ||
87 | - { | ||
88 | - public String listMask(DisplayNameConfigurable person) | ||
89 | - { | ||
90 | - return NOMPRENOM.getDisplayName(person); | ||
91 | - } | ||
92 | - | ||
93 | - public String getDisplayName(DisplayNameConfigurable person) | ||
94 | - { | ||
95 | - StringBuilder myResult = new StringBuilder(); | ||
96 | - | ||
97 | - if (person.getFirstName() != null) | ||
98 | - { | ||
99 | - myResult.append(person.getFirstName()); | ||
100 | - myResult.append(' '); | ||
101 | - } | ||
102 | - if ( person.getNickName() != null ) | ||
103 | - { | ||
104 | - myResult.append('\''); | ||
105 | - myResult.append(person.getNickName()); | ||
106 | - myResult.append('\''); | ||
107 | - myResult.append(' '); | ||
108 | - } | ||
109 | - if (person.getLastName() != null) | ||
110 | - { | ||
111 | - myResult.append(person.getLastName()); | ||
112 | - } | ||
113 | - return myResult.toString(); | ||
114 | - } | ||
115 | - }; | ||
116 | - | ||
117 | - private final String symbol; | ||
118 | - | ||
119 | - DisplayNameMask(String symbol) { | ||
120 | - this.symbol = symbol; | ||
121 | - } | ||
122 | - | ||
123 | - public String getSymbol() | ||
124 | - { | ||
125 | - return symbol; | ||
126 | - } | ||
127 | - | ||
128 | - public String toString() | ||
129 | - { | ||
130 | - return symbol; | ||
131 | - } | ||
132 | - | ||
133 | - public abstract String getDisplayName(DisplayNameConfigurable person); | ||
134 | - | ||
135 | - public abstract String listMask(DisplayNameConfigurable person); | ||
136 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.apache.solr.client.solrj.beans.Field; | ||
4 | -import javax.persistence.Id; | ||
5 | -import javax.persistence.Lob; | ||
6 | - | ||
7 | -/** | ||
8 | - * Simplified class for searching indexed Accounts | ||
9 | - */ | ||
10 | -public class IndexedAccount { | ||
11 | - @Id | ||
12 | - @Field | ||
13 | - private Integer userId; | ||
14 | - @Lob | ||
15 | - @Field | ||
16 | - private String presentation; | ||
17 | - | ||
18 | - /** | ||
19 | - * | ||
20 | - * @param account Account to be simplified as IndexedAccount | ||
21 | - */ | ||
22 | - public IndexedAccount(Account account) { | ||
23 | - this.userId = account.getUserId(); | ||
24 | - this.presentation = account.getPresentation(); | ||
25 | - } | ||
26 | - | ||
27 | - public IndexedAccount() { | ||
28 | - //no args constructor to make it proxyable | ||
29 | - } | ||
30 | - | ||
31 | - public Integer getUserId() { | ||
32 | - return userId; | ||
33 | - } | ||
34 | - | ||
35 | - public void setUserId(Integer userId) { | ||
36 | - this.userId = userId; | ||
37 | - } | ||
38 | - | ||
39 | - public String getPresentation() { | ||
40 | - return presentation; | ||
41 | - } | ||
42 | - | ||
43 | - public void setPresentation(String presentation) { | ||
44 | - this.presentation = presentation; | ||
45 | - } | ||
46 | -} |
1 | -package org.legrog.entities; | ||
2 | -import org.apache.solr.client.solrj.beans.Field; | ||
3 | -import javax.persistence.Id; | ||
4 | -import javax.persistence.Lob; | ||
5 | - | ||
6 | -/** | ||
7 | - * Simplified class for indexing and searching validated publishers: content from PublisherVersion with id from Publisher | ||
8 | - */ | ||
9 | -public class IndexedPublisher { | ||
10 | - @Id | ||
11 | - @Field | ||
12 | - private Integer publisherId; | ||
13 | - @Field | ||
14 | - private String publisherName; | ||
15 | - @Lob | ||
16 | - @Field | ||
17 | - private String publisherHistory; | ||
18 | - | ||
19 | - /** | ||
20 | - * Extracts data needed for indexing from Publisher and its validated PublisherVersion | ||
21 | - * | ||
22 | - * @param publisher Publisher we want to be indexed | ||
23 | - */ | ||
24 | - public IndexedPublisher(Publisher publisher) { | ||
25 | - PublisherVersion publisherVersion = publisher.getValidatedVersion(); | ||
26 | - this.publisherId = publisher.getPublisherId(); | ||
27 | - this.publisherName = publisherVersion.getPublisherName(); | ||
28 | - this.publisherHistory = publisherVersion.getPublisherHistory(); | ||
29 | - } | ||
30 | - | ||
31 | - public IndexedPublisher() { | ||
32 | - //no args constructor to make it proxyable | ||
33 | - } | ||
34 | - | ||
35 | - public Integer getPublisherId() { | ||
36 | - return publisherId; | ||
37 | - } | ||
38 | - | ||
39 | - public String getPublisherName() { | ||
40 | - return publisherName; | ||
41 | - } | ||
42 | - | ||
43 | - public String getPublisherHistory() { | ||
44 | - return publisherHistory; | ||
45 | - } | ||
46 | - | ||
47 | - public void setPublisherId(Integer publisherId) { | ||
48 | - this.publisherId = publisherId; | ||
49 | - } | ||
50 | - | ||
51 | - public void setPublisherName(String publisherName) { | ||
52 | - this.publisherName = publisherName; | ||
53 | - } | ||
54 | - | ||
55 | - public void setPublisherHistory(String publisherHistory) { | ||
56 | - this.publisherHistory = publisherHistory; | ||
57 | - } | ||
58 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.ejb.ApplicationException; | ||
4 | - | ||
5 | -/** | ||
6 | - * Exception when indexing fails, whatever the reason. Has to be dealt with at service level. | ||
7 | - */ | ||
8 | -@ApplicationException(rollback = true) | ||
9 | -public class IndexingException extends Exception { | ||
10 | - final Throwable rootCause; | ||
11 | - | ||
12 | - IndexingException(Throwable rootCause) { | ||
13 | - this.rootCause = rootCause; | ||
14 | - } | ||
15 | - | ||
16 | - public Throwable getRootCause() { | ||
17 | - return rootCause; | ||
18 | - } | ||
19 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | -import java.util.Set; | ||
5 | - | ||
6 | -/** | ||
7 | - * Persisted entity for a publisher | ||
8 | - * Has versions of type PublisherVersion | ||
9 | - * May have a validated PublisherVersion among those | ||
10 | - * Has access to PublisherAction related to it | ||
11 | - */ | ||
12 | -@Entity | ||
13 | -public class Publisher /* extends org.roliste.data.DbLinkableEntity */ { | ||
14 | -// TODO L'éventuel usage de Linkable reste à confirmer https://tree.taiga.io/project/jr-utily-grog-v3/us/48 | ||
15 | -// TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué | ||
16 | - @Id | ||
17 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
18 | - private Integer publisherId; | ||
19 | - | ||
20 | - @OneToOne | ||
21 | - private PublisherVersion validatedVersion; | ||
22 | - | ||
23 | - @OneToMany(mappedBy = "publisher", fetch = FetchType.EAGER) | ||
24 | - private Set<PublisherVersion> versions; | ||
25 | - | ||
26 | - @OneToMany(mappedBy = "publisher", fetch = FetchType.EAGER) | ||
27 | - private Set<PublisherAction> actions; | ||
28 | - | ||
29 | - public Integer getPublisherId() { | ||
30 | - return publisherId; | ||
31 | - } | ||
32 | - | ||
33 | - public void setPublisherId(Integer publisherId) { | ||
34 | - this.publisherId = publisherId; | ||
35 | - } | ||
36 | - | ||
37 | - public PublisherVersion getValidatedVersion() { | ||
38 | - return validatedVersion; | ||
39 | - } | ||
40 | - | ||
41 | - public void setValidatedVersion(PublisherVersion activeVersion) { | ||
42 | - this.validatedVersion = activeVersion; | ||
43 | - } | ||
44 | - | ||
45 | - public Set<PublisherVersion> getVersions() { | ||
46 | - return versions; | ||
47 | - } | ||
48 | - | ||
49 | - public void setVersions(Set<PublisherVersion> versions) { | ||
50 | - this.versions = versions; | ||
51 | - } | ||
52 | - | ||
53 | - public Set<PublisherAction> getActions() { | ||
54 | - return actions; | ||
55 | - } | ||
56 | - | ||
57 | - public void setActions(Set<PublisherAction> actions) { | ||
58 | - this.actions = actions; | ||
59 | - } | ||
60 | - | ||
61 | - @Override | ||
62 | - public String toString() { | ||
63 | - return "PUBLISHER_ID = " + publisherId + ", Validated Version = " + validatedVersion; | ||
64 | - } | ||
65 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | -import java.sql.Timestamp; | ||
5 | - | ||
6 | -/** | ||
7 | - * Pesisted entity for actions made on PublisherVersion | ||
8 | - */ | ||
9 | -@Entity | ||
10 | -public class PublisherAction { | ||
11 | - @Id | ||
12 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
13 | - private Integer publisherActionId; | ||
14 | - | ||
15 | - @Enumerated | ||
16 | - private ActionType actionType; | ||
17 | - @ManyToOne | ||
18 | - private Account publisherActionActor; | ||
19 | - @ManyToOne | ||
20 | - private PublisherVersion publisherVersion; | ||
21 | - | ||
22 | - private Timestamp publisherActionDatetime; | ||
23 | - | ||
24 | - // Simplified access instead of going through PublisherVersion | ||
25 | - @ManyToOne | ||
26 | - private Publisher publisher; | ||
27 | - | ||
28 | - public void setPublisherActionActor(Account publisherActionActor) { | ||
29 | - this.publisherActionActor = publisherActionActor; | ||
30 | - } | ||
31 | - | ||
32 | - public void setPublisherActionDatetime(Timestamp publisherActionDatetime) { | ||
33 | - this.publisherActionDatetime = publisherActionDatetime; | ||
34 | - } | ||
35 | - | ||
36 | - public void setActionType(ActionType actionType) { | ||
37 | - this.actionType = actionType; | ||
38 | - } | ||
39 | - | ||
40 | - public void setPublisherVersion(PublisherVersion publisherVersion) { | ||
41 | - this.publisherVersion = publisherVersion; | ||
42 | - } | ||
43 | - | ||
44 | - public void setPublisher(Publisher publisher) { | ||
45 | - this.publisher = publisher; | ||
46 | - } | ||
47 | - | ||
48 | - public ActionType getActionType() { | ||
49 | - return actionType; | ||
50 | - } | ||
51 | - | ||
52 | - public Account getPublisherActionActor() { | ||
53 | - return publisherActionActor; | ||
54 | - } | ||
55 | - | ||
56 | - public PublisherVersion getPublisherVersion() { | ||
57 | - return publisherVersion; | ||
58 | - } | ||
59 | - | ||
60 | - public Timestamp getPublisherActionDatetime() { | ||
61 | - return publisherActionDatetime; | ||
62 | - } | ||
63 | - | ||
64 | - public Publisher getPublisher() { | ||
65 | - return publisher; | ||
66 | - } | ||
67 | - | ||
68 | - public Integer getPublisherActionId() { | ||
69 | - return publisherActionId; | ||
70 | - } | ||
71 | - | ||
72 | - public void setPublisherActionId(Integer publisherActionId) { | ||
73 | - this.publisherActionId = publisherActionId; | ||
74 | - } | ||
75 | - | ||
76 | - @Override | ||
77 | - public String toString() { | ||
78 | - return "publisherActionId = " + publisherActionId + ", actionType = " + actionType + | ||
79 | - ", publisherActionAuthor = " + publisherActionActor + ", publisherVersion = " + publisherVersion + | ||
80 | - ", publisherActionDatetime = " + publisherActionDatetime + ", publisher = " + publisher; | ||
81 | - } | ||
82 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.springframework.data.jpa.repository.JpaRepository; | ||
4 | - | ||
5 | -import java.util.List; | ||
6 | - | ||
7 | -/** | ||
8 | - * Interface for accessing PublisherAction | ||
9 | - */ | ||
10 | -public interface PublisherActionRepository extends JpaRepository<PublisherAction, Integer> { | ||
11 | - | ||
12 | - /** | ||
13 | - * Returns last action of a type for a publisher | ||
14 | - * | ||
15 | - * @param actionType ActionType requested | ||
16 | - * @param publisher Publisher concerned by the action | ||
17 | - * @return PublisherAction | ||
18 | - */ | ||
19 | - PublisherAction findFirstByActionTypeAndPublisherOrderByPublisherActionDatetimeDesc(ActionType actionType, Publisher publisher); | ||
20 | - | ||
21 | - /** | ||
22 | - * Returns all actions for a PublisherVersion | ||
23 | - * | ||
24 | - * @param publisherVersion PublisherVersion concerned by the actions | ||
25 | - * @return List<PublisherAction> | ||
26 | - */ | ||
27 | - List<PublisherAction> findByPublisherVersion(PublisherVersion publisherVersion); | ||
28 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import java.util.List; | ||
4 | - | ||
5 | -/** | ||
6 | - * Indexing/Search interface for IndexedPublisher | ||
7 | - */ | ||
8 | -public interface PublisherSearchRepository { | ||
9 | - /** | ||
10 | - * Indexes an IndexedPublisher | ||
11 | - * | ||
12 | - * @param indexedPublisher IndexedPublisher to be indexed | ||
13 | - * @return IndexedPublisher | ||
14 | - */ | ||
15 | - IndexedPublisher save(IndexedPublisher indexedPublisher) throws IndexingException; | ||
16 | - | ||
17 | - /** | ||
18 | - * Searches for IndexedPublishers | ||
19 | - * | ||
20 | - * @param string String looked for in IndexedPublishers | ||
21 | - * @return list of matching IndexedPublishers | ||
22 | - */ | ||
23 | - List<IndexedPublisher> search(String string) throws SearchingException; | ||
24 | - | ||
25 | - /** | ||
26 | - * | ||
27 | - * @param inxdexedPublishers IndexedPublishers to reindex | ||
28 | - */ | ||
29 | - public void reindex(List<IndexedPublisher> inxdexedPublishers) throws IndexingException; | ||
30 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.apache.solr.client.solrj.SolrClient; | ||
4 | -import org.apache.solr.client.solrj.SolrQuery; | ||
5 | -import org.apache.solr.client.solrj.SolrServerException; | ||
6 | -import org.apache.solr.client.solrj.response.QueryResponse; | ||
7 | -import org.apache.solr.client.solrj.response.UpdateResponse; | ||
8 | -import org.slf4j.Logger; | ||
9 | -import org.slf4j.LoggerFactory; | ||
10 | - | ||
11 | -import javax.inject.Inject; | ||
12 | -import java.io.IOException; | ||
13 | -import java.util.ArrayList; | ||
14 | -import java.util.List; | ||
15 | - | ||
16 | -/** | ||
17 | - * Implementation of PublisherSearchRepository using SolrJ | ||
18 | - */ | ||
19 | -public class PublisherSearchRepositorySolrj implements PublisherSearchRepository { | ||
20 | - Logger logger = LoggerFactory.getLogger(getClass()); | ||
21 | - | ||
22 | - SolrClient solrClient; | ||
23 | - | ||
24 | - protected static String collectionName = "publishers"; | ||
25 | - | ||
26 | - @Inject | ||
27 | - PublisherSearchRepositorySolrj(SolrClient solrClient) { | ||
28 | - this.solrClient = solrClient; | ||
29 | - } | ||
30 | - | ||
31 | - //no args constructor to make it proxyable | ||
32 | - PublisherSearchRepositorySolrj() { | ||
33 | - } | ||
34 | - | ||
35 | - @Override | ||
36 | - public IndexedPublisher save(IndexedPublisher indexedPublisher) throws IndexingException { | ||
37 | - try { | ||
38 | - UpdateResponse updateResponse = solrClient.addBean(collectionName, indexedPublisher, 1); | ||
39 | - logger.trace("validatePublisherVersion SolrJ UpdateResponse {}", updateResponse); | ||
40 | - } catch (IOException ioe) { | ||
41 | - throw new IndexingException(ioe); | ||
42 | - } catch (SolrServerException sse) { | ||
43 | - logger.error("SolrServerException {}", sse); | ||
44 | - throw new IndexingException(sse.getRootCause()); | ||
45 | - } | ||
46 | - | ||
47 | - return indexedPublisher; | ||
48 | - } | ||
49 | - | ||
50 | - @Override | ||
51 | - public List<IndexedPublisher> search(String string) throws SearchingException { | ||
52 | - SolrQuery solrQuery = new SolrQuery(string); | ||
53 | - QueryResponse queryResponse; | ||
54 | - try { | ||
55 | - queryResponse = solrClient.query(collectionName, solrQuery); | ||
56 | - } catch (IOException ioe) { | ||
57 | - throw new SearchingException(ioe); | ||
58 | - } catch (SolrServerException sse) { | ||
59 | - logger.error("SolrServerException {}", sse); | ||
60 | - throw new SearchingException(sse.getRootCause()); | ||
61 | - } | ||
62 | - | ||
63 | - if (queryResponse != null) { | ||
64 | - return queryResponse.getBeans(IndexedPublisher.class); | ||
65 | - } else { | ||
66 | - return new ArrayList<>(); | ||
67 | - } | ||
68 | - } | ||
69 | - | ||
70 | - @Override | ||
71 | - public void reindex(List<IndexedPublisher> indexedPublishers) throws IndexingException { | ||
72 | - try { | ||
73 | - UpdateResponse updateResponse = solrClient.addBeans(collectionName, indexedPublishers); | ||
74 | - solrClient.commit(collectionName); | ||
75 | - logger.trace("reindex inxdexedPublishers SolrJ UpdateResponse {}", updateResponse); | ||
76 | - } catch (IOException ioe) { | ||
77 | - throw new IndexingException(ioe); | ||
78 | - } catch (SolrServerException sse) { | ||
79 | - logger.error("SolrServerException {}", sse); | ||
80 | - throw new IndexingException(sse.getRootCause()); | ||
81 | - } | ||
82 | - } | ||
83 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import javax.persistence.*; | ||
4 | -import java.sql.Timestamp; | ||
5 | - | ||
6 | -/** | ||
7 | - * Persisted entity for a publisher version | ||
8 | - * Contains the data | ||
9 | - * Postal Address is split according to http://schema.org/PostalAddress | ||
10 | - */ | ||
11 | -@Entity | ||
12 | -public class PublisherVersion { | ||
13 | - @Id | ||
14 | - @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
15 | - private Integer publisherVersionId; | ||
16 | - @ManyToOne | ||
17 | - private Publisher publisher; | ||
18 | - private String publisherName; | ||
19 | - private String publisherStreetAddress; | ||
20 | - private String publisherPostalCode; | ||
21 | - private String publisherPostOfficeBoxNumber; | ||
22 | - private String publisherAddressRegion; | ||
23 | - private String publisherAddressLocality; | ||
24 | - @ManyToOne | ||
25 | - private Country publisherAddressCountry; | ||
26 | - private String publisherTelephone; | ||
27 | - private String publisherEmail; | ||
28 | - private String publisherURL; | ||
29 | - @Lob | ||
30 | - private String publisherHistory; | ||
31 | - @ManyToOne | ||
32 | - private Account publisherVersionCreator; | ||
33 | - private Timestamp publisherVersionDatetime; | ||
34 | - | ||
35 | - public Timestamp getPublisherVersionDatetime() { | ||
36 | - return publisherVersionDatetime; | ||
37 | - } | ||
38 | - | ||
39 | - public void setPublisherVersionDatetime(Timestamp publisherVersionDatetime) { | ||
40 | - this.publisherVersionDatetime = publisherVersionDatetime; | ||
41 | - } | ||
42 | - | ||
43 | - public String getPublisherHistory() { | ||
44 | - return publisherHistory; | ||
45 | - } | ||
46 | - | ||
47 | - public void setPublisherHistory(String publisherHistory) { | ||
48 | - this.publisherHistory = publisherHistory; | ||
49 | - } | ||
50 | - | ||
51 | - public String getPublisherStreetAddress() { | ||
52 | - return publisherStreetAddress; | ||
53 | - } | ||
54 | - | ||
55 | - public void setPublisherStreetAddress(String publisherStreetAddress) { | ||
56 | - this.publisherStreetAddress = publisherStreetAddress; | ||
57 | - } | ||
58 | - | ||
59 | - public String getPublisherPostalCode() { | ||
60 | - return publisherPostalCode; | ||
61 | - } | ||
62 | - | ||
63 | - public void setPublisherPostalCode(String publisherPostalCode) { | ||
64 | - this.publisherPostalCode = publisherPostalCode; | ||
65 | - } | ||
66 | - | ||
67 | - public String getPublisherPostOfficeBoxNumber() { | ||
68 | - return publisherPostOfficeBoxNumber; | ||
69 | - } | ||
70 | - | ||
71 | - public void setPublisherPostOfficeBoxNumber(String publisherPostOfficeBoxNumber) { | ||
72 | - this.publisherPostOfficeBoxNumber = publisherPostOfficeBoxNumber; | ||
73 | - } | ||
74 | - | ||
75 | - public String getPublisherAddressRegion() { | ||
76 | - return publisherAddressRegion; | ||
77 | - } | ||
78 | - | ||
79 | - public void setPublisherAddressRegion(String publisherAddressRegion) { | ||
80 | - this.publisherAddressRegion = publisherAddressRegion; | ||
81 | - } | ||
82 | - | ||
83 | - public String getPublisherAddressLocality() { | ||
84 | - return publisherAddressLocality; | ||
85 | - } | ||
86 | - | ||
87 | - public void setPublisherAddressLocality(String publisherAddressLocality) { | ||
88 | - this.publisherAddressLocality = publisherAddressLocality; | ||
89 | - } | ||
90 | - | ||
91 | - public String getPublisherTelephone() { | ||
92 | - return publisherTelephone; | ||
93 | - } | ||
94 | - | ||
95 | - public void setPublisherTelephone(String publisherTelephone) { | ||
96 | - this.publisherTelephone = publisherTelephone; | ||
97 | - } | ||
98 | - | ||
99 | - public String getPublisherEmail() { | ||
100 | - return publisherEmail; | ||
101 | - } | ||
102 | - | ||
103 | - public void setPublisherEmail(String publisherEmail) { | ||
104 | - this.publisherEmail = publisherEmail; | ||
105 | - } | ||
106 | - | ||
107 | - public String getPublisherURL() { | ||
108 | - return publisherURL; | ||
109 | - } | ||
110 | - | ||
111 | - public void setPublisherURL(String publisherURL) { | ||
112 | - this.publisherURL = publisherURL; | ||
113 | - } | ||
114 | - | ||
115 | - public Integer getPublisherVersionId() { | ||
116 | - return publisherVersionId; | ||
117 | - } | ||
118 | - | ||
119 | - public void setPublisherVersionId(Integer publisherVersionId) { | ||
120 | - this.publisherVersionId = publisherVersionId; | ||
121 | - } | ||
122 | - | ||
123 | - public String getPublisherName() { | ||
124 | - return publisherName; | ||
125 | - } | ||
126 | - | ||
127 | - public void setPublisherName(String publisherName) { | ||
128 | - this.publisherName = publisherName; | ||
129 | - } | ||
130 | - | ||
131 | - public Country getPublisherAddressCountry() { | ||
132 | - return publisherAddressCountry; | ||
133 | - } | ||
134 | - | ||
135 | - public void setPublisherAddressCountry(Country publisherAddressCountry) { | ||
136 | - this.publisherAddressCountry = publisherAddressCountry; | ||
137 | - } | ||
138 | - | ||
139 | - public Account getPublisherVersionCreator() { | ||
140 | - return publisherVersionCreator; | ||
141 | - } | ||
142 | - | ||
143 | - public void setPublisherVersionCreator(Account publisherVersionCreator) { | ||
144 | - this.publisherVersionCreator = publisherVersionCreator; | ||
145 | - } | ||
146 | - | ||
147 | - @Override | ||
148 | - public String toString() { | ||
149 | - return "PUBLISHER_VERSION_ID = " + publisherVersionId + ", Name = " + publisherName + ", St Address = " + | ||
150 | - publisherStreetAddress + ", CP = " + publisherPostalCode + ", BP = " + publisherPostOfficeBoxNumber + | ||
151 | - ", Region = " + publisherAddressRegion + ", Ville = " + publisherAddressLocality + ", Pays = " + | ||
152 | - publisherAddressCountry + ", Telephone = " + publisherTelephone + ", email = " + publisherEmail + | ||
153 | - ", URL = " + publisherURL + ", History = " + publisherHistory + | ||
154 | - ", Version Author = " + publisherVersionCreator + ", Version DateTime = " + publisherVersionDatetime; | ||
155 | - } | ||
156 | - | ||
157 | - public Publisher getPublisher() { | ||
158 | - return publisher; | ||
159 | - } | ||
160 | - | ||
161 | - public void setPublisher(Publisher publisher) { | ||
162 | - this.publisher = publisher; | ||
163 | - } | ||
164 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.springframework.data.jpa.repository.JpaRepository; | ||
4 | - | ||
5 | -import java.util.List; | ||
6 | - | ||
7 | -public interface PublisherVersionRepository extends JpaRepository<PublisherVersion, Integer> { | ||
8 | - /** | ||
9 | - * | ||
10 | - * @param integers list of Ids for the PublisherVersions we're looking for | ||
11 | - * @return PublisherVersions looked for | ||
12 | - */ | ||
13 | - List<PublisherVersion> findByPublisherVersionIdIn(List<Integer> integers); | ||
14 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -/** | ||
4 | - * Exception when searching fails, whatever the reason. Has to be dealt with at service level. | ||
5 | - */ | ||
6 | -public class SearchingException extends Exception { | ||
7 | - final Throwable rootCause; | ||
8 | - | ||
9 | - SearchingException(Throwable rootCause) { | ||
10 | - this.rootCause = rootCause; | ||
11 | - } | ||
12 | - | ||
13 | - public Throwable getRootCause() { | ||
14 | - return rootCause; | ||
15 | - } | ||
16 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.util; | ||
2 | -// Code copied from org.h2.server.web.WebSession | ||
3 | -/* | ||
4 | - * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, | ||
5 | - * and the EPL 1.0 (http://h2database.com/html/license.html). | ||
6 | - * Initial Developer: H2 Group | ||
7 | - */ | ||
8 | -///package org.h2.server.web; | ||
9 | - | ||
10 | - import java.sql.Connection; | ||
11 | - import java.sql.DatabaseMetaData; | ||
12 | - import java.sql.ResultSet; | ||
13 | - import java.sql.SQLException; | ||
14 | - import java.sql.Statement; | ||
15 | - import java.sql.Timestamp; | ||
16 | - import java.util.ArrayList; | ||
17 | - import java.util.HashMap; | ||
18 | - import java.util.Locale; | ||
19 | - | ||
20 | - import org.h2.bnf.Bnf; | ||
21 | - import org.h2.bnf.context.DbContents; | ||
22 | - import org.h2.bnf.context.DbContextRule; | ||
23 | - import org.h2.message.DbException; | ||
24 | - import org.h2.util.New; | ||
25 | -import org.h2.server.web.*; | ||
26 | - | ||
27 | -/** | ||
28 | - * The web session keeps all data of a user session. | ||
29 | - * This class is used by the H2 Console. | ||
30 | - */ | ||
31 | -class WebSession { | ||
32 | - | ||
33 | - private static final int MAX_HISTORY = 1000; | ||
34 | - | ||
35 | - /** | ||
36 | - * The last time this client sent a request. | ||
37 | - */ | ||
38 | - long lastAccess; | ||
39 | - | ||
40 | - /** | ||
41 | - * The session attribute map. | ||
42 | - */ | ||
43 | - final HashMap<String, Object> map = New.hashMap(); | ||
44 | - | ||
45 | - /** | ||
46 | - * The current locale. | ||
47 | - */ | ||
48 | - Locale locale; | ||
49 | - | ||
50 | - /** | ||
51 | - * The currently executing statement. | ||
52 | - */ | ||
53 | - Statement executingStatement; | ||
54 | - | ||
55 | - /** | ||
56 | - * The current updatable result set. | ||
57 | - */ | ||
58 | - ResultSet result; | ||
59 | - | ||
60 | - private final WebServer server; | ||
61 | - | ||
62 | - private final ArrayList<String> commandHistory; | ||
63 | - | ||
64 | - private Connection conn; | ||
65 | - private DatabaseMetaData meta; | ||
66 | - private DbContents contents = new DbContents(); | ||
67 | - private Bnf bnf; | ||
68 | - private boolean shutdownServerOnDisconnect; | ||
69 | - | ||
70 | - WebSession(WebServer server) { | ||
71 | - this.server = server; | ||
72 | - // This must be stored in the session rather than in the server. | ||
73 | - // Otherwise, one client could allow | ||
74 | - // saving history for others (insecure). | ||
75 | - this.commandHistory = server.getCommandHistoryList(); | ||
76 | - } | ||
77 | - | ||
78 | - /** | ||
79 | - * Put an attribute value in the map. | ||
80 | - * | ||
81 | - * @param key the key | ||
82 | - * @param value the new value | ||
83 | - */ | ||
84 | - void put(String key, Object value) { | ||
85 | - map.put(key, value); | ||
86 | - } | ||
87 | - | ||
88 | - /** | ||
89 | - * Get the value for the given key. | ||
90 | - * | ||
91 | - * @param key the key | ||
92 | - * @return the value | ||
93 | - */ | ||
94 | - Object get(String key) { | ||
95 | - if ("sessions".equals(key)) { | ||
96 | - return server.getSessions(); | ||
97 | - } | ||
98 | - return map.get(key); | ||
99 | - } | ||
100 | - | ||
101 | - /** | ||
102 | - * Remove a session attribute from the map. | ||
103 | - * | ||
104 | - * @param key the key | ||
105 | - */ | ||
106 | - void remove(String key) { | ||
107 | - map.remove(key); | ||
108 | - } | ||
109 | - | ||
110 | - /** | ||
111 | - * Get the BNF object. | ||
112 | - * | ||
113 | - * @return the BNF object | ||
114 | - */ | ||
115 | - Bnf getBnf() { | ||
116 | - return bnf; | ||
117 | - } | ||
118 | - | ||
119 | - /** | ||
120 | - * Load the SQL grammar BNF. | ||
121 | - */ | ||
122 | - void loadBnf() { | ||
123 | - try { | ||
124 | - Bnf newBnf = Bnf.getInstance(null); | ||
125 | - DbContextRule columnRule = | ||
126 | - new DbContextRule(contents, DbContextRule.COLUMN); | ||
127 | - DbContextRule newAliasRule = | ||
128 | - new DbContextRule(contents, DbContextRule.NEW_TABLE_ALIAS); | ||
129 | - DbContextRule aliasRule = | ||
130 | - new DbContextRule(contents, DbContextRule.TABLE_ALIAS); | ||
131 | - DbContextRule tableRule = | ||
132 | - new DbContextRule(contents, DbContextRule.TABLE); | ||
133 | - DbContextRule schemaRule = | ||
134 | - new DbContextRule(contents, DbContextRule.SCHEMA); | ||
135 | - DbContextRule columnAliasRule = | ||
136 | - new DbContextRule(contents, DbContextRule.COLUMN_ALIAS); | ||
137 | - DbContextRule procedure = | ||
138 | - new DbContextRule(contents, DbContextRule.PROCEDURE); | ||
139 | - newBnf.updateTopic("procedure", procedure); | ||
140 | - newBnf.updateTopic("column_name", columnRule); | ||
141 | - newBnf.updateTopic("new_table_alias", newAliasRule); | ||
142 | - newBnf.updateTopic("table_alias", aliasRule); | ||
143 | - newBnf.updateTopic("column_alias", columnAliasRule); | ||
144 | - newBnf.updateTopic("table_name", tableRule); | ||
145 | - newBnf.updateTopic("schema_name", schemaRule); | ||
146 | - newBnf.linkStatements(); | ||
147 | - bnf = newBnf; | ||
148 | - } catch (Exception e) { | ||
149 | - // ok we don't have the bnf | ||
150 | - server.traceError(e); | ||
151 | - } | ||
152 | - } | ||
153 | - | ||
154 | - /** | ||
155 | - * Get the SQL statement from history. | ||
156 | - * | ||
157 | - * @param id the history id | ||
158 | - * @return the SQL statement | ||
159 | - */ | ||
160 | - String getCommand(int id) { | ||
161 | - return commandHistory.get(id); | ||
162 | - } | ||
163 | - | ||
164 | - /** | ||
165 | - * Add a SQL statement to the history. | ||
166 | - * | ||
167 | - * @param sql the SQL statement | ||
168 | - */ | ||
169 | - void addCommand(String sql) { | ||
170 | - if (sql == null) { | ||
171 | - return; | ||
172 | - } | ||
173 | - sql = sql.trim(); | ||
174 | - if (sql.length() == 0) { | ||
175 | - return; | ||
176 | - } | ||
177 | - if (commandHistory.size() > MAX_HISTORY) { | ||
178 | - commandHistory.remove(0); | ||
179 | - } | ||
180 | - int idx = commandHistory.indexOf(sql); | ||
181 | - if (idx >= 0) { | ||
182 | - commandHistory.remove(idx); | ||
183 | - } | ||
184 | - commandHistory.add(sql); | ||
185 | - if (server.isCommandHistoryAllowed()) { | ||
186 | - server.saveCommandHistoryList(commandHistory); | ||
187 | - } | ||
188 | - } | ||
189 | - | ||
190 | - /** | ||
191 | - * Get the list of SQL statements in the history. | ||
192 | - * | ||
193 | - * @return the commands | ||
194 | - */ | ||
195 | - ArrayList<String> getCommandHistory() { | ||
196 | - return commandHistory; | ||
197 | - } | ||
198 | - | ||
199 | - /** | ||
200 | - * Update session meta data information and get the information in a map. | ||
201 | - * | ||
202 | - * @return a map containing the session meta data | ||
203 | - */ | ||
204 | - HashMap<String, Object> getInfo() { | ||
205 | - HashMap<String, Object> m = New.hashMap(); | ||
206 | - m.putAll(map); | ||
207 | - m.put("lastAccess", new Timestamp(lastAccess).toString()); | ||
208 | - try { | ||
209 | - m.put("url", conn == null ? | ||
210 | - "${text.admin.notConnected}" : conn.getMetaData().getURL()); | ||
211 | - m.put("user", conn == null ? | ||
212 | - "-" : conn.getMetaData().getUserName()); | ||
213 | - m.put("lastQuery", commandHistory.size() == 0 ? | ||
214 | - "" : commandHistory.get(0)); | ||
215 | - m.put("executing", executingStatement == null ? | ||
216 | - "${text.admin.no}" : "${text.admin.yes}"); | ||
217 | - } catch (SQLException e) { | ||
218 | - DbException.traceThrowable(e); | ||
219 | - } | ||
220 | - return m; | ||
221 | - } | ||
222 | - | ||
223 | - void setConnection(Connection conn) throws SQLException { | ||
224 | - this.conn = conn; | ||
225 | - if (conn == null) { | ||
226 | - meta = null; | ||
227 | - } else { | ||
228 | - meta = conn.getMetaData(); | ||
229 | - } | ||
230 | - contents = new DbContents(); | ||
231 | - } | ||
232 | - | ||
233 | - DatabaseMetaData getMetaData() { | ||
234 | - return meta; | ||
235 | - } | ||
236 | - | ||
237 | - Connection getConnection() { | ||
238 | - return conn; | ||
239 | - } | ||
240 | - | ||
241 | - DbContents getContents() { | ||
242 | - return contents; | ||
243 | - } | ||
244 | - | ||
245 | - /** | ||
246 | - * Shutdown the server when disconnecting. | ||
247 | - */ | ||
248 | - void setShutdownServerOnDisconnect() { | ||
249 | - this.shutdownServerOnDisconnect = true; | ||
250 | - } | ||
251 | - | ||
252 | - boolean getShutdownServerOnDisconnect() { | ||
253 | - return shutdownServerOnDisconnect; | ||
254 | - } | ||
255 | - | ||
256 | - /** | ||
257 | - * Close the connection and stop the statement if one is currently | ||
258 | - * executing. | ||
259 | - */ | ||
260 | - void close() { | ||
261 | - if (executingStatement != null) { | ||
262 | - try { | ||
263 | - executingStatement.cancel(); | ||
264 | - } catch (Exception e) { | ||
265 | - // ignore | ||
266 | - } | ||
267 | - } | ||
268 | - if (conn != null) { | ||
269 | - try { | ||
270 | - conn.close(); | ||
271 | - } catch (Exception e) { | ||
272 | - // ignore | ||
273 | - } | ||
274 | - } | ||
275 | - | ||
276 | - } | ||
277 | - | ||
278 | -} | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.apache.solr.client.solrj.SolrClient; | ||
4 | -import org.apache.solr.client.solrj.SolrQuery; | ||
5 | -import org.apache.solr.client.solrj.SolrServerException; | ||
6 | -import org.apache.solr.client.solrj.beans.BindingException; | ||
7 | -import org.apache.solr.common.params.SolrParams; | ||
8 | -import org.junit.jupiter.api.*; | ||
9 | -import org.junit.jupiter.api.extension.ExtendWith; | ||
10 | -import org.junit.platform.runner.JUnitPlatform; | ||
11 | -import org.junit.runner.RunWith; | ||
12 | -import org.legrog.test.MockitoExtension; | ||
13 | -import org.mockito.ArgumentCaptor; | ||
14 | -import org.mockito.Captor; | ||
15 | -import org.mockito.Mock; | ||
16 | -import org.mockito.Mockito; | ||
17 | -import org.slf4j.Logger; | ||
18 | -import org.slf4j.LoggerFactory; | ||
19 | - | ||
20 | -import java.io.IOException; | ||
21 | - | ||
22 | -import static org.assertj.core.api.Assertions.assertThat; | ||
23 | -import static org.mockito.Mockito.verify; | ||
24 | -import static org.mockito.Mockito.when; | ||
25 | - | ||
26 | -/** | ||
27 | - * Classe testant AccountSearchRepositorySolrj | ||
28 | - */ | ||
29 | -@RunWith(JUnitPlatform.class) | ||
30 | -@ExtendWith(MockitoExtension.class) | ||
31 | -@DisplayName("Indexes and searches with SearchRepository") | ||
32 | - | ||
33 | -public class AccountSearchRepositorySolrjTest { | ||
34 | - Logger logger = LoggerFactory.getLogger(getClass()); | ||
35 | - | ||
36 | - private AccountSearchRepository accountSearchRepository; | ||
37 | - private SolrClient solrClient; | ||
38 | - | ||
39 | - @Captor | ||
40 | - ArgumentCaptor<SolrParams> solrParamsArgumentCaptor; | ||
41 | - | ||
42 | - @BeforeEach | ||
43 | - public void setup(@Mock SolrClient solrClient) { | ||
44 | - accountSearchRepository = new AccountSearchRepositorySolrj(solrClient); | ||
45 | - this.solrClient = solrClient; | ||
46 | - } | ||
47 | - | ||
48 | - @Nested | ||
49 | - @DisplayName("search method") | ||
50 | - class SearchTests { | ||
51 | - | ||
52 | - @DisplayName("when repository in IO error, should throw a SearchingException") | ||
53 | - @Test | ||
54 | - public void searchIOETest() throws IOException, SolrServerException{ | ||
55 | - when(solrClient.query(Mockito.anyString(), Mockito.any())).thenThrow(new IOException()); | ||
56 | - Assertions.assertThrows(SearchingException.class, () -> accountSearchRepository.search("a")); | ||
57 | - } | ||
58 | - | ||
59 | - @DisplayName("when repository in SolrServerException, should throw an SearchingException with its root cause") | ||
60 | - @Test | ||
61 | - public void searchSSETest() throws SolrServerException, IOException { | ||
62 | - when(solrClient.query(Mockito.any())).thenThrow(new SolrServerException(new BindingException("BE test 2"))); | ||
63 | - try { | ||
64 | - accountSearchRepository.search("b"); | ||
65 | - } catch (SearchingException se) { | ||
66 | - logger.error("SearchingException {}", se); | ||
67 | - assertThat(se.getRootCause().getClass()).isEqualTo(BindingException.class); | ||
68 | - } | ||
69 | - } | ||
70 | - | ||
71 | - @DisplayName("when called, it parameter should be embedded in a query sent through SolrClient") | ||
72 | - @Test | ||
73 | - public void searchParameterTest() throws IOException, SolrServerException { | ||
74 | - try { | ||
75 | - accountSearchRepository.search("c"); | ||
76 | - Mockito.verify(solrClient).query(Mockito.anyString(), solrParamsArgumentCaptor.capture()); | ||
77 | - } catch (SearchingException se) { | ||
78 | - logger.error("SearchingException {}", se); | ||
79 | - } | ||
80 | - SolrQuery solrQuery = (SolrQuery) solrParamsArgumentCaptor.getValue(); | ||
81 | - assertThat(solrQuery.getQuery()).isEqualTo("c"); | ||
82 | - } | ||
83 | - | ||
84 | - } | ||
85 | - | ||
86 | - | ||
87 | -} |
1 | -package org.legrog.entities; | ||
2 | - | ||
3 | -import org.apache.solr.client.solrj.SolrClient; | ||
4 | -import org.apache.solr.client.solrj.SolrQuery; | ||
5 | -import org.apache.solr.client.solrj.SolrServerException; | ||
6 | -import org.apache.solr.client.solrj.beans.BindingException; | ||
7 | -import org.apache.solr.common.params.SolrParams; | ||
8 | -import org.junit.jupiter.api.*; | ||
9 | -import org.junit.jupiter.api.extension.ExtendWith; | ||
10 | -import org.junit.platform.runner.JUnitPlatform; | ||
11 | -import org.junit.runner.RunWith; | ||
12 | -import org.legrog.test.MockitoExtension; | ||
13 | -import org.mockito.ArgumentCaptor; | ||
14 | -import org.mockito.Captor; | ||
15 | -import org.mockito.Mock; | ||
16 | -import org.mockito.Mockito; | ||
17 | -import org.slf4j.Logger; | ||
18 | -import org.slf4j.LoggerFactory; | ||
19 | - | ||
20 | -import java.io.IOException; | ||
21 | - | ||
22 | -import static org.mockito.Mockito.verify; | ||
23 | -import static org.mockito.Mockito.when; | ||
24 | - | ||
25 | -import static org.assertj.core.api.Assertions.assertThat; | ||
26 | - | ||
27 | -/** | ||
28 | - * Classe testant PublisherSearchRepositorySolrj | ||
29 | - */ | ||
30 | -@RunWith(JUnitPlatform.class) | ||
31 | -@ExtendWith(MockitoExtension.class) | ||
32 | -@DisplayName("Indexes and searches with SearchRepository") | ||
33 | - | ||
34 | -public class PublisherSearchRepositorySolrjTest { | ||
35 | - Logger logger = LoggerFactory.getLogger(getClass()); | ||
36 | - | ||
37 | - private PublisherSearchRepository publisherSearchRepository; | ||
38 | - private SolrClient solrClient; | ||
39 | - | ||
40 | - @Captor | ||
41 | - ArgumentCaptor<SolrParams> solrParamsArgumentCaptor; | ||
42 | - | ||
43 | - @BeforeEach | ||
44 | - public void setup(@Mock SolrClient solrClient) { | ||
45 | - publisherSearchRepository = new PublisherSearchRepositorySolrj(solrClient); | ||
46 | - this.solrClient = solrClient; | ||
47 | - } | ||
48 | - | ||
49 | - @Nested | ||
50 | - @DisplayName("save method") | ||
51 | - class SaveTests { | ||
52 | - | ||
53 | - @Test | ||
54 | - @DisplayName("when called with right parameters, should addBean IndexedPublisher with commitWithinMs of 1 to repository") | ||
55 | - public void addBeanTest(@Mock IndexedPublisher indexedPublisher) throws IndexingException, SolrServerException, IOException { | ||
56 | - publisherSearchRepository.save(indexedPublisher); | ||
57 | - verify(solrClient).addBean(PublisherSearchRepositorySolrj.collectionName, indexedPublisher, 1); | ||
58 | - } | ||
59 | - | ||
60 | - @Test | ||
61 | - @DisplayName("When repository in IO error, should throw an IndexingException") | ||
62 | - public void addBeanIOETest(@Mock IndexedPublisher indexedPublisher) throws SolrServerException, IOException { | ||
63 | - when(solrClient.addBean(PublisherSearchRepositorySolrj.collectionName, indexedPublisher, 1)).thenThrow(new IOException()); | ||
64 | - Assertions.assertThrows(IndexingException.class, () -> publisherSearchRepository.save(indexedPublisher)); | ||
65 | - } | ||
66 | - | ||
67 | - @Test | ||
68 | - @DisplayName("When repository in SolrServerException, should throw an IndexingException with its root cause") | ||
69 | - public void addBeanSSETest(@Mock IndexedPublisher indexedPublisher) throws SolrServerException, IOException{ | ||
70 | - when(solrClient.addBean(indexedPublisher, 1)).thenThrow(new SolrServerException(new BindingException("BE test"))); | ||
71 | - try { | ||
72 | - publisherSearchRepository.save(indexedPublisher); | ||
73 | - } catch (IndexingException ie) { | ||
74 | - logger.error("IndexingException {}", ie); | ||
75 | - assertThat(ie.getRootCause().getClass()).isEqualTo(BindingException.class); | ||
76 | - } | ||
77 | - } | ||
78 | - } | ||
79 | - | ||
80 | - @Nested | ||
81 | - @DisplayName("search method") | ||
82 | - class SearchTests { | ||
83 | - | ||
84 | - @DisplayName("when repository in IO error, should throw a SearchingException") | ||
85 | - @Test | ||
86 | - public void searchIOETest() throws IOException, SolrServerException{ | ||
87 | - when(solrClient.query(Mockito.anyString(), Mockito.any())).thenThrow(new IOException()); | ||
88 | - Assertions.assertThrows(SearchingException.class, () -> publisherSearchRepository.search("a")); | ||
89 | - } | ||
90 | - | ||
91 | - @DisplayName("when repository in SolrServerException, should throw an SearchingException with its root cause") | ||
92 | - @Test | ||
93 | - public void searchSSETest() throws SolrServerException, IOException { | ||
94 | - when(solrClient.query(Mockito.any())).thenThrow(new SolrServerException(new BindingException("BE test 2"))); | ||
95 | - try { | ||
96 | - publisherSearchRepository.search("b"); | ||
97 | - } catch (SearchingException se) { | ||
98 | - logger.error("SearchingException {}", se); | ||
99 | - assertThat(se.getRootCause().getClass()).isEqualTo(BindingException.class); | ||
100 | - } | ||
101 | - } | ||
102 | - | ||
103 | - @DisplayName("when called, it parameter should be embedded in a query sent through SolrClient") | ||
104 | - @Test | ||
105 | - public void searchParameterTest() throws IOException, SolrServerException { | ||
106 | - try { | ||
107 | - publisherSearchRepository.search("c"); | ||
108 | - Mockito.verify(solrClient).query(Mockito.anyString(), solrParamsArgumentCaptor.capture()); | ||
109 | - } catch (SearchingException se) { | ||
110 | - logger.error("SearchingException {}", se); | ||
111 | - } | ||
112 | - SolrQuery solrQuery = (SolrQuery) solrParamsArgumentCaptor.getValue(); | ||
113 | - assertThat(solrQuery.getQuery()).isEqualTo("c"); | ||
114 | - } | ||
115 | - | ||
116 | - } | ||
117 | - | ||
118 | - | ||
119 | -} |
1 | -package org.legrog.test; | ||
2 | - | ||
3 | -/* | ||
4 | - | ||
5 | -TAKEN FROM JUnit 5 Sample | ||
6 | -https://github.com/junit-team/junit5-samples/blob/master/junit5-mockito-extension/src/main/java/com/example/mockito/MockitoExtension.java | ||
7 | - | ||
8 | -*/ | ||
9 | - | ||
10 | -/* | ||
11 | - * Copyright 2015-2016 the original author or authors. | ||
12 | - * | ||
13 | - * All rights reserved. This program and the accompanying materials are | ||
14 | - * made available under the terms of the Eclipse Public License v1.0 which | ||
15 | - * accompanies this distribution and is available at | ||
16 | - * | ||
17 | - * http://www.eclipse.org/legal/epl-v10.html | ||
18 | - * | ||
19 | - */ | ||
20 | - | ||
21 | - | ||
22 | -import static org.mockito.Mockito.mock; | ||
23 | - | ||
24 | -import java.lang.reflect.Parameter; | ||
25 | - | ||
26 | -import org.junit.jupiter.api.extension.ExtensionContext; | ||
27 | -import org.junit.jupiter.api.extension.ExtensionContext.Namespace; | ||
28 | -import org.junit.jupiter.api.extension.ExtensionContext.Store; | ||
29 | -import org.junit.jupiter.api.extension.ParameterContext; | ||
30 | -import org.junit.jupiter.api.extension.ParameterResolver; | ||
31 | -import org.junit.jupiter.api.extension.TestInstancePostProcessor; | ||
32 | -import org.mockito.Mock; | ||
33 | -import org.mockito.MockitoAnnotations; | ||
34 | - | ||
35 | -/** | ||
36 | - * {@code MockitoExtension} showcases the {@link TestInstancePostProcessor} | ||
37 | - * and {@link ParameterResolver} extension APIs of JUnit 5 by providing | ||
38 | - * dependency injection support at the field level and at the method parameter | ||
39 | - * level via Mockito 2.x's {@link Mock @Mock} annotation. | ||
40 | - */ | ||
41 | -public class MockitoExtension implements TestInstancePostProcessor, ParameterResolver { | ||
42 | - | ||
43 | - @Override | ||
44 | - public void postProcessTestInstance(Object testInstance, ExtensionContext context) { | ||
45 | - MockitoAnnotations.initMocks(testInstance); | ||
46 | - } | ||
47 | - | ||
48 | - @Override | ||
49 | - public boolean supports(ParameterContext parameterContext, ExtensionContext extensionContext) { | ||
50 | - return parameterContext.getParameter().isAnnotationPresent(Mock.class); | ||
51 | - } | ||
52 | - | ||
53 | - @Override | ||
54 | - public Object resolve(ParameterContext parameterContext, ExtensionContext extensionContext) { | ||
55 | - return getMock(parameterContext.getParameter(), extensionContext); | ||
56 | - } | ||
57 | - | ||
58 | - private Object getMock(Parameter parameter, ExtensionContext extensionContext) { | ||
59 | - Class<?> mockType = parameter.getType(); | ||
60 | - Store mocks = extensionContext.getStore(Namespace.create(MockitoExtension.class, mockType)); | ||
61 | - String mockName = getMockName(parameter); | ||
62 | - | ||
63 | - if (mockName != null) { | ||
64 | - return mocks.getOrComputeIfAbsent(mockName, key -> mock(mockType, mockName)); | ||
65 | - } else { | ||
66 | - return mocks.getOrComputeIfAbsent(mockType.getCanonicalName(), key -> mock(mockType)); | ||
67 | - } | ||
68 | - } | ||
69 | - | ||
70 | - private String getMockName(Parameter parameter) { | ||
71 | - String explicitMockName = parameter.getAnnotation(Mock.class).name().trim(); | ||
72 | - if (!explicitMockName.isEmpty()) { | ||
73 | - return explicitMockName; | ||
74 | - } else if (parameter.isNamePresent()) { | ||
75 | - return parameter.getName(); | ||
76 | - } | ||
77 | - return null; | ||
78 | - } | ||
79 | - | ||
80 | -} | ||
81 | - |
1 | -package org.legrog.web.xyz; | ||
2 | - | ||
3 | -import org.junit.jupiter.api.BeforeEach; | ||
4 | -import org.junit.jupiter.api.DisplayName; | ||
5 | -import org.junit.jupiter.api.Nested; | ||
6 | -import org.junit.jupiter.api.Test; | ||
7 | -import org.junit.jupiter.api.extension.ExtendWith; | ||
8 | -import org.junit.platform.runner.JUnitPlatform; | ||
9 | -import org.junit.runner.RunWith; | ||
10 | -import org.legrog.entities.Account; | ||
11 | -import org.legrog.entities.PublisherVersion; | ||
12 | -import org.legrog.entities.SearchingException; | ||
13 | -import org.legrog.test.MockitoExtension; | ||
14 | -import org.legrog.web.account.AccountService; | ||
15 | -import org.legrog.web.publisher.PublisherSearchView; | ||
16 | -import org.legrog.web.publisher.PublisherService; | ||
17 | -import org.mockito.Mock; | ||
18 | -import org.mockito.Mockito; | ||
19 | - | ||
20 | -import java.util.ArrayList; | ||
21 | -import java.util.List; | ||
22 | - | ||
23 | -import static org.assertj.core.api.Assertions.assertThat; | ||
24 | -import static org.mockito.Mockito.when; | ||
25 | - | ||
26 | -/** | ||
27 | - * Classe testant SearchView | ||
28 | - */ | ||
29 | -@RunWith(JUnitPlatform.class) | ||
30 | -@ExtendWith(MockitoExtension.class) | ||
31 | -@DisplayName("Searches for an indexed publisher") | ||
32 | -public class SearchViewTest { | ||
33 | - | ||
34 | - private SearchView searchView; | ||
35 | - private PublisherService publisherService; | ||
36 | - private AccountService accountService; | ||
37 | - | ||
38 | - @BeforeEach | ||
39 | - public void setUp(@Mock PublisherService publisherService, @Mock AccountService accountService) { | ||
40 | - this.publisherService = publisherService; | ||
41 | - this.accountService = accountService; | ||
42 | - this.searchView = new SearchView(publisherService, accountService); | ||
43 | - } | ||
44 | - | ||
45 | - @Nested | ||
46 | - @DisplayName("search method") | ||
47 | - class SearchTests { | ||
48 | - | ||
49 | - @Test | ||
50 | - @DisplayName("when called, should delegate search to PublisherService and AccountService with same string") | ||
51 | - public void searchUsesPublisherService(@Mock PublisherService publisherService, @Mock AccountService accountService) throws SearchingException{ | ||
52 | - searchView.setSearchString("1"); | ||
53 | - searchView.search(); | ||
54 | - Mockito.verify(publisherService).search("1"); | ||
55 | - Mockito.verify(accountService).search("1"); | ||
56 | - } | ||
57 | - | ||
58 | - @Test | ||
59 | - @DisplayName("when called, should return the answer it gets from PublisherService") | ||
60 | - public void searchReturnsDataFromPublisherService(@Mock PublisherService publisherService) throws SearchingException { | ||
61 | - List<PublisherVersion> publisherVersionList = new ArrayList<>(); | ||
62 | - when(publisherService.search("2")).thenReturn(publisherVersionList); | ||
63 | - searchView.setSearchString("2"); | ||
64 | - searchView.search(); | ||
65 | - assertThat(searchView.getPublisherVersions()).isEqualTo(publisherVersionList); | ||
66 | - } | ||
67 | - | ||
68 | - @Test | ||
69 | - @DisplayName("when called, should return the answer it gets from AccountService") | ||
70 | - public void searchReturnsDataFromAccountService(@Mock AccountService accountService) throws SearchingException { | ||
71 | - List<Account> publisherVersionList = new ArrayList<>(); | ||
72 | - when(accountService.search("3")).thenReturn(publisherVersionList); | ||
73 | - searchView.setSearchString("3"); | ||
74 | - searchView.search(); | ||
75 | - assertThat(searchView.getPublisherVersions()).isEqualTo(publisherVersionList); | ||
76 | - } | ||
77 | - | ||
78 | - } | ||
79 | -} |
webapp/pom.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
4 | + <modelVersion>4.0.0</modelVersion> | ||
5 | + | ||
6 | + <name>Web-application of GROG</name> | ||
7 | + <url>http://legrog.org</url> | ||
8 | + <description> | ||
9 | + Le Guide du Roliste Galactique (GROG) est une encyclopedie en ligne référençant tous les jeux de rôles connus. | ||
10 | + Cette version CUBI est la 3e mouture du site. | ||
11 | + </description> | ||
12 | + | ||
13 | + | ||
14 | + <parent> | ||
15 | + <groupId>org.legrog</groupId> | ||
16 | + <artifactId>grog-cubi</artifactId> | ||
17 | + <version>3.0-SNAPSHOT</version> | ||
18 | + </parent> | ||
19 | + <artifactId>grog-webapp</artifactId> | ||
20 | + <packaging>war</packaging> | ||
21 | + | ||
22 | + | ||
23 | + <properties> | ||
24 | + <!-- dependencies version --> | ||
25 | + <spring.platform-bom.version>Athens-SR1</spring.platform-bom.version> | ||
26 | + <omnifaces.version>2.5.1</omnifaces.version> | ||
27 | + <primefaces.version>6.0</primefaces.version> | ||
28 | + <myfaces.version>2.2.10</myfaces.version> | ||
29 | + <tomee.javaee-api.version>7.0</tomee.javaee-api.version> | ||
30 | + <assertj-core.version>1.6.1</assertj-core.version> | ||
31 | + <openjpa.version>2.4.1</openjpa.version> | ||
32 | + <rewrite.version>3.4.1.Final</rewrite.version> | ||
33 | + <hibernate-commons-annotations.version>5.0.1.Final</hibernate-commons-annotations.version> | ||
34 | + <hibernate-jpa-2.1-api.version>1.0.0.Final</hibernate-jpa-2.1-api.version> | ||
35 | + <junit.platform.version>1.0.0-M3</junit.platform.version> | ||
36 | + <junit.jupiter.version>5.0.0-M3</junit.jupiter.version> | ||
37 | + <mockito-core.version>2.2.16</mockito-core.version> | ||
38 | + <spring-data-solr.version>3.0.0.M1</spring-data-solr.version> | ||
39 | + <solr.version>6.3.0</solr.version> | ||
40 | + | ||
41 | + <!-- paths --> | ||
42 | + <custom.web.dir>src/main/java/org/legrog/web</custom.web.dir> | ||
43 | + | ||
44 | + <!-- misc --> | ||
45 | + <debug.jvm.args /> | ||
46 | + <tomee.autoreload /> | ||
47 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
48 | + <maven.compiler.source>1.8</maven.compiler.source> | ||
49 | + <maven.compiler.target>1.8</maven.compiler.target> | ||
50 | + | ||
51 | + | ||
52 | + </properties> | ||
53 | + | ||
54 | + <profiles> | ||
55 | + <profile> | ||
56 | + <id>debug</id> | ||
57 | + <!-- | ||
58 | + activate this one to be able to attach a remote debbuger on tomee | ||
59 | + --> | ||
60 | + <properties> | ||
61 | + <debug.jvm.args>-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005</debug.jvm.args> | ||
62 | + </properties> | ||
63 | + </profile> | ||
64 | + | ||
65 | + <profile> | ||
66 | + <id>autoreload</id> | ||
67 | + <!-- | ||
68 | + activate this one for tomee to reload (takes times) every times it detect a synchro | ||
69 | + reminder : you can always force a reload by typing reload in the console while tomee:run is active | ||
70 | + --> | ||
71 | + <properties> | ||
72 | + <tomee.autoreload>true</tomee.autoreload> | ||
73 | + </properties> | ||
74 | + </profile> | ||
75 | + </profiles> | ||
76 | + | ||
77 | + | ||
78 | + <dependencies> | ||
79 | + | ||
80 | + <dependency> | ||
81 | + <groupId>org.legrog</groupId> | ||
82 | + <artifactId>grog-entities</artifactId> | ||
83 | + <version>3.0-SNAPSHOT</version> | ||
84 | + </dependency> | ||
85 | + | ||
86 | + <dependency> | ||
87 | + <groupId>org.apache.solr</groupId> | ||
88 | + <artifactId>solr-solrj</artifactId> | ||
89 | + <version>${solr.version}</version> | ||
90 | + </dependency> | ||
91 | + | ||
92 | + | ||
93 | + <!-- https://mvnrepository.com/artifact/org.omnifaces/omnifaces --> | ||
94 | + <dependency> | ||
95 | + <groupId>org.omnifaces</groupId> | ||
96 | + <artifactId>omnifaces</artifactId> | ||
97 | + <version>${omnifaces.version}</version> | ||
98 | + </dependency> | ||
99 | + | ||
100 | + <!-- https://mvnrepository.com/artifact/org.primefaces/primefaces --> | ||
101 | + <dependency> | ||
102 | + <groupId>org.primefaces</groupId> | ||
103 | + <artifactId>primefaces</artifactId> | ||
104 | + <version>${primefaces.version}</version> | ||
105 | + </dependency> | ||
106 | + | ||
107 | + <dependency> | ||
108 | + <groupId>org.apache.myfaces.core</groupId> | ||
109 | + <artifactId>myfaces-api</artifactId> | ||
110 | + <version>${myfaces.version}</version> | ||
111 | + </dependency> | ||
112 | + <dependency> | ||
113 | + <groupId>org.apache.myfaces.core</groupId> | ||
114 | + <artifactId>myfaces-impl</artifactId> | ||
115 | + <version>${myfaces.version}</version> | ||
116 | + <scope>runtime</scope> | ||
117 | + </dependency> | ||
118 | + | ||
119 | + | ||
120 | + <!-- Rewriting tool --> | ||
121 | + | ||
122 | + <dependency> | ||
123 | + <groupId>org.ocpsoft.rewrite</groupId> | ||
124 | + <artifactId>rewrite-servlet</artifactId> | ||
125 | + <version>${rewrite.version}</version> | ||
126 | + </dependency> | ||
127 | + | ||
128 | + <dependency> | ||
129 | + <groupId>org.ocpsoft.rewrite</groupId> | ||
130 | + <artifactId>rewrite-integration-faces</artifactId> | ||
131 | + <version>${rewrite.version}</version> | ||
132 | + </dependency> | ||
133 | + | ||
134 | + <dependency> | ||
135 | + <groupId>org.ocpsoft.rewrite</groupId> | ||
136 | + <artifactId>rewrite-integration-cdi</artifactId> | ||
137 | + <version>${rewrite.version}</version> | ||
138 | + </dependency> | ||
139 | + | ||
140 | + | ||
141 | + <!-- **** TOOLS : LOGS + UTILS **** --> | ||
142 | + | ||
143 | + <dependency> | ||
144 | + <groupId>org.slf4j</groupId> | ||
145 | + <artifactId>slf4j-api</artifactId> | ||
146 | + </dependency> | ||
147 | + | ||
148 | + <dependency> | ||
149 | + <groupId>ch.qos.logback</groupId> | ||
150 | + <artifactId>logback-classic</artifactId> | ||
151 | + </dependency> | ||
152 | + | ||
153 | + | ||
154 | + <!-- **** DATA MANAGEMENT **** --> | ||
155 | + | ||
156 | + <dependency> | ||
157 | + <groupId>com.h2database</groupId> | ||
158 | + <artifactId>h2</artifactId> | ||
159 | + </dependency> | ||
160 | + | ||
161 | + <dependency> | ||
162 | + <groupId>mysql</groupId> | ||
163 | + <artifactId>mysql-connector-java</artifactId> | ||
164 | + <!-- | ||
165 | + <version>5.1.6</version> | ||
166 | + --> | ||
167 | + </dependency> | ||
168 | + | ||
169 | + </dependencies> | ||
170 | + | ||
171 | + <build> | ||
172 | + <plugins> | ||
173 | + | ||
174 | + <plugin> | ||
175 | + <groupId>org.apache.maven.plugins</groupId> | ||
176 | + <artifactId>maven-war-plugin</artifactId> | ||
177 | + <version>2.6</version> | ||
178 | + <configuration> | ||
179 | + <failOnMissingWebXml>false</failOnMissingWebXml> | ||
180 | + <webResources> | ||
181 | + <resource> | ||
182 | + <!-- this is relative to the pom.xml directory --> | ||
183 | + <directory>${custom.web.dir}</directory> | ||
184 | + <excludes> | ||
185 | + <exclude>**/*.java</exclude> | ||
186 | + </excludes> | ||
187 | + | ||
188 | + </resource> | ||
189 | + </webResources> | ||
190 | + | ||
191 | + </configuration> | ||
192 | + </plugin> | ||
193 | + | ||
194 | + | ||
195 | + <!-- **** TOMEE **** --> | ||
196 | + <!-- For now we just get a generic one from the repo and put it in target dir --> | ||
197 | + <!-- For production release, we will need another pom doing a real provisionning and build it with grog-cubi already inside --> | ||
198 | + <!-- | ||
199 | + see http://tomee.apache.org/ng/developer/tools/maven/tomee.html | ||
200 | + and http://tomee.apache.org/maven/index.html | ||
201 | + for conf references (I love when a new reference page doesn't get the same info as the former one) | ||
202 | + --> | ||
203 | + <plugin> | ||
204 | + <groupId>org.apache.tomee.maven</groupId> | ||
205 | + <artifactId>tomee-maven-plugin</artifactId> | ||
206 | + <version>7.0.1</version> | ||
207 | + <configuration> | ||
208 | + <context>ROOT</context> | ||
209 | + | ||
210 | + <!-- debug agent to attach a remote debbuger, activate profile for that --> | ||
211 | + <args>${debug.jvm.args}</args> | ||
212 | + | ||
213 | + <systemVariables> | ||
214 | + <!-- | ||
215 | + taken from http://tomee-openejb.979440.n4.nabble.com/7-0-0-M3-synchronization-td4677806.html for synchro to work | ||
216 | + --> | ||
217 | + <openejb.system.apps>true</openejb.system.apps> | ||
218 | + <tomee.serialization.class.blacklist>-</tomee.serialization.class.blacklist> | ||
219 | + </systemVariables> | ||
220 | + | ||
221 | + | ||
222 | + <synchronization> | ||
223 | + <resourcesDir>${custom.web.dir}</resourcesDir> | ||
224 | + <extensions> | ||
225 | + <extension>.class</extension> <!-- update each time you build with mvn compile --> | ||
226 | + <extension>.xhtml</extension> <!-- update each time you save an xhtml in custom web dir --> | ||
227 | + </extensions> | ||
228 | + </synchronization> | ||
229 | + <reloadOnUpdate>${tomee.autoreload}</reloadOnUpdate> | ||
230 | + | ||
231 | + </configuration> | ||
232 | + </plugin> | ||
233 | + </plugins> | ||
234 | + </build> | ||
235 | + | ||
236 | +</project> |
... | @@ -15,7 +15,7 @@ public class JpaConfiguration { | ... | @@ -15,7 +15,7 @@ public class JpaConfiguration { |
15 | */ | 15 | */ |
16 | @Produces | 16 | @Produces |
17 | @RequestScoped | 17 | @RequestScoped |
18 | - @PersistenceContext(unitName = "migration-pu") | 18 | + @PersistenceContext(unitName = "development-pu") |
19 | public EntityManager entityManager; | 19 | public EntityManager entityManager; |
20 | 20 | ||
21 | } | 21 | } | ... | ... |
src/main/java/org/legrog/util/PageParser.java
→
webapp/src/main/java/org/legrog/util/PageParser.java
File moved
File moved
File moved
File moved
src/main/java/org/legrog/web/navigation.xhtml
→
webapp/src/main/java/org/legrog/web/navigation.xhtml
File moved
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> | 10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> |
11 | </head> | 11 | </head> |
12 | <body> | 12 | <body> |
13 | -<ui:include src="/navigation.xhtml" /> | 13 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
14 | 14 | ||
15 | <a jsf:outcome="listPublisherActions" jsf:rendered="#{not listPublisherActionsView.viewAll}">Voir toutes les actions</a> | 15 | <a jsf:outcome="listPublisherActions" jsf:rendered="#{not listPublisherActionsView.viewAll}">Voir toutes les actions</a> |
16 | 16 | ... | ... |
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> | 10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> |
11 | </head> | 11 | </head> |
12 | <body> | 12 | <body> |
13 | -<ui:include src="/navigation.xhtml" /> | 13 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
14 | 14 | ||
15 | <a jsf:outcome="listPublisherVersions" jsf:rendered="#{not listPublisherVersionsView.viewAll}">Voir toutes les versions d'éditeurs</a> | 15 | <a jsf:outcome="listPublisherVersions" jsf:rendered="#{not listPublisherVersionsView.viewAll}">Voir toutes les versions d'éditeurs</a> |
16 | <p jsf:rendered="#{listPublisherVersionsView.publisherVersions.isEmpty()}">Liste des révisions est vide</p> | 16 | <p jsf:rendered="#{listPublisherVersionsView.publisherVersions.isEmpty()}">Liste des révisions est vide</p> | ... | ... |
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> | 10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> |
11 | </head> | 11 | </head> |
12 | <body> | 12 | <body> |
13 | -<ui:include src="/navigation.xhtml" /> | 13 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
14 | 14 | ||
15 | <form action="" jsf:id="search"> | 15 | <form action="" jsf:id="search"> |
16 | <h:panelGrid columns="2"> | 16 | <h:panelGrid columns="2"> | ... | ... |
... | @@ -9,7 +9,7 @@ | ... | @@ -9,7 +9,7 @@ |
9 | <head> | 9 | <head> |
10 | </head> | 10 | </head> |
11 | <body> | 11 | <body> |
12 | -<ui:include src="/navigation.xhtml" /> | 12 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
13 | 13 | ||
14 | <form jsf:id="publisherVersion" action=""> | 14 | <form jsf:id="publisherVersion" action=""> |
15 | <h:panelGrid columns="2"> | 15 | <h:panelGrid columns="2"> | ... | ... |
... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
6 | xmlns:jsf="http://xmlns.jcp.org/jsf" | 6 | xmlns:jsf="http://xmlns.jcp.org/jsf" |
7 | xmlns:ui="http://java.sun.com/jsf/facelets"> | 7 | xmlns:ui="http://java.sun.com/jsf/facelets"> |
8 | <body> | 8 | <body> |
9 | -<ui:include src="/navigation.xhtml" /> | 9 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
10 | 10 | ||
11 | <form action="" jsf:id="country"> | 11 | <form action="" jsf:id="country"> |
12 | <h:panelGrid columns="2"> | 12 | <h:panelGrid columns="2"> | ... | ... |
... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
5 | xmlns:ui="http://xmlns.jcp.org/jsf/facelets" | 5 | xmlns:ui="http://xmlns.jcp.org/jsf/facelets" |
6 | xmlns:jsf="http://xmlns.jcp.org/jsf"> | 6 | xmlns:jsf="http://xmlns.jcp.org/jsf"> |
7 | <body> | 7 | <body> |
8 | -<ui:include src="/navigation.xhtml" /> | 8 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
9 | 9 | ||
10 | <ul> | 10 | <ul> |
11 | <ui:repeat value="#{listCountriesView.countries}" var="country"> | 11 | <ui:repeat value="#{listCountriesView.countries}" var="country"> | ... | ... |
... | @@ -7,7 +7,7 @@ | ... | @@ -7,7 +7,7 @@ |
7 | xmlns:f="http://xmlns.jcp.org/jsf/core" | 7 | xmlns:f="http://xmlns.jcp.org/jsf/core" |
8 | xmlns:jsf="http://xmlns.jcp.org/jsf"> | 8 | xmlns:jsf="http://xmlns.jcp.org/jsf"> |
9 | <body> | 9 | <body> |
10 | -<ui:include src="/navigation.xhtml" /> | 10 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
11 | 11 | ||
12 | <form action="" jsf:id="reindex"> | 12 | <form action="" jsf:id="reindex"> |
13 | <button jsf:action="#{reindexView.reindexAll}">Réindexer</button> | 13 | <button jsf:action="#{reindexView.reindexAll}">Réindexer</button> | ... | ... |
src/main/java/org/legrog/web/xyz/search.xhtml
→
webapp/src/main/java/org/legrog/web/xyz/search.xhtml
... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> | 10 | <link rel="stylesheet" type="text/css" href="/minimal.css"/> |
11 | </head> | 11 | </head> |
12 | <body> | 12 | <body> |
13 | -<ui:include src="/navigation.xhtml" /> | 13 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
14 | 14 | ||
15 | <form action="" jsf:id="search"> | 15 | <form action="" jsf:id="search"> |
16 | <h:panelGrid columns="2"> | 16 | <h:panelGrid columns="2"> | ... | ... |
File moved
File moved
... | @@ -2,15 +2,15 @@ | ... | @@ -2,15 +2,15 @@ |
2 | <tomee> | 2 | <tomee> |
3 | <Resource id="H2Database" type="javax.sql.DataSource"> | 3 | <Resource id="H2Database" type="javax.sql.DataSource"> |
4 | JdbcDriver = org.h2.Driver | 4 | JdbcDriver = org.h2.Driver |
5 | - JdbcUrl = jdbc:h2:mem:test | 5 | + JdbcUrl = jdbc:h2:~/grog-dev.db |
6 | UserName = sa | 6 | UserName = sa |
7 | JtaManaged= true | 7 | JtaManaged= true |
8 | </Resource> | 8 | </Resource> |
9 | - <Resource id="migrationDatabase" type="javax.sql.DataSource"> | 9 | + <!--<Resource id="migrationDatabase" type="javax.sql.DataSource">--> |
10 | - JdbcDriver = com.mysql.jdbc.Driver | 10 | + <!--JdbcDriver = com.mysql.jdbc.Driver--> |
11 | - JdbcUrl = jdbc:mysql://localhost/migration?useSSL=false | 11 | + <!--JdbcUrl = jdbc:mysql://localhost/migration?useSSL=false--> |
12 | - UserName = grogdev | 12 | + <!--UserName = grogdev--> |
13 | - password = grogdev | 13 | + <!--password = grogdev--> |
14 | - JtaManaged= true | 14 | + <!--JtaManaged= true--> |
15 | - </Resource> | 15 | + <!--</Resource>--> |
16 | </tomee> | 16 | </tomee> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -5,6 +5,6 @@ | ... | @@ -5,6 +5,6 @@ |
5 | xmlns:jsf="http://xmlns.jcp.org/jsf" | 5 | xmlns:jsf="http://xmlns.jcp.org/jsf" |
6 | xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> | 6 | xmlns:ui="http://xmlns.jcp.org/jsf/facelets"> |
7 | <body> | 7 | <body> |
8 | -<ui:include src="/navigation.xhtml" /> | 8 | +<ui:include src="/org/legrog/web/navigation.xhtml" /> |
9 | </body> | 9 | </body> |
10 | </html> | 10 | </html> |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment