diff --git a/CITATION.cff b/CITATION.cff index ac69a8f685b58b92496a2b4c879af063048dd316..204bdeb05f620ad1dae75cb0f2a119745e30ffb3 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -1,48 +1,66 @@ +# This CITATION.cff file was generated with cffinit. +# Visit https://bit.ly/cffinit to generate yours today! cff-version: 1.2.0 message: You can cite AgroMetInfo by using the following metadata title: AgroMetInfo 2.0 -abstract: - en: AgroMetInfo 2.0 is a web application developed at INRAE AgroClim. It shows changes - in agroclimatic indicators for small farming regions across France in real time. - fr: "AgroMetInfo 2.0 est une application web de l'unit\xE9 INRAE AgroClim. Elle\ - \ permet de visualiser en temps r\xE9el l'\xE9volution d'indicateurs agroclimatiques\ - \ sur l'ensemble de la France sur les petites r\xE9gions agricoles." +type: software +abstract: AgroMetInfo 2.0 is a web application developed at INRAE + AgroClim. It shows changes in agroclimatic indicators for + small farming regions across France in real time. authors: - family-names: Maury given-names: Olivier - orcid: https://orcid.org/0000-0001-9016-9720 + orcid: 'https://orcid.org/0000-0001-9016-9720' + affiliation: INRAE AgroClim - family-names: Minet given-names: Vincent orcid: https://orcid.org/0009-0004-5605-4478 + affiliation: INRAE AgroClim - family-names: Lecharpentier given-names: Patrice orcid: https://orcid.org/0000-0002-4044-4322 + affiliation: INRAE AgroClim - family-names: Gandon given-names: Cyril orcid: https://orcid.org/0009-0006-9705-8867 + affiliation: INRAE AgroClim - family-names: "Garc\xEDa de Cort\xE1zar-Atauri" given-names: "I\xF1aki" orcid: https://orcid.org/0000-0001-6941-9844 + affiliation: INRAE AgroClim - family-names: Furusho-Percot given-names: Carina orcid: https://orcid.org/0000-0001-5756-3515 + affiliation: INRAE AgroClim - family-names: Huard given-names: "Fr\xE9d\xE9ric" + affiliation: INRAE AgroClim - family-names: "D\xE9come" given-names: "J\xE9r\xE9mie" orcid: https://orcid.org/0000-0002-7780-8548 + affiliation: INRAE AgroClim - family-names: Launay given-names: Marie orcid: https://orcid.org/0000-0003-4067-3907 + affiliation: INRAE AgroClim - family-names: Le Roux given-names: Renan - orcid: https://orcid.org/0000-0001-7778-1878 + orcid: 'https://orcid.org/0000-0001-7778-1878' + affiliation: INRAE AgroClim +- name: INRAE AgroClim + website: 'https://agroclim.inrae.fr/' + city: Avignon + country: FR + post-code: '84914' keywords: - Java - Indicators - Web application version: 2.0.4 -doi: https://doi.org/10.57745/9LYIAS +identifiers: + - type: doi + value: 10.57745/9LYIAS date-released: 2025-01-16 -license: GNU General Public License +license: GPL-3.0-or-later repository-code: https://forgemia.inra.fr/agroclim/agrometinfo/www.git +url: 'https://www.agrometinfo.fr/' diff --git a/bin/tokei2cloc.py b/bin/tokei2cloc.py index bc41a97876ca9d42b55f6a2aaa1e2590312f3d01..08b439edebba82046fc5170174df03bff38f2d07 100755 --- a/bin/tokei2cloc.py +++ b/bin/tokei2cloc.py @@ -1,12 +1,7 @@ #!/usr/bin/env python3 # -*- coding: UTF-8 -*- -# $Id$ -# # Author : Olivier Maury -# Creation Date : 2019-01-15 10:30:29 +0200 -# Last Revision : $Date$ -# Revision : $Rev$ u""" [1mNOM[m %prog - Tokei2Cloc @@ -62,7 +57,7 @@ for lang in results: blank = int(result['stats']['blanks']) comment = int(result['stats']['comments']) code = int(result['stats']['code']) - print(""" <file name="%s" blank="%d" comment="%d" code="%d" language="%s" />""" % + print(""" <file name="%s" blank="%d" comment="%d" code="%d" language="%s" />""" % (result['name'], blank, comment, code, lang)) total_blank += blank total_comment += comment diff --git a/pom.xml b/pom.xml index f4fd829799d5a3117e247fd0f4a6faa645c4a0a1..0ad7ec713d97b5352acdfa22af91f918897f73e8 100644 --- a/pom.xml +++ b/pom.xml @@ -10,28 +10,6 @@ <description>Web application for AgroMetInfo.</description> <url>https://www.agrometinfo.fr/</url> <inceptionYear>2023</inceptionYear> - <developers> - <developer> - <name>Jérémie Décome</name> - <organization>INRAE AgroClim</organization> - <organizationUrl>https://agroclim.inrae.fr/</organizationUrl> - <properties> - <metadata.gitlab-id>@jeremie.decome</metadata.gitlab-id> - <metadata.gitlab>https://forgemia.inra.fr/jeremie.decome</metadata.gitlab> - <metadata.orcid>https://orcid.org/0000-0002-7780-8548</metadata.orcid> - </properties> - </developer> - <developer> - <name>Olivier Maury</name> - <organization>INRAE AgroClim</organization> - <organizationUrl>https://agroclim.inrae.fr/</organizationUrl> - <properties> - <metadata.gitlab-id>@olivier.maury</metadata.gitlab-id> - <metadata.gitlab>https://forgemia.inra.fr/olivier.maury</metadata.gitlab> - <metadata.orcid>https://orcid.org/0000-0001-9016-9720</metadata.orcid> - </properties> - </developer> - </developers> <organization> <name>INRAE AgroClim</name> <url>https://agroclim.inrae.fr/</url> @@ -42,6 +20,28 @@ <url>https://www.gnu.org/licenses/gpl-3.0.txt</url> </license> </licenses> + <developers> + <developer> + <name>Jérémie Décome</name> + <organization>INRAE AgroClim</organization> + <organizationUrl>https://agroclim.inrae.fr/</organizationUrl> + <properties> + <metadata.gitlab-id>@jeremie.decome</metadata.gitlab-id> + <metadata.gitlab>https://forgemia.inra.fr/jeremie.decome</metadata.gitlab> + <metadata.orcid>https://orcid.org/0000-0002-7780-8548</metadata.orcid> + </properties> + </developer> + <developer> + <name>Olivier Maury</name> + <organization>INRAE AgroClim</organization> + <organizationUrl>https://agroclim.inrae.fr/</organizationUrl> + <properties> + <metadata.gitlab-id>@olivier.maury</metadata.gitlab-id> + <metadata.gitlab>https://forgemia.inra.fr/olivier.maury</metadata.gitlab> + <metadata.orcid>https://orcid.org/0000-0001-9016-9720</metadata.orcid> + </properties> + </developer> + </developers> <modules> <module>www-client</module> <module>www-server</module> @@ -70,8 +70,8 @@ <hibernate.version>6.6.3.Final</hibernate.version> <jax.rs.version>3.1.0</jax.rs.version> <jersey.version>3.1.9</jersey.version> - <junit.version>5.11.3</junit.version> - <log4j.version>2.24.2</log4j.version> + <junit.version>5.11.4</junit.version> + <log4j.version>2.24.3</log4j.version> <lombok.version>1.18.36</lombok.version> <weld.version>4.0.3.Final</weld.version> <!-- Maven environment values --> @@ -105,22 +105,6 @@ <metadata.long-description xml:lang="fr"><![CDATA[AgroMetInfo est une application web de l'unité INRAE AgroClim. Elle permet de visualiser en temps réel l'évolution d'indicateurs agroclimatiques sur l'ensemble de la France sur les petites régions agricoles.]]></metadata.long-description> </properties> - <dependencies> - <!-- Tests --> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-engine</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-params</artifactId> - <version>${junit.version}</version> - <scope>test</scope> - </dependency> - </dependencies> - <dependencyManagement> <dependencies> <!-- ensure all GWT deps use the same version (unless overridden) --> @@ -228,6 +212,22 @@ </dependencies> </dependencyManagement> + <dependencies> + <!-- Tests --> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-params</artifactId> + <version>${junit.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + <build> <plugins> <plugin> @@ -528,6 +528,7 @@ </plugins> </pluginManagement> </build> + <reporting> <plugins> <!-- Include JaCoCo report into site --> @@ -566,6 +567,7 @@ </plugin> </plugins> </reporting> + <profiles> <profile> <id>local</id> diff --git a/sql/schema.tables.sql b/sql/schema.tables.sql index 02873ea9e4b49d538b230dfeda6b81fbffa63883..eefe4836414278bb41e10e0990da36083f82dbbe 100644 --- a/sql/schema.tables.sql +++ b/sql/schema.tables.sql @@ -109,7 +109,7 @@ COMMENT ON TABLE pra IS 'Petite région agricole.'; COMMENT ON COLUMN pra.code IS 'Official code.'; COMMENT ON COLUMN pra.coordinates IS 'Latitudes and longitudes of edges.'; COMMENT ON COLUMN pra.name IS 'Official name.'; -COMMENT ON COLUMN pra.department IS 'Departement containing the PRA.'; +COMMENT ON COLUMN pra.department IS 'Department containing the PRA.'; CREATE TABLE IF NOT EXISTS cellpra ( id SERIAL, diff --git a/sql/surveyquestions.csv b/sql/surveyquestions.csv index f85176616d008b40ef3fa639cc9b17d949742a28..b2f797e5ec600f129f78063be7fe5346c8bf0971 100644 --- a/sql/surveyquestions.csv +++ b/sql/surveyquestions.csv @@ -1,4 +1,4 @@ id,description -1,Quelle est votre profession ? -2,Comment avez-vous connu AgroMetInfo ? -3,Dans quel but voulez-vous utiliser cette application ? +1,Quelle est votre profession ? +2,Comment avez-vous connu AgroMetInfo ? +3,Dans quel but voulez-vous utiliser cette application ? diff --git a/www-client/pom.xml b/www-client/pom.xml index b27b96da122ed1d989271459dc77e43f11bf207e..548d05f0472a7616496fed871231b763344834a3 100644 --- a/www-client/pom.xml +++ b/www-client/pom.xml @@ -2,107 +2,107 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <modelVersion>4.0.0</modelVersion> + <modelVersion>4.0.0</modelVersion> - <parent> - <groupId>fr.agrometinfo</groupId> - <artifactId>www</artifactId> - <version>2.0.5-SNAPSHOT</version> - </parent> + <parent> + <groupId>fr.agrometinfo</groupId> + <artifactId>www</artifactId> + <version>2.0.5-SNAPSHOT</version> + </parent> - <artifactId>www-client</artifactId> - <name>AgroMetInfo web app - client</name> - <packaging>gwt-app</packaging> + <artifactId>www-client</artifactId> + <packaging>gwt-app</packaging> + <name>AgroMetInfo web app - client</name> - <properties> - <!-- Maven environment values --> - <maven.compiler.source>17</maven.compiler.source> - <maven.compiler.target>17</maven.compiler.target> - <maven.compiler.testSource>17</maven.compiler.testSource> - <maven.compiler.testTarget>17</maven.compiler.testTarget> - <!-- Tools --> - <checkstyle.config.location>file://${basedir}/../config/sun_checks.xml</checkstyle.config.location> - </properties> + <properties> + <!-- Maven environment values --> + <maven.compiler.source>17</maven.compiler.source> + <maven.compiler.target>17</maven.compiler.target> + <maven.compiler.testSource>17</maven.compiler.testSource> + <maven.compiler.testTarget>17</maven.compiler.testTarget> + <!-- Tools --> + <checkstyle.config.location>file://${basedir}/../config/sun_checks.xml</checkstyle.config.location> + </properties> - <dependencies> - <!-- AgroMetInfo --> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>www-shared</artifactId> - <version>${project.version}</version> - <type>gwt-lib</type> - </dependency> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>www-shared</artifactId> - <version>${project.version}</version> - <classifier>sources</classifier> - </dependency> - <!-- GWT --> - <dependency> - <groupId>org.gwtproject</groupId> - <artifactId>gwt-user</artifactId> - </dependency> - <dependency> - <groupId>org.gwtproject</groupId> - <artifactId>gwt-dev</artifactId> - </dependency> - <!-- Domino-REST --> - <dependency> - <groupId>org.dominokit</groupId> - <artifactId>domino-rest-client</artifactId> - </dependency> - <dependency> - <groupId>org.dominokit</groupId> - <artifactId>domino-rest-processor</artifactId> - <scope>provided</scope> - </dependency> - <!-- Domino-UI --> - <dependency> - <groupId>org.dominokit</groupId> - <artifactId>domino-ui</artifactId> - </dependency> - <dependency> - <groupId>org.dominokit</groupId> - <artifactId>domino-ui</artifactId> - <classifier>sources</classifier> - </dependency> - <!-- Charba --> - <dependency> - <groupId>org.pepstock</groupId> - <artifactId>charba</artifactId> - <version>6.5</version> - </dependency> - <!-- GWT-OL3 --> - <dependency> - <groupId>com.github.tdesjardins</groupId> - <artifactId>gwt-ol3</artifactId> - <version>8.5.0</version> - </dependency> - </dependencies> + <dependencies> + <!-- AgroMetInfo --> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>www-shared</artifactId> + <version>${project.version}</version> + <type>gwt-lib</type> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>www-shared</artifactId> + <version>${project.version}</version> + <classifier>sources</classifier> + </dependency> + <!-- GWT --> + <dependency> + <groupId>org.gwtproject</groupId> + <artifactId>gwt-user</artifactId> + </dependency> + <dependency> + <groupId>org.gwtproject</groupId> + <artifactId>gwt-dev</artifactId> + </dependency> + <!-- Domino-REST --> + <dependency> + <groupId>org.dominokit</groupId> + <artifactId>domino-rest-client</artifactId> + </dependency> + <dependency> + <groupId>org.dominokit</groupId> + <artifactId>domino-rest-processor</artifactId> + <scope>provided</scope> + </dependency> + <!-- Domino-UI --> + <dependency> + <groupId>org.dominokit</groupId> + <artifactId>domino-ui</artifactId> + </dependency> + <dependency> + <groupId>org.dominokit</groupId> + <artifactId>domino-ui</artifactId> + <classifier>sources</classifier> + </dependency> + <!-- Charba --> + <dependency> + <groupId>org.pepstock</groupId> + <artifactId>charba</artifactId> + <version>6.5</version> + </dependency> + <!-- GWT-OL3 --> + <dependency> + <groupId>com.github.tdesjardins</groupId> + <artifactId>gwt-ol3</artifactId> + <version>8.5.0</version> + </dependency> + </dependencies> - <build> - <plugins> - <plugin> - <groupId>net.ltgt.gwt.maven</groupId> - <artifactId>gwt-maven-plugin</artifactId> - <configuration> - <moduleName>fr.agrometinfo.www.client.module</moduleName> - <moduleShortName>app</moduleShortName> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <executions> - <execution> - <phase>test</phase> - <goals> - <goal>test</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <groupId>net.ltgt.gwt.maven</groupId> + <artifactId>gwt-maven-plugin</artifactId> + <configuration> + <moduleName>fr.agrometinfo.www.client.module</moduleName> + <moduleShortName>app</moduleShortName> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <executions> + <execution> + <phase>test</phase> + <goals> + <goal>test</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> </project> diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/presenter/MapPresenter.java b/www-client/src/main/java/fr/agrometinfo/www/client/presenter/MapPresenter.java index e2bdadddd6fb4a85c773d2d96fcdf846b17f6a05..a943133e2cf9a307fe51315bc4780120e1d69f15 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/presenter/MapPresenter.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/presenter/MapPresenter.java @@ -54,7 +54,7 @@ public final class MapPresenter implements Presenter { void setPraNames(Map<String, String> values); /** - * @param lines the title splitted in lines + * @param lines the title split in lines */ void setTitle(List<String> lines); } diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/CanvasTitle.java b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/CanvasTitle.java index 64fbe36b48d01dd172e9b24b996b2a3cb2667d96..7c309a245cf236c6dc6b3f55507870095cc81221 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/CanvasTitle.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/CanvasTitle.java @@ -141,8 +141,8 @@ public final class CanvasTitle extends CanvasWidget { if (line == null) { continue; } - for (final String splittedLine : splitLine(line, ctx, availableWidth)) { - lines.add(splittedLine); + for (final String splitLine : splitLine(line, ctx, availableWidth)) { + lines.add(splitLine); } } this.drawBorder(lines.size()); @@ -273,7 +273,7 @@ public final class CanvasTitle extends CanvasWidget { /** * @param intervals Color intervals used to set background color of cells. - * @param lines the title splitted in lines + * @param lines the title split in lines */ public void setTitle(final List<String> lines, final List<ColorInterval> intervals) { this.title = lines; @@ -287,7 +287,7 @@ public final class CanvasTitle extends CanvasWidget { * @param line line to split * @param ctx canvas context * @param availableWidth space where text must be drawn - * @return splitted lines + * @return split lines */ private List<String> splitLine(final String line, final Context2d ctx, final double availableWidth) { final List<String> lines = new ArrayList<>(); diff --git a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java index f29957d348dc890e892099abdc433ddf3369d5ca..8df98776047868daa361d0da1bbef0ef25c4c092 100644 --- a/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java +++ b/www-client/src/main/java/fr/agrometinfo/www/client/ui/map/TileSuppliers.java @@ -229,7 +229,7 @@ public abstract class TileSuppliers { /** * See https://geoservices.ign.fr/services-geoplateforme-diffusion . * - * @param wmts basic caracteristics to generate an IGN served layer + * @param wmts basic characteristics to generate an IGN served layer * @return base layer */ private static Base createIgnWmtsLayer(final IgnWmtsLayer wmts) { diff --git a/www-server/pom.xml b/www-server/pom.xml index 0ce8c1db731601d79d49aa42810067b01939ec26..81c84fdc10d92e47d360828ef221d06cd8106d3c 100644 --- a/www-server/pom.xml +++ b/www-server/pom.xml @@ -14,6 +14,18 @@ <packaging>war</packaging> <name>AgroMetInfo web app - server</name> + <distributionManagement> + <repository> + <id>sava-gitlab-maven</id> + <url>https://forgemia.inra.fr/api/v4/projects/5817/packages/maven</url> + </repository> + + <snapshotRepository> + <id>sava-gitlab-maven</id> + <url>https://forgemia.inra.fr/api/v4/projects/5817/packages/maven</url> + </snapshotRepository> + </distributionManagement> + <properties> <mockito-core.version>5.14.2</mockito-core.version> <sava.version>1.0.0</sava.version> @@ -227,18 +239,6 @@ </repository> </repositories> - <distributionManagement> - <repository> - <id>sava-gitlab-maven</id> - <url>https://forgemia.inra.fr/api/v4/projects/5817/packages/maven</url> - </repository> - - <snapshotRepository> - <id>sava-gitlab-maven</id> - <url>https://forgemia.inra.fr/api/v4/projects/5817/packages/maven</url> - </snapshotRepository> - </distributionManagement> - <build> <resources> <resource> @@ -268,14 +268,14 @@ <artifactId>maven-surefire-plugin</artifactId> <configuration> <argLine> --Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager ---add-opens=java.base/java.lang=ALL-UNNAMED ---add-opens=java.base/java.math=ALL-UNNAMED ---add-opens=java.base/java.net=ALL-UNNAMED ---add-opens=java.base/java.text=ALL-UNNAMED ---add-opens=java.base/java.util=ALL-UNNAMED ---add-opens=java.base/java.util.concurrent=ALL-UNNAMED ---add-opens=java.sql/java.sql=ALL-UNNAMED + -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager + --add-opens=java.base/java.lang=ALL-UNNAMED + --add-opens=java.base/java.math=ALL-UNNAMED + --add-opens=java.base/java.net=ALL-UNNAMED + --add-opens=java.base/java.text=ALL-UNNAMED + --add-opens=java.base/java.util=ALL-UNNAMED + --add-opens=java.base/java.util.concurrent=ALL-UNNAMED + --add-opens=java.sql/java.sql=ALL-UNNAMED </argLine> </configuration> </plugin> diff --git a/www-server/src/main/java/fr/agrometinfo/www/server/dao/EntityManagerFactoryHandler.java b/www-server/src/main/java/fr/agrometinfo/www/server/dao/EntityManagerFactoryHandler.java index c7b8950a0e8244cb85467f2e7334fecfd2eb96bb..aa2cb880bd2263759474e8d0fe9cb366c1c27ee9 100644 --- a/www-server/src/main/java/fr/agrometinfo/www/server/dao/EntityManagerFactoryHandler.java +++ b/www-server/src/main/java/fr/agrometinfo/www/server/dao/EntityManagerFactoryHandler.java @@ -31,8 +31,7 @@ public final class EntityManagerFactoryHandler implements InvocationHandler { static { try { - CREATE_ENTITY_MANAGER = EntityManagerFactory.class - .getMethod("createEntityManager"); + CREATE_ENTITY_MANAGER = EntityManagerFactory.class.getMethod("createEntityManager"); CREATE_SCOPED_ENTITY_MANAGER = ScopedEntityManagerFactory.class .getMethod("createScopedEntityManager"); } catch (final NoSuchMethodException e) { diff --git a/www-server/src/main/java/fr/agrometinfo/www/server/dao/ScopedEntityManager.java b/www-server/src/main/java/fr/agrometinfo/www/server/dao/ScopedEntityManager.java index 2f534109891e9ac7817a4bc9de9cb9d7df44d2ee..97cf66f0da2af3f1ca5c374e35f33f54bff236f5 100644 --- a/www-server/src/main/java/fr/agrometinfo/www/server/dao/ScopedEntityManager.java +++ b/www-server/src/main/java/fr/agrometinfo/www/server/dao/ScopedEntityManager.java @@ -17,7 +17,7 @@ import jakarta.persistence.EntityManager; * * @author Olivier Maury */ -public interface ScopedEntityManager extends EntityManager, AutoCloseable { +public interface ScopedEntityManager extends EntityManager { /** * Operations to execute in transaction. diff --git a/www-server/src/main/java/fr/agrometinfo/www/server/model/UserEmail.java b/www-server/src/main/java/fr/agrometinfo/www/server/model/UserEmail.java index fe65c0320bb0b8d8deef8d87fcd2040862af52bc..5254e65169ee7459c389729c508174555a1fc614 100644 --- a/www-server/src/main/java/fr/agrometinfo/www/server/model/UserEmail.java +++ b/www-server/src/main/java/fr/agrometinfo/www/server/model/UserEmail.java @@ -11,7 +11,7 @@ import jakarta.persistence.Table; import lombok.Data; /** - * Table for storage email adress.<br> + * Table for storage email address.<br> * @author jdecome */ @Data diff --git a/www-server/src/main/java/fr/agrometinfo/www/server/rs/IndicatorResource.java b/www-server/src/main/java/fr/agrometinfo/www/server/rs/IndicatorResource.java index 42d0fb970fca6efe8705b5006532993def9fec62..816b183124367ad1fd81c32706c04809e920c0ae 100644 --- a/www-server/src/main/java/fr/agrometinfo/www/server/rs/IndicatorResource.java +++ b/www-server/src/main/java/fr/agrometinfo/www/server/rs/IndicatorResource.java @@ -61,40 +61,6 @@ import lombok.extern.log4j.Log4j2; @Path(IndicatorService.PATH) @RequestScoped public class IndicatorResource implements IndicatorService { - /** - * Query parameter. - */ - private static final String PARAM_COMPARISON = "comparison"; - - /** - * Query parameter. - */ - private static final String PARAM_ID = "id"; - - /** - * Query parameter. - */ - private static final String PARAM_INDICATOR = "indicator"; - - /** - * Query parameter. - */ - private static final String PARAM_LEVEL = "level"; - - /** - * Query parameter. - */ - private static final String PARAM_PERIOD = "period"; - - /** - * Query parameter. - */ - private static final String PARAM_REGION = "region"; - - /** - * Query parameter. - */ - private static final String PARAM_YEAR = "year"; private static String getTranslation(final Map<String, String> names, final Locale locale) { final var locales = List.of(locale, Locale.FRENCH, Locale.ENGLISH); diff --git a/www-server/src/main/java/fr/agrometinfo/www/server/rs/SurveyFormResource.java b/www-server/src/main/java/fr/agrometinfo/www/server/rs/SurveyFormResource.java index d837927fe30d23cb06329c2d77ffa305c144c2ab..0cd9b85a0663bdc0daf8aa63f8197cf3970f87b4 100644 --- a/www-server/src/main/java/fr/agrometinfo/www/server/rs/SurveyFormResource.java +++ b/www-server/src/main/java/fr/agrometinfo/www/server/rs/SurveyFormResource.java @@ -29,6 +29,7 @@ import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.MediaType; +import jakarta.ws.rs.core.Response; import lombok.extern.log4j.Log4j2; /** @@ -117,16 +118,16 @@ public class SurveyFormResource implements SurveyFormService { @Inject private MailService mailService; /** - * Ensure the value of query parameter is not null and not blanck. + * Ensure the value of query parameter is not null and not blank. * @param value value of query parameter to check * @param queryParamName name of query parameter * @throws WebApplicationException if validation failed */ private void checkRequired(final Object value, final String queryParamName) { if (value instanceof final String str && str.isBlank() || value == null) { - final jakarta.ws.rs.core.Response.Status badRequest = jakarta.ws.rs.core.Response.Status.BAD_REQUEST; + final Response.Status badRequest = Response.Status.BAD_REQUEST; throw new WebApplicationException( - jakarta.ws.rs.core.Response.status(badRequest).entity(ErrorResponseDTO.of( + Response.status(badRequest).entity(ErrorResponseDTO.of( badRequest.getStatusCode(), badRequest.getReasonPhrase(), queryParamName + " parameter is mandatory") @@ -154,7 +155,7 @@ public class SurveyFormResource implements SurveyFormService { final List<SurveyQuestion> questions = questionsDao.findAll(); - // proccessing of predefined responses + // processing of predefined responses for (final SurveyQuestionDTO dto : data.getQuestions()) { final SurveyQuestion q = toEntity(dto); // if question from survey doesn't exist, don't inserting response @@ -179,7 +180,7 @@ public class SurveyFormResource implements SurveyFormService { } } - // if the user provided their email address and is vaild + // If the user provided their email address and is valid if (EmailUtils.isEmailAddressValid(data.getEmail())) { this.userEmailDao.insertEmailUserAddress(data.getEmail(), datetime); } diff --git a/www-server/src/main/resources/fr/agrometinfo/www/server/jsp.properties b/www-server/src/main/resources/fr/agrometinfo/www/server/jsp.properties index dd42edfa1e7a6ff93ceebcf84bd66c21552e891c..66f504bb63cad261117999de53294c7856fdc1ce 100644 --- a/www-server/src/main/resources/fr/agrometinfo/www/server/jsp.properties +++ b/www-server/src/main/resources/fr/agrometinfo/www/server/jsp.properties @@ -1,4 +1,4 @@ -# Ce fichier est encodé en UTF-8 +# Ce fichier est encodé en UTF-8 page.cookies=Cookies page.error=Error page page.legal-notice=Legal notice diff --git a/www-server/src/test/java/fr/agrometinfo/www/server/I18nTest.java b/www-server/src/test/java/fr/agrometinfo/www/server/I18nTest.java index 185fa50a5abe4764a989fe6a69a385c14788fc53..95485e6b5953142e9d2ae80df9e176bf30cf420a 100644 --- a/www-server/src/test/java/fr/agrometinfo/www/server/I18nTest.java +++ b/www-server/src/test/java/fr/agrometinfo/www/server/I18nTest.java @@ -23,8 +23,13 @@ import fr.agrometinfo.www.server.I18n.Operator; */ class I18nTest { - + /** + * I18n key. + */ private static final String KEY_CATS = "cats"; + /** + * I18n key. + */ private static final String KEY_COMPARISON = "comparison"; /** * Key for plural messages to test. @@ -65,7 +70,7 @@ class I18nTest { private final I18n res = new I18n(NAME, Locale.FRENCH); @Test - void contructorWithResourceBundle() { + void constructorWithResourceBundle() { final var bundle = ResourceBundle.getBundle(NAME, Locale.FRENCH); final var i18n = new I18n(bundle); String actual; diff --git a/www-shared/src/main/java/fr/agrometinfo/www/shared/dto/ChoiceDTO.java b/www-shared/src/main/java/fr/agrometinfo/www/shared/dto/ChoiceDTO.java index e0a155b1c19f640d19b570890d9c79f3a198f602..0382fda33f04980026abcad0b05a23744c880217 100644 --- a/www-shared/src/main/java/fr/agrometinfo/www/shared/dto/ChoiceDTO.java +++ b/www-shared/src/main/java/fr/agrometinfo/www/shared/dto/ChoiceDTO.java @@ -26,7 +26,6 @@ public final class ChoiceDTO implements Serializable { */ private Boolean comparison = FALSE; - /** * ID of chosen feature (region in left panel, PRA on map). */ diff --git a/www-shared/src/main/java/fr/agrometinfo/www/shared/service/IndicatorService.java b/www-shared/src/main/java/fr/agrometinfo/www/shared/service/IndicatorService.java index 3ff1658ae7365b9284c450758819e10205052a27..b5ce371f66e70f91bc690c34ab76300f86d26680 100644 --- a/www-shared/src/main/java/fr/agrometinfo/www/shared/service/IndicatorService.java +++ b/www-shared/src/main/java/fr/agrometinfo/www/shared/service/IndicatorService.java @@ -22,8 +22,33 @@ import jakarta.ws.rs.QueryParam; @RequestFactory @Path(IndicatorService.PATH) public interface IndicatorService { + + /** + * Query parameter. + */ + String PARAM_COMPARISON = "comparison"; + /** + * Query parameter. + */ + String PARAM_ID = "id"; + /** + * Query parameter. + */ + String PARAM_INDICATOR = "indicator"; + /** + * Query parameter. + */ + String PARAM_LEVEL = "level"; + /** + * Query parameter. + */ + String PARAM_PERIOD = "period"; + /** + * Query parameter. + */ + String PARAM_REGION = "region"; /** - * Same string for all. + * Query parameter. */ String PARAM_YEAR = "year"; /** @@ -90,9 +115,9 @@ public interface IndicatorService { */ @GET @Path(PATH_SUMMARY) - SummaryDTO getSummary(@QueryParam(value = "indicator") String indicator, - @QueryParam(value = "period") String period, @QueryParam(value = "level") FeatureLevel level, - @QueryParam(value = "id") String id, @QueryParam(value = PARAM_YEAR) Integer year); + SummaryDTO getSummary(@QueryParam(value = PARAM_INDICATOR) String indicator, + @QueryParam(value = PARAM_PERIOD) String period, @QueryParam(value = PARAM_LEVEL) FeatureLevel level, + @QueryParam(value = PARAM_ID) String id, @QueryParam(value = PARAM_YEAR) Integer year); /** * @param indicator indicator code @@ -104,9 +129,9 @@ public interface IndicatorService { */ @GET @Path(PATH_VALUES) - FeatureCollection getValues(@QueryParam(value = "indicator") String indicator, - @QueryParam(value = "period") String period, @QueryParam(value = "region") Integer region, - @QueryParam(value = PARAM_YEAR) Integer year, @QueryParam(value = "comparison") Boolean comparison); + FeatureCollection getValues(@QueryParam(value = PARAM_INDICATOR) String indicator, + @QueryParam(value = PARAM_PERIOD) String period, @QueryParam(value = PARAM_REGION) Integer region, + @QueryParam(value = PARAM_YEAR) Integer year, @QueryParam(value = PARAM_COMPARISON) Boolean comparison); /** * @return list of computed years.