diff --git a/pom.xml b/pom.xml index 76566ab2..9e7cfce9 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,7 @@ fr.insee.survey platine-management - 2.4.1 + 2.4.2 platine-management REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java index 453e86ae..9a69690a 100644 --- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java +++ b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java @@ -81,9 +81,8 @@ public int deleteQuestioningsOfOnePartitioning(Partitioning partitioning) { SurveyUnit su = q.getSurveyUnit(); su.getQuestionings().remove(q); surveyUnitService.saveSurveyUnit(su); - q.getQuestioningEvents().stream().forEach(qe -> questioningEventService.deleteQuestioningEvent(qe.getId())); - q.getQuestioningAccreditations().stream() - .forEach(questioningAccreditationService::deleteAccreditation); + q.getQuestioningEvents().forEach(qe -> questioningEventService.deleteQuestioningEvent(qe.getId())); + q.getQuestioningAccreditations().forEach(questioningAccreditationService::deleteAccreditation); deleteQuestioning(q.getId()); nbQuestioningDeleted++; } @@ -101,15 +100,15 @@ public Set findBySurveyUnitIdSu(String idSu) { * * @param baseUrl The base URL for the access. * @param typeUrl The type of URL (V1 or V2). - * @param role The user role (REVIEWER or INTERVIEWER). - * @param questioning The questioning object. - * @param surveyUnitId The survey unit ID. + * @param role The user role (REVIEWER or INTERVIEWER). + * @param questioning The questioning object. + * @param surveyUnitId The survey unit ID. * @return The generated access URL. */ public String getAccessUrl(String baseUrl, String typeUrl, String role, Questioning questioning, String surveyUnitId, String sourceId) { // Set default values if baseUrl or typeUrl is empty baseUrl = StringUtils.defaultIfEmpty(baseUrl, applicationConfig.getQuestioningUrl()); - typeUrl = StringUtils.defaultIfEmpty(typeUrl, V2.name()); + typeUrl = StringUtils.defaultIfEmpty(typeUrl, V3.name()); if (typeUrl.equalsIgnoreCase(V1.name())) { return buildV1Url(baseUrl, role, questioning.getModelName(), surveyUnitId); @@ -125,14 +124,13 @@ public String getAccessUrl(String baseUrl, String typeUrl, String role, Question } - /** * Builds a V1 access URL based on the provided parameters. * * @param baseUrl The base URL for the access. - * @param role The user role (REVIEWER or INTERVIEWER). - * @param campaignId The campaign ID. - * @param surveyUnitId The survey unit ID. + * @param role The user role (REVIEWER or INTERVIEWER). + * @param campaignId The campaign ID. + * @param surveyUnitId The survey unit ID. * @return The generated V1 access URL. */ protected String buildV1Url(String baseUrl, String role, String campaignId, String surveyUnitId) { @@ -147,10 +145,11 @@ protected String buildV1Url(String baseUrl, String role, String campaignId, Stri /** * Builds a V3 access URL based on the provided parameters - * @param baseUrl host url - * @param role - * @param modelName - * @param surveyUnitId + * + * @param baseUrl The base URL for the access. + * @param role The user role (REVIEWER or INTERVIEWER). + * @param modelName The model ID. + * @param surveyUnitId The survey unit ID. * @return The generated V3 access URL. */ @@ -166,11 +165,11 @@ protected String buildV2Url(String baseUrl, String role, String modelName, Strin /** * Builds a V3 access URL based on the provided parameters - * @param baseUrl - * @param role - * @param modelName - * @param surveyUnitId - * @param sourceId + * + * @param baseUrl The base URL for the access. + * @param role The user role (REVIEWER or INTERVIEWER). + * @param modelName The model ID. + * @param surveyUnitId The survey unit ID. * @return The generated V3 access URL. */ protected String buildV3Url(String baseUrl, String role, String modelName, String surveyUnitId, String sourceId, Long questioningId) { @@ -186,4 +185,4 @@ protected String buildV3Url(String baseUrl, String role, String modelName, Strin return ""; } - } +} diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java b/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java index b34a4de8..b5dc0b92 100644 --- a/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java +++ b/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java @@ -1,7 +1,6 @@ package fr.insee.survey.datacollectionmanagement.query.controller; import fr.insee.survey.datacollectionmanagement.constants.Constants; -import fr.insee.survey.datacollectionmanagement.query.service.MoogService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; @@ -22,18 +21,15 @@ class MoogControllerTest { @Autowired - private MockMvc mockMvc; - - @Autowired - private MoogService moogService; - + MockMvc mockMvc; + @Test void getMoogReadOnlyUrl() throws Exception { String idCampaign = "SOURCE12023T01"; String surveyUnitId = "100000000"; this.mockMvc.perform(get(Constants.MOOG_API_READONLY_URL, idCampaign, surveyUnitId)).andDo(print()).andExpect(status().isOk()) - .andExpect(content().string("http://localhost:8081/readonly/questionnaire/m0/unite-enquetee/100000000")); + .andExpect(content().string("http://localhost:8081/v3/review/questionnaire/m0/unite-enquetee/100000000")); }