From 7c05393a51650b975daa57eddca728cb52a939e4 Mon Sep 17 00:00:00 2001 From: Hugo Gimbert Date: Mon, 6 Jan 2025 07:54:57 +0100 Subject: [PATCH] cleanup --- .../fr/gouv/monprojetsup/data/Constants.java | 2 +- .../data/model/attendus/GrilleAnalyse.java | 35 +-------------- .../DescriptifsFormationsMetiers.java | 4 +- .../data/model/formations/Formations.java | 4 +- .../monprojetsup/data/model/graph/Edges.java | 28 ++++-------- .../monprojetsup/data/model/graph/Path.java | 2 +- .../data/model/liens/UrlsUpdater.java | 3 +- .../data/model/onisep/SousDomaineWeb.java | 2 +- .../formations/FormationIdeoSimple.java | 1 + .../data/model/psup/FormationsSimilaires.java | 2 +- .../data/model/stats/Middle50.java | 2 +- .../monprojetsup/data/tools/CsvTools.java | 2 +- .../data/tools/DictApproxInversion.java | 45 ------------------- .../data/tools/Serialisation.java | 7 ++- .../entity/FormationMetierEntity.kt | 7 ++- .../data/psup/ConnecteurBackendSQL.java | 2 +- .../data/psup/ConnecteurJsonCarteSQL.java | 14 +++--- .../exceptions/AccesDonneesException.java | 2 - .../AccesDonneesExceptionMessage.java | 8 ++-- .../exceptions/VerificationException.java | 31 ------------- .../VerificationExceptionMessage.java | 16 ------- .../monprojetsup/data/etl/labels/Labels.java | 12 ++--- .../data/etl/loaders/DataSources.java | 2 +- .../data/etl/loaders/LoadersTest.kt | 5 +-- .../data/etl/loaders/OnisepDataLoaderTest.kt | 5 +-- app/etl/pom.xml | 1 - app/suggestions/suggestions-algo/pom.xml | 6 --- .../suggestions/algo/AlgoSuggestions.java | 10 +---- .../monprojetsup/suggestions/algo/Config.java | 2 +- .../suggestions/algo/Suggestion.java | 2 +- .../suggestions/data/model/Path.java | 2 +- app/suggestions/suggestions-export/pom.xml | 6 --- .../export/experts/ReferenceCases.java | 2 +- .../export/experts/SuggestionsEvaluator.java | 32 +++++-------- .../export/experts/SuggestionsGenerator.java | 2 +- .../reference/AuditSuggestionsData.java | 9 ---- .../monprojetsup/suggestions/server/Log.java | 22 --------- .../suggestions/server/MyService.java | 2 +- .../suggestions/server/MySuggService.java | 2 +- 39 files changed, 71 insertions(+), 272 deletions(-) delete mode 100644 app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/DictApproxInversion.java delete mode 100644 app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationException.java delete mode 100644 app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationExceptionMessage.java delete mode 100644 app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/Log.java diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/Constants.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/Constants.java index d803261dc..803b4166f 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/Constants.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/Constants.java @@ -40,7 +40,7 @@ public class Constants { public static final String FRANCE_TRAVAIL_FICHE_METIER_PREFIX = "https://candidat.francetravail.fr/metierscope/fiche-metier/"; public static final int MAX_NB_LIENS_IDEO_SUR_FICHE_FORMATION = 3; public static final int MAX_NB_LIENS_PSUP_SUR_FICHE_FORMATION = 3; - public static String PSUP_FORMATION_FICHE = "https://dossier.parcoursup.fr/Candidats/public/fiches/afficherFicheFormation?g_ta_cod="; + public static final String PSUP_FORMATION_FICHE = "https://dossier.parcoursup.fr/Candidats/public/fiches/afficherFicheFormation?g_ta_cod="; public static final String DIAGNOSTICS_OUTPUT_DIR = "diagnostics/"; /* constant added to the las gFlCod indexes */ diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/attendus/GrilleAnalyse.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/attendus/GrilleAnalyse.java index e9a06757f..94f802a3b 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/attendus/GrilleAnalyse.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/attendus/GrilleAnalyse.java @@ -36,7 +36,7 @@ public static Map getLabelsMap() { CEN_INT_FIELD, "Engagements, activités et centres d’intérêt, réalisations péri ou extra-scolaires" ); } - public static List> labelsFront = List.of( + public static final List> labelsFront = List.of( Pair.of(RES_ACA_FIELD, "Résultats académiques"), Pair.of(COM_ACA_FIELD, "Compétences académiques"), Pair.of(SAV_ETR_FIELD, "Savoir-être"), @@ -44,37 +44,4 @@ public static Map getLabelsMap() { Pair.of(CEN_INT_FIELD, "Engagements, activités et centres d’intérêt, réalisations péri ou extra-scolaires") ); - /* - { - "TABLE_NAME": "C_JUR_ADM", - "COLUMN_NAME": "C_JA_CGV_RES_ACA_PRC", - "COMMENTS": "Pourcentage (en valeur entière) de prise en compte du criètres, saisi par l\u0027utilisateur en charge du paramétrage et cela au niveau de chaque jury", - "ORIGIN_CON_ID": "0" - }, - { - "TABLE_NAME": "C_JUR_ADM", - "COLUMN_NAME": "C_JA_CGV_COM_ACA_PRC", - "COMMENTS": "Pourcentage (en valeur entière) de prise en compte du criètres, saisi par l\u0027utilisateur en charge du paramétrage et cela au niveau de chaque jury", - "ORIGIN_CON_ID": "0" - }, - { - "TABLE_NAME": "C_JUR_ADM", - "COLUMN_NAME": "C_JA_CGV_SAV_ETR_PRC", - "COMMENTS": "Pourcentage (en valeur entière) de prise en compte du criètres, saisi par l\u0027utilisateur en charge du paramétrage et cela au niveau de chaque jury", - "ORIGIN_CON_ID": "0" - }, - { - "TABLE_NAME": "C_JUR_ADM", - "COLUMN_NAME": "C_JA_CGV_MOT_CON_PRC", - "COMMENTS": "Pourcentage (en valeur entière) de prise en compte du criètres, saisi par l\u0027utilisateur en charge du paramétrage et cela au niveau de chaque jury", - "ORIGIN_CON_ID": "0" - }, - { - "TABLE_NAME": "C_JUR_ADM", - "COLUMN_NAME": "C_JA_CGV_ACT_CEN_INT_PRC", - "COMMENTS": "Pourcentage (en valeur entière) de prise en compte du criètres, saisi par l\u0027utilisateur en charge du paramétrage et cela au niveau de chaque jury", - "ORIGIN_CON_ID": "0" - } - - */ } diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/descriptifs/DescriptifsFormationsMetiers.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/descriptifs/DescriptifsFormationsMetiers.java index e8d55abe7..2de9ae29f 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/descriptifs/DescriptifsFormationsMetiers.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/descriptifs/DescriptifsFormationsMetiers.java @@ -105,7 +105,9 @@ public DescriptifFormation get(String key) { public String getDescriptifGeneralFront(@NotNull String flCod) { val desc = keyToDescriptifs.get(flCod); if(desc == null) return null; - return Helpers.removeHtml(desc.getDescriptifGeneralFront()).trim(); + val html = Helpers.removeHtml(desc.getDescriptifGeneralFront()); + if(html == null) return null; + return html.trim(); } @Nullable diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/formations/Formations.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/formations/Formations.java index 1c1bcda73..c42d0d65a 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/formations/Formations.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/formations/Formations.java @@ -69,9 +69,7 @@ public Collection getFilieres() { public void ajouterSiInconnu(Formations o) { - o.formations.forEach((key, value) -> { - this.formations.putIfAbsent(key, value); - }); + o.formations.forEach(this.formations::putIfAbsent); o.filieres.forEach(this.filieres::putIfAbsent); o.typesMacros.forEach(this.typesMacros::putIfAbsent); _groupesToFilieres.clear(); diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Edges.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Edges.java index ab7aa9edb..b16d86ec2 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Edges.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Edges.java @@ -27,11 +27,7 @@ public Edges(Edges edges) { } public Edges(Map> medges, double weight, boolean reverse) { - medges.forEach((s, strings) -> { - strings.forEach(s1 -> { - this.put(s, s1, reverse, weight); - }); - }); + medges.forEach((s, strings) -> strings.forEach(s1 -> this.put(s, s1, reverse, weight))); } public void put(String a, Collection bs) { @@ -120,7 +116,7 @@ private Set computePathesFromInternal(String node, int maxDistance) { } /** - * @param node + * @param node the node to compute the in degree * @return the number of edges going to node */ private int inDegree(String node) { @@ -131,9 +127,9 @@ private int inDegree(String node) { /** * add some edges with initial weight * - * @param o - * @param reverse - * @param weight + * @param o the edges to add + * @param reverse if true, add the reverse edges + * @param weight the weight to apply to the edges */ public void putAll(@Nullable Edges o, boolean reverse, double weight) { if (o != null) putAll(o.edges(), reverse, weight); @@ -234,11 +230,10 @@ public void createLabelledGraphFrom(Edges edgesKeys, Map globalD String label = globalDict.get(k); if (label == null) label = k; String finalKey = label; - m.entrySet().forEach(e -> { - String s = e.getKey(); + m.forEach((s, value) -> { String val = globalDict.get(s); if (val == null) val = s; - put(finalKey, val, false, e.getValue()); + put(finalKey, val, false, value); }); }); @@ -247,8 +242,8 @@ public void createLabelledGraphFrom(Edges edgesKeys, Map globalD /** * the specifics inherit from the generics * - * @param specificToGeneric - * @param coef + * @param specificToGeneric the map of specific to generic + * @param coef the coefficient to apply to the weights */ public void addEdgesFromMoreGenericItem(Map specificToGeneric, double coef) { @@ -263,11 +258,6 @@ public void addEdgesFromMoreGenericItem(Map specificToGeneric, d backEdges.forEach((origin, weight) -> put(origin, specific, false, weight * coef)); } }); - /* - Set toErase = specificToGeneric.entrySet().stream().filter(e -> !e.getValue().equals(e.getKey())) - .map(e -> e.getKey()) - .collect(Collectors.toSet()); - */ } public void addTransitiveClosure(String theme, Set transitiveClosureOfTheme) { diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Path.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Path.java index d861b1e2f..1abe8772a 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Path.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/graph/Path.java @@ -41,7 +41,7 @@ public int size() { @Override public String toString() { - return nodes.stream().collect(Collectors.joining(" -- ")) + " [sc" + (int) (10000 * weight) + "]"; + return String.join(" -- ", nodes) + " [sc" + (int) (10000 * weight) + "]"; } public String toString(Map keyToLabel) { diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/liens/UrlsUpdater.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/liens/UrlsUpdater.java index 63fa9e898..16fd00b4f 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/liens/UrlsUpdater.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/liens/UrlsUpdater.java @@ -225,8 +225,7 @@ public static String capitalizeFirstLetter(String sentence) { } private static String getLabel(@NotNull Map labels, String cleanedupKey, String url) { - String label = labels.getOrDefault(cleanedupKey, url); - return label; + return labels.getOrDefault(cleanedupKey, url); } private UrlsUpdater() {} diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/SousDomaineWeb.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/SousDomaineWeb.java index ea165cded..e72351aec 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/SousDomaineWeb.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/SousDomaineWeb.java @@ -31,7 +31,7 @@ public record SousDomaineWeb( * ""information-communication, audiovisuel/communication| commerce, marketing, vente/marketing, vente" * * @param domaines the field to extract keys from - * @param domainesPro + * @param sousDomainesWeb the map of all domaines * @return the keys */ public static Set extractDomaines(@NotNull String domaines, Map sousDomainesWeb) { diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/formations/FormationIdeoSimple.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/formations/FormationIdeoSimple.java index 18267ece6..80519ec64 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/formations/FormationIdeoSimple.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/onisep/formations/FormationIdeoSimple.java @@ -89,6 +89,7 @@ public boolean estFormationDuSup() { ); } + @SuppressWarnings("ExtractMethodRecommender") public List getMotsCles() { List result = new ArrayList<>(); if (codeNsf != null) result.add("codeNsf" + codeNsf); diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/psup/FormationsSimilaires.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/psup/FormationsSimilaires.java index 92cb835ab..b01056dce 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/psup/FormationsSimilaires.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/psup/FormationsSimilaires.java @@ -17,7 +17,7 @@ public FormationsSimilaires() { public void add(String gFlCodOri, String gFlCodSim, int gFsSco, int iTcCod) { parFiliereOrigine.computeIfAbsent(gFlCodOri, z -> new FormationsSimilairesParBac()) .parBac().computeIfAbsent(iTcCod, z -> new HashMap<>()) - .put(gFlCodSim, Long.valueOf(gFsSco)); + .put(gFlCodSim, (long) gFsSco); } public void normalize() { diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/stats/Middle50.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/stats/Middle50.java index 265063703..f69567d70 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/stats/Middle50.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/model/stats/Middle50.java @@ -24,7 +24,7 @@ public record Middle50( /** * - * @param frequencesCumulees + * @param frequencesCumulees the cumulative frequencies * */ public Middle50(int[] frequencesCumulees) { diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/CsvTools.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/CsvTools.java index e8afe3ec3..fa144a4a8 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/CsvTools.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/CsvTools.java @@ -97,7 +97,7 @@ public void close() throws IOException { public void appendHeaders(List headers) throws IOException { append(headers); } - public void append(List items) throws IOException { + public void append(List items) { csvWriter.writeNext(items.toArray(new String[0])); } diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/DictApproxInversion.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/DictApproxInversion.java deleted file mode 100644 index ba8239c1d..000000000 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/DictApproxInversion.java +++ /dev/null @@ -1,45 +0,0 @@ -package fr.gouv.monprojetsup.data.tools; - -import org.apache.commons.text.similarity.LevenshteinDistance; -import org.jetbrains.annotations.Nullable; - -import java.util.Map; - -public class DictApproxInversion { - - private static final LevenshteinDistance levenAlgo = new LevenshteinDistance(10); - - /** - * maps lbales to key with closest correspondance - * @return - */ - public static @Nullable String findKey(String label, Map keyToLabelbel) { - if(label == null || label.length() <= 3) return null; - String bestMatch = null; - String bestLib = null; - int bestScore = Integer.MAX_VALUE; - for (Map.Entry entry : keyToLabelbel.entrySet()) { - String lib = entry.getValue(); - if(lib == null) continue; - int distance = levenAlgo.apply(label, lib); - int i = lib.indexOf("/"); - if(i > 0) { - int distance2 = levenAlgo.apply(label, lib.substring(i)); - if(distance2 >= 0 && distance2 < distance) { - distance = distance2; - } - } - if (distance >= 0 && distance < bestScore) { - bestScore = distance; - bestMatch = entry.getKey(); - bestLib = lib; - } - } - if(bestMatch == null || bestScore >= 4 || bestScore > 1 + label.length() / 5 || bestScore > 1 + bestLib.length() / 5) { - return null; - } else { - return bestMatch; - } - } - -} diff --git a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/Serialisation.java b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/Serialisation.java index 0ee278298..894d4b663 100644 --- a/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/Serialisation.java +++ b/app/etl/etl-common/src/main/java/fr/gouv/monprojetsup/data/tools/Serialisation.java @@ -40,9 +40,8 @@ public class Serialisation { } public static InputStream getRemoteFile(String urlString, String dataDir) throws IOException, InterruptedException { - String dirName = dataDir; int i = urlString.lastIndexOf('/') + 1; - String cacheName = dirName + "/" + urlString.substring(i); + String cacheName = dataDir + "/" + urlString.substring(i); if (dataDir != null && Files.exists(Path.of(cacheName))) { LOGGER.warning("Utilisation du cache pour " + urlString + " depuis " + cacheName); return new FileInputStream(cacheName); @@ -56,13 +55,13 @@ public static InputStream getRemoteFile(String urlString, String dataDir) throws .header("Content-Type", "application/json") .GET() // or use .POST(), .PUT(), etc. .build(); - HttpClient client = HttpClient.newHttpClient(); + final HttpClient client = HttpClient.newHttpClient(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofInputStream()); if (response.statusCode() == HTTP_OK) { val stream = response.body(); if (dataDir != null) { LOGGER.warning("Sauvegarde de " + urlString + " dans le cache " + cacheName); - if(!Files.exists(Path.of(dirName))) Files.createDirectories(Path.of(dirName)); + if (!Files.exists(Path.of(dataDir))) Files.createDirectories(Path.of(dataDir)); try (OutputStream out = new FileOutputStream(cacheName)) { stream.transferTo(out); } diff --git a/app/etl/etl-common/src/main/kotlin/fr/gouv/monprojetsup/data/formationmetier/entity/FormationMetierEntity.kt b/app/etl/etl-common/src/main/kotlin/fr/gouv/monprojetsup/data/formationmetier/entity/FormationMetierEntity.kt index 9df54b14b..a24cdcae3 100644 --- a/app/etl/etl-common/src/main/kotlin/fr/gouv/monprojetsup/data/formationmetier/entity/FormationMetierEntity.kt +++ b/app/etl/etl-common/src/main/kotlin/fr/gouv/monprojetsup/data/formationmetier/entity/FormationMetierEntity.kt @@ -1,7 +1,10 @@ package fr.gouv.monprojetsup.data.formationmetier.entity -import jakarta.persistence.* -import java.io.Serializable +import jakarta.persistence.Column +import jakarta.persistence.Embeddable +import jakarta.persistence.EmbeddedId +import jakarta.persistence.Entity +import jakarta.persistence.Table @Entity @Table(name = "ref_join_formation_metier") diff --git a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurBackendSQL.java b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurBackendSQL.java index 705c178be..f8db6b4eb 100644 --- a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurBackendSQL.java +++ b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurBackendSQL.java @@ -574,7 +574,7 @@ public static TagsSources recupererSources(AlgoCarteEntree carte, Set f //group bac mat - Map>> percCounters = new HashMap<>(); + final Map>> percCounters = new HashMap<>(); void incremente(String bac, String group, String matCod, double note) { int[] c = percCounters diff --git a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurJsonCarteSQL.java b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurJsonCarteSQL.java index ad9d1ba4d..480f58bdc 100644 --- a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurJsonCarteSQL.java +++ b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/ConnecteurJsonCarteSQL.java @@ -3,19 +3,23 @@ import fr.gouv.monprojetsup.data.model.psup.Filiere; import fr.gouv.monprojetsup.data.psup.exceptions.AccesDonneesException; import fr.gouv.monprojetsup.data.psup.exceptions.AccesDonneesExceptionMessage; -import fr.gouv.monprojetsup.data.psup.exceptions.VerificationException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; -import java.util.*; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Objects; +import java.util.Set; import java.util.logging.Logger; import java.util.stream.Collectors; +import static fr.gouv.monprojetsup.data.Constants.LAS_CONSTANT; import static fr.gouv.monprojetsup.data.psup.AlgoCarteConfig.FILIERE; import static fr.gouv.monprojetsup.data.psup.AlgoCarteConfig.TYPE_FORMATION; -import static fr.gouv.monprojetsup.data.Constants.LAS_CONSTANT; import static fr.gouv.monprojetsup.data.psup.Scores.cleanAndSplit; import static fr.gouv.monprojetsup.data.psup.exceptions.AccesDonneesExceptionMessage.CONNECTEUR_ORACLE_CONNEXION_NULL; @@ -46,7 +50,7 @@ public AlgoCarteEntree recupererDonneesJSONCarte(AlgoCarteConfig config) throws recuperationDesFilieres(entree); recuperationDomainesOnisep(entree); recuperationFormationsTagguees(entree, config); - } catch (SQLException | VerificationException ex) { + } catch (SQLException ex) { throw new AccesDonneesException(AccesDonneesExceptionMessage.MESSAGE, ex, String.format(ex.getMessage()), ex); } return entree; @@ -55,7 +59,7 @@ public AlgoCarteEntree recupererDonneesJSONCarte(AlgoCarteConfig config) throws public static final String G_TA_COD = "g_ta_cod"; public static final String G_TF_MOT_CLE_MDR = "g_tf_mot_cle_mdr"; - public void recuperationDomainesOnisep(AlgoCarteEntree entree) throws VerificationException, SQLException { + public void recuperationDomainesOnisep(AlgoCarteEntree entree) throws SQLException { try (Statement stmt = connection.createStatement()) { LOGGER.info("Récupération des secteursActivite onisep v2"); diff --git a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesException.java b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesException.java index 60238f3de..a41ce22bb 100644 --- a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesException.java +++ b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesException.java @@ -22,8 +22,6 @@ Hugo Gimbert (hugo.gimbert@enseignementsup.gouv.fr) public class AccesDonneesException extends Exception { - private static final long serialVersionUID = 1L; - public AccesDonneesException(AccesDonneesExceptionMessage exceptionMessage, Object... arguments) { super(String.format(exceptionMessage.getMessage(), arguments)); } diff --git a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesExceptionMessage.java b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesExceptionMessage.java index 51ea0edd7..1a9a9cec1 100644 --- a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesExceptionMessage.java +++ b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/AccesDonneesExceptionMessage.java @@ -1,11 +1,12 @@ package fr.gouv.monprojetsup.data.psup.exceptions; -@SuppressWarnings("unused") +import lombok.Getter; + +@Getter public enum AccesDonneesExceptionMessage { MESSAGE("%s"), CONNECTEUR_ORACLE_CONNEXION_NULL("Impossible de créer un ConnecteurOracle à partir d'une connexion null"), - CONNECTEUR_ORACLE_CREATION("Echec de création du connecteur"), CONNECTEUR_DONNEES_APPEL_ORACLE_ERREUR_SQL_RECUPERATION("Erreur SQL lors de la récupération des données d'appel"); @@ -15,7 +16,4 @@ public enum AccesDonneesExceptionMessage { this.message = message; } - public String getMessage(){ - return this.message; - } } diff --git a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationException.java b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationException.java deleted file mode 100644 index 3f6c86d47..000000000 --- a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationException.java +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2020 © Ministère de l'Enseignement Supérieur, de la Recherche et de -l'Innovation, - Hugo Gimbert (hugo.gimbert@enseignementsup.gouv.fr) - - This file is part of Algorithmes-de-parcoursup. - - Algorithmes-de-parcoursup is free software: you can redistribute it and/or modify - it under the terms of the Affero GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Algorithmes-de-parcoursup is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - Affero GNU General Public License for more details. - - You should have received a copy of the Affero GNU General Public License - along with Algorithmes-de-parcoursup. If not, see . - - */ -package fr.gouv.monprojetsup.data.psup.exceptions; - -public class VerificationException extends Exception { - - private static final long serialVersionUID = 6_494_999_485_590_357_622L; - - public VerificationException(VerificationExceptionMessage exceptionMessage, Object... arguments) { - super(String.format(exceptionMessage.getMessage(), arguments)); - } - -} diff --git a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationExceptionMessage.java b/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationExceptionMessage.java deleted file mode 100644 index 6e78ea780..000000000 --- a/app/etl/etl-psup/src/main/java/fr/gouv/monprojetsup/data/psup/exceptions/VerificationExceptionMessage.java +++ /dev/null @@ -1,16 +0,0 @@ -package fr.gouv.monprojetsup.data.psup.exceptions; - -public enum VerificationExceptionMessage { - - MESSAGE("%s"); - - private final String message; - - VerificationExceptionMessage(@SuppressWarnings("SameParameterValue") String message){ - this.message = message; - } - - public String getMessage(){ - return this.message; - } -} \ No newline at end of file diff --git a/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/labels/Labels.java b/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/labels/Labels.java index 72ee7028f..194d684b7 100644 --- a/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/labels/Labels.java +++ b/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/labels/Labels.java @@ -106,15 +106,9 @@ public static Map getFormationsLabels(@NotNull PsupData psupData public static Map getLabelsOriginauxPsup(@NotNull PsupData psupData) { val result = new HashMap(); - psupData.formations().formations.forEach((key, formation) -> { - result.put(gTaCodToMpsId(key), formation.libelle); - }); - psupData.filieres().forEach((key, filiere) -> { - result.put(Constants.gFlCodToMpsId(key), filiere.libelle); - }); - psupData.formations().typesMacros.forEach((key, libelle) -> { - result.put(gFrCodToMpsId(key), libelle); - }); + psupData.formations().formations.forEach((key, formation) -> result.put(gTaCodToMpsId(key), formation.libelle)); + psupData.filieres().forEach((key, filiere) -> result.put(Constants.gFlCodToMpsId(key), filiere.libelle)); + psupData.formations().typesMacros.forEach((key, libelle) -> result.put(gFrCodToMpsId(key), libelle)); return result; diff --git a/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/loaders/DataSources.java b/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/loaders/DataSources.java index 56d7d7c10..e2ec090e7 100644 --- a/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/loaders/DataSources.java +++ b/app/etl/etl-updatedb/src/main/java/fr/gouv/monprojetsup/data/etl/loaders/DataSources.java @@ -10,7 +10,7 @@ public class DataSources { /* the directory containing the data */ @Value("${dataRootDirectory}") - private String dataRootDirectory = "./"; + private final String dataRootDirectory = "./"; /* Psup data */ public static final String BACK_PSUP_DATA_FILENAME = "parcoursup/psupDataBack.zip"; diff --git a/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/LoadersTest.kt b/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/LoadersTest.kt index 99b436f3e..fce1f17c5 100644 --- a/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/LoadersTest.kt +++ b/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/LoadersTest.kt @@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ActiveProfiles -import java.util.Map @SpringBootTest(classes = [DataSources::class] ) @ActiveProfiles("test") @@ -20,7 +19,7 @@ class LoadersTest { @Test fun `Doit réussir à récupérer les formations ideo `() { // Given - val formations = OnisepDataLoader.loadFormationsSimplesIdeo(dataSources, Map.of()) + val formations = OnisepDataLoader.loadFormationsSimplesIdeo(dataSources, emptyMap()) // When // Then Assertions.assertThat(formations).isNotEmpty() @@ -29,7 +28,7 @@ class LoadersTest { @Test fun `Doit réussir à récupérer les fiches formations ideo `() { // Given - val fiches = OnisepDataLoader.loadFichesFormationsIdeo(dataSources, Map.of()) + val fiches = OnisepDataLoader.loadFichesFormationsIdeo(dataSources, emptyMap()) // When // Then Assertions.assertThat(fiches).isNotEmpty() diff --git a/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/OnisepDataLoaderTest.kt b/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/OnisepDataLoaderTest.kt index 67d9c20cc..dc0154a3e 100644 --- a/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/OnisepDataLoaderTest.kt +++ b/app/etl/etl-updatedb/src/test/kotlin/fr/gouv/monprojetsup/data/etl/loaders/OnisepDataLoaderTest.kt @@ -11,7 +11,6 @@ import org.junit.jupiter.api.Test import org.springframework.beans.factory.annotation.Autowired import org.springframework.boot.test.context.SpringBootTest import org.springframework.test.context.ActiveProfiles -import java.util.Map @SpringBootTest(classes = [DataSources::class] ) @@ -63,11 +62,11 @@ class OnisepDataLoaderTest { fun `Licence d histoire ne mène pas à directeur de golf ni technicienne de forge`() { val formationsIdeoSansfiche = OnisepDataLoader.loadFormationsSimplesIdeo( dataSources, - Map.of() + emptyMap() ) val formationsIdeoAvecFiche = OnisepDataLoader.loadFichesFormationsIdeo( dataSources, - Map.of() + emptyMap() ) val formationsIdeoDuSup = OnisepDataLoader.extractFormationsIdeoDuSup( formationsIdeoSansfiche, diff --git a/app/etl/pom.xml b/app/etl/pom.xml index 8587a2663..9a75c1fba 100644 --- a/app/etl/pom.xml +++ b/app/etl/pom.xml @@ -27,7 +27,6 @@ UTF-8 1.9.23 official - diff --git a/app/suggestions/suggestions-algo/pom.xml b/app/suggestions/suggestions-algo/pom.xml index 6451fed65..d17139c76 100644 --- a/app/suggestions/suggestions-algo/pom.xml +++ b/app/suggestions/suggestions-algo/pom.xml @@ -13,12 +13,6 @@ 1.4.2 - - fr.gouv.monprojetsup - etl-common - 1.4.2 - - jakarta.annotation diff --git a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/AlgoSuggestions.java b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/AlgoSuggestions.java index 43a8bae4f..f56d2f007 100644 --- a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/AlgoSuggestions.java +++ b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/AlgoSuggestions.java @@ -3,7 +3,6 @@ import fr.gouv.monprojetsup.data.Constants; import fr.gouv.monprojetsup.data.model.LatLng; import fr.gouv.monprojetsup.data.model.Ville; -import fr.gouv.monprojetsup.data.model.stats.Middle50; import fr.gouv.monprojetsup.suggestions.data.SuggestionsData; import fr.gouv.monprojetsup.suggestions.data.model.Edges; import fr.gouv.monprojetsup.suggestions.data.model.Path; @@ -68,7 +67,7 @@ public AlgoSuggestions(SuggestionsData data) { /* les formations en apprentissage */ private Set apprentissage; /* les formations qui sont des LAS, elles sont systématiquement supprimées des suggestions su run profil qui n'a pas coché un intérêt "santé" */ - protected Set las; + protected final Set las; /* la médiane du nombre d'action de formation dans une formation, permet de définir beaucoup d'offre ou peu d'offre */ public final int p50NbFormations; /* le 75 percentiel de la capacité d'accueil globale d'une formation, permet de définir gros ou petit */ @@ -244,7 +243,7 @@ public void createGraph() { @NotNull List>> result = new ArrayList<>(); val config = data.getConfig(); - val diversityMultiplicativeMalus = config.getDiversityMultiplicativeMalusBacGen(pf.bac()); + val diversityMultiplicativeMalus = config.getDiversityMultiplicativeMalusBac(pf.bac()); while(!affinities.isEmpty()) { int nb = result.size() + 1; @@ -440,11 +439,6 @@ public int getCapacity(String fl) { return nbAdmis.computeIfAbsent(Pair.of(grp, bac), z -> data.getNbAdmis(grp, bac)); } - private final ConcurrentHashMap, Pair> statsBac = new ConcurrentHashMap<>(); - public @Nullable Pair getStatsBac(String fl, String bac) { - return statsBac.computeIfAbsent(Pair.of(fl, bac), z -> data.getStatsBac(fl, bac)); - } - private final ConcurrentHashMap>> voeuxCoords = new ConcurrentHashMap<>(); public @NotNull List<@NotNull Pair<@NotNull String, @NotNull LatLng>> getVoeuxCoords(String fl) { return voeuxCoords.computeIfAbsent(fl, z -> data.getVoeuxCoords(fl)); diff --git a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Config.java b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Config.java index 0a0b2abd8..8d58185b0 100644 --- a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Config.java +++ b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Config.java @@ -134,7 +134,7 @@ public boolean isVeryVerbose() { return verbosityLevel >= 2; } - public double getDiversityMultiplicativeMalusBacGen(String bac) { + public double getDiversityMultiplicativeMalusBac(String bac) { if(bac == null || bac.isEmpty() || bac.startsWith("G") || bac.equals(TOUS_BACS_CODE_MPS)) { return diversityMultiplicativeMalusBacGen; } diff --git a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Suggestion.java b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Suggestion.java index e2042fb8d..39968d7f3 100644 --- a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Suggestion.java +++ b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/algo/Suggestion.java @@ -34,7 +34,7 @@ public static Suggestion getPendingSuggestion(String fl, List expla public String humanReadable(Map labels) { StringBuilder sb = new StringBuilder(); - sb.append("\t" + labels.getOrDefault(id, id)); + sb.append("\t").append(labels.getOrDefault(id, id)); sb.append(lineSeparator()); sb.append(lineSeparator()); if(expl != null) { diff --git a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/data/model/Path.java b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/data/model/Path.java index 8391f3e34..ef052e00b 100644 --- a/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/data/model/Path.java +++ b/app/suggestions/suggestions-algo/src/main/java/fr/gouv/monprojetsup/suggestions/data/model/Path.java @@ -41,7 +41,7 @@ public int size() { @Override public String toString() { - return nodes.stream().collect(Collectors.joining(" -- ")) + " [sc" + (int) (10000 * weight) + "]"; + return String.join(" -- ", nodes) + " [sc" + (int) (10000 * weight) + "]"; } public String toString(Map keyToLabel) { diff --git a/app/suggestions/suggestions-export/pom.xml b/app/suggestions/suggestions-export/pom.xml index f276fde56..c58337bd7 100644 --- a/app/suggestions/suggestions-export/pom.xml +++ b/app/suggestions/suggestions-export/pom.xml @@ -13,12 +13,6 @@ 1.4.2 - - fr.gouv.monprojetsup - etl-common - 1.4.2 - compile - fr.gouv.monprojetsup suggestions-algo diff --git a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/ReferenceCases.java b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/ReferenceCases.java index d535c996b..fadee72d6 100644 --- a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/ReferenceCases.java +++ b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/ReferenceCases.java @@ -171,7 +171,7 @@ public static GetExplanationsAndExamplesServiceDTO.Response getExplanationsAndEx } - public static Logger LOGGER = Logger.getLogger(ReferenceCases.class.getName()); + public static final Logger LOGGER = Logger.getLogger(ReferenceCases.class.getName()); public static ReferenceCases loadFromFile(String filename) throws IOException { diff --git a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsEvaluator.java b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsEvaluator.java index b557ce709..da88df104 100644 --- a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsEvaluator.java +++ b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsEvaluator.java @@ -98,8 +98,6 @@ public void evaluate() throws Exception { fos.write("\n"); fos.write("************ EXPECTATIONS ******************\n"); for (String expectation : refCase.expectations()) {//Todo compute distance between expectation and details - /*if(!expectation.contains("parcours coordination et gestion des établissements et services sanitaires ") - || expectation.contains("apprentissage")) continue;*/ int rank = getRank(expectation, suggestionsRanks); if (rank > 0) { fos.write("OK rank " + rank + " \t" + expectation + "\n"); @@ -130,29 +128,19 @@ public void evaluate() throws Exception { fos2.write("\n************************** OVERTAKEN BY ***************************\n"); fos2.write("\n***********************************************************************\n"); fos2.write(worst); - /* - if (stopOnFirstKO) { - stoppedBecauseOfKo = true; - break; - }*/ } } } fos.write("\n"); - if(refCase.suggestions() != null) { - fos.write("************ ACTUAL SUGGESTIONS ******************\n"); - fos.append(refCase.suggestions().stream() - .filter(s -> Constants.isFiliere(s.id())) - .map(e -> getOKPrefix(refCase, e.id()) + data.getLabel(e.id())) - .collect(Collectors.joining("\n", "", "\n"))); - } + fos.write("************ ACTUAL SUGGESTIONS ******************\n"); + fos.append(refCase.suggestions().stream() + .filter(s -> Constants.isFiliere(s.id())) + .map(e -> getOKPrefix(refCase, e.id()) + data.getLabel(e.id())) + .collect(Collectors.joining("\n", "", "\n"))); } i++; - if(stoppedBecauseOfKo && stopOnFirstKO) { - break; - } } fos.flush(); } @@ -202,10 +190,12 @@ private static int getRank(String expectation, Map suggestionsC static String toApprentissageExplanationString(String apprentissage) { if (apprentissage == null) return "Non-renseigné"; - if (apprentissage.equals("A")) return "Indifférent"; - if (apprentissage.equals("B")) return "Indifférent"; - if (apprentissage.equals("C")) return "Peu intéressé"; - return apprentissage; + return switch (apprentissage) { + case "A" -> "Indifférent"; + case "B" -> "Indifférent"; + case "C" -> "Peu intéressé"; + default -> apprentissage; + }; } diff --git a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsGenerator.java b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsGenerator.java index 3a3d43d8a..b1609dca3 100644 --- a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsGenerator.java +++ b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/experts/SuggestionsGenerator.java @@ -36,7 +36,7 @@ public SuggestionsGenerator(SuggestionsData data) { private static final boolean ONLY_FORMATIONS = true; @Value("${profils.experts.mps.path}") - private String profilsExpertPath = "profilsExperts.json"; + private final String profilsExpertPath = "profilsExperts.json"; diff --git a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/reference/AuditSuggestionsData.java b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/reference/AuditSuggestionsData.java index b251700c8..b6c790e85 100644 --- a/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/reference/AuditSuggestionsData.java +++ b/app/suggestions/suggestions-export/src/main/java/fr/gouv/monprojetsup/suggestions/export/reference/AuditSuggestionsData.java @@ -89,15 +89,6 @@ public void outputDiagnostics() throws Exception { outputMetiersDiagnostics(); - /* - outputRelatedToHealth(); - - outputGraph(); - - outputSemanticGraph(); - - outputMetiersSansFormations(); - */ } private void outputMetiersDiagnostics() throws IOException { diff --git a/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/Log.java b/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/Log.java deleted file mode 100644 index 186e7cd15..000000000 --- a/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/Log.java +++ /dev/null @@ -1,22 +0,0 @@ -package fr.gouv.monprojetsup.suggestions.server; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class Log { - - /* todo: do better, keep track uf usage statistics */ - - public static void logTrace(String handleException, String message) { - log.info(handleException + " " + message); - - } - - public static void logBackError(Throwable e) { - log.warn("Error", e); - } - - public static void logBackError(String s) { - log.warn(s); - } -} diff --git a/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MyService.java b/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MyService.java index e64fa444f..53a895b2a 100644 --- a/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MyService.java +++ b/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MyService.java @@ -13,7 +13,7 @@ public abstract class MyService { private static final Logger logger = LoggerFactory.getLogger(MyService.class); - protected abstract @NotNull U handleRequest(@NotNull T req) throws Exception; + protected abstract @NotNull U handleRequest(@NotNull T req); public @NotNull U handleRequestAndExceptions(@NotNull T req) throws MyServiceException { try { diff --git a/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MySuggService.java b/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MySuggService.java index 38624d35e..86172b66d 100644 --- a/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MySuggService.java +++ b/app/suggestions/suggestions-server/src/main/java/fr/gouv/monprojetsup/suggestions/server/MySuggService.java @@ -12,6 +12,6 @@ protected MySuggService() { super(); } - protected abstract @NotNull U handleRequest(@NotNull T req) throws Exception; + protected abstract @NotNull U handleRequest(@NotNull T req); }