From 24e9ce619f1420398efecc95a1e8c54ebb1f2fc6 Mon Sep 17 00:00:00 2001 From: Hajarel-moukh Date: Mon, 11 May 2026 13:52:43 +0200 Subject: [PATCH 1/2] add new variable rawRecordDate to response and deprecate fileDate --- .../controller/adapter/LunaticXmlAdapter.java | 1 + .../sources/xml/LunaticXmlDataParser.java | 4 ++- .../xml/LunaticXmlDataSequentialParser.java | 7 ++-- .../sources/xml/LunaticXmlSurveyUnit.java | 2 ++ .../model/surveyunit/SurveyUnitModel.java | 3 ++ .../rawdata/LunaticJsonRawDataService.java | 1 + .../service/rawdata/RawResponseService.java | 1 + .../genesis/domain/utils/DataVerifier.java | 1 + .../surveyunit/SurveyUnitDocument.java | 3 ++ .../adapter/LunaticXmlAdapterTest.java | 12 ++++--- .../model/surveyunit/SurveyUnitModelTest.java | 5 +++ .../SurveyUnitDocumentMapperImplTest.java | 35 +++++++++++++------ 12 files changed, 56 insertions(+), 19 deletions(-) diff --git a/src/main/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapter.java b/src/main/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapter.java index 36339a2ea..18e0f38ed 100644 --- a/src/main/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapter.java +++ b/src/main/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapter.java @@ -73,6 +73,7 @@ private static SurveyUnitModel getStateDataFromSurveyUnit(LunaticXmlSurveyUnit s .mode(mode) .recordDate(Instant.now()) .fileDate(su.getFileDate()) + .rawRecordDate(su.getFileDate()) .build(); return getCollectedDataFromSurveyUnit(su, surveyUnitModel, variablesMap, dataState); diff --git a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataParser.java b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataParser.java index 2c8e3f37c..bbe8db83f 100644 --- a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataParser.java +++ b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataParser.java @@ -68,7 +68,9 @@ public LunaticXmlCampaign parseDataFile(Path filePath) throws GenesisException, if (surveyUnit.getNodeType() == Node.ELEMENT_NODE) { Element surveyUnitElement = (Element) surveyUnit; LunaticXmlSurveyUnit lunaticXmlSurveyUnit = new LunaticXmlSurveyUnit(); - lunaticXmlSurveyUnit.setFileDate(getFileDate(filePath)); + LocalDateTime rawRecordDate = getFileDate(filePath); + lunaticXmlSurveyUnit.setRawRecordDate(rawRecordDate); + lunaticXmlSurveyUnit.setFileDate(rawRecordDate); lunaticXmlSurveyUnit.setId(surveyUnitElement.getElementsByTagName("Id").item(0).getFirstChild().getNodeValue()); lunaticXmlSurveyUnit.setQuestionnaireModelId(surveyUnitElement.getElementsByTagName("QuestionnaireModelId").item(0).getFirstChild().getNodeValue()); Node data = surveyUnitElement.getElementsByTagName("Data").item(0); diff --git a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataSequentialParser.java b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataSequentialParser.java index 96413312e..c54aa800a 100644 --- a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataSequentialParser.java +++ b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlDataSequentialParser.java @@ -24,12 +24,12 @@ * It iterates through the file instead of storing the entire file into memory */ public class LunaticXmlDataSequentialParser{ - private final LocalDateTime fileDate; + private final LocalDateTime rawRecordDate; private final XMLEventReader reader; public LunaticXmlDataSequentialParser(final Path filePath, final InputStream stream) throws IOException, XMLStreamException { - this.fileDate = getFileDate(filePath); + this.rawRecordDate = getFileDate(filePath); XMLInputFactory factory = XMLInputFactory.newInstance(); factory.setProperty(XMLInputFactory.SUPPORT_DTD, false); @@ -90,7 +90,8 @@ public LunaticXmlSurveyUnit readNextSurveyUnit() throws XMLStreamException { */ private LunaticXmlSurveyUnit parseSurveyUnit(final XMLEventReader reader) throws XMLStreamException { LunaticXmlSurveyUnit xmlSurveyUnit = new LunaticXmlSurveyUnit(); - xmlSurveyUnit.setFileDate(this.fileDate); + xmlSurveyUnit.setFileDate(this.rawRecordDate); + xmlSurveyUnit.setRawRecordDate(this.rawRecordDate); LunaticXmlData data = new LunaticXmlData(); diff --git a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java index c09615897..caa136d12 100644 --- a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java +++ b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java @@ -11,6 +11,8 @@ public class LunaticXmlSurveyUnit { private String id; private String questionnaireModelId; + @Deprecated(since = "2026-05-11") private LocalDateTime fileDate; + private LocalDateTime rawRecordDate; private LunaticXmlData data; } diff --git a/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java b/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java index ab48532ca..18658c7e0 100644 --- a/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java +++ b/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java @@ -37,8 +37,11 @@ public class SurveyUnitModel { private RawResponseDto.QuestionnaireStateEnum questionnaireState; private LocalDateTime validationDate; private Instant recordDate; + @Deprecated(since = "2026-05-11") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm") private LocalDateTime fileDate; + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm") + private LocalDateTime rawRecordDate; private List collectedVariables; private List externalVariables; diff --git a/src/main/java/fr/insee/genesis/domain/service/rawdata/LunaticJsonRawDataService.java b/src/main/java/fr/insee/genesis/domain/service/rawdata/LunaticJsonRawDataService.java index 191b98a53..89ee7e3da 100644 --- a/src/main/java/fr/insee/genesis/domain/service/rawdata/LunaticJsonRawDataService.java +++ b/src/main/java/fr/insee/genesis/domain/service/rawdata/LunaticJsonRawDataService.java @@ -299,6 +299,7 @@ public List convertRawData(List rawDat .isCapturedIndirectly(isCapturedIndirectly) .state(dataState) .fileDate(rawData.recordDate()) + .rawRecordDate(rawData.recordDate()) .recordDate(Instant.now()) .collectedVariables(new ArrayList<>()) .externalVariables(new ArrayList<>()) diff --git a/src/main/java/fr/insee/genesis/domain/service/rawdata/RawResponseService.java b/src/main/java/fr/insee/genesis/domain/service/rawdata/RawResponseService.java index 9cbdf12ab..599ec366e 100644 --- a/src/main/java/fr/insee/genesis/domain/service/rawdata/RawResponseService.java +++ b/src/main/java/fr/insee/genesis/domain/service/rawdata/RawResponseService.java @@ -270,6 +270,7 @@ public List convertRawResponse(List rawRespon .isCapturedIndirectly(isCapturedIndirectly) .state(dataState) .fileDate(rawResponseModel.recordDate()) + .rawRecordDate(rawResponseModel.recordDate()) .recordDate(Instant.now()) .collectedVariables(new ArrayList<>()) .externalVariables(new ArrayList<>()) diff --git a/src/main/java/fr/insee/genesis/domain/utils/DataVerifier.java b/src/main/java/fr/insee/genesis/domain/utils/DataVerifier.java index 356d333f1..e5ba1b6d2 100644 --- a/src/main/java/fr/insee/genesis/domain/utils/DataVerifier.java +++ b/src/main/java/fr/insee/genesis/domain/utils/DataVerifier.java @@ -80,6 +80,7 @@ private static SurveyUnitModel createFormattedSurveyUnitModel( .mode(sampleSurveyUnitModel.getMode()) .recordDate(Instant.now().plusSeconds(1)) // Add 1 second to avoid same recordDate as COLLECTED .fileDate(sampleSurveyUnitModel.getFileDate()) + .rawRecordDate(sampleSurveyUnitModel.getRawRecordDate()) .collectedVariables(new ArrayList<>()) .externalVariables(new ArrayList<>()) .build(); diff --git a/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java b/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java index abd258135..80760a9e3 100644 --- a/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java +++ b/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java @@ -1,5 +1,6 @@ package fr.insee.genesis.infrastructure.document.surveyunit; +import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import fr.insee.genesis.Constants; import fr.insee.modelefiliere.RawResponseDto; @@ -46,7 +47,9 @@ public class SurveyUnitDocument { @Indexed private String mode; private Instant recordDate; + @Deprecated(since = "2026-05-11") private LocalDateTime fileDate; + private LocalDateTime rawRecordDate; private List collectedVariables; private List externalVariables; private String modifiedBy; diff --git a/src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java b/src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java index 8d9378e22..1d6948e95 100644 --- a/src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java +++ b/src/test/java/fr/insee/genesis/controller/adapter/LunaticXmlAdapterTest.java @@ -250,18 +250,20 @@ void convert_shouldSetRecordDateCloseToNow() { } @Test - @DisplayName("Should map fileDate from survey unit") - void convert_shouldMapFileDate() { + @DisplayName("Should map rawRecordDate from survey unit") + void convert_shouldMapRawRecordDate() { // GIVEN - LocalDateTime fileDate = LocalDateTime.of(2024, 1, 15, 10, 0); + LocalDateTime rawRecordDate = LocalDateTime.of(2024, 1, 15, 10, 0); LunaticXmlSurveyUnit su = buildSurveyUnit(List.of(collectedDataWithValue("VAR1", "val"))); - su.setFileDate(fileDate); + su.setFileDate(rawRecordDate); + su.setRawRecordDate(rawRecordDate); // WHEN SurveyUnitModel collected = getCollected(LunaticXmlAdapter.convert(su, VARIABLES_MAP, MODE)); // THEN - assertThat(collected.getFileDate()).isEqualTo(fileDate); + assertThat(collected.getFileDate()).isEqualTo(rawRecordDate); + assertThat(collected.getRawRecordDate()).isEqualTo(rawRecordDate); } } diff --git a/src/test/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModelTest.java b/src/test/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModelTest.java index bc4d8f6b7..d16f2d17d 100644 --- a/src/test/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModelTest.java +++ b/src/test/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModelTest.java @@ -56,6 +56,7 @@ void noArgsConstructor_shouldCreateEmptyModel() { assertThat(model.getValidationDate()).isNull(); assertThat(model.getRecordDate()).isNull(); assertThat(model.getFileDate()).isNull(); + assertThat(model.getRawRecordDate()).isNull(); assertThat(model.getCollectedVariables()).isNull(); assertThat(model.getExternalVariables()).isNull(); assertThat(model.getModifiedBy()).isNull(); @@ -94,6 +95,7 @@ void allArgsConstructor_shouldSetAllFields() { now, now.toInstant(ZoneOffset.UTC), now, + now, collected, external, MODIFIED_BY @@ -111,6 +113,7 @@ void allArgsConstructor_shouldSetAllFields() { assertThat(model.getValidationDate()).isEqualTo(now); assertThat(model.getRecordDate()).isEqualTo(now.toInstant(ZoneOffset.UTC)); assertThat(model.getFileDate()).isEqualTo(now); + assertThat(model.getRawRecordDate()).isEqualTo(now); assertThat(model.getCollectedVariables()).isEqualTo(collected); assertThat(model.getExternalVariables()).isEqualTo(external); assertThat(model.getModifiedBy()).isEqualTo(MODIFIED_BY); @@ -144,6 +147,7 @@ void builder_shouldSetAllFields() { .validationDate(now) .recordDate(now.toInstant(ZoneOffset.UTC)) .fileDate(now) + .rawRecordDate(now) .collectedVariables(collected) .externalVariables(external) .modifiedBy(MODIFIED_BY) @@ -161,6 +165,7 @@ void builder_shouldSetAllFields() { assertThat(model.getValidationDate()).isEqualTo(now); assertThat(model.getRecordDate()).isEqualTo(now.toInstant(ZoneOffset.UTC)); assertThat(model.getFileDate()).isEqualTo(now); + assertThat(model.getRawRecordDate()).isEqualTo(now); assertThat(model.getCollectedVariables()).isEqualTo(collected); assertThat(model.getExternalVariables()).isEqualTo(external); assertThat(model.getModifiedBy()).isEqualTo(MODIFIED_BY); diff --git a/src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java b/src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java index 83654af08..29b98dbf0 100644 --- a/src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java +++ b/src/test/java/fr/insee/genesis/infrastructure/mapper/SurveyUnitDocumentMapperImplTest.java @@ -50,7 +50,9 @@ static void init(){ surveyUnitDocumentStatic.setUsualSurveyUnitId(USUAL_SURVEY_UNIT_ID); surveyUnitDocumentStatic.setInterrogationId(INTERROGATION_ID); surveyUnitDocumentStatic.setState("COLLECTED"); - surveyUnitDocumentStatic.setFileDate(LocalDateTime.of(2023,1,1,0,0,0)); + LocalDateTime rawRecordDate = LocalDateTime.of(2023, 1, 1, 0, 0, 0); + surveyUnitDocumentStatic.setFileDate(rawRecordDate); + surveyUnitDocumentStatic.setRawRecordDate(rawRecordDate); List documentExternalVariableList = new ArrayList<>(); VariableDocument externalVariable = new VariableDocument(); @@ -88,7 +90,8 @@ static void init(){ deprecatedSurveyUnitDocumentStatic.setIdUE(ID_UE); deprecatedSurveyUnitDocumentStatic.setInterrogationId(INTERROGATION_ID); deprecatedSurveyUnitDocumentStatic.setState("COLLECTED"); - deprecatedSurveyUnitDocumentStatic.setFileDate(LocalDateTime.of(2023,1,1,0,0,0)); + deprecatedSurveyUnitDocumentStatic.setFileDate(rawRecordDate); + deprecatedSurveyUnitDocumentStatic.setRawRecordDate(rawRecordDate); documentExternalVariableList = new ArrayList<>(); externalVariable = new VariableDocument(); @@ -125,7 +128,8 @@ static void init(){ .interrogationId(INTERROGATION_ID) .collectionInstrumentId(COLLECTION_INSTRUMENT_ID) .state(DataState.COLLECTED) - .fileDate(LocalDateTime.of(2023,1,1,0,0,0)) + .fileDate(rawRecordDate) + .rawRecordDate(rawRecordDate) .recordDate(LocalDateTime.of(2024,1,1,0,0,0).toInstant(ZoneOffset.UTC)) .externalVariables(externalVariableModelList) .collectedVariables(collectedVariableList) @@ -147,13 +151,15 @@ void shouldReturnNull(){ @DisplayName("Should convert survey unit document to model") void shouldReturnModelFromDocument(){ SurveyUnitModel surveyUnit = surveyUnitDocumentMapperImplStatic.documentToModel(surveyUnitDocumentStatic); + LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0); Assertions.assertThat(surveyUnit.getMode()).isEqualTo(Mode.WEB); Assertions.assertThat(surveyUnit.getInterrogationId()).isEqualTo(INTERROGATION_ID); Assertions.assertThat(surveyUnit.getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID); Assertions.assertThat(surveyUnit.getUsualSurveyUnitId()).isEqualTo(USUAL_SURVEY_UNIT_ID); Assertions.assertThat(surveyUnit.getState()).isEqualTo(DataState.COLLECTED); - Assertions.assertThat(surveyUnit.getFileDate()).isEqualTo(LocalDateTime.of(2023,1,1,0,0,0)); + Assertions.assertThat(surveyUnit.getFileDate()).isEqualTo(rawRecordDate); + Assertions.assertThat(surveyUnit.getRawRecordDate()).isEqualTo(rawRecordDate); Assertions.assertThat(surveyUnit.getExternalVariables()).filteredOn(externalVariableModel -> externalVariableModel.varId().equals(VAR_ID) @@ -171,13 +177,15 @@ void shouldReturnModelFromDocument(){ @DisplayName("Should convert deprecated survey unit document to model") void shouldReturnModelFromDeprecatedDocument(){ SurveyUnitModel surveyUnit = surveyUnitDocumentMapperImplStatic.documentToModel(deprecatedSurveyUnitDocumentStatic); + LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0); Assertions.assertThat(surveyUnit.getMode()).isEqualTo(Mode.WEB); Assertions.assertThat(surveyUnit.getInterrogationId()).isEqualTo(INTERROGATION_ID); Assertions.assertThat(surveyUnit.getCollectionInstrumentId()).isEqualTo(QUESTIONNAIRE_ID); Assertions.assertThat(surveyUnit.getUsualSurveyUnitId()).isEqualTo(ID_UE); Assertions.assertThat(surveyUnit.getState()).isEqualTo(DataState.COLLECTED); - Assertions.assertThat(surveyUnit.getFileDate()).isEqualTo(LocalDateTime.of(2023,1,1,0,0,0)); + Assertions.assertThat(surveyUnit.getFileDate()).isEqualTo(rawRecordDate); + Assertions.assertThat(surveyUnit.getRawRecordDate()).isEqualTo(rawRecordDate); Assertions.assertThat(surveyUnit.getExternalVariables()).filteredOn(externalVariableModel -> externalVariableModel.varId().equals(VAR_ID) @@ -195,12 +203,14 @@ void shouldReturnModelFromDeprecatedDocument(){ @DisplayName("Should convert survey unit model to document") void shouldReturnDocumentFromModel(){ SurveyUnitDocument surveyUnitDocument = surveyUnitDocumentMapperImplStatic.modelToDocument(surveyUnitStatic); + LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0); Assertions.assertThat(surveyUnitDocument.getMode()).isEqualTo(MODE); Assertions.assertThat(surveyUnitDocument.getInterrogationId()).isEqualTo(INTERROGATION_ID); Assertions.assertThat(surveyUnitDocument.getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID); Assertions.assertThat(surveyUnitDocument.getState()).isEqualTo("COLLECTED"); - Assertions.assertThat(surveyUnitDocument.getFileDate()).isEqualTo(LocalDateTime.of(2023,1,1,0,0,0)); + Assertions.assertThat(surveyUnitDocument.getFileDate()).isEqualTo(rawRecordDate); + Assertions.assertThat(surveyUnitDocument.getRawRecordDate()).isEqualTo(rawRecordDate); Assertions.assertThat(surveyUnitDocument.getExternalVariables()).filteredOn(externalVariableDocument -> externalVariableDocument.getVarId().equals(VAR_ID) @@ -222,13 +232,15 @@ void shouldReturnModelListFromDocumentList(){ surveyUnitDocumentList.add(surveyUnitDocumentStatic); List surveyUnitList = surveyUnitDocumentMapperImplStatic.listDocumentToListModel(surveyUnitDocumentList); + LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0); Assertions.assertThat(surveyUnitList.getFirst().getMode()).isEqualTo(Mode.WEB); Assertions.assertThat(surveyUnitList.getFirst().getInterrogationId()).isEqualTo(INTERROGATION_ID); Assertions.assertThat(surveyUnitList.getFirst().getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID); Assertions.assertThat(surveyUnitList.getFirst().getUsualSurveyUnitId()).isEqualTo(USUAL_SURVEY_UNIT_ID); Assertions.assertThat(surveyUnitList.getFirst().getState()).isEqualTo(DataState.COLLECTED); - Assertions.assertThat(surveyUnitList.getFirst().getFileDate()).isEqualTo(LocalDateTime.of(2023,1,1,0,0,0)); + Assertions.assertThat(surveyUnitList.getFirst().getFileDate()).isEqualTo(rawRecordDate); + Assertions.assertThat(surveyUnitList.getFirst().getRawRecordDate()).isEqualTo(rawRecordDate); Assertions.assertThat(surveyUnitList.getFirst().getExternalVariables()).filteredOn(externalVariableModel -> externalVariableModel.varId().equals(VAR_ID) @@ -248,13 +260,15 @@ void shouldReturnModelListFromDeprecatedDocumentList(){ surveyUnitDocumentList.add(deprecatedSurveyUnitDocumentStatic); List surveyUnitList = surveyUnitDocumentMapperImplStatic.listDocumentToListModel(surveyUnitDocumentList); + LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0); Assertions.assertThat(surveyUnitList.getFirst().getMode()).isEqualTo(Mode.WEB); Assertions.assertThat(surveyUnitList.getFirst().getInterrogationId()).isEqualTo(INTERROGATION_ID); Assertions.assertThat(surveyUnitList.getFirst().getCollectionInstrumentId()).isEqualTo(QUESTIONNAIRE_ID); Assertions.assertThat(surveyUnitList.getFirst().getUsualSurveyUnitId()).isEqualTo(ID_UE); Assertions.assertThat(surveyUnitList.getFirst().getState()).isEqualTo(DataState.COLLECTED); - Assertions.assertThat(surveyUnitList.getFirst().getFileDate()).isEqualTo(LocalDateTime.of(2023,1,1,0,0,0)); + Assertions.assertThat(surveyUnitList.getFirst().getFileDate()).isEqualTo(rawRecordDate); + Assertions.assertThat(surveyUnitList.getFirst().getRawRecordDate()).isEqualTo(rawRecordDate); Assertions.assertThat(surveyUnitList.getFirst().getExternalVariables()).filteredOn(externalVariableModel -> externalVariableModel.varId().equals(VAR_ID) @@ -274,12 +288,13 @@ void shouldReturnDocumentListFromModelList(){ surveyUnitList.add(surveyUnitStatic); List surveyUnitDocumentList = surveyUnitDocumentMapperImplStatic.listModelToListDocument(surveyUnitList); - + LocalDateTime rawRecordDate = LocalDateTime.of(2023,1,1,0,0,0); Assertions.assertThat(surveyUnitDocumentList.getFirst().getMode()).isEqualTo(MODE); Assertions.assertThat(surveyUnitDocumentList.getFirst().getInterrogationId()).isEqualTo(INTERROGATION_ID); Assertions.assertThat(surveyUnitDocumentList.getFirst().getCollectionInstrumentId()).isEqualTo(COLLECTION_INSTRUMENT_ID); Assertions.assertThat(surveyUnitDocumentList.getFirst().getState()).isEqualTo("COLLECTED"); - Assertions.assertThat(surveyUnitDocumentList.getFirst().getFileDate()).isEqualTo(LocalDateTime.of(2023,1,1,0,0,0)); + Assertions.assertThat(surveyUnitDocumentList.getFirst().getFileDate()).isEqualTo(rawRecordDate); + Assertions.assertThat(surveyUnitDocumentList.getFirst().getRawRecordDate()).isEqualTo(rawRecordDate); Assertions.assertThat(surveyUnitDocumentList.getFirst().getExternalVariables()).filteredOn(externalVariableDocument -> externalVariableDocument.getVarId().equals(VAR_ID) From 082f9e0647e0c5ecf0437b6654a81408008bcc48 Mon Sep 17 00:00:00 2001 From: Hajarel-moukh Date: Mon, 11 May 2026 15:10:40 +0200 Subject: [PATCH 2/2] update changelog and add javadoc to fix sonar issues --- CHANGELOG.md | 7 +++++++ .../controller/sources/xml/LunaticXmlSurveyUnit.java | 4 ++++ .../genesis/domain/model/surveyunit/SurveyUnitModel.java | 4 ++++ .../document/surveyunit/SurveyUnitDocument.java | 4 ++++ 4 files changed, 19 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b832fcd7b..ab11a6033 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 2.6.2 [TODO] +### Changed +- Renamed `fileDate` to `rawRecordDate` in `response` documents to clarify that it represents the original raw record date. + +### Deprecated +- Deprecated `fileDate` in `response` documents. It is still populated with the same value as `rawRecordDate` for backward compatibility. + ## 2.6.1 [2026-04-29] ### Fixed - Fixed V1 schedules endpoint returning an empty list when V1 schedules have a null `partitionId`. diff --git a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java index caa136d12..c6cc3a95b 100644 --- a/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java +++ b/src/main/java/fr/insee/genesis/controller/sources/xml/LunaticXmlSurveyUnit.java @@ -11,6 +11,10 @@ public class LunaticXmlSurveyUnit { private String id; private String questionnaireModelId; + /** + * @deprecated use {@link #rawRecordDate} instead. + * This field is kept temporarily for backward compatibility and will be removed in a future version. + */ @Deprecated(since = "2026-05-11") private LocalDateTime fileDate; private LocalDateTime rawRecordDate; diff --git a/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java b/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java index 18658c7e0..61f162018 100644 --- a/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java +++ b/src/main/java/fr/insee/genesis/domain/model/surveyunit/SurveyUnitModel.java @@ -37,6 +37,10 @@ public class SurveyUnitModel { private RawResponseDto.QuestionnaireStateEnum questionnaireState; private LocalDateTime validationDate; private Instant recordDate; + /** + * @deprecated use {@link #rawRecordDate} instead. + * This field is kept temporarily for backward compatibility and will be removed in a future version. + */ @Deprecated(since = "2026-05-11") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'hh:mm") private LocalDateTime fileDate; diff --git a/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java b/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java index 80760a9e3..f90cd0096 100644 --- a/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java +++ b/src/main/java/fr/insee/genesis/infrastructure/document/surveyunit/SurveyUnitDocument.java @@ -47,6 +47,10 @@ public class SurveyUnitDocument { @Indexed private String mode; private Instant recordDate; + /** + * @deprecated use {@link #rawRecordDate} instead. + * This field is kept temporarily for backward compatibility and will be removed in a future version. + */ @Deprecated(since = "2026-05-11") private LocalDateTime fileDate; private LocalDateTime rawRecordDate;