From 83e0993d3efbaf1a0ec584404df7c6de42360e11 Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Tue, 10 Feb 2026 16:31:42 +0100 Subject: [PATCH 1/3] fix: sparql query when dateMiseAJourTrue --- .../getDatasetById/getDataSetByIDSummary.ftlh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh b/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh index 161eead31..d3e4b213e 100644 --- a/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh +++ b/magma-gestion-impl/src/main/resources/queries/dataSets/getDatasetById/getDataSetByIDSummary.ftlh @@ -2,9 +2,13 @@ select distinct ?id ?dateModification FROM where { - ?uri a dcat:Dataset ; - dcterms:identifier "${ID}" ; - dcterms:identifier ?id ; - OPTIONAL {?uri dcterms:modified ?dateModification . } + ?uri a dcat:Dataset ; + dcterms:identifier "${ID}" ; + dcterms:identifier ?id ; + OPTIONAL { + ?record a dcat:CatalogRecord ; + foaf:primaryTopic ?uri ; + dcterms:modified ?dateModification . + } -} group by ?id ?dateModification \ No newline at end of file +} \ No newline at end of file From d4e96053d0e474c43490c92c2e8bcc35aba1c27c Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Tue, 10 Feb 2026 16:32:49 +0100 Subject: [PATCH 2/3] fix: management for dateMiseAJourfalse when disseminationStatus or wasGeneratedBy is null --- .../dataset/DataSetModelSwagger.java | 11 ++++++++ .../old/services/datasets/DataSetsImpl.java | 25 ++++++++++++++----- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java index d56b7302f..f21d9cc1c 100644 --- a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java +++ b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/modelSwagger/dataset/DataSetModelSwagger.java @@ -194,4 +194,15 @@ public DataSetModelSwagger(Id id, List title, Uri uri, Modified mod this.validationState = validationState; this.themeModelSwaggerS = themeModelSwaggerS; } + + public DataSetModelSwagger(Id id, List title, Uri uri, String validationState, CatalogRecordCreated catalogRecordCreated, CatalogRecordModified catalogRecordModified, CatalogRecordCreator catalogRecordCreator, CatalogRecordContributor catalogRecordContributor) { + this.id = id.toString(); + this.title = title; + this.uri = uri.toString(); + this.validationState = validationState; + this.catalogRecordContributor = catalogRecordContributor; + this.catalogRecordCreator = catalogRecordCreator; + this.catalogRecordCreated = catalogRecordCreated; + this.catalogRecordModified = catalogRecordModified; + } } diff --git a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java index 87c09158a..7f171b0b4 100644 --- a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java +++ b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java @@ -152,13 +152,22 @@ protected DataSetModelSwagger findDataSetModelSwagger(String id) throws RmesExce List title = constructLangContent(catalogue_result.getString("titleLg1"), catalogue_result.getString("titleLg2")); Id id1=new Id(catalogue_result.getString("id")); Uri uri = new Uri(catalogue_result.getString("uri")); - DisseminationStatus disseminationStatus = new DisseminationStatus(ontologies_result.getString("labeldisseminationStatusLg1")); + CatalogRecordCreated catalogRecordCreated = new CatalogRecordCreated(catalogue_result.getString("catalogRecordCreated")); CatalogRecordModified catalogRecordModified = new CatalogRecordModified(catalogue_result.getString("catalogRecordModified")); CatalogRecordCreator catalogRecordCreator = new CatalogRecordCreator(catalogue_result.getString("catalogRecordCreator")); CatalogRecordContributor catalogRecordContributor = new CatalogRecordContributor(catalogue_result.getString("catalogRecordContributor")); String validationState = catalogue_result.getString("statutValidation"); - DataSetModelSwagger response = new DataSetModelSwagger(id1, title, uri, validationState, disseminationStatus, catalogRecordCreated,catalogRecordModified,catalogRecordCreator,catalogRecordContributor); + + DisseminationStatus disseminationStatus = null; + DataSetModelSwagger response = null; + if (ontologies_result.has("labeldisseminationStatusLg1")){ + disseminationStatus = new DisseminationStatus(ontologies_result.getString("labeldisseminationStatusLg1")); + response = new DataSetModelSwagger(id1, title, uri, validationState, disseminationStatus, catalogRecordCreated, catalogRecordModified, catalogRecordCreator, catalogRecordContributor); + } else { + response = new DataSetModelSwagger(id1, title, uri, validationState, catalogRecordCreated, catalogRecordModified, catalogRecordCreator, catalogRecordContributor); + } + testPresenceVariablePuisAjout(response,catalogue_result,adms_result,codes_result,organisations_result,structures_result); return response; } else { @@ -524,10 +533,14 @@ private List getWasGeneratedBy(List operationStat) throws RmesE params.put("URI", s.replace(" ", "")); JSONObject wasGeneratedByQuery = repoGestion.getResponseAsObject(buildRequest(Constants.DATASETS_QUERIES_PATH+DATASET_BY_ID_PATH, "getDataSetByIdWasGeneratedBy.ftlh", params)); - List wasGeneratedByTitles = constructLangContent(wasGeneratedByQuery.getString("labelwasGeneratedByLg1"),wasGeneratedByQuery.getString("labelwasGeneratedByLg2")); - IdLabel wasGeneratedByIdLabel = new IdLabel(wasGeneratedByQuery.getString("wasGeneratedById"),wasGeneratedByTitles); - wasGeneratedByIdLabel.setType(wasGeneratedByQuery.getString("typeWasGeneratedBy")); - wasGeneratedBy.add(wasGeneratedByIdLabel); + List wasGeneratedByTitles = null; + IdLabel wasGeneratedByIdLabel = null; + if (wasGeneratedByQuery.has("wasGeneratedById")) { + wasGeneratedByTitles = constructLangContent(wasGeneratedByQuery.getString("labelwasGeneratedByLg1"), wasGeneratedByQuery.getString("labelwasGeneratedByLg2")); + wasGeneratedByIdLabel = new IdLabel(wasGeneratedByQuery.getString("wasGeneratedById"), wasGeneratedByTitles); + wasGeneratedByIdLabel.setType(wasGeneratedByQuery.getString("typeWasGeneratedBy")); + wasGeneratedBy.add(wasGeneratedByIdLabel); + } } return wasGeneratedBy; } From a2791399047f6de369b5e7d4b552171d84e0f85a Mon Sep 17 00:00:00 2001 From: GtanSndil Date: Tue, 3 Mar 2026 14:08:46 +0100 Subject: [PATCH 3/3] feat: dataset/{id} --- .../magma/gestion/old/services/datasets/DataSetsImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java index 7f171b0b4..10d7e038c 100644 --- a/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java +++ b/magma-gestion-impl/src/main/java/fr/insee/rmes/magma/gestion/old/services/datasets/DataSetsImpl.java @@ -1,7 +1,5 @@ package fr.insee.rmes.magma.gestion.old.services.datasets; -import tools.jackson.core.JacksonException; -import tools.jackson.databind.JsonNode; import fr.insee.rmes.magma.gestion.old.datasets.PatchDatasetDTO; import fr.insee.rmes.magma.gestion.old.model.CodeList.Code; import fr.insee.rmes.magma.gestion.old.model.datasets.*; @@ -12,8 +10,6 @@ import fr.insee.rmes.magma.gestion.old.utils.Constants; import fr.insee.rmes.magma.gestion.old.utils.config.Config; import fr.insee.rmes.magma.gestion.old.utils.exceptions.RmesException; -import fr.insee.rmes.magma.gestion.old.model.datasets.*; -import fr.insee.rmes.magma.gestion.old.modelSwagger.dataset.*; import fr.insee.rmes.magma.gestion.security.User; import org.json.JSONArray; import org.json.JSONObject; @@ -25,6 +21,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.web.client.RestClient; +import tools.jackson.core.JacksonException; +import tools.jackson.databind.JsonNode; import tools.jackson.databind.json.JsonMapper; import java.util.*;