diff --git a/.github/workflows/ci-rc.yml b/.github/workflows/ci-rc.yml
index f383a84c..77c033c4 100644
--- a/.github/workflows/ci-rc.yml
+++ b/.github/workflows/ci-rc.yml
@@ -9,14 +9,14 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK 21
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build with Maven
- run: mvn -B clean package
+ run: mvn -B clean package --no-transfer-progress
- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.20.0
with:
@@ -26,10 +26,10 @@ jobs:
vuln-type: 'os,library'
severity: 'CRITICAL,HIGH'
- name: Upload jar
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
- name: jar
- path: target/*.jar
+ name: app-jar
+ path: platine-management-api/target/*.jar
get_version:
needs: build
@@ -40,7 +40,7 @@ jobs:
version: ${{steps.version.outputs.version}}
steps:
- name: Checkout current branch
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Get current version
@@ -53,7 +53,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: softprops/action-gh-release@v1
@@ -72,15 +72,15 @@ jobs:
needs: get_version
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Download jar
id: download
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@v4
with:
- name: jar
- path: target
+ name: app-jar
+ path: platine-management-api/target
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
@@ -90,7 +90,7 @@ jobs:
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
- context: .
+ context: platine-management-api
push: true
tags: |
inseefr/platine-management-back-office:${{ needs.get_version.outputs.version }}-rc
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b1045841..f8f1153b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -9,19 +9,19 @@ jobs:
name: Build
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
- name: Set up JDK 21
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Build with Maven
- run: mvn -B clean package
+ run: mvn -B clean package --no-transfer-progress
- name: Upload jar
- uses: actions/upload-artifact@v3
+ uses: actions/upload-artifact@v4
with:
- name: jar
- path: target/*.jar
+ name: app-jar
+ path: platine-management-api/target/*.jar
get_version:
needs: build
@@ -32,7 +32,7 @@ jobs:
version: ${{steps.version.outputs.version}}
steps:
- name: Checkout current branch
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Get current version
@@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout current branch
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: softprops/action-gh-release@v1
@@ -62,15 +62,15 @@ jobs:
needs: get_version
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Download jar
id: download
- uses: actions/download-artifact@v3
+ uses: actions/download-artifact@v4
with:
- name: jar
- path: target
+ name: app-jar
+ path: platine-management-api/target
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/login-action@v2
@@ -80,7 +80,7 @@ jobs:
- uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64
- context: .
+ context: platine-management-api
push: true
tags: |
inseefr/platine-management-back-office:${{ needs.get_version.outputs.version }}
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
index 96fafd5a..dfe63560 100644
--- a/.github/workflows/sonar.yml
+++ b/.github/workflows/sonar.yml
@@ -12,11 +12,11 @@ jobs:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 21
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
diff --git a/.github/workflows/trivy.yml b/.github/workflows/trivy.yml
index 92f121b9..70a5a84f 100644
--- a/.github/workflows/trivy.yml
+++ b/.github/workflows/trivy.yml
@@ -12,19 +12,21 @@ jobs:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 21
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: 21
distribution: 'temurin'
- name: Run Trivy vulnerability scanner
- uses: aquasecurity/trivy-action@0.20.0
+ uses: aquasecurity/trivy-action@0.28.0
+ env:
+ TRIVY_DB_REPOSITORY: public.ecr.aws/aquasecurity/trivy-db:2
with:
format: 'table'
scan-type: 'repo'
exit-code: '1'
vuln-type: 'os,library'
- severity: 'CRITICAL,HIGH'
\ No newline at end of file
+ severity: 'CRITICAL,HIGH'
diff --git a/.gitignore b/.gitignore
index 2045b9ff..61318ab0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,4 +33,9 @@ build/
### VS Code ###
.vscode/
-src/main/resources/application-*.properties
+
+logs
+**/.flattened-pom.xml
+**/src/main/resources/application-*.yaml
+**/src/main/resources/application-*.yml
+**/src/main/resources/application-*.properties
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 1e044d0a..00000000
--- a/Dockerfile
+++ /dev/null
@@ -1,14 +0,0 @@
-FROM eclipse-temurin:21.0.2_13-jre-alpine
-
-WORKDIR /opt/app/
-COPY ./target/*.jar /opt/app/app.jar
-
-# Setup a non-root user context (security)
-RUN addgroup -g 1000 tomcatgroup
-RUN adduser -D -s / -u 1000 tomcatuser -G tomcatgroup
-RUN mkdir /opt/app/temp-files
-RUN chown -R 1000:1000 /opt/app
-
-USER 1000
-
-ENTRYPOINT ["java", "-jar", "/opt/app/app.jar"]
diff --git a/docs/MDD Platine.pdf b/docs/MDD Platine.pdf
deleted file mode 100644
index 81462d9d..00000000
Binary files a/docs/MDD Platine.pdf and /dev/null differ
diff --git a/docs/di_pg_sicpilbo_dv03 - MDD.png b/docs/di_pg_sicpilbo_dv03 - MDD.png
new file mode 100644
index 00000000..caf12b22
Binary files /dev/null and b/docs/di_pg_sicpilbo_dv03 - MDD.png differ
diff --git a/docs/metadata.jpg b/docs/metadata.jpg
deleted file mode 100644
index bad36c59..00000000
Binary files a/docs/metadata.jpg and /dev/null differ
diff --git a/docs/questioning.jpg b/docs/questioning.jpg
deleted file mode 100644
index 79ecb036..00000000
Binary files a/docs/questioning.jpg and /dev/null differ
diff --git a/docs/user.jpg b/docs/user.jpg
deleted file mode 100644
index c9dead5b..00000000
Binary files a/docs/user.jpg and /dev/null differ
diff --git a/docs/view.jpg b/docs/view.jpg
deleted file mode 100644
index f90b9315..00000000
Binary files a/docs/view.jpg and /dev/null differ
diff --git a/platine-management-api/Dockerfile b/platine-management-api/Dockerfile
new file mode 100644
index 00000000..14bf3335
--- /dev/null
+++ b/platine-management-api/Dockerfile
@@ -0,0 +1,20 @@
+FROM eclipse-temurin:21.0.4_7-jre-alpine
+
+ENV PATH_TO_JAR=/opt/app/app.jar
+WORKDIR /opt/app/
+COPY ./target/*.jar $PATH_TO_JAR
+
+ENV JAVA_TOOL_OPTIONS_DEFAULT \
+ -XX:MaxRAMPercentage=75
+
+# Setup a non-root user context (security)
+RUN addgroup -g 1000 tomcatgroup
+RUN adduser -D -s / -u 1000 tomcatuser -G tomcatgroup
+RUN mkdir /opt/app/temp-files
+RUN chown -R 1000:1000 /opt/app
+
+USER 1000
+
+ENTRYPOINT [ "/bin/sh", "-c", \
+ "export JAVA_TOOL_OPTIONS=\"$JAVA_TOOL_OPTIONS_DEFAULT $JAVA_TOOL_OPTIONS\"; \
+ exec java -jar $PATH_TO_JAR" ]
\ No newline at end of file
diff --git a/platine-management-api/pom.xml b/platine-management-api/pom.xml
new file mode 100644
index 00000000..0d628332
--- /dev/null
+++ b/platine-management-api/pom.xml
@@ -0,0 +1,193 @@
+
+
+ 4.0.0
+
+ fr.insee.survey
+ platine-management
+ ${revision}${changelist}
+
+
+ platine-management-api
+
+
+ 2.6.0
+ 3.1.0
+ 7.18.0
+
+
+
+
+ fr.insee.survey
+ platine-management-shared
+ ${project.version}
+
+
+
+ fr.insee.survey
+ platine-management-service
+ ${project.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+ org.springframework.boot
+ spring-boot-starter-tomcat
+
+
+ org.springframework.boot
+ spring-boot-devtools
+ runtime
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-mail
+
+
+ org.springdoc
+ springdoc-openapi-starter-webmvc-ui
+ ${springdoc-version}
+
+
+
+ jakarta.ws.rs
+ jakarta.ws.rs-api
+ ${jakarta-version}
+
+
+
+ com.fasterxml.jackson.dataformat
+ jackson-dataformat-xml
+
+
+ jakarta.xml.bind
+ jakarta.xml.bind-api
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-oauth2-resource-server
+
+
+ org.springframework.boot
+ spring-boot-starter-security
+
+
+ org.springframework.security
+ spring-security-oauth2-client
+
+
+
+
+ org.junit.platform
+ junit-platform-suite
+ test
+
+
+ io.cucumber
+ cucumber-java
+ ${cucumber.version}
+ test
+
+
+ io.cucumber
+ cucumber-spring
+ ${cucumber.version}
+
+
+ io.cucumber
+ cucumber-junit-platform-engine
+ ${cucumber.version}
+
+
+
+
+ org.springframework.security
+ spring-security-test
+ test
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ org.springframework.boot
+ spring-boot-starter-actuator
+
+
+
+
+ io.micrometer
+ micrometer-registry-prometheus
+
+
+
+ com.h2database
+ h2
+ test
+
+
+
+
+
+
+ coverage
+
+
+
+ org.jacoco
+ jacoco-maven-plugin
+ 0.8.12
+
+
+ report-aggregate
+
+ report-aggregate
+
+
+ true
+
+ verify
+
+
+
+
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+
+
+ build-info
+
+ build-info
+
+
+
+
+
+
+ org.projectlombok
+ lombok
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplication.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplication.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplication.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplication.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/ApplicationConfig.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/ApplicationConfig.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/ApplicationConfig.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/ApplicationConfig.java
index bbbac362..63080579 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/ApplicationConfig.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/ApplicationConfig.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
import lombok.Getter;
import lombok.Setter;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/CorsGlobalConfig.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/CorsGlobalConfig.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/CorsGlobalConfig.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/CorsGlobalConfig.java
index 0c1cf9d2..775efed6 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/CorsGlobalConfig.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/CorsGlobalConfig.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/ForwardedHeaderFilterBean.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/ForwardedHeaderFilterBean.java
similarity index 84%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/ForwardedHeaderFilterBean.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/ForwardedHeaderFilterBean.java
index 7f928509..1df5b579 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/ForwardedHeaderFilterBean.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/ForwardedHeaderFilterBean.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
import org.springframework.context.annotation.Bean;
import org.springframework.web.filter.ForwardedHeaderFilter;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/LogInterceptor.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/LogInterceptor.java
similarity index 88%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/LogInterceptor.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/LogInterceptor.java
index 53415cc2..84b2b934 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/LogInterceptor.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/LogInterceptor.java
@@ -1,6 +1,6 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthenticationUserHelper;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthenticationUserHelper;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
@@ -42,6 +42,7 @@ public boolean preHandle(HttpServletRequest request, HttpServletResponse respons
@Override
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView mv) {
+ // no need to posthandle things for this interceptor
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/MapperConfiguration.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/MapperConfiguration.java
similarity index 82%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/MapperConfiguration.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/MapperConfiguration.java
index 13038818..c9bbbfb0 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/MapperConfiguration.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/MapperConfiguration.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
import org.modelmapper.ModelMapper;
import org.springframework.context.annotation.Bean;
diff --git a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/OpenAPIConfiguration.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/OpenAPIConfiguration.java
new file mode 100644
index 00000000..858e12c7
--- /dev/null
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/OpenAPIConfiguration.java
@@ -0,0 +1,58 @@
+package fr.insee.survey.datacollectionmanagement.configuration;
+
+
+import fr.insee.survey.datacollectionmanagement.constants.AuthConstants;
+import io.swagger.v3.oas.models.Components;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Info;
+import io.swagger.v3.oas.models.security.*;
+import lombok.RequiredArgsConstructor;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.boot.info.BuildProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Arrays;
+
+
+@Configuration
+@ConditionalOnProperty(name = "springdoc.swagger-ui.enabled", havingValue = "true", matchIfMissing = true)
+@RequiredArgsConstructor
+public class OpenAPIConfiguration {
+
+ private final BuildProperties buildProperties;
+
+ private final ApplicationConfig applicationConfig;
+
+
+ @Bean public OpenAPI customOpenAPI() {
+
+ if (applicationConfig.getAuthType().equals(AuthConstants.OIDC)) {
+ OAuthFlows flows = getoAuthFlows();
+
+ return new OpenAPI()
+ .components(
+ new Components().addSecuritySchemes("oauth2", new SecurityScheme().type(SecurityScheme.Type.OAUTH2).flows(flows)))
+ .info(new Info().title(buildProperties.getName()).version(buildProperties.getVersion()))
+ .addSecurityItem(new SecurityRequirement().addList("oauth2", Arrays.asList("read", "write")));
+ }
+ return new OpenAPI()
+ .info(new Info().title(buildProperties.getName()).version(buildProperties.getVersion()));
+
+ }
+
+ private OAuthFlows getoAuthFlows() {
+ OAuthFlows flows = new OAuthFlows();
+ OAuthFlow flow = new OAuthFlow();
+
+ flow.setAuthorizationUrl(applicationConfig.getKeyCloakUrl() + "/realms/" + applicationConfig.getKeycloakRealm() + "/protocol/openid-connect/auth");
+ flow.setTokenUrl(applicationConfig.getKeyCloakUrl() + "/realms/" + applicationConfig.getKeycloakRealm() + "/protocol/openid-connect/token");
+ Scopes scopes = new Scopes();
+ flow.setScopes(scopes);
+ flows = flows.authorizationCode(flow);
+ return flows;
+ }
+
+
+}
+
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/PropertyLogger.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/PropertyLogger.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/PropertyLogger.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/PropertyLogger.java
index e7e44c8d..b5432164 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/PropertyLogger.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/PropertyLogger.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
import lombok.extern.slf4j.Slf4j;
@@ -29,7 +29,7 @@ public void handleContextRefresh(ContextRefreshedEvent event) {
log.info("================================ Properties ================================");
final MutablePropertySources sources = ((AbstractEnvironment) env).getPropertySources();
StreamSupport.stream(sources.spliterator(), false)
- .filter(ps -> ps instanceof EnumerablePropertySource)
+ .filter(EnumerablePropertySource.class::isInstance)
.map(ps -> ((EnumerablePropertySource>) ps).getPropertyNames())
.flatMap(Arrays::stream)
.distinct()
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/WebConfig.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/WebConfig.java
similarity index 69%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/WebConfig.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/WebConfig.java
index 5a168a94..4b862d8f 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/WebConfig.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/WebConfig.java
@@ -1,6 +1,6 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthenticationUserHelper;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthenticationUserHelper;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -13,6 +13,8 @@ public class WebConfig implements WebMvcConfigurer {
private final AuthenticationUserHelper authenticationUserHelper;
+ private final ApplicationConfig applicationConfig;
+
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(this.myLogInterceptor());
@@ -23,4 +25,8 @@ public LogInterceptor myLogInterceptor() {
return new LogInterceptor(authenticationUserHelper);
}
+ @Bean
+ public String questioningUrl() {
+ return applicationConfig.getQuestioningUrl();
+ }
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/DefaultSecurityContext.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/DefaultSecurityContext.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/DefaultSecurityContext.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/DefaultSecurityContext.java
index 4a1bfbb7..cdd5cddf 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/DefaultSecurityContext.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/DefaultSecurityContext.java
@@ -1,6 +1,6 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.security;
+package fr.insee.survey.datacollectionmanagement.configuration.auth.security;
-import fr.insee.survey.datacollectionmanagement.config.ApplicationConfig;
+import fr.insee.survey.datacollectionmanagement.configuration.ApplicationConfig;
import lombok.AllArgsConstructor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/GrantedAuthorityConverter.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/GrantedAuthorityConverter.java
similarity index 51%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/GrantedAuthorityConverter.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/GrantedAuthorityConverter.java
index 4f3b4fdb..aac51c7e 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/GrantedAuthorityConverter.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/GrantedAuthorityConverter.java
@@ -1,7 +1,7 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.security;
+package fr.insee.survey.datacollectionmanagement.configuration.auth.security;
-import fr.insee.survey.datacollectionmanagement.config.ApplicationConfig;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.ApplicationConfig;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.springframework.core.convert.converter.Converter;
@@ -15,12 +15,12 @@
@AllArgsConstructor
public class GrantedAuthorityConverter implements Converter> {
- private final Map grantedRoles;
+ private final Map> roles;
ApplicationConfig applicationConfig;
public GrantedAuthorityConverter(ApplicationConfig applicationConfig) {
this.applicationConfig = applicationConfig;
- this.grantedRoles = new HashMap<>();
+ this.roles = new HashMap<>();
fillGrantedRoles(applicationConfig.getRoleAdmin(), AuthorityRoleEnum.ADMIN);
fillGrantedRoles(applicationConfig.getRoleRespondent(), AuthorityRoleEnum.RESPONDENT);
fillGrantedRoles(applicationConfig.getRoleInternalUser(), AuthorityRoleEnum.INTERNAL_USER);
@@ -31,23 +31,37 @@ public GrantedAuthorityConverter(ApplicationConfig applicationConfig) {
@Override
public Collection convert(@NonNull Jwt jwt) {
Map claims = jwt.getClaims();
- List roles = (List) claims.get(applicationConfig.getRoleClaim());
+ List userRoles = (List) claims.get(applicationConfig.getRoleClaim());
- return roles.stream()
+ if(userRoles == null) {
+ return new ArrayList<>();
+ }
+
+ return userRoles.stream()
.filter(Objects::nonNull)
.filter(role -> !role.isBlank())
- .filter(grantedRoles::containsKey)
- .map(grantedRoles::get)
+ .filter(roles::containsKey)
+ .map(roles::get)
+ .flatMap(Collection::stream)
+ .distinct()
.collect(Collectors.toCollection(ArrayList::new));
}
- private void fillGrantedRoles(List listRoles, AuthorityRoleEnum roleEnum) {
+ private void fillGrantedRoles(List configRoles, AuthorityRoleEnum authorityRole) {
- for (String role : listRoles ) {
- this.grantedRoles.putIfAbsent(role,
- new SimpleGrantedAuthority(roleEnum.securityRole()));
- }
+ for (String configRole : configRoles ) {
+ if(configRole == null || configRole.isBlank()) {
+ return;
+ }
+ this.roles.compute(configRole, (key, grantedAuthorities) -> {
+ if(grantedAuthorities == null) {
+ grantedAuthorities = new ArrayList<>();
+ }
+ grantedAuthorities.add(new SimpleGrantedAuthority(authorityRole.securityRole()));
+ return grantedAuthorities;
+ });
+ }
}
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/OpenIDConnectSecurityContext.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/OpenIDConnectSecurityContext.java
similarity index 96%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/OpenIDConnectSecurityContext.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/OpenIDConnectSecurityContext.java
index 78c89251..40139cf9 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/OpenIDConnectSecurityContext.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/OpenIDConnectSecurityContext.java
@@ -1,6 +1,6 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.security;
+package fr.insee.survey.datacollectionmanagement.configuration.auth.security;
-import fr.insee.survey.datacollectionmanagement.config.ApplicationConfig;
+import fr.insee.survey.datacollectionmanagement.configuration.ApplicationConfig;
import fr.insee.survey.datacollectionmanagement.constants.AuthConstants;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import lombok.RequiredArgsConstructor;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/PublicSecurityFilterChain.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/PublicSecurityFilterChain.java
similarity index 96%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/PublicSecurityFilterChain.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/PublicSecurityFilterChain.java
index 048a7e54..9ef60f25 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/security/PublicSecurityFilterChain.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/PublicSecurityFilterChain.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.security;
+package fr.insee.survey.datacollectionmanagement.configuration.auth.security;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthenticationUserHelper.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/user/AuthenticationUserHelper.java
similarity index 82%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthenticationUserHelper.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/user/AuthenticationUserHelper.java
index 710a6f22..08819bfb 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthenticationUserHelper.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/user/AuthenticationUserHelper.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.user;
+package fr.insee.survey.datacollectionmanagement.configuration.auth.user;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthorityPrivileges.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/user/AuthorityPrivileges.java
similarity index 90%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthorityPrivileges.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/user/AuthorityPrivileges.java
index 148227a3..cd375b75 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthorityPrivileges.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/configuration/auth/user/AuthorityPrivileges.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.user;
+package fr.insee.survey.datacollectionmanagement.configuration.auth.user;
public class AuthorityPrivileges {
private AuthorityPrivileges() {
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/constants/Constants.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/constants/Constants.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/constants/Constants.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/constants/Constants.java
index b8eebae8..a6a2e133 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/constants/Constants.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/constants/Constants.java
@@ -31,6 +31,8 @@ private Constants() {
//API QUESTIONING DOMAIN
public static final String API_QUESTIONINGS = "/api/questionings";
public static final String API_QUESTIONINGS_ID = "/api/questionings/{id}";
+ public static final String API_QUESTIONINGS_SEARCH = "/api/questionings/search";
+
public static final String API_SURVEY_UNITS ="/api/survey-units";
public static final String API_SURVEY_UNITS_ID = "/api/survey-units/{id}";
public static final String API_SURVEY_UNITS_ID_QUESTIONINGS = "/api/survey-units/{id}/questionings";
@@ -40,6 +42,10 @@ private Constants() {
public static final String API_QUESTIONING_QUESTIONING_EVENTS = "/api/questionings/questioning-events";
public static final String API_QUESTIONING_ID_QUESTIONING_EVENTS = "/api/questionings/{id}/questioning-events";
public static final String API_QUESTIONING_QUESTIONING_EVENTS_ID = "/api/questionings/questioning-events/{id}";
+ public static final String API_QUESTIONING_ID_QUESTIONING_COMMUNICATIONS = "/api/questionings/{id}/questioning-communications";
+ public static final String API_QUESTIONING_ID_COMMENT = "/api/questionings/{id}/comment";
+
+
public static final String API_MAIN_CONTACT = "/api/main-contact";
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressController.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressController.java
index 2da362aa..381e51cd 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressController.java
@@ -1,105 +1,105 @@
-package fr.insee.survey.datacollectionmanagement.contact.controller;
-
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
-import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
-import fr.insee.survey.datacollectionmanagement.contact.dto.AddressDto;
-import fr.insee.survey.datacollectionmanagement.contact.service.AddressService;
-import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
-import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
-import fr.insee.survey.datacollectionmanagement.contact.util.PayloadUtil;
-import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Pageable;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.security.core.Authentication;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
-import java.util.List;
-
-@RestController
-@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
-@Tag(name = "1 - Contacts", description = "Enpoints to create, update, delete and find contacts")
-@Slf4j
-@RequiredArgsConstructor
-public class AddressController {
-
- private final AddressService addressService;
-
- private final ContactService contactService;
-
- private final ContactEventService contactEventService;
-
- /**
- * @deprecated
- */
- @Operation(summary = "Search for a contact address by the contact id")
- @GetMapping(value = Constants.API_CONTACTS_ID_ADDRESS, produces = "application/json")
- @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
- @Deprecated(since="2.6.0", forRemoval=true)
- public ResponseEntity getContactAddress(@PathVariable("id") String id) {
- Contact contact = contactService.findByIdentifier(id);
- if (contact.getAddress() != null)
- return ResponseEntity.status(HttpStatus.OK)
- .body(addressService.convertToDto(contact.getAddress()));
- else throw new NotFoundException(String.format("No address found for contact %s", id));
-
-
- }
-
- @Operation(summary = "Update or create an address by the contact id")
- @PutMapping(value = Constants.API_CONTACTS_ID_ADDRESS, produces = "application/json", consumes = "application/json")
- @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
- public ResponseEntity putAddress(@PathVariable("id") String id,
- @RequestBody AddressDto addressDto,
- Authentication auth) {
- Contact contact = contactService.findByIdentifier(id);
- HttpStatus httpStatus;
- Address addressUpdate;
- Address address = addressService.convertToEntity(addressDto);
- HttpHeaders responseHeaders = new HttpHeaders();
- responseHeaders.set(HttpHeaders.LOCATION, ServletUriComponentsBuilder.fromCurrentRequest().toUriString());
-
- if (contact.getAddress() != null) {
- log.info("Update address for the contact {} ", id);
- address.setId(contact.getAddress().getId());
- addressUpdate = addressService.saveAddress(address);
- httpStatus = HttpStatus.OK;
- } else {
- log.info("Create address for the contact {} ", id);
- addressUpdate = addressService.saveAddress(address);
- contact.setAddress(addressUpdate);
- contactService.saveContact(contact);
- httpStatus = HttpStatus.CREATED;
- }
- PayloadUtil.getPayloadAuthor(auth.getName());
- ContactEvent contactEventUpdate = contactEventService.createContactEvent(contact, ContactEventType.update,
- null);
- contactEventService.saveContactEvent(contactEventUpdate);
- return ResponseEntity.status(httpStatus).headers(responseHeaders)
- .body(addressService.convertToDto(addressUpdate));
-
-
- }
-
- class AddressPage extends PageImpl {
-
- private static final long serialVersionUID = -5570255373624396569L;
-
- public AddressPage(List content, Pageable pageable, long total) {
- super(content, pageable, total);
- }
- }
-
-}
+package fr.insee.survey.datacollectionmanagement.contact.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
+import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
+import fr.insee.survey.datacollectionmanagement.contact.dto.AddressDto;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
+import fr.insee.survey.datacollectionmanagement.contact.service.AddressService;
+import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
+import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
+import fr.insee.survey.datacollectionmanagement.contact.util.PayloadUtil;
+import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.Authentication;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.util.List;
+
+@RestController
+@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
+@Tag(name = "1 - Contacts", description = "Enpoints to create, update, delete and find contacts")
+@Slf4j
+@RequiredArgsConstructor
+public class AddressController {
+
+ private final AddressService addressService;
+
+ private final ContactService contactService;
+
+ private final ContactEventService contactEventService;
+
+ /**
+ * @deprecated
+ */
+ @Operation(summary = "Search for a contact address by the contact id")
+ @GetMapping(value = Constants.API_CONTACTS_ID_ADDRESS, produces = "application/json")
+ @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
+ @Deprecated(since="2.6.0", forRemoval=true)
+ public ResponseEntity getContactAddress(@PathVariable("id") String id) {
+ Contact contact = contactService.findByIdentifier(id);
+ if (contact.getAddress() != null)
+ return ResponseEntity.status(HttpStatus.OK)
+ .body(addressService.convertToDto(contact.getAddress()));
+ else throw new NotFoundException(String.format("No address found for contact %s", id));
+
+
+ }
+
+ @Operation(summary = "Update or create an address by the contact id")
+ @PutMapping(value = Constants.API_CONTACTS_ID_ADDRESS, produces = "application/json", consumes = "application/json")
+ @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
+ public ResponseEntity putAddress(@PathVariable("id") String id,
+ @RequestBody AddressDto addressDto,
+ Authentication auth) {
+ Contact contact = contactService.findByIdentifier(id);
+ HttpStatus httpStatus;
+ Address addressUpdate;
+ Address address = addressService.convertToEntity(addressDto);
+ HttpHeaders responseHeaders = new HttpHeaders();
+ responseHeaders.set(HttpHeaders.LOCATION, ServletUriComponentsBuilder.fromCurrentRequest().toUriString());
+
+ if (contact.getAddress() != null) {
+ log.info("Update address for the contact {} ", id);
+ address.setId(contact.getAddress().getId());
+ addressUpdate = addressService.saveAddress(address);
+ httpStatus = HttpStatus.OK;
+ } else {
+ log.info("Create address for the contact {} ", id);
+ addressUpdate = addressService.saveAddress(address);
+ contact.setAddress(addressUpdate);
+ contactService.saveContact(contact);
+ httpStatus = HttpStatus.CREATED;
+ }
+ PayloadUtil.getPayloadAuthor(auth.getName());
+ ContactEvent contactEventUpdate = contactEventService.createContactEvent(contact, ContactEventTypeEnum.update,
+ null);
+ contactEventService.saveContactEvent(contactEventUpdate);
+ return ResponseEntity.status(httpStatus).headers(responseHeaders)
+ .body(addressService.convertToDto(addressUpdate));
+
+
+ }
+
+ class AddressPage extends PageImpl {
+
+ private static final long serialVersionUID = -5570255373624396569L;
+
+ public AddressPage(List content, Pageable pageable, long total) {
+ super(content, pageable, total);
+ }
+ }
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java
index 76516791..88fb971f 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactController.java
@@ -1,219 +1,220 @@
-package fr.insee.survey.datacollectionmanagement.contact.controller;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
-import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
-import fr.insee.survey.datacollectionmanagement.contact.dto.ContactDetailsDto;
-import fr.insee.survey.datacollectionmanagement.contact.dto.ContactDto;
-import fr.insee.survey.datacollectionmanagement.contact.dto.SearchContactDto;
-import fr.insee.survey.datacollectionmanagement.contact.service.AddressService;
-import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
-import fr.insee.survey.datacollectionmanagement.contact.util.ContactParamEnum;
-import fr.insee.survey.datacollectionmanagement.contact.util.PayloadUtil;
-import fr.insee.survey.datacollectionmanagement.contact.validation.ValidContactParam;
-import fr.insee.survey.datacollectionmanagement.exception.ImpossibleToDeleteException;
-import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
-import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
-import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.responses.ApiResponses;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.validation.Valid;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.modelmapper.ModelMapper;
-import org.springframework.data.domain.*;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.security.core.Authentication;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
-import java.io.Serial;
-import java.util.Collections;
-import java.util.List;
-
-@RestController
-@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
-@Tag(name = "1 - Contacts", description = "Endpoints to create, update, delete and find contacts")
-@Slf4j
-@RequiredArgsConstructor
-@Validated
-public class ContactController {
-
- private final ContactService contactService;
-
- private final AddressService addressService;
-
- private final ViewService viewService;
-
- private final QuestioningAccreditationService questioningAccreditationService;
-
- private final ModelMapper modelMapper;
-
- /**
- * @deprecated
- */
- @Operation(summary = "Search for contacts, paginated")
- @GetMapping(value = Constants.API_CONTACTS_ALL, produces = "application/json")
- @Deprecated(since = "2.6.0", forRemoval = true)
- public ContactPage getContacts(
- @RequestParam(defaultValue = "0") Integer page,
- @RequestParam(defaultValue = "20") Integer size,
- @RequestParam(defaultValue = "identifier") String sort) {
- Pageable pageable = PageRequest.of(page, size, Sort.by(sort));
- Page pageC = contactService.findAll(pageable);
- List listC = pageC.stream().map(this::convertToDto).toList();
- return new ContactPage(listC, pageable, pageC.getTotalElements());
- }
-
- @Operation(summary = "Search for a contact by its id")
- @GetMapping(value = Constants.API_CONTACTS_ID)
- @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
- public ContactDetailsDto getContact(@PathVariable("id") String id) {
- String idContact = StringUtils.upperCase(id);
- Contact contact = contactService.findByIdentifier(idContact);
- List listCampaigns = viewService.findDistinctCampaignByIdentifier(idContact);
- return convertToContactDetailsDto(contact, listCampaigns);
-
-
- }
-
-
- @Operation(summary = "Update or create a contact")
- @PutMapping(value = Constants.API_CONTACTS_ID, produces = "application/json", consumes = "application/json")
- @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
- public ResponseEntity putContact(@PathVariable("id") String id,
- @RequestBody @Valid ContactDto contactDto,
- Authentication auth) throws JsonProcessingException {
- if (!contactDto.getIdentifier().equalsIgnoreCase(id)) {
- throw new NotMatchException("id and contact identifier don't match");
- }
- Contact contact;
- HttpHeaders responseHeaders = new HttpHeaders();
- responseHeaders.set(HttpHeaders.LOCATION, ServletUriComponentsBuilder.fromCurrentRequest()
- .buildAndExpand(contactDto.getIdentifier()).toUriString());
-
- JsonNode payload = PayloadUtil.getPayloadAuthor(auth.getName());
-
- try {
- contact = convertToEntity(contactDto);
- if (contactDto.getAddress() != null)
- contact.setAddress(addressService.convertToEntity(contactDto.getAddress()));
- Contact contactUpdate = contactService.updateContactAddressEvent(contact, payload);
- return ResponseEntity.ok().headers(responseHeaders).body(convertToDto(contactUpdate));
- } catch (NotFoundException e) {
- log.info("Creating contact with the identifier {}", contactDto.getIdentifier());
- contact = convertToEntityNewContact(contactDto);
- if (contactDto.getAddress() != null)
- contact.setAddress(addressService.convertToEntity(contactDto.getAddress()));
- Contact contactCreate = contactService.createContactAddressEvent(contact, payload);
- viewService.createView(id, null, null);
- return ResponseEntity.status(HttpStatus.CREATED).headers(responseHeaders).body(convertToDto(contactCreate));
- }
-
- }
-
-
- /**
- * @deprecated
- */
- @Operation(summary = "Delete a contact, its address, its contactEvents")
- @DeleteMapping(value = Constants.API_CONTACTS_ID)
- @ResponseStatus(HttpStatus.NO_CONTENT)
- @Deprecated(since = "2.6.0", forRemoval = true)
- public void deleteContact(@PathVariable("id") String id) {
-
- if (!questioningAccreditationService.findByContactIdentifier(id).isEmpty()) {
- throw new ImpossibleToDeleteException(
- String.format("Contact %s cannot be deleted as he/she is still entitled to answer one or more questionnaires", id));
- }
-
- log.info("Delete contact {}", id);
- Contact contact = contactService.findByIdentifier(id);
- contactService.deleteContactAddressEvent(contact);
-
- }
-
- @GetMapping(path = Constants.API_CONTACTS_SEARCH, produces = "application/json")
- @Operation(summary = "Multi-criteria search contacts")
- @ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SearchContactDto.class)))),
- @ApiResponse(responseCode = "400", description = "Bad Request")
- })
- public Page searchContacts(
- @RequestParam(required = true) String searchParam,
- @RequestParam(required = false) @Valid @ValidContactParam String searchType,
- @RequestParam(defaultValue = "0") Integer page,
- @RequestParam(defaultValue = "10") Integer pageSize,
- @RequestParam(defaultValue = "identifier") String sort) {
-
- log.info(
- "Search contact by {} with param = {} page = {} pageSize = {}", searchType, searchParam, page, pageSize);
-
- Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
-
- switch (ContactParamEnum.fromValue(searchType)) {
- case ContactParamEnum.IDENTIFIER:
- return contactService.searchContactByIdentifier(searchParam, pageable);
- case ContactParamEnum.NAME:
- return contactService.searchContactByName(searchParam, pageable);
- case ContactParamEnum.EMAIL:
- return contactService.searchContactByEmail(searchParam, pageable);
- }
- return new PageImpl<>(Collections.emptyList());
-
- }
-
- private ContactDto convertToDto(Contact contact) {
- ContactDto contactDto = modelMapper.map(contact, ContactDto.class);
- contactDto.setCivility(contact.getGender().name());
- return contactDto;
- }
-
- private ContactDetailsDto convertToContactDetailsDto(Contact contact, List listCampaigns) {
- ContactDetailsDto contactDetailsDto = modelMapper.map(contact, ContactDetailsDto.class);
- contactDetailsDto.setCivility(contact.getGender());
- contactDetailsDto.setListCampaigns(listCampaigns);
- return contactDetailsDto;
- }
-
- private Contact convertToEntity(ContactDto contactDto) {
- Contact contact = modelMapper.map(contactDto, Contact.class);
- contact.setGender(Contact.Gender.valueOf(contactDto.getCivility()));
- Contact oldContact = contactService.findByIdentifier(contactDto.getIdentifier());
- contact.setComment(oldContact.getComment());
- contact.setAddress(oldContact.getAddress());
- contact.setContactEvents(oldContact.getContactEvents());
-
- return contact;
- }
-
- private Contact convertToEntityNewContact(ContactDto contactDto) {
- Contact contact = modelMapper.map(contactDto, Contact.class);
- contact.setGender(Contact.Gender.valueOf(contactDto.getCivility()));
- return contact;
- }
-
- static class ContactPage extends PageImpl {
-
- @Serial
- private static final long serialVersionUID = 656181199902518234L;
-
- public ContactPage(List content, Pageable pageable, long total) {
- super(content, pageable, total);
- }
- }
-
-}
+package fr.insee.survey.datacollectionmanagement.contact.controller;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.dto.ContactDetailsDto;
+import fr.insee.survey.datacollectionmanagement.contact.dto.ContactDto;
+import fr.insee.survey.datacollectionmanagement.contact.dto.SearchContactDto;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactParamEnum;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
+import fr.insee.survey.datacollectionmanagement.contact.service.AddressService;
+import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
+import fr.insee.survey.datacollectionmanagement.contact.util.PayloadUtil;
+import fr.insee.survey.datacollectionmanagement.contact.validation.ValidContactParam;
+import fr.insee.survey.datacollectionmanagement.exception.ImpossibleToDeleteException;
+import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
+import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
+import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.modelmapper.ModelMapper;
+import org.springframework.data.domain.*;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.Authentication;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.io.Serial;
+import java.util.Collections;
+import java.util.List;
+
+@RestController
+@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
+@Tag(name = "1 - Contacts", description = "Endpoints to create, update, delete and find contacts")
+@Slf4j
+@RequiredArgsConstructor
+@Validated
+public class ContactController {
+
+ private final ContactService contactService;
+
+ private final AddressService addressService;
+
+ private final ViewService viewService;
+
+ private final QuestioningAccreditationService questioningAccreditationService;
+
+ private final ModelMapper modelMapper;
+
+ /**
+ * @deprecated
+ */
+ @Operation(summary = "Search for contacts, paginated")
+ @GetMapping(value = Constants.API_CONTACTS_ALL, produces = "application/json")
+ @Deprecated(since = "2.6.0", forRemoval = true)
+ public ContactPage getContacts(
+ @RequestParam(defaultValue = "0") Integer page,
+ @RequestParam(defaultValue = "20") Integer size,
+ @RequestParam(defaultValue = "identifier") String sort) {
+ Pageable pageable = PageRequest.of(page, size, Sort.by(sort));
+ Page pageC = contactService.findAll(pageable);
+ List listC = pageC.stream().map(this::convertToDto).toList();
+ return new ContactPage(listC, pageable, pageC.getTotalElements());
+ }
+
+ @Operation(summary = "Search for a contact by its id")
+ @GetMapping(value = Constants.API_CONTACTS_ID)
+ @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
+ public ContactDetailsDto getContact(@PathVariable("id") String id) {
+ String idContact = StringUtils.upperCase(id);
+ Contact contact = contactService.findByIdentifier(idContact);
+ List listCampaigns = viewService.findDistinctCampaignByIdentifier(idContact);
+ return convertToContactDetailsDto(contact, listCampaigns);
+
+
+ }
+
+
+ @Operation(summary = "Update or create a contact")
+ @PutMapping(value = Constants.API_CONTACTS_ID, produces = "application/json", consumes = "application/json")
+ @PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES + " || " + AuthorityPrivileges.HAS_REPONDENT_LIMITATED_PRIVILEGES)
+ public ResponseEntity putContact(@PathVariable("id") String id,
+ @RequestBody @Valid ContactDto contactDto,
+ Authentication auth) throws JsonProcessingException {
+ if (!contactDto.getIdentifier().equalsIgnoreCase(id)) {
+ throw new NotMatchException("id and contact identifier don't match");
+ }
+ Contact contact;
+ HttpHeaders responseHeaders = new HttpHeaders();
+ responseHeaders.set(HttpHeaders.LOCATION, ServletUriComponentsBuilder.fromCurrentRequest()
+ .buildAndExpand(contactDto.getIdentifier()).toUriString());
+
+ JsonNode payload = PayloadUtil.getPayloadAuthor(auth.getName());
+
+ try {
+ contact = convertToEntity(contactDto);
+ if (contactDto.getAddress() != null)
+ contact.setAddress(addressService.convertToEntity(contactDto.getAddress()));
+ Contact contactUpdate = contactService.updateContactAddressEvent(contact, payload);
+ return ResponseEntity.ok().headers(responseHeaders).body(convertToDto(contactUpdate));
+ } catch (NotFoundException e) {
+ log.info("Creating contact with the identifier {}", contactDto.getIdentifier());
+ contact = convertToEntityNewContact(contactDto);
+ if (contactDto.getAddress() != null)
+ contact.setAddress(addressService.convertToEntity(contactDto.getAddress()));
+ Contact contactCreate = contactService.createContactAddressEvent(contact, payload);
+ viewService.createView(id, null, null);
+ return ResponseEntity.status(HttpStatus.CREATED).headers(responseHeaders).body(convertToDto(contactCreate));
+ }
+
+ }
+
+
+ /**
+ * @deprecated
+ */
+ @Operation(summary = "Delete a contact, its address, its contactEvents")
+ @DeleteMapping(value = Constants.API_CONTACTS_ID)
+ @ResponseStatus(HttpStatus.NO_CONTENT)
+ @Deprecated(since = "2.6.0", forRemoval = true)
+ public void deleteContact(@PathVariable("id") String id) {
+
+ if (!questioningAccreditationService.findByContactIdentifier(id).isEmpty()) {
+ throw new ImpossibleToDeleteException(
+ String.format("Contact %s cannot be deleted as he/she is still entitled to answer one or more questionnaires", id));
+ }
+
+ log.info("Delete contact {}", id);
+ Contact contact = contactService.findByIdentifier(id);
+ contactService.deleteContactAddressEvent(contact);
+
+ }
+
+ @GetMapping(path = Constants.API_CONTACTS_SEARCH, produces = "application/json")
+ @Operation(summary = "Multi-criteria search contacts")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "OK", content = @Content(array = @ArraySchema(schema = @Schema(implementation = SearchContactDto.class)))),
+ @ApiResponse(responseCode = "400", description = "Bad Request")
+ })
+ public Page searchContacts(
+ @RequestParam(required = true) String searchParam,
+ @RequestParam(required = false) @Valid @ValidContactParam String searchType,
+ @RequestParam(defaultValue = "0") Integer page,
+ @RequestParam(defaultValue = "10") Integer pageSize,
+ @RequestParam(defaultValue = "identifier") String sort) {
+
+ log.info(
+ "Search contact by {} with param = {} page = {} pageSize = {}", searchType, searchParam, page, pageSize);
+
+ Pageable pageable = PageRequest.of(page, pageSize, Sort.by(sort));
+
+ switch (ContactParamEnum.fromValue(searchType)) {
+ case ContactParamEnum.IDENTIFIER:
+ return contactService.searchContactByIdentifier(searchParam, pageable);
+ case ContactParamEnum.NAME:
+ return contactService.searchContactByName(searchParam, pageable);
+ case ContactParamEnum.EMAIL:
+ return contactService.searchContactByEmail(searchParam, pageable);
+ }
+ return new PageImpl<>(Collections.emptyList());
+
+ }
+
+ private ContactDto convertToDto(Contact contact) {
+ ContactDto contactDto = modelMapper.map(contact, ContactDto.class);
+ contactDto.setCivility(contact.getGender().name());
+ return contactDto;
+ }
+
+ private ContactDetailsDto convertToContactDetailsDto(Contact contact, List listCampaigns) {
+ ContactDetailsDto contactDetailsDto = modelMapper.map(contact, ContactDetailsDto.class);
+ contactDetailsDto.setCivility(contact.getGender());
+ contactDetailsDto.setListCampaigns(listCampaigns);
+ return contactDetailsDto;
+ }
+
+ private Contact convertToEntity(ContactDto contactDto) {
+ Contact contact = modelMapper.map(contactDto, Contact.class);
+ contact.setGender(GenderEnum.valueOf(contactDto.getCivility()));
+ Contact oldContact = contactService.findByIdentifier(contactDto.getIdentifier());
+ contact.setComment(oldContact.getComment());
+ contact.setAddress(oldContact.getAddress());
+ contact.setContactEvents(oldContact.getContactEvents());
+
+ return contact;
+ }
+
+ private Contact convertToEntityNewContact(ContactDto contactDto) {
+ Contact contact = modelMapper.map(contactDto, Contact.class);
+ contact.setGender(GenderEnum.valueOf(contactDto.getCivility()));
+ return contact;
+ }
+
+ static class ContactPage extends PageImpl {
+
+ @Serial
+ private static final long serialVersionUID = 656181199902518234L;
+
+ public ContactPage(List content, Pageable pageable, long total) {
+ super(content, pageable, total);
+ }
+ }
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventController.java
similarity index 96%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventController.java
index 87f44966..510073ac 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventController.java
@@ -1,120 +1,120 @@
-package fr.insee.survey.datacollectionmanagement.contact.controller;
-
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
-import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.dto.ContactEventDto;
-import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
-import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.validation.Valid;
-import lombok.RequiredArgsConstructor;
-import org.modelmapper.ModelMapper;
-import org.springframework.data.domain.PageImpl;
-import org.springframework.data.domain.Pageable;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-@RestController(value = "contactEvents")
-@PreAuthorize(AuthorityPrivileges.HAS_USER_PRIVILEGES)
-@Tag(name = "1 - Contacts", description = "Enpoints to create, update, delete and find contacts")
-@RequiredArgsConstructor
-@Validated
-public class ContactEventController {
-
- private final ContactEventService contactEventService;
-
- private final ContactService contactService;
-
- private final ModelMapper modelMapper;
-
- /**
- * @deprecated
- */
- @Operation(summary = "Search for contactEvents by the contact id")
- @GetMapping(value = Constants.API_CONTACTS_ID_CONTACTEVENTS, produces = "application/json")
- @Deprecated(since = "2.6.0", forRemoval = true)
- public ResponseEntity> getContactContactEvents(@PathVariable("id") String identifier) {
- Contact contact = contactService.findByIdentifier(identifier);
- return ResponseEntity.status(HttpStatus.OK)
- .body(contact.getContactEvents().stream().map(this::convertToDto)
- .toList());
-
-
- }
-
-
- /**
- * @deprecated
- */
- @Operation(summary = "Create a contactEvent")
- @PostMapping(value = Constants.API_CONTACTEVENTS, produces = "application/json", consumes = "application/json")
- @Deprecated(since = "2.6.0", forRemoval = true)
- public ResponseEntity postContactEvent(@RequestBody @Valid ContactEventDto contactEventDto) {
-
- Contact contact = contactService.findByIdentifier(contactEventDto.getIdentifier());
- ContactEvent contactEvent = convertToEntity(contactEventDto);
- ContactEvent newContactEvent = contactEventService.saveContactEvent(contactEvent);
- Set setContactEvents = contact.getContactEvents();
- setContactEvents.add(newContactEvent);
- contact.setContactEvents(setContactEvents);
- contactService.saveContact(contact);
- HttpHeaders responseHeaders = new HttpHeaders();
- responseHeaders.set(HttpHeaders.LOCATION,
- ServletUriComponentsBuilder.fromCurrentRequest().toUriString());
- return ResponseEntity.status(HttpStatus.CREATED).headers(responseHeaders)
- .body(convertToDto(newContactEvent));
-
- }
-
-
-
- /**
- * @deprecated
- */
- @Operation(summary = "Delete a contact event")
- @DeleteMapping(value = Constants.API_CONTACTEVENTS_ID, produces = "application/json")
- @ResponseStatus(HttpStatus.NO_CONTENT)
- @Deprecated(since = "2.6.0", forRemoval = true)
- public void deleteContactEvent(@PathVariable("id") Long id) {
- ContactEvent contactEvent = contactEventService.findById(id);
- Contact contact = contactEvent.getContact();
- contact.setContactEvents(contact.getContactEvents().stream().filter(ce -> !ce.equals(contactEvent))
- .collect(Collectors.toSet()));
- contactService.saveContact(contact);
- contactEventService.deleteContactEvent(id);
-
- }
-
- private ContactEventDto convertToDto(ContactEvent contactEvent) {
- ContactEventDto ceDto = modelMapper.map(contactEvent, ContactEventDto.class);
- ceDto.setIdentifier(contactEvent.getContact().getIdentifier());
- return ceDto;
- }
-
- private ContactEvent convertToEntity(ContactEventDto contactEventDto) {
- return modelMapper.map(contactEventDto, ContactEvent.class);
- }
-
- class ContactEventPage extends PageImpl {
-
- private static final long serialVersionUID = 3619811755902956158L;
-
- public ContactEventPage(List content, Pageable pageable, long total) {
- super(content, pageable, total);
- }
- }
-
-
-}
+package fr.insee.survey.datacollectionmanagement.contact.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
+import fr.insee.survey.datacollectionmanagement.contact.dto.ContactEventDto;
+import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
+import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import org.modelmapper.ModelMapper;
+import org.springframework.data.domain.PageImpl;
+import org.springframework.data.domain.Pageable;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+@RestController(value = "contactEvents")
+@PreAuthorize(AuthorityPrivileges.HAS_USER_PRIVILEGES)
+@Tag(name = "1 - Contacts", description = "Enpoints to create, update, delete and find contacts")
+@RequiredArgsConstructor
+@Validated
+public class ContactEventController {
+
+ private final ContactEventService contactEventService;
+
+ private final ContactService contactService;
+
+ private final ModelMapper modelMapper;
+
+ /**
+ * @deprecated
+ */
+ @Operation(summary = "Search for contactEvents by the contact id")
+ @GetMapping(value = Constants.API_CONTACTS_ID_CONTACTEVENTS, produces = "application/json")
+ @Deprecated(since = "2.6.0", forRemoval = true)
+ public ResponseEntity> getContactContactEvents(@PathVariable("id") String identifier) {
+ Contact contact = contactService.findByIdentifier(identifier);
+ return ResponseEntity.status(HttpStatus.OK)
+ .body(contact.getContactEvents().stream().map(this::convertToDto)
+ .toList());
+
+
+ }
+
+
+ /**
+ * @deprecated
+ */
+ @Operation(summary = "Create a contactEvent")
+ @PostMapping(value = Constants.API_CONTACTEVENTS, produces = "application/json", consumes = "application/json")
+ @Deprecated(since = "2.6.0", forRemoval = true)
+ public ResponseEntity postContactEvent(@RequestBody @Valid ContactEventDto contactEventDto) {
+
+ Contact contact = contactService.findByIdentifier(contactEventDto.getIdentifier());
+ ContactEvent contactEvent = convertToEntity(contactEventDto);
+ ContactEvent newContactEvent = contactEventService.saveContactEvent(contactEvent);
+ Set setContactEvents = contact.getContactEvents();
+ setContactEvents.add(newContactEvent);
+ contact.setContactEvents(setContactEvents);
+ contactService.saveContact(contact);
+ HttpHeaders responseHeaders = new HttpHeaders();
+ responseHeaders.set(HttpHeaders.LOCATION,
+ ServletUriComponentsBuilder.fromCurrentRequest().toUriString());
+ return ResponseEntity.status(HttpStatus.CREATED).headers(responseHeaders)
+ .body(convertToDto(newContactEvent));
+
+ }
+
+
+
+ /**
+ * @deprecated
+ */
+ @Operation(summary = "Delete a contact event")
+ @DeleteMapping(value = Constants.API_CONTACTEVENTS_ID, produces = "application/json")
+ @ResponseStatus(HttpStatus.NO_CONTENT)
+ @Deprecated(since = "2.6.0", forRemoval = true)
+ public void deleteContactEvent(@PathVariable("id") Long id) {
+ ContactEvent contactEvent = contactEventService.findById(id);
+ Contact contact = contactEvent.getContact();
+ contact.setContactEvents(contact.getContactEvents().stream().filter(ce -> !ce.equals(contactEvent))
+ .collect(Collectors.toSet()));
+ contactService.saveContact(contact);
+ contactEventService.deleteContactEvent(id);
+
+ }
+
+ private ContactEventDto convertToDto(ContactEvent contactEvent) {
+ ContactEventDto ceDto = modelMapper.map(contactEvent, ContactEventDto.class);
+ ceDto.setIdentifier(contactEvent.getContact().getIdentifier());
+ return ceDto;
+ }
+
+ private ContactEvent convertToEntity(ContactEventDto contactEventDto) {
+ return modelMapper.map(contactEventDto, ContactEvent.class);
+ }
+
+ class ContactEventPage extends PageImpl {
+
+ private static final long serialVersionUID = 3619811755902956158L;
+
+ public ContactEventPage(List content, Pageable pageable, long total) {
+ super(content, pageable, total);
+ }
+ }
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/PayloadUtil.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/PayloadUtil.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/PayloadUtil.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/PayloadUtil.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiError.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiError.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiError.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiError.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiExceptionComponent.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiExceptionComponent.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiExceptionComponent.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ApiExceptionComponent.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ExceptionControllerAdvice.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ExceptionControllerAdvice.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/ExceptionControllerAdvice.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ExceptionControllerAdvice.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/heathcheck/controller/HealthcheckController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/healthcheck/controller/HealthcheckController.java
similarity index 81%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/heathcheck/controller/HealthcheckController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/healthcheck/controller/HealthcheckController.java
index 5cdc7de5..58bfccff 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/heathcheck/controller/HealthcheckController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/healthcheck/controller/HealthcheckController.java
@@ -1,7 +1,7 @@
-package fr.insee.survey.datacollectionmanagement.heathcheck.controller;
+package fr.insee.survey.datacollectionmanagement.healthcheck.controller;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.heathcheck.dto.HealthcheckDto;
+import fr.insee.survey.datacollectionmanagement.healthcheck.dto.HealthcheckDto;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java
index 874f7b1f..31f011b0 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignController.java
@@ -1,262 +1,263 @@
-package fr.insee.survey.datacollectionmanagement.metadata.controller;
-
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
-import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.exception.ImpossibleToDeleteException;
-import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
-import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Survey;
-import fr.insee.survey.datacollectionmanagement.metadata.dto.CampaignDto;
-import fr.insee.survey.datacollectionmanagement.metadata.dto.CampaignPartitioningsDto;
-import fr.insee.survey.datacollectionmanagement.metadata.dto.OnGoingDto;
-import fr.insee.survey.datacollectionmanagement.metadata.dto.ParamsDto;
-import fr.insee.survey.datacollectionmanagement.metadata.service.CampaignService;
-import fr.insee.survey.datacollectionmanagement.metadata.service.SurveyService;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.Upload;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.UploadService;
-import fr.insee.survey.datacollectionmanagement.util.EmailValidatorRegex;
-import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
-import io.swagger.v3.oas.annotations.responses.ApiResponses;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import jakarta.validation.Valid;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.StringUtils;
-import org.modelmapper.ModelMapper;
-import org.springframework.data.domain.*;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import static fr.insee.survey.datacollectionmanagement.questioning.util.UrlTypeEnum.values;
-import static java.util.stream.Collectors.joining;
-
-@RestController
-@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
-@Tag(name = "3 - Metadata", description = "Enpoints to create, update, delete and find entities in metadata domain")
-@Slf4j
-@Validated
-@RequiredArgsConstructor
-public class CampaignController {
-
- private final CampaignService campaignService;
-
- private final SurveyService surveyService;
-
- private final ViewService viewService;
-
- private final QuestioningService questioningService;
-
- private final UploadService uploadService;
-
- private final ModelMapper modelmapper;
-
-
- @Operation(summary = "Search for campaigns, paginated")
- @GetMapping(value = Constants.API_CAMPAIGNS, produces = "application/json")
- public ResponseEntity getSources(
- @RequestParam(defaultValue = "0") Integer page,
- @RequestParam(defaultValue = "20") Integer size,
- @RequestParam(defaultValue = "id") String sort) {
- Pageable pageable = PageRequest.of(page, size, Sort.by(sort));
- Page pageCampaign = campaignService.findAll(pageable);
- List listCampaigns = pageCampaign.stream().map(this::convertToDto).toList();
- return ResponseEntity.ok().body(new CampaignPage(listCampaigns, pageable, pageCampaign.getTotalElements()));
- }
-
- @Operation(summary = "Search for campaigns by the survey id")
- @GetMapping(value = Constants.API_SURVEYS_ID_CAMPAIGNS, produces = "application/json")
- public ResponseEntity> getCampaignsBySurvey(@PathVariable("id") String id) {
-
- Survey survey = surveyService.findById(id);
- return ResponseEntity.ok()
- .body(survey.getCampaigns().stream().map(this::convertToDto).toList());
-
- }
-
- @Operation(summary = "Search for campaigns and partitionings by the survey id")
- @GetMapping(value = Constants.API_SURVEYS_ID_CAMPAIGNS_PARTITIONINGS, produces = "application/json")
- public ResponseEntity> getCampaignsPartitioningsBySurvey(@PathVariable("id") String id) {
-
- Survey survey = surveyService.findById(id);
- return ResponseEntity.ok()
- .body(survey.getCampaigns().stream().map(this::convertToCampaignPartitioningsDto).toList());
-
- }
-
- @Operation(summary = "Search for a campaign by its id")
- @GetMapping(value = Constants.API_CAMPAIGNS_ID, produces = "application/json")
- @ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CampaignDto.class))),
- @ApiResponse(responseCode = "404", description = "Not found"),
- @ApiResponse(responseCode = "400", description = "Bad request")
- })
- public ResponseEntity getCampaign(@PathVariable("id") String id) {
- Campaign campaign = campaignService.findById(StringUtils.upperCase(id));
- return ResponseEntity.ok().body(convertToDto(campaign));
-
-
- }
-
-
- @Operation(summary = "Get campaign parameters")
- @GetMapping(value = "/api/campaigns/{id}/params", produces = "application/json")
- public ResponseEntity> getParams(@PathVariable("id") String id) {
- Campaign campaign = campaignService.findById(StringUtils.upperCase(id));
- List listParams = campaign.getParams().stream().map(this::convertToDto).toList();
- return ResponseEntity.ok().body(listParams);
- }
-
-
- @Operation(summary = "Create a parameter for a campaign")
- @PutMapping(value = "/api/campaigns/{id}/params", produces = "application/json")
- public void putParams(@PathVariable("id") String id, @RequestBody @Valid ParamsDto paramsDto) {
- Campaign campaign = campaignService.findById(StringUtils.upperCase(id));
-
- if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.URL_TYPE.name())
- && Arrays.stream(values()).noneMatch(p -> p.name().equals(paramsDto.getParamValue()))) {
-
- throw new NotMatchException(String.format("Only %s are valid values for URL_TYPE", Arrays.stream(values()).map(Enum::name)
- .collect(joining(" "))));
- }
- if (paramsDto.getParamId().equalsIgnoreCase(Parameters.ParameterEnum.MAIL_ASSISTANCE.name())
- && !EmailValidatorRegex.isValidEmail(paramsDto.getParamValue())) {
-
- throw new NotMatchException(String.format("Email %s is not valid", paramsDto.getParamValue()));
- }
- Parameters param = convertToEntity(paramsDto);
- param.setMetadataId(StringUtils.upperCase(id));
- Set setParams = campaign.getParams().stream()
- .filter(parameter -> !parameter.getParamId().equals(param.getParamId()))
- .collect(Collectors.toSet());
- setParams.add(param);
- campaign.setParams(setParams);
- campaignService.insertOrUpdateCampaign(campaign);
- }
-
-
- @Operation(summary = "Update or create a campaign")
- @PutMapping(value = Constants.API_CAMPAIGNS_ID, produces = "application/json", consumes = "application/json")
- @ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CampaignDto.class))),
- @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = CampaignDto.class))),
- @ApiResponse(responseCode = "400", description = "Bad request")
- })
- public ResponseEntity putCampaign(@PathVariable("id") String id, @RequestBody @Valid CampaignDto campaignDto) {
- if (!campaignDto.getId().equalsIgnoreCase(id)) {
- throw new NotMatchException("id and idCampaign don't match");
- }
- HttpHeaders responseHeaders = new HttpHeaders();
- responseHeaders.set(HttpHeaders.LOCATION,
- ServletUriComponentsBuilder.fromCurrentRequest().buildAndExpand(campaignDto.getId()).toUriString());
- HttpStatus httpStatus;
-
- try {
- campaignService.findById(id);
- log.info("Update campaign with the id {}", campaignDto.getId());
- httpStatus = HttpStatus.OK;
- } catch (NotFoundException e) {
- log.info("Create campaign with the id {}", campaignDto.getId());
- httpStatus = HttpStatus.CREATED;
- }
-
- Campaign campaign = campaignService.insertOrUpdateCampaign(convertToEntity(campaignDto));
- Survey survey = campaign.getSurvey();
- survey.getCampaigns().add(campaign);
- surveyService.insertOrUpdateSurvey(survey);
- return ResponseEntity.status(httpStatus).headers(responseHeaders).body(convertToDto(campaign));
- }
-
- @Operation(summary = "Delete a campaign, its campaigns, partitionings, questionings ...")
- @DeleteMapping(value = {Constants.API_CAMPAIGNS_ID, Constants.MOOG_API_CAMPAIGNS_ID})
-
- @Transactional
- public void deleteCampaign(@PathVariable("id") String id) throws fr.insee.survey.datacollectionmanagement.exception.NotFoundException {
-
- if (campaignService.isCampaignOngoing(id)) {
- throw new ImpossibleToDeleteException("Campaign is still ongoing and can't be deleted");
- }
-
- Campaign campaign = campaignService.findById(id);
-
- int nbQuestioningDeleted = 0;
- Survey survey = campaign.getSurvey();
- survey.getCampaigns().remove(campaign);
- surveyService.insertOrUpdateSurvey(survey);
- List uploadsCamp = uploadService.findAllByIdCampaign(id);
- campaignService.deleteCampaignById(id);
- Set listPartitionings = campaign.getPartitionings();
-
- int nbViewDeleted = viewService.deleteViewsOfOneCampaign(campaign);
-
- for (Partitioning partitioning : listPartitionings) {
- nbQuestioningDeleted += questioningService.deleteQuestioningsOfOnePartitioning(partitioning);
- }
- uploadsCamp.forEach(uploadService::delete);
- log.info("Campaign {} deleted with all its metadata children - {} questioning deleted - {} view deleted - {} uploads deleted",
- id,
- nbQuestioningDeleted, nbViewDeleted, uploadsCamp.size());
-
- }
-
- @Operation(summary = "campaign is ongoing")
- @GetMapping(value = Constants.CAMPAIGNS_ID_ONGOING, produces = "application/json")
- @ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OnGoingDto.class))),
- @ApiResponse(responseCode = "404", description = "Not found")
- })
- public ResponseEntity isOnGoingCampaign(@PathVariable("id") String id) {
- boolean isOnGoing = campaignService.isCampaignOngoing(id);
- return ResponseEntity.ok().body(new OnGoingDto(isOnGoing));
-
- }
-
- private CampaignDto convertToDto(Campaign campaign) {
- return modelmapper.map(campaign, CampaignDto.class);
- }
-
- private ParamsDto convertToDto(Parameters params) {
- return modelmapper.map(params, ParamsDto.class);
- }
-
- private CampaignPartitioningsDto convertToCampaignPartitioningsDto(Campaign campaign) {
- return modelmapper.map(campaign, CampaignPartitioningsDto.class);
- }
-
- private Campaign convertToEntity(CampaignDto campaignDto) {
- return modelmapper.map(campaignDto, Campaign.class);
- }
-
- private Parameters convertToEntity(ParamsDto paramsDto) {
-
- Parameters params = modelmapper.map(paramsDto, Parameters.class);
- params.setParamId(Parameters.ParameterEnum.valueOf(paramsDto.getParamId()));
- return params;
- }
-
- class CampaignPage extends PageImpl {
-
- public CampaignPage(List content, Pageable pageable, long total) {
- super(content, pageable, total);
- }
- }
-
-}
+package fr.insee.survey.datacollectionmanagement.metadata.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.exception.ImpossibleToDeleteException;
+import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
+import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Survey;
+import fr.insee.survey.datacollectionmanagement.metadata.dto.CampaignDto;
+import fr.insee.survey.datacollectionmanagement.metadata.dto.CampaignPartitioningsDto;
+import fr.insee.survey.datacollectionmanagement.metadata.dto.OnGoingDto;
+import fr.insee.survey.datacollectionmanagement.metadata.dto.ParamsDto;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.service.CampaignService;
+import fr.insee.survey.datacollectionmanagement.metadata.service.SurveyService;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Upload;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import fr.insee.survey.datacollectionmanagement.questioning.service.UploadService;
+import fr.insee.survey.datacollectionmanagement.util.EmailValidatorRegex;
+import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.modelmapper.ModelMapper;
+import org.springframework.data.domain.*;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static fr.insee.survey.datacollectionmanagement.questioning.enums.UrlTypeEnum.values;
+import static java.util.stream.Collectors.joining;
+
+@RestController
+@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
+@Tag(name = "3 - Metadata", description = "Enpoints to create, update, delete and find entities in metadata domain")
+@Slf4j
+@Validated
+@RequiredArgsConstructor
+public class CampaignController {
+
+ private final CampaignService campaignService;
+
+ private final SurveyService surveyService;
+
+ private final ViewService viewService;
+
+ private final QuestioningService questioningService;
+
+ private final UploadService uploadService;
+
+ private final ModelMapper modelmapper;
+
+
+ @Operation(summary = "Search for campaigns, paginated")
+ @GetMapping(value = Constants.API_CAMPAIGNS, produces = "application/json")
+ public ResponseEntity getSources(
+ @RequestParam(defaultValue = "0") Integer page,
+ @RequestParam(defaultValue = "20") Integer size,
+ @RequestParam(defaultValue = "id") String sort) {
+ Pageable pageable = PageRequest.of(page, size, Sort.by(sort));
+ Page pageCampaign = campaignService.findAll(pageable);
+ List listCampaigns = pageCampaign.stream().map(this::convertToDto).toList();
+ return ResponseEntity.ok().body(new CampaignPage(listCampaigns, pageable, pageCampaign.getTotalElements()));
+ }
+
+ @Operation(summary = "Search for campaigns by the survey id")
+ @GetMapping(value = Constants.API_SURVEYS_ID_CAMPAIGNS, produces = "application/json")
+ public ResponseEntity> getCampaignsBySurvey(@PathVariable("id") String id) {
+
+ Survey survey = surveyService.findById(id);
+ return ResponseEntity.ok()
+ .body(survey.getCampaigns().stream().map(this::convertToDto).toList());
+
+ }
+
+ @Operation(summary = "Search for campaigns and partitionings by the survey id")
+ @GetMapping(value = Constants.API_SURVEYS_ID_CAMPAIGNS_PARTITIONINGS, produces = "application/json")
+ public ResponseEntity> getCampaignsPartitioningsBySurvey(@PathVariable("id") String id) {
+
+ Survey survey = surveyService.findById(id);
+ return ResponseEntity.ok()
+ .body(survey.getCampaigns().stream().map(this::convertToCampaignPartitioningsDto).toList());
+
+ }
+
+ @Operation(summary = "Search for a campaign by its id")
+ @GetMapping(value = Constants.API_CAMPAIGNS_ID, produces = "application/json")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CampaignDto.class))),
+ @ApiResponse(responseCode = "404", description = "Not found"),
+ @ApiResponse(responseCode = "400", description = "Bad request")
+ })
+ public ResponseEntity getCampaign(@PathVariable("id") String id) {
+ Campaign campaign = campaignService.findById(StringUtils.upperCase(id));
+ return ResponseEntity.ok().body(convertToDto(campaign));
+
+
+ }
+
+
+ @Operation(summary = "Get campaign parameters")
+ @GetMapping(value = "/api/campaigns/{id}/params", produces = "application/json")
+ public ResponseEntity> getParams(@PathVariable("id") String id) {
+ Campaign campaign = campaignService.findById(StringUtils.upperCase(id));
+ List listParams = campaign.getParams().stream().map(this::convertToDto).toList();
+ return ResponseEntity.ok().body(listParams);
+ }
+
+
+ @Operation(summary = "Create a parameter for a campaign")
+ @PutMapping(value = "/api/campaigns/{id}/params", produces = "application/json")
+ public void putParams(@PathVariable("id") String id, @RequestBody @Valid ParamsDto paramsDto) {
+ Campaign campaign = campaignService.findById(StringUtils.upperCase(id));
+
+ if (paramsDto.getParamId().equalsIgnoreCase(ParameterEnum.URL_TYPE.name())
+ && Arrays.stream(values()).noneMatch(p -> p.name().equals(paramsDto.getParamValue()))) {
+
+ throw new NotMatchException(String.format("Only %s are valid values for URL_TYPE", Arrays.stream(values()).map(Enum::name)
+ .collect(joining(" "))));
+ }
+ if (paramsDto.getParamId().equalsIgnoreCase(ParameterEnum.MAIL_ASSISTANCE.name())
+ && !EmailValidatorRegex.isValidEmail(paramsDto.getParamValue())) {
+
+ throw new NotMatchException(String.format("Email %s is not valid", paramsDto.getParamValue()));
+ }
+ Parameters param = convertToEntity(paramsDto);
+ param.setMetadataId(StringUtils.upperCase(id));
+ Set setParams = campaign.getParams().stream()
+ .filter(parameter -> !parameter.getParamId().equals(param.getParamId()))
+ .collect(Collectors.toSet());
+ setParams.add(param);
+ campaign.setParams(setParams);
+ campaignService.insertOrUpdateCampaign(campaign);
+ }
+
+
+ @Operation(summary = "Update or create a campaign")
+ @PutMapping(value = Constants.API_CAMPAIGNS_ID, produces = "application/json", consumes = "application/json")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = CampaignDto.class))),
+ @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = CampaignDto.class))),
+ @ApiResponse(responseCode = "400", description = "Bad request")
+ })
+ public ResponseEntity putCampaign(@PathVariable("id") String id, @RequestBody @Valid CampaignDto campaignDto) {
+ if (!campaignDto.getId().equalsIgnoreCase(id)) {
+ throw new NotMatchException("id and idCampaign don't match");
+ }
+ HttpHeaders responseHeaders = new HttpHeaders();
+ responseHeaders.set(HttpHeaders.LOCATION,
+ ServletUriComponentsBuilder.fromCurrentRequest().buildAndExpand(campaignDto.getId()).toUriString());
+ HttpStatus httpStatus;
+
+ try {
+ campaignService.findById(id);
+ log.info("Update campaign with the id {}", campaignDto.getId());
+ httpStatus = HttpStatus.OK;
+ } catch (NotFoundException e) {
+ log.info("Create campaign with the id {}", campaignDto.getId());
+ httpStatus = HttpStatus.CREATED;
+ }
+
+ Campaign campaign = campaignService.insertOrUpdateCampaign(convertToEntity(campaignDto));
+ Survey survey = campaign.getSurvey();
+ survey.getCampaigns().add(campaign);
+ surveyService.insertOrUpdateSurvey(survey);
+ return ResponseEntity.status(httpStatus).headers(responseHeaders).body(convertToDto(campaign));
+ }
+
+ @Operation(summary = "Delete a campaign, its campaigns, partitionings, questionings ...")
+ @DeleteMapping(value = {Constants.API_CAMPAIGNS_ID, Constants.MOOG_API_CAMPAIGNS_ID})
+
+ @Transactional
+ public void deleteCampaign(@PathVariable("id") String id) throws fr.insee.survey.datacollectionmanagement.exception.NotFoundException {
+
+ if (campaignService.isCampaignOngoing(id)) {
+ throw new ImpossibleToDeleteException("Campaign is still ongoing and can't be deleted");
+ }
+
+ Campaign campaign = campaignService.findById(id);
+
+ int nbQuestioningDeleted = 0;
+ Survey survey = campaign.getSurvey();
+ survey.getCampaigns().remove(campaign);
+ surveyService.insertOrUpdateSurvey(survey);
+ List uploadsCamp = uploadService.findAllByIdCampaign(id);
+ campaignService.deleteCampaignById(id);
+ Set listPartitionings = campaign.getPartitionings();
+
+ int nbViewDeleted = viewService.deleteViewsOfOneCampaign(campaign);
+
+ for (Partitioning partitioning : listPartitionings) {
+ nbQuestioningDeleted += questioningService.deleteQuestioningsOfOnePartitioning(partitioning);
+ }
+ uploadsCamp.forEach(uploadService::delete);
+ log.info("Campaign {} deleted with all its metadata children - {} questioning deleted - {} view deleted - {} uploads deleted",
+ id,
+ nbQuestioningDeleted, nbViewDeleted, uploadsCamp.size());
+
+ }
+
+ @Operation(summary = "campaign is ongoing")
+ @GetMapping(value = Constants.CAMPAIGNS_ID_ONGOING, produces = "application/json")
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = OnGoingDto.class))),
+ @ApiResponse(responseCode = "404", description = "Not found")
+ })
+ public ResponseEntity isOnGoingCampaign(@PathVariable("id") String id) {
+ boolean isOnGoing = campaignService.isCampaignOngoing(id);
+ return ResponseEntity.ok().body(new OnGoingDto(isOnGoing));
+
+ }
+
+ private CampaignDto convertToDto(Campaign campaign) {
+ return modelmapper.map(campaign, CampaignDto.class);
+ }
+
+ private ParamsDto convertToDto(Parameters params) {
+ return modelmapper.map(params, ParamsDto.class);
+ }
+
+ private CampaignPartitioningsDto convertToCampaignPartitioningsDto(Campaign campaign) {
+ return modelmapper.map(campaign, CampaignPartitioningsDto.class);
+ }
+
+ private Campaign convertToEntity(CampaignDto campaignDto) {
+ return modelmapper.map(campaignDto, Campaign.class);
+ }
+
+ private Parameters convertToEntity(ParamsDto paramsDto) {
+
+ Parameters params = modelmapper.map(paramsDto, Parameters.class);
+ params.setParamId(ParameterEnum.valueOf(paramsDto.getParamId()));
+ return params;
+ }
+
+ class CampaignPage extends PageImpl {
+
+ public CampaignPage(List content, Pageable pageable, long total) {
+ super(content, pageable, total);
+ }
+ }
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/MetadataController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/MetadataController.java
similarity index 92%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/MetadataController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/MetadataController.java
index a8e2292f..14afbc01 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/MetadataController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/MetadataController.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
import fr.insee.survey.datacollectionmanagement.metadata.dto.CampaignMoogDto;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/OwnerController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/OwnerController.java
similarity index 97%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/OwnerController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/OwnerController.java
index ce927968..0324e49a 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/OwnerController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/OwnerController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PartitioningController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PartitioningController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PartitioningController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PartitioningController.java
index 46e6d6ed..69a298aa 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PartitioningController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PartitioningController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PeriodPeriodicityController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PeriodPeriodicityController.java
similarity index 92%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PeriodPeriodicityController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PeriodPeriodicityController.java
index cd4ab608..a89b101b 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PeriodPeriodicityController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/PeriodPeriodicityController.java
@@ -1,12 +1,12 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.dto.PeriodDto;
import fr.insee.survey.datacollectionmanagement.metadata.dto.PeriodicityDto;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceController.java
index 41bc52ed..9482e12e 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SupportController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SupportController.java
similarity index 97%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SupportController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SupportController.java
index 7ee6f5b6..3efce74e 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SupportController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SupportController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyController.java
index 744def65..e15e8253 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/CheckHabilitationController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/CheckHabilitationController.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/CheckHabilitationController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/CheckHabilitationController.java
index b9366663..8c9fa42a 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/CheckHabilitationController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/CheckHabilitationController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.query.dto.HabilitationDto;
import fr.insee.survey.datacollectionmanagement.query.service.CheckHabilitationService;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MonitoringController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MonitoringController.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MonitoringController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MonitoringController.java
index 14ecd5b1..5100e17e 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MonitoringController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MonitoringController.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
import fr.insee.survey.datacollectionmanagement.metadata.service.CampaignService;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogController.java
similarity index 97%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogController.java
index 556a6ccf..ff3bf42d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogController.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsController.java
similarity index 91%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsController.java
index 79c27ac0..189c7f3b 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsController.java
@@ -1,35 +1,35 @@
-package fr.insee.survey.datacollectionmanagement.query.controller;
-
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
-import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.query.dto.MyQuestioningDto;
-import fr.insee.survey.datacollectionmanagement.query.service.MySurveysService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.security.core.annotation.CurrentSecurityContext;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-@RestController
-@Tag(name = "1 - Contacts", description = "Endpoints to create, update, delete and find contacts")
-@RequiredArgsConstructor
-public class MyQuestioningsController {
-
- private final MySurveysService mySurveysService;
-
-
- @GetMapping(value = Constants.API_MY_QUESTIONINGS_ID)
- @PreAuthorize(AuthorityPrivileges.HAS_REPONDENT_PRIVILEGES)
- public List findById(@CurrentSecurityContext(expression = "authentication.name")
- String idec) {
-
-
- List listSurveys = mySurveysService.getListMySurveys(idec.toUpperCase());
-
- return listSurveys;
-
- }
-}
+package fr.insee.survey.datacollectionmanagement.query.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.query.dto.MyQuestioningDto;
+import fr.insee.survey.datacollectionmanagement.query.service.MySurveysService;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.security.core.annotation.CurrentSecurityContext;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+@RestController
+@Tag(name = "1 - Contacts", description = "Endpoints to create, update, delete and find contacts")
+@RequiredArgsConstructor
+public class MyQuestioningsController {
+
+ private final MySurveysService mySurveysService;
+
+
+ @GetMapping(value = Constants.API_MY_QUESTIONINGS_ID)
+ @PreAuthorize(AuthorityPrivileges.HAS_REPONDENT_PRIVILEGES)
+ public List findById(@CurrentSecurityContext(expression = "authentication.name")
+ String idec) {
+
+
+ List listSurveys = mySurveysService.getListMySurveys(idec.toUpperCase());
+
+ return listSurveys;
+
+ }
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningAccreditationController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningAccreditationController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningAccreditationController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningAccreditationController.java
index 18fcff75..42245c65 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningAccreditationController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningAccreditationController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningController.java
similarity index 83%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningController.java
index 0bbc1e1c..7bc2c403 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningController.java
@@ -1,9 +1,10 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
import fr.insee.survey.datacollectionmanagement.query.dto.AssistanceDto;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
@@ -44,22 +45,6 @@ public class QuestioningController {
private final ModelMapper modelMapper;
- @Operation(summary = "Search for a questioning by id")
- @GetMapping(value = Constants.API_QUESTIONINGS_ID, produces = "application/json")
- @ApiResponses(value = {
- @ApiResponse(responseCode = "200", description = "OK", content = @Content(schema = @Schema(implementation = QuestioningDto.class))),
- @ApiResponse(responseCode = "404", description = "Not found"),
- @ApiResponse(responseCode = "400", description = "Bad Request")
- })
- public ResponseEntity> getQuestioning(@PathVariable("id") Long id) {
-
- Questioning questioning = questioningService.findbyId(id);
- try {
- return new ResponseEntity<>(convertToDto(questioning), HttpStatus.OK);
- } catch (Exception e) {
- return new ResponseEntity("Error", HttpStatus.BAD_REQUEST);
- }
- }
@Operation(summary = "Create or update questioning")
@PostMapping(value = Constants.API_QUESTIONINGS, produces = "application/json", consumes = "application/json")
@@ -103,7 +88,7 @@ public ResponseEntity> getQuestioningsBySurveyUnit(@PathVariable("id") String
public AssistanceDto getAssistanceQuestioning(@PathVariable("id") Long questioningId) {
Questioning questioning = questioningService.findbyId(questioningId);
Partitioning part = partitioningService.findById(questioning.getIdPartitioning());
- String mail = partitioningService.findSuitableParameterValue(part, Parameters.ParameterEnum.MAIL_ASSISTANCE);
+ String mail = partitioningService.findSuitableParameterValue(part, ParameterEnum.MAIL_ASSISTANCE);
return new AssistanceDto(mail, questioning.getSurveyUnit().getIdSu());
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningInformationsController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningInformationsController.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningInformationsController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/QuestioningInformationsController.java
diff --git a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchQuestioningController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchQuestioningController.java
new file mode 100644
index 00000000..639a0ac0
--- /dev/null
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchQuestioningController.java
@@ -0,0 +1,54 @@
+package fr.insee.survey.datacollectionmanagement.query.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.query.dto.QuestioningDetailsDto;
+import fr.insee.survey.datacollectionmanagement.query.dto.SearchQuestioningDto;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
+@Slf4j
+@Tag(name = "2 - Questioning", description = "Enpoints to create, update, delete and find entities around the questionings")
+@RequiredArgsConstructor
+public class SearchQuestioningController {
+
+ private final QuestioningService questioningService;
+
+ @Operation(summary = "Multi-criteria search questionings")
+ @GetMapping(value = Constants.API_QUESTIONINGS_SEARCH, produces = "application/json")
+ public Page searchQuestionings(
+ @RequestParam(required = false) String searchParam,
+ @RequestParam(defaultValue = "0") Integer page,
+ @RequestParam(defaultValue = "20") Integer pageSize) {
+ log.info(
+ "Search questionings with param {} page = {} pageSize = {}", searchParam, page, pageSize);
+
+ Pageable pageable = PageRequest.of(page, pageSize);
+
+ return questioningService.searchQuestioning(searchParam, pageable);
+
+ }
+
+ @Operation(summary = "Get questioning details")
+ @GetMapping(value = Constants.API_QUESTIONINGS_ID, produces = "application/json")
+ public QuestioningDetailsDto getQuestioning (@PathVariable("id") Long id) {
+
+ return questioningService.getQuestioningDetails(id);
+
+ }
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchSurveyUnitController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchSurveyUnitController.java
similarity index 96%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchSurveyUnitController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchSurveyUnitController.java
index 58888867..65137a41 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchSurveyUnitController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/SearchSurveyUnitController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
@@ -12,9 +12,9 @@
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningAccreditation;
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
similarity index 99%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
index b8892406..400f02da 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/query/controller/WebclientController.java
@@ -3,7 +3,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.dto.ContactDto;
@@ -23,11 +23,11 @@
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitDto;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitService;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
diff --git a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningCommentController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningCommentController.java
new file mode 100644
index 00000000..cea5f013
--- /dev/null
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningCommentController.java
@@ -0,0 +1,67 @@
+package fr.insee.survey.datacollectionmanagement.questioning.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningComment;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentInputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentOutputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningCommentService;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.validation.Valid;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.modelmapper.ModelMapper;
+import org.springframework.http.HttpStatus;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Date;
+import java.util.Set;
+
+@RestController
+@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
+@Tag(name = "2 - Questioning", description = "Enpoints to create, update, delete and find entities around the questionings")
+@Slf4j
+@RequiredArgsConstructor
+@Validated
+public class QuestioningCommentController {
+
+ private final QuestioningService questioningService;
+ private final QuestioningCommentService questioningCommentService;
+ private final ModelMapper modelMapper;
+
+
+ @Operation(summary = "Create a questioning comment")
+ @PostMapping(value = Constants.API_QUESTIONING_ID_COMMENT, produces = "application/json", consumes = "application/json")
+ @ResponseStatus(HttpStatus.CREATED)
+ @ApiResponses(value = {
+ @ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = QuestioningCommentInputDto.class))),
+ @ApiResponse(responseCode = "400", description = "Bad request"),
+ @ApiResponse(responseCode = "404", description = "Not found")
+ })
+ public QuestioningCommentOutputDto postQuestioningComment(@PathVariable Long id, @Valid @RequestBody QuestioningCommentInputDto questioningCommentDto) {
+
+ Questioning questioning = questioningService.findbyId(id);
+ QuestioningComment questioningComment = questioningCommentService.convertToEntity(questioningCommentDto);
+ questioningComment.setDate(new Date());
+ QuestioningComment newQuestioningComment = questioningCommentService.saveQuestioningComment(questioningComment);
+ Set setQuestioningComments = questioning.getQuestioningComments();
+ setQuestioningComments.add(newQuestioningComment);
+ questioning.setQuestioningComments(setQuestioningComments);
+ questioningService.saveQuestioning(questioning);
+ return questioningCommentService.convertToOutputDto(newQuestioningComment);
+
+ }
+
+
+
+
+}
diff --git a/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningCommunicationController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningCommunicationController.java
new file mode 100644
index 00000000..f60faa1f
--- /dev/null
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningCommunicationController.java
@@ -0,0 +1,43 @@
+package fr.insee.survey.datacollectionmanagement.questioning.controller;
+
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.constants.Constants;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningCommunication;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommunicationDto;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningCommunicationService;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Set;
+
+@RestController
+@PreAuthorize(AuthorityPrivileges.HAS_MANAGEMENT_PRIVILEGES)
+@Tag(name = "2 - Questioning", description = "Enpoints to create, update, delete and find entities around the questionings")
+@Slf4j
+@RequiredArgsConstructor
+public class QuestioningCommunicationController {
+
+ private final QuestioningService questioningService;
+
+ private final QuestioningCommunicationService questioningCommunicationService;
+
+ @Operation(summary = "Search for questioning communications by questioning id")
+ @GetMapping(value = Constants.API_QUESTIONING_ID_QUESTIONING_COMMUNICATIONS, produces = "application/json")
+ public List findQuestioningCommunicationsByQuestioningId(@PathVariable("id") Long id) {
+ Questioning questioning = questioningService.findbyId(id);
+ Set setQe = questioning.getQuestioningCommunications();
+ return setQe.stream().map(questioningCommunicationService::convertToDto).toList();
+
+ }
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningEventController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningEventController.java
similarity index 90%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningEventController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningEventController.java
index 1c26f3c9..601020db 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningEventController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestioningEventController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
@@ -47,8 +47,6 @@ public class QuestioningEventController {
private final UploadService uploadService;
- private final ModelMapper modelMapper;
-
@Operation(summary = "Search for a questioning event by questioning id")
@GetMapping(value = Constants.API_QUESTIONING_ID_QUESTIONING_EVENTS, produces = "application/json")
@ApiResponses(value = {
@@ -61,7 +59,7 @@ public ResponseEntity> findQuestioningEventsByQuestioning(@PathVariable("id")
Set setQe = questioning.getQuestioningEvents();
return ResponseEntity.status(HttpStatus.OK)
.body(setQe.stream()
- .map(this::convertToDto).toList());
+ .map(questioningEventService::convertToDto).toList());
}
@@ -76,7 +74,7 @@ public ResponseEntity> postQuestioningEvent(@Parameter(description = "question
Questioning questioning = questioningService.findbyId(id);
try {
- QuestioningEvent questioningEvent = convertToEntity(questioningEventDto);
+ QuestioningEvent questioningEvent = questioningEventService.convertToEntity(questioningEventDto);
QuestioningEvent newQuestioningEvent = questioningEventService.saveQuestioningEvent(questioningEvent);
Set setQuestioningEvents = questioning.getQuestioningEvents();
setQuestioningEvents.add(newQuestioningEvent);
@@ -86,7 +84,7 @@ public ResponseEntity> postQuestioningEvent(@Parameter(description = "question
responseHeaders.set(HttpHeaders.LOCATION,
ServletUriComponentsBuilder.fromCurrentRequest().toUriString());
return ResponseEntity.status(HttpStatus.CREATED).headers(responseHeaders)
- .body(convertToDto(newQuestioningEvent));
+ .body(questioningEventService.convertToDto(newQuestioningEvent));
} catch (ParseException e) {
log.error(e.getMessage(),e);
@@ -123,13 +121,6 @@ public ResponseEntity> deleteQuestioningEvent(@PathVariable("id") Long id) {
}
}
- private QuestioningEventDto convertToDto(QuestioningEvent questioningEvent) {
- return modelMapper.map(questioningEvent, QuestioningEventDto.class);
- }
-
- private QuestioningEvent convertToEntity(QuestioningEventDto questioningEventDto) throws ParseException {
- return modelMapper.map(questioningEventDto, QuestioningEvent.class);
- }
class QuestioningEventPage extends PageImpl {
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitCommentController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitCommentController.java
similarity index 81%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitCommentController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitCommentController.java
index 4d1d032b..9312f455 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitCommentController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitCommentController.java
@@ -1,10 +1,11 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnitComment;
import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitCommentInputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitCommentOutputDto;
import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitCommentService;
import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitService;
import io.swagger.v3.oas.annotations.Operation;
@@ -17,13 +18,10 @@
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.modelmapper.ModelMapper;
-import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
-import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import java.util.Date;
import java.util.Set;
@@ -49,22 +47,21 @@ public class SurveyUnitCommentController {
@ApiResponse(responseCode = "400", description = "Bad request"),
@ApiResponse(responseCode = "404", description = "Not found")
})
- public void postSurveyUnitComment(@PathVariable String id, @Valid @RequestBody SurveyUnitCommentInputDto surveyUnitCommentDto) {
+ public SurveyUnitCommentOutputDto postSurveyUnitComment(@PathVariable String id, @Valid @RequestBody SurveyUnitCommentInputDto surveyUnitCommentDto) {
SurveyUnit surveyUnit = surveyUnitService.findbyId(id);
- SurveyUnitComment surveyUnitComment = convertToEntity(surveyUnitCommentDto);
+ SurveyUnitComment surveyUnitComment = surveyUnitCommentService.convertToEntity(surveyUnitCommentDto);
surveyUnitComment.setDate(new Date());
SurveyUnitComment newSurveyUnitComment = surveyUnitCommentService.saveSurveyUnitComment(surveyUnitComment);
Set setSurveyUnitComments = surveyUnit.getSurveyUnitComments();
setSurveyUnitComments.add(newSurveyUnitComment);
surveyUnit.setSurveyUnitComments(setSurveyUnitComments);
surveyUnitService.saveSurveyUnit(surveyUnit);
+ return surveyUnitCommentService.convertToOutputDto(surveyUnit);
}
- private SurveyUnitComment convertToEntity(SurveyUnitCommentInputDto surveyUnitCommentDto) {
- return modelMapper.map(surveyUnitCommentDto, SurveyUnitComment.class);
- }
+
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java
index 430e34cc..a32e72f3 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.ImpossibleToDeleteException;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
@@ -9,8 +9,8 @@
import fr.insee.survey.datacollectionmanagement.questioning.dto.SearchSurveyUnitDto;
import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitDetailsDto;
import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitDto;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.SurveyUnitParamEnum;
import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitService;
-import fr.insee.survey.datacollectionmanagement.questioning.util.SurveyUnitParamEnum;
import fr.insee.survey.datacollectionmanagement.questioning.validation.ValidSurveyUnitParam;
import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
import io.swagger.v3.oas.annotations.Operation;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/UploadController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/UploadController.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/UploadController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/UploadController.java
index c19219df..a4131832 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/UploadController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/controller/UploadController.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.RessourceNotValidatedException;
import fr.insee.survey.datacollectionmanagement.query.domain.ResultUpload;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/SurveyUnitParamValidator.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/SurveyUnitParamValidator.java
similarity index 89%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/SurveyUnitParamValidator.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/SurveyUnitParamValidator.java
index bca32070..08fe5a79 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/SurveyUnitParamValidator.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/SurveyUnitParamValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.questioning.validation;
-import fr.insee.survey.datacollectionmanagement.questioning.util.SurveyUnitParamEnum;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.SurveyUnitParamEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/ValidSurveyUnitParam.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/ValidSurveyUnitParam.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/ValidSurveyUnitParam.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/validation/ValidSurveyUnitParam.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/SourceAccreditationController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/SourceAccreditationController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/SourceAccreditationController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/SourceAccreditationController.java
index e53d51a1..9686b64a 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/SourceAccreditationController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/SourceAccreditationController.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.user.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Source;
import fr.insee.survey.datacollectionmanagement.metadata.service.SourceService;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserController.java
similarity index 96%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserController.java
index 834bc23c..dfe54895 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserController.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.user.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.NotMatchException;
@@ -9,6 +9,7 @@
import fr.insee.survey.datacollectionmanagement.user.domain.SourceAccreditation;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
import fr.insee.survey.datacollectionmanagement.user.dto.UserDto;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserRoleTypeEnum;
import fr.insee.survey.datacollectionmanagement.user.service.SourceAccreditationService;
import fr.insee.survey.datacollectionmanagement.user.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
@@ -171,7 +172,7 @@ private User convertToEntity(UserDto userDto) throws ParseException {
User oldUser = userService.findByIdentifier(userDto.getIdentifier());
User user = modelMapper.map(userDto, User.class);
- user.setRole(User.UserRoleType.valueOf(userDto.getRole()));
+ user.setRole(UserRoleTypeEnum.valueOf(userDto.getRole()));
user.setUserEvents(oldUser.getUserEvents());
return user;
@@ -179,7 +180,7 @@ private User convertToEntity(UserDto userDto) throws ParseException {
private User convertToEntityNewUser(UserDto userDto) {
User user = modelMapper.map(userDto, User.class);
- user.setRole(User.UserRoleType.valueOf(userDto.getRole()));
+ user.setRole(UserRoleTypeEnum.valueOf(userDto.getRole()));
return user;
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventController.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventController.java
similarity index 98%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventController.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventController.java
index ea6fc1ec..b91b2e38 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventController.java
+++ b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventController.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.user.controller;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityPrivileges;
+import fr.insee.survey.datacollectionmanagement.configuration.auth.user.AuthorityPrivileges;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegex.java b/platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegex.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegex.java
rename to platine-management-api/src/main/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegex.java
diff --git a/src/main/resources/application.properties b/platine-management-api/src/main/resources/application.properties
similarity index 100%
rename from src/main/resources/application.properties
rename to platine-management-api/src/main/resources/application.properties
diff --git a/src/main/resources/banner.txt b/platine-management-api/src/main/resources/banner.txt
similarity index 100%
rename from src/main/resources/banner.txt
rename to platine-management-api/src/main/resources/banner.txt
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/config/AuthenticationUserProvider.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/configuration/AuthenticationUserProvider.java
similarity index 91%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/config/AuthenticationUserProvider.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/configuration/AuthenticationUserProvider.java
index 1bf86718..2f7db5b7 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/config/AuthenticationUserProvider.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/configuration/AuthenticationUserProvider.java
@@ -1,6 +1,6 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.configuration;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import lombok.AllArgsConstructor;
import org.springframework.security.authentication.AnonymousAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
diff --git a/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/GrantedAuthorityConverterTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/GrantedAuthorityConverterTest.java
new file mode 100644
index 00000000..cefe9b85
--- /dev/null
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/configuration/auth/security/GrantedAuthorityConverterTest.java
@@ -0,0 +1,133 @@
+package fr.insee.survey.datacollectionmanagement.configuration.auth.security;
+
+import fr.insee.survey.datacollectionmanagement.configuration.ApplicationConfig;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.springframework.security.core.GrantedAuthority;
+import org.springframework.security.core.authority.SimpleGrantedAuthority;
+import org.springframework.security.oauth2.jwt.Jwt;
+
+import java.time.Instant;
+import java.util.*;
+import java.util.stream.Stream;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+class GrantedAuthorityConverterTest {
+
+ private GrantedAuthorityConverter converter;
+
+ private ApplicationConfig applicationConfig;
+
+ private static final List JWT_ROLE_INTERNAL_USER = List.of("internal_user", "intern_user");
+ private static final List JWT_ROLE_RESPONDENT = List.of("respondent", "resp");
+ private static final List JWT_ROLE_ADMIN = List.of("admin", "adm");
+ private static final List JWT_ROLE_WEBCLIENT = List.of("webclient","webcli");
+
+ @BeforeEach
+ void init() {
+ applicationConfig = new ApplicationConfig();
+ }
+
+ @Test
+ @DisplayName("Given a JWT, when converting null or empty JWT role, then converting ignore these roles")
+ void testConverter01() {
+ applicationConfig.setRoleAdmin(List.of(""));
+ applicationConfig.setRoleInternalUser(List.of());
+ applicationConfig.setRoleWebClient(List.of(""));
+ List nullList = new ArrayList<>();
+ nullList.add(null);
+ applicationConfig.setRoleRespondent(nullList);
+ converter = new GrantedAuthorityConverter(applicationConfig);
+ List tokenRoles = new ArrayList<>();
+ tokenRoles.add(null);
+ tokenRoles.add("");
+
+ Jwt jwt = createJwt(tokenRoles);
+ Collection authorities = converter.convert(jwt);
+ assertThat(authorities).isEmpty();
+ }
+
+ @Test
+ @DisplayName("Given a JWT, when converting roles, then convert only JWT roles matching roles in role properties")
+ void testConverter02() {
+ applicationConfig.setRoleAdmin(JWT_ROLE_ADMIN);
+ applicationConfig.setRoleInternalUser(JWT_ROLE_INTERNAL_USER);
+ applicationConfig.setRoleWebClient(List.of("webclient", "adm"));
+ applicationConfig.setRoleRespondent(JWT_ROLE_RESPONDENT);
+ converter = new GrantedAuthorityConverter(applicationConfig);
+ List tokenRoles = List.of("dummyRole1", "internal_user", "dummyRole2", "webclient", "adm");
+
+ Jwt jwt = createJwt(tokenRoles);
+ Collection authorities = converter.convert(jwt);
+ assertThat(authorities)
+ .hasSize(3)
+ .containsExactlyInAnyOrder(
+ new SimpleGrantedAuthority(AuthorityRoleEnum.INTERNAL_USER.securityRole()),
+ new SimpleGrantedAuthority(AuthorityRoleEnum.ADMIN.securityRole()),
+ new SimpleGrantedAuthority(AuthorityRoleEnum.WEB_CLIENT.securityRole()));
+ }
+
+ @Test
+ @DisplayName("Given a JWT, when converting roles, then accept a config role can be used for multiple app roles")
+ void testConverter03() {
+ String dummyRole = "dummyRole";
+ String dummyRole2 = "dummyRole2";
+ applicationConfig.setRoleAdmin(List.of(dummyRole));
+ applicationConfig.setRoleInternalUser(List.of(dummyRole2));
+ applicationConfig.setRoleWebClient(List.of(dummyRole));
+ applicationConfig.setRoleRespondent(List.of(""));
+ converter = new GrantedAuthorityConverter(applicationConfig);
+
+ List tokenRoles = List.of(dummyRole, "role-not-used", dummyRole2, "role-not-used-2");
+ Jwt jwt = createJwt(tokenRoles);
+
+ Collection authorities = converter.convert(jwt);
+ assertThat(authorities)
+ .hasSize(3)
+ .contains(
+ new SimpleGrantedAuthority(AuthorityRoleEnum.INTERNAL_USER.securityRole()),
+ new SimpleGrantedAuthority(AuthorityRoleEnum.ADMIN.securityRole()),
+ new SimpleGrantedAuthority(AuthorityRoleEnum.WEB_CLIENT.securityRole()));
+ }
+
+ @ParameterizedTest
+ @MethodSource("provideJWTRoleWithAppRoleAssociated")
+ @DisplayName("Given a JWT, when converting roles, then assure each JWT role is converted to equivalent app role")
+ void testConverter04(List jwtRoles, AuthorityRoleEnum appRole) {
+ applicationConfig.setRoleAdmin(JWT_ROLE_ADMIN);
+ applicationConfig.setRoleInternalUser(JWT_ROLE_INTERNAL_USER);
+ applicationConfig.setRoleWebClient(JWT_ROLE_WEBCLIENT);
+ applicationConfig.setRoleRespondent(JWT_ROLE_RESPONDENT);
+ converter = new GrantedAuthorityConverter(applicationConfig);
+
+ Jwt jwt = createJwt(jwtRoles);
+ Collection authorities = converter.convert(jwt);
+ assertThat(authorities)
+ .hasSize(1)
+ .contains(new SimpleGrantedAuthority(appRole.securityRole()));
+ }
+
+ private static Stream provideJWTRoleWithAppRoleAssociated() {
+ return Stream.of(
+ Arguments.of(JWT_ROLE_INTERNAL_USER, AuthorityRoleEnum.INTERNAL_USER),
+ Arguments.of(JWT_ROLE_ADMIN, AuthorityRoleEnum.ADMIN),
+ Arguments.of(JWT_ROLE_WEBCLIENT, AuthorityRoleEnum.WEB_CLIENT),
+ Arguments.of(JWT_ROLE_RESPONDENT, AuthorityRoleEnum.RESPONDENT));
+ }
+
+ private Jwt createJwt(List tokenRoles) {
+ Map jwtHeaders = new HashMap<>();
+ jwtHeaders.put("header", "headerValue");
+
+ Map claims = new HashMap<>();
+ claims.put(applicationConfig.getRoleClaim(), tokenRoles);
+
+ return new Jwt("user-id", Instant.now(), Instant.MAX, jwtHeaders, claims);
+ }
+}
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/AddressControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressControllerTest.java
similarity index 89%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/AddressControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressControllerTest.java
index 9a27dc60..4093f238 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/AddressControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/AddressControllerTest.java
@@ -1,7 +1,7 @@
-package fr.insee.survey.datacollectionmanagement.contacts.controller;
+package fr.insee.survey.datacollectionmanagement.contact.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
@@ -99,13 +99,6 @@ void putAddressCreateUpdate() throws Exception {
assertEquals(contactAfterUpdate.getAddress().getStreetName(), addressUpdated.getStreetName());
assertEquals(contactAfterUpdate.getAddress().getCountryName(), addressUpdated.getCountryName());
- // back to before
- contact.setAddress(addressBefore);
- addressService.saveAddress(addressBefore);
- contactService.saveContact(contact);
- assertEquals(contact.getAddress().getCityName(), addressBefore.getCityName());
- assertEquals(contact.getAddress().getStreetName(), addressBefore.getStreetName());
- assertEquals(contact.getAddress().getCountryName(), addressBefore.getCountryName());
}
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/ContactControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactControllerTest.java
similarity index 94%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/ContactControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactControllerTest.java
index 7752dc02..b3fb974f 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/ContactControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactControllerTest.java
@@ -1,12 +1,13 @@
-package fr.insee.survey.datacollectionmanagement.contacts.controller;
+package fr.insee.survey.datacollectionmanagement.contact.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactRepository;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
@@ -102,9 +103,8 @@ void putContactCreateUpdateDelete() throws Exception {
assertEquals(contact.getFirstName(), contactFound.getFirstName());
assertEquals(contact.getEmail(), contactFound.getEmail());
List list = new ArrayList<>(contactEventService.findContactEventsByContact(contactFound));
- // List list = new ArrayList<>(contactFound.getContactEvents());
assertEquals(1, list.size());
- assertEquals(ContactEventType.create, list.get(0).getType());
+ assertEquals(ContactEventTypeEnum.create, list.get(0).getType());
// update contact - status ok
contact.setLastName("lastNameUpdate");
@@ -119,7 +119,7 @@ void putContactCreateUpdateDelete() throws Exception {
List listUpdate = new ArrayList<>(
contactEventService.findContactEventsByContact(contactFoundAfterUpdate));
assertEquals(2, listUpdate.size());
- assertEquals(ContactEventType.update, listUpdate.get(1).getType());
+ assertEquals(ContactEventTypeEnum.update, listUpdate.get(1).getType());
// delete contact
mockMvc.perform(delete(Constants.API_CONTACTS_ID, identifier).contentType(MediaType.APPLICATION_JSON))
@@ -183,7 +183,7 @@ private Contact initContact(String identifier) {
contactMock.setEmail("test@insee.fr");
contactMock.setFirstName("firstName" + identifier);
contactMock.setLastName("lastName" + identifier);
- contactMock.setGender(Contact.Gender.Male);
+ contactMock.setGender(GenderEnum.Male);
return contactMock;
}
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/ContactEventControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventControllerTest.java
similarity index 91%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/ContactEventControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventControllerTest.java
index 141ef215..2934a58b 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/contacts/controller/ContactEventControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/contact/controller/ContactEventControllerTest.java
@@ -1,7 +1,7 @@
-package fr.insee.survey.datacollectionmanagement.contacts.controller;
+package fr.insee.survey.datacollectionmanagement.contact.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import org.json.JSONArray;
import org.json.JSONException;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderTest.java
similarity index 95%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderTest.java
index db45fa7c..381b3422 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderTest.java
@@ -7,18 +7,20 @@
import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.AddressRepository;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactEventRepository;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactRepository;
import fr.insee.survey.datacollectionmanagement.metadata.domain.*;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.metadata.repository.*;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.questioning.domain.*;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.repository.*;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserRoleTypeEnum;
import fr.insee.survey.datacollectionmanagement.user.service.UserService;
import fr.insee.survey.datacollectionmanagement.view.domain.View;
import fr.insee.survey.datacollectionmanagement.view.repository.ViewRepository;
@@ -105,7 +107,7 @@ public void init() throws ParseException {
private void initUser() {
User user = new User();
user.setIdentifier("USER1");
- user.setRole(User.UserRoleType.ASSISTANCE);
+ user.setRole(UserRoleTypeEnum.ASSISTANCE);
userService.createUser(user, null);
}
@@ -158,7 +160,7 @@ private void createContactAddressAndEvents(int i) {
private void createContactEvent(Contact contact) {
ContactEvent contactEvent = new ContactEvent();
contactRepository.save(contact);
- contactEvent.setType(ContactEventType.create);
+ contactEvent.setType(ContactEventTypeEnum.create);
contactEvent.setEventDate(new Date());
contactEvent.setContact(contact);
String json = "{\"contact_identifier\":\"" + contact.getIdentifier() + "\",\"name\":\"" + contact.getLastName()
@@ -195,9 +197,9 @@ private Contact createContact(int i) {
contact.setLastName("lastName" + i);
contact.setEmail(contact.getFirstName() + contact.getLastName() + "@test.com");
if (i % 2 == 0)
- contact.setGender(Contact.Gender.Female);
+ contact.setGender(GenderEnum.Female);
if (i % 2 != 0)
- contact.setGender(Contact.Gender.Male);
+ contact.setGender(GenderEnum.Male);
return contact;
}
@@ -269,7 +271,6 @@ private void initMetadata() throws ParseException {
Date openingDate = sdf.parse("01/01/" + year);
Date closingDate = sdf.parse("31/12/" + year);
Date returnDate = sdf.parse("01/06/" + year);
- Date today = sdf.parse("31/12/" + year);
part.setOpeningDate(openingDate);
part.setClosingDate(closingDate);
@@ -311,7 +312,6 @@ private void initQuestionning(Faker faker) {
QuestioningAccreditation accreditation;
Set questioningAccreditations;
String fakeSiren;
- Random qeRan = new Random();
for (Long i = surveyUnitRepository.count(); i < 10; i++) {
SurveyUnit su = new SurveyUnit();
@@ -324,7 +324,6 @@ private void initQuestionning(Faker faker) {
}
for (Long i = nbExistingQuestionings; i < 10; i++) {
qu = new Questioning();
- qe = new QuestioningEvent();
List qeList = new ArrayList<>();
questioningAccreditations = new HashSet<>();
@@ -342,7 +341,6 @@ private void initQuestionning(Faker faker) {
// questioning events
// everybody in INITLA
Optional part = partitioningRepository.findById(qu.getIdPartitioning());
- Date eventDate = today;
qeList.add(new QuestioningEvent(
faker.date().between(part.get().getOpeningDate(), part.get().getClosingDate()),
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/CucumberTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/CucumberTest.java
similarity index 100%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/integration/CucumberTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/CucumberTest.java
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/QuestioningInformationsSteps.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/QuestioningInformationsSteps.java
similarity index 97%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/integration/QuestioningInformationsSteps.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/QuestioningInformationsSteps.java
index 95dc9a6d..f26981cf 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/QuestioningInformationsSteps.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/QuestioningInformationsSteps.java
@@ -1,10 +1,11 @@
package fr.insee.survey.datacollectionmanagement.integration;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.AddressRepository;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactRepository;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
@@ -142,7 +143,7 @@ public void createContact(String contactId, String firstName, String lastName, S
c.setIdentifier(contactId);
c.setFirstName(firstName);
c.setLastName(lastName);
- c.setGender(Contact.Gender.valueOf(gender));
+ c.setGender(GenderEnum.valueOf(gender));
Address address = new Address();
address.setStreetNumber(streetNumber);
addressRepository.save(address);
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchContactSteps.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchContactSteps.java
similarity index 96%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchContactSteps.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchContactSteps.java
index c6a163c2..9d738ed8 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchContactSteps.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchContactSteps.java
@@ -2,13 +2,13 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.dto.SearchContactDtoImpl;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactParamEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactRepository;
-import fr.insee.survey.datacollectionmanagement.contact.util.ContactParamEnum;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchSurveyUnitSteps.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchSurveyUnitSteps.java
similarity index 95%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchSurveyUnitSteps.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchSurveyUnitSteps.java
index 9a045e3f..972867f6 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchSurveyUnitSteps.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/integration/SearchSurveyUnitSteps.java
@@ -2,13 +2,13 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
import fr.insee.survey.datacollectionmanagement.questioning.dto.SearchSurveyUnitDtoImpl;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.SurveyUnitParamEnum;
import fr.insee.survey.datacollectionmanagement.questioning.repository.SurveyUnitRepository;
-import fr.insee.survey.datacollectionmanagement.questioning.util.SurveyUnitParamEnum;
import io.cucumber.datatable.DataTable;
import io.cucumber.java.en.Given;
import io.cucumber.java.en.Then;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignControllerTest.java
similarity index 97%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignControllerTest.java
index c83d4f3e..36700637 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/CampaignControllerTest.java
@@ -1,13 +1,13 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
import fr.insee.survey.datacollectionmanagement.metadata.service.CampaignService;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
import fr.insee.survey.datacollectionmanagement.util.JsonUtil;
import net.minidev.json.JSONObject;
import org.assertj.core.util.DateUtil;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceControllerTest.java
similarity index 96%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceControllerTest.java
index 8e49cf6b..809bc05b 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SourceControllerTest.java
@@ -1,13 +1,13 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Source;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.metadata.repository.SourceRepository;
import fr.insee.survey.datacollectionmanagement.metadata.service.SourceService;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.util.JsonUtil;
import org.json.JSONException;
import org.json.JSONObject;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyControllerTest.java
similarity index 97%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyControllerTest.java
index 0f330c09..e4cf7c7a 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/metadata/controller/SurveyControllerTest.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.metadata.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Survey;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java
similarity index 93%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java
index 55a26f24..b1c88355 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MoogControllerTest.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsControllerTest.java
similarity index 82%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsControllerTest.java
index 42cdb355..5708855d 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/query/controller/MyQuestioningsControllerTest.java
@@ -1,16 +1,14 @@
package fr.insee.survey.datacollectionmanagement.query.controller;
import com.fasterxml.jackson.databind.ObjectMapper;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.query.dto.MyQuestioningDto;
-import fr.insee.survey.datacollectionmanagement.query.service.CheckHabilitationService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
@@ -29,11 +27,7 @@
class MyQuestioningsControllerTest {
@Autowired
- private MockMvc mockMvc;
-
- @MockBean
- private CheckHabilitationService checkAccreditationService;
-
+ MockMvc mockMvc;
@Test
void myQuestioningsContactNotExist() throws Exception {
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningAccreditationControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningAccreditationControllerTest.java
similarity index 90%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningAccreditationControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningAccreditationControllerTest.java
index 1ea44ad2..a66c3cee 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningAccreditationControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningAccreditationControllerTest.java
@@ -1,11 +1,12 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningAccreditation;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import jakarta.transaction.Transactional;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -22,9 +23,9 @@
import org.springframework.test.web.servlet.MockMvc;
import java.util.Set;
-import java.util.stream.Collectors;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
@@ -35,6 +36,7 @@
@SpringBootTest
@ActiveProfiles("test")
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_CLASS)
+@Transactional
class QuestionningAccreditationControllerTest {
@Autowired
@@ -52,7 +54,7 @@ void init() {
void getQuestioningAccreditationOk() throws Exception {
Questioning questioning = questioningService.findBySurveyUnitIdSu("100000001").stream().findFirst().get();
Long identifier = questioning.getQuestioningAccreditations().stream().findFirst().get().getId();
- String json = createJsonQuestioningAcreditation(identifier);
+ String json = createJsonQuestioningAcreditation();
this.mockMvc.perform(get(Constants.API_QUESTIONINGS_ID_QUESTIONING_ACCREDITATIONS, identifier)).andDo(print()).andExpect(status().isOk())
.andExpect(content().json(json, false));
}
@@ -107,12 +109,12 @@ void postAccreditationCreateUpdate() throws Exception {
post(Constants.API_QUESTIONINGS_ID_QUESTIONING_ACCREDITATIONS, idQuestioning)
.content(jsonAccreditation).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated())
- .andExpect(content().json(jsonAccreditation.toString(), false));
- Questioning questioning = questioningService.findbyId((long) idQuestioning);
+ .andExpect(content().json(jsonAccreditation, false));
+ Questioning questioning = questioningService.findbyId(idQuestioning);
Set setAccreditationFound = questioning.getQuestioningAccreditations();
QuestioningAccreditation accreditationFound = setAccreditationFound.stream()
.filter(acc -> acc.getIdContact().equals(idContact))
- .collect(Collectors.toList()).get(0);
+ .toList().getFirst();
assertEquals(accreditationFound.getCreationAuthor(), accreditation.getCreationAuthor());
assertEquals(accreditationFound.getIdContact(), accreditation.getIdContact());
@@ -123,12 +125,12 @@ void postAccreditationCreateUpdate() throws Exception {
post(Constants.API_QUESTIONINGS_ID_QUESTIONING_ACCREDITATIONS, idQuestioning)
.content(jsonAccreditationUpdate).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
- .andExpect(content().json(jsonAccreditationUpdate.toString(), false));
+ .andExpect(content().json(jsonAccreditationUpdate, false));
- QuestioningAccreditation accreditationFoundAfterUpdate = questioningService.findbyId((long) idQuestioning)
+ QuestioningAccreditation accreditationFoundAfterUpdate = questioningService.findbyId(idQuestioning)
.getQuestioningAccreditations().stream().filter(acc -> acc.getIdContact().equals(idContact))
- .toList().get(0);
- assertEquals(true, accreditationFoundAfterUpdate.isMain());
+ .toList().getFirst();
+ assertTrue(accreditationFoundAfterUpdate.isMain());
}
@@ -148,7 +150,7 @@ private String createJson(QuestioningAccreditation accreditation) throws JSONExc
return jo.toString();
}
- private String createJsonQuestioningAcreditation(Long identifier) throws JSONException {
+ private String createJsonQuestioningAcreditation() throws JSONException {
JSONObject jo1 = new JSONObject();
jo1.put("idContact", "CONT1");
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningControllerTest.java
similarity index 64%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningControllerTest.java
index 0872467f..3fe514c9 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningControllerTest.java
@@ -1,9 +1,8 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
import org.json.JSONArray;
import org.json.JSONException;
@@ -13,7 +12,6 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.http.HttpStatus;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
@@ -39,22 +37,6 @@ void init() {
SecurityContextHolder.getContext().setAuthentication(AuthenticationUserProvider.getAuthenticatedUser("test", AuthorityRoleEnum.ADMIN));
}
- @Test
- void getQuestioningOk() throws Exception {
- Questioning questioning = questioningService.findBySurveyUnitIdSu("100000001").stream().findFirst().get();
- Long id = questioning.getQuestioningAccreditations().stream().findFirst().get().getId();
- String json = createJson(id).toString();
- this.mockMvc.perform(get(Constants.API_QUESTIONINGS_ID, id)).andDo(print()).andExpect(status().isOk())
- .andExpect(content().json(json, false));
- }
-
- @Test
- void getQuestioningNotFound() throws Exception {
- String id = "300";
- this.mockMvc.perform(get(Constants.API_QUESTIONINGS_ID, id)).andDo(print())
- .andExpect(status().is(HttpStatus.NOT_FOUND.value()));
-
- }
@Test
void getQuestioningsBySurveyUnit() throws Exception {
@@ -66,11 +48,6 @@ void getQuestioningsBySurveyUnit() throws Exception {
}
- private JSONObject createJson(Long id) throws JSONException {
- JSONObject jo = new JSONObject();
- jo.put("id", id);
- return jo;
- }
private String createJsonQuestionings(String id) throws JSONException {
JSONObject jo = new JSONObject();
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningEventControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningEventControllerTest.java
similarity index 88%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningEventControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningEventControllerTest.java
index bf9931ae..ae3c5674 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningEventControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/QuestionningEventControllerTest.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
@@ -17,6 +17,7 @@
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.transaction.annotation.Transactional;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
@@ -40,10 +41,11 @@ void init() {
@Test
+ @Transactional
void getQuestioningEventOk() throws Exception {
Questioning questioning = questioningService.findBySurveyUnitIdSu("100000001").stream().findFirst().get();
Long id = questioning.getQuestioningAccreditations().stream().findFirst().get().getId();
- String json = createJsonQuestioningEvent(id);
+ String json = createJsonQuestioningEvent();
this.mockMvc.perform(get(Constants.API_QUESTIONING_ID_QUESTIONING_EVENTS, id)).andDo(print()).andExpect(status().isOk())
.andExpect(content().json(json, false));
}
@@ -56,7 +58,7 @@ void getQuestioningEventNotFound() throws Exception {
}
- private String createJsonQuestioningEvent(Long identifier) throws JSONException {
+ private String createJsonQuestioningEvent() throws JSONException {
JSONObject joEventInitla = new JSONObject();
joEventInitla.put("type", "INITLA");
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitControllerTest.java
similarity index 98%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitControllerTest.java
index 0d15aa7a..5244b083 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/controller/SurveyUnitControllerTest.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.questioning.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/controller/UserControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/UserControllerTest.java
similarity index 90%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/controller/UserControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/UserControllerTest.java
index 0f05fc3b..9dd3e584 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/controller/UserControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/UserControllerTest.java
@@ -1,12 +1,13 @@
-package fr.insee.survey.datacollectionmanagement.user.controller.controller;
+package fr.insee.survey.datacollectionmanagement.user.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
-import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent.UserEventType;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserRoleTypeEnum;
import fr.insee.survey.datacollectionmanagement.user.repository.UserRepository;
import fr.insee.survey.datacollectionmanagement.user.service.UserEventService;
import fr.insee.survey.datacollectionmanagement.user.service.UserService;
@@ -101,17 +102,17 @@ void putUserCreateUpdateDelete() throws Exception {
assertEquals(user.getRole(), userFound.getRole());
// update user - status ok
- user.setRole(User.UserRoleType.ASSISTANCE);
+ user.setRole(UserRoleTypeEnum.ASSISTANCE);
String jsonUserUpdate = createJson(user);
mockMvc.perform(put(Constants.API_USERS_ID, identifier).content(jsonUserUpdate)
.contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk())
.andExpect(content().json(jsonUserUpdate.toString(), false));
User userFoundAfterUpdate = userService.findByIdentifier(identifier);
- assertEquals(User.UserRoleType.ASSISTANCE, userFoundAfterUpdate.getRole());
+ assertEquals(UserRoleTypeEnum.ASSISTANCE, userFoundAfterUpdate.getRole());
List listUpdate = new ArrayList<>(
userEventService.findUserEventsByUser(userFoundAfterUpdate));
assertEquals(2, listUpdate.size());
- assertEquals(UserEventType.UPDATE, listUpdate.get(1).getType());
+ assertEquals(UserEventTypeEnum.UPDATE, listUpdate.get(1).getType());
// delete user
mockMvc.perform(delete(Constants.API_USERS_ID, identifier).contentType(MediaType.APPLICATION_JSON))
@@ -140,10 +141,10 @@ void putUsersErrorId() throws Exception {
}
private User initGestionnaire(String identifier) {
- return initUser(identifier, User.UserRoleType.GESTIONNAIRE);
+ return initUser(identifier, UserRoleTypeEnum.GESTIONNAIRE);
}
- private User initUser(String identifier, User.UserRoleType role) {
+ private User initUser(String identifier, UserRoleTypeEnum role) {
User userMock = new User();
userMock.setIdentifier(identifier);
userMock.setRole(role);
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/controller/UserEventControllerTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventControllerTest.java
similarity index 88%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/controller/UserEventControllerTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventControllerTest.java
index a4a8e15c..5e5b8a45 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/controller/UserEventControllerTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/user/controller/UserEventControllerTest.java
@@ -1,9 +1,9 @@
-package fr.insee.survey.datacollectionmanagement.user.controller.controller;
+package fr.insee.survey.datacollectionmanagement.user.controller;
-import fr.insee.survey.datacollectionmanagement.config.AuthenticationUserProvider;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
+import fr.insee.survey.datacollectionmanagement.configuration.AuthenticationUserProvider;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.Constants;
-import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@@ -59,7 +59,7 @@ private String createJsonUserEvent(String identifier, JSONObject payload) throws
JSONObject jo = new JSONObject();
JSONObject joPayload = new JSONObject();
joPayload.put("identifier", identifier);
- joPayload.put("type", UserEvent.UserEventType.CREATE.name());
+ joPayload.put("type", UserEventTypeEnum.CREATE.name());
jo.put("payload", payload);
JSONArray ja = new JSONArray();
ja.put(jo);
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorTest.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegexTest.java
similarity index 98%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorTest.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegexTest.java
index a5b8208d..c9e18670 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorTest.java
+++ b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/util/EmailValidatorRegexTest.java
@@ -6,7 +6,7 @@
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
-class EmailValidatorTest {
+class EmailValidatorRegexTest {
@Test
@DisplayName("Check valid email")
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/util/JsonUtil.java b/platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/util/JsonUtil.java
similarity index 100%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/util/JsonUtil.java
rename to platine-management-api/src/test/java/fr/insee/survey/datacollectionmanagement/util/JsonUtil.java
diff --git a/src/test/resources/application.properties b/platine-management-api/src/test/resources/application.properties
similarity index 100%
rename from src/test/resources/application.properties
rename to platine-management-api/src/test/resources/application.properties
diff --git a/src/test/resources/data.sql b/platine-management-api/src/test/resources/data.sql
similarity index 100%
rename from src/test/resources/data.sql
rename to platine-management-api/src/test/resources/data.sql
diff --git a/src/test/resources/integration/query/get_questioning_informations.feature b/platine-management-api/src/test/resources/integration/query/get_questioning_informations.feature
similarity index 100%
rename from src/test/resources/integration/query/get_questioning_informations.feature
rename to platine-management-api/src/test/resources/integration/query/get_questioning_informations.feature
diff --git a/src/test/resources/integration/query/search_contact.feature b/platine-management-api/src/test/resources/integration/query/search_contact.feature
similarity index 100%
rename from src/test/resources/integration/query/search_contact.feature
rename to platine-management-api/src/test/resources/integration/query/search_contact.feature
diff --git a/src/test/resources/integration/query/search_survey_unit.feature b/platine-management-api/src/test/resources/integration/query/search_survey_unit.feature
similarity index 100%
rename from src/test/resources/integration/query/search_survey_unit.feature
rename to platine-management-api/src/test/resources/integration/query/search_survey_unit.feature
diff --git a/platine-management-db/pom.xml b/platine-management-db/pom.xml
new file mode 100644
index 00000000..1ce2efe2
--- /dev/null
+++ b/platine-management-db/pom.xml
@@ -0,0 +1,36 @@
+
+
+ 4.0.0
+
+ fr.insee.survey
+ platine-management
+ ${revision}${changelist}
+
+
+ platine-management-db
+
+
+ 42.7.3
+
+
+
+
+ fr.insee.survey
+ platine-management-shared
+ ${project.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-data-jpa
+
+
+
+ org.postgresql
+ postgresql
+ ${postgres-version}
+
+
+
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Address.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Address.java
similarity index 52%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Address.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Address.java
index ad606d07..d449e754 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Address.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Address.java
@@ -30,18 +30,4 @@ public class Address {
private String countryCode;
private String countryName;
- public String toStringMoog() {
- return (streetNumber!=null?streetNumber:"") +
- " "+ (repetitionIndex!=null?repetitionIndex:"")+
- " " +(streetType!=null?streetType:"")+
- "" + (streetName!=null?streetName:"")+
- " " +(addressSupplement!=null?addressSupplement:"") +
- " " + (cityName!=null?cityName:"")+
- " " + (zipCode!=null?zipCode:"") +
- " " + (cedexCode!=null?cedexCode:"") +
- " " + (cedexName!=null?cedexName:"") +
- " " + (specialDistribution!=null?specialDistribution:"") +
- " " + (countryCode!=null?countryCode:"") +
- " " + (countryName!=null?countryName:"");
- }
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Contact.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Contact.java
similarity index 92%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Contact.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Contact.java
index 1f46a1e2..6c6b67c1 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Contact.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/Contact.java
@@ -1,5 +1,6 @@
package fr.insee.survey.datacollectionmanagement.contact.domain;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
@@ -18,10 +19,6 @@
@Setter
public class Contact {
- public enum Gender {
- Female, Male, Undefined
- }
-
@Id
private String identifier;
@@ -45,6 +42,6 @@ public enum Gender {
private Set contactEvents;
@Enumerated(EnumType.STRING)
- private Gender gender;
+ private GenderEnum gender;
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/ContactEvent.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/ContactEvent.java
similarity index 86%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/ContactEvent.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/ContactEvent.java
index 8acd1999..01703fa5 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/ContactEvent.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/domain/ContactEvent.java
@@ -1,6 +1,7 @@
package fr.insee.survey.datacollectionmanagement.contact.domain;
import com.fasterxml.jackson.databind.JsonNode;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.JdbcTypeCode;
@@ -14,10 +15,6 @@
@NoArgsConstructor
public class ContactEvent {
- public enum ContactEventType {
- create, update, merged, firstConnect, reinitPassword
- }
-
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "contact_event_seq")
private Long id;
@@ -25,7 +22,7 @@ public enum ContactEventType {
@JdbcTypeCode(SqlTypes.INTEGER)
@Enumerated(EnumType.ORDINAL)
- private ContactEventType type;
+ private ContactEventTypeEnum type;
@ManyToOne
private Contact contact;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/AddressRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/AddressRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/AddressRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/AddressRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactEventRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactEventRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactEventRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactEventRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/contact/repository/ContactRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Campaign.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Campaign.java
similarity index 92%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Campaign.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Campaign.java
index 9f533506..d880e9a3 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Campaign.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Campaign.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.domain;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
import jakarta.persistence.*;
import lombok.*;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/CampaignEvent.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/CampaignEvent.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/CampaignEvent.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/CampaignEvent.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Owner.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Owner.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Owner.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Owner.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Parameters.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Parameters.java
similarity index 79%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Parameters.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Parameters.java
index 449580d4..2a0b0f04 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Parameters.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Parameters.java
@@ -1,22 +1,17 @@
package fr.insee.survey.datacollectionmanagement.metadata.domain;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
import jakarta.persistence.Entity;
import jakarta.persistence.EnumType;
import jakarta.persistence.Enumerated;
import jakarta.persistence.Id;
import jakarta.persistence.*;
import lombok.Data;
-import lombok.Getter;
@Entity
@Data
public class Parameters {
- @Getter
- public enum ParameterEnum {
- URL_REDIRECTION,URL_TYPE, MAIL_ASSISTANCE;
- }
-
@Id
private String metadataId;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Partitioning.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Partitioning.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Partitioning.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Partitioning.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Source.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Source.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Source.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Source.java
index 4b238000..5df06555 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Source.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Source.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.domain;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.user.domain.SourceAccreditation;
import jakarta.persistence.*;
import lombok.*;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Support.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Support.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Support.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Support.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Survey.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Survey.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Survey.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/domain/Survey.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignEventRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignEventRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignEventRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignEventRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/CampaignRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/OwnerRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/OwnerRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/OwnerRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/OwnerRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/PartitioningRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/PartitioningRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/PartitioningRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/PartitioningRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SourceRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SourceRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SourceRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SourceRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SupportRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SupportRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SupportRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SupportRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SurveyRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SurveyRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SurveyRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/repository/SurveyRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/MoogCampaign.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/MoogCampaign.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/MoogCampaign.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/MoogCampaign.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/QuestioningInformations.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/QuestioningInformations.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/QuestioningInformations.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/QuestioningInformations.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/ResultUpload.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/ResultUpload.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/ResultUpload.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/domain/ResultUpload.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/InformationsRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/InformationsRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/InformationsRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/InformationsRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MonitoringRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MonitoringRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MonitoringRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MonitoringRepository.java
diff --git a/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MoogRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MoogRepository.java
new file mode 100644
index 00000000..c027d60b
--- /dev/null
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MoogRepository.java
@@ -0,0 +1,241 @@
+package fr.insee.survey.datacollectionmanagement.query.repository;
+
+import fr.insee.survey.datacollectionmanagement.query.dto.MoogExtractionRowDto;
+import fr.insee.survey.datacollectionmanagement.query.dto.MoogQuestioningEventDto;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.stereotype.Repository;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.List;
+
+@Repository
+@RequiredArgsConstructor
+@Slf4j
+public class MoogRepository {
+
+ private final JdbcTemplate jdbcTemplate;
+
+ static final String GET_EVENTS_QUERY = """
+ select
+ qe.id,
+ date,
+ type,
+ survey_unit_id_su,
+ campaign_id
+ from
+ questioning_event qe
+ join questioning q on
+ qe.questioning_id = q.id
+ join partitioning p on
+ q.id_partitioning = p.id
+ where
+ survey_unit_id_su =?
+ and campaign_id =?
+ """;
+
+
+ public List getEventsByIdSuByCampaign(String idCampaign, String idSu) {
+ return jdbcTemplate.query(GET_EVENTS_QUERY, (rs, rowNum) -> {
+ MoogQuestioningEventDto moogEvent = new MoogQuestioningEventDto();
+ moogEvent.setIdManagementMonitoringInfo(rs.getString("id"));
+ moogEvent.setStatus(rs.getString("type"));
+ moogEvent.setDateInfo(rs.getTimestamp("date").getTime());
+ return moogEvent;
+ }, idSu, idCampaign);
+ }
+
+ static final String EXTRACTION_QUERY = """
+ SELECT
+ B.id_su,
+ B.identifier AS id_contact,
+ B.first_name AS firstname,
+ B.last_name AS lastname,
+ addr.id AS address_id,
+ addr.street_number AS street_number,
+ addr.repetition_index AS repetition_index,
+ addr.street_type AS street_type,
+ addr.street_name AS street_name,
+ addr.address_supplement AS address_supplement,
+ addr.zip_code AS zip_code,
+ addr.city_name AS city_name,
+ addr.cedex_code AS cedex_code,
+ addr.cedex_name AS cedex_name,
+ addr.special_distribution AS special_distribution,
+ addr.country_code AS country_code,
+ addr.country_name AS country_name,
+ B.date AS dateinfo,
+ B.type AS status,
+ B.batch_num
+ FROM (
+ SELECT
+ q.id,
+ A.campaign_id,
+ A.id_su,
+ A.identifier,
+ A.first_name,
+ A.last_name,
+ A.address_id,
+ q.id_partitioning AS batch_num,
+ qe.date,
+ qe.type
+ FROM (
+ SELECT
+ v.campaign_id,
+ v.id_su,
+ contact.identifier,
+ contact.first_name,
+ contact.last_name,
+ contact.address_id
+ FROM view v
+ LEFT JOIN contact
+ ON contact.identifier = v.identifier
+ WHERE v.campaign_id = ?
+ ) AS A
+ LEFT JOIN questioning q
+ ON A.id_su = q.survey_unit_id_su
+ AND q.id_partitioning IN (
+ SELECT id
+ FROM partitioning p
+ WHERE p.campaign_id = ?
+ )
+ LEFT JOIN questioning_event qe
+ ON q.id = qe.questioning_id
+ ) AS B
+ LEFT JOIN address addr
+ ON B.address_id = addr.id
+ """;
+
+
+ public List getExtraction(String idCampaign) {
+ return jdbcTemplate.query(EXTRACTION_QUERY, (rs, rowNum) -> {
+ MoogExtractionRowDto ev = new MoogExtractionRowDto();
+
+ ev.setAddress("addresse non connue");
+
+ ev.setStatus(rs.getString("status"));
+ ev.setDateInfo(rs.getString("dateinfo"));
+ ev.setIdSu(rs.getString("id_su"));
+ ev.setIdContact(rs.getString("id_contact"));
+ ev.setLastname(rs.getString("lastname"));
+ ev.setFirstname(rs.getString("firstname"));
+ ev.setAddress(createAddress(rs));
+ ev.setBatchNumber(rs.getString("batch_num"));
+
+ return ev;
+ }, idCampaign, idCampaign);
+ }
+
+ private static String createAddress(ResultSet rs) throws SQLException {
+ StringBuilder addressBuilder = new StringBuilder();
+
+ appendIfNotEmpty(addressBuilder, rs.getString("street_number"));
+ appendIfNotEmpty(addressBuilder, rs.getString("repetition_index"));
+ appendIfNotEmpty(addressBuilder, rs.getString("street_type"));
+ appendIfNotEmpty(addressBuilder, rs.getString("street_name"));
+ appendIfNotEmpty(addressBuilder, rs.getString("address_supplement"));
+ appendIfNotEmpty(addressBuilder, rs.getString("zip_code"));
+ appendIfNotEmpty(addressBuilder, rs.getString("city_name"));
+ appendIfNotEmpty(addressBuilder, rs.getString("cedex_code"));
+ appendIfNotEmpty(addressBuilder, rs.getString("cedex_name"));
+ appendIfNotEmpty(addressBuilder, rs.getString("special_distribution"));
+ appendIfNotEmpty(addressBuilder, rs.getString("country_code"));
+ appendIfNotEmpty(addressBuilder, rs.getString("country_name"));
+
+ return addressBuilder.toString().trim(); // Remove trailing spaces
+ }
+
+ private static void appendIfNotEmpty(StringBuilder builder, String value) {
+ if (value != null && !value.isEmpty()) {
+ builder.append(value.trim()).append(" ");
+ }
+ }
+
+ static final String SURVEY_UNIT_FOLLOW_UP_QUERY = """
+ select
+ distinct on
+ (id_su) id_su,
+ batch_num,
+ case
+ when type in ('PND') then 1
+ else 0
+ end as PND
+ from
+ (
+ select
+ A.id_su,
+ A.identifier,
+ q.id,
+ q.id_partitioning as batch_num
+ from
+ (
+ select
+ id_su,
+ identifier
+ from
+ public.view v
+ where
+ campaign_id = ?)as A
+ left join questioning q on
+ q.survey_unit_id_su = A.id_su
+ and q.id_partitioning in (
+ select
+ id
+ from
+ partitioning p
+ where
+ p.campaign_id = ?)) as B
+ left join questioning_event qe on
+ B.id = qe.questioning_id
+ where
+ B.id_su not in (
+ select
+ distinct on
+ (id_su) id_su
+ from
+ (
+ select
+ id_su,
+ identifier,
+ id,
+ id_partitioning as batch_num
+ from
+ (
+ select
+ id_su,
+ identifier
+ from
+ public.view
+ where
+ campaign_id = ?)as A
+ left join questioning q on
+ q.survey_unit_id_su = A.id_su
+ and q.id_partitioning in (
+ select
+ id
+ from
+ partitioning p
+ where
+ p.campaign_id = ?)) as B
+ left join questioning_event on
+ B.id = questioning_event.questioning_id
+ where
+ type in ('VALINT', 'VALPAP', 'HC', 'REFUSAL', 'WASTE'))
+ order by
+ id_su,
+ pnd desc
+ """;
+
+ public List getSurveyUnitToFollowUp(String idCampaign) {
+ return jdbcTemplate.query(SURVEY_UNIT_FOLLOW_UP_QUERY,
+ (rs, rowNum) -> {
+ MoogExtractionRowDto er = new MoogExtractionRowDto();
+ er.setIdSu(rs.getString("id_su"));
+ er.setPnd(rs.getInt("PND"));
+ er.setBatchNumber(rs.getString("batch_num"));
+ return er;
+ }, idCampaign, idCampaign, idCampaign, idCampaign);
+ }
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/EventOrder.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/EventOrder.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/EventOrder.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/EventOrder.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Operator.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Operator.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Operator.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Operator.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/OperatorService.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/OperatorService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/OperatorService.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/OperatorService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java
similarity index 62%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java
index 65409dfa..8054d4b9 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Questioning.java
@@ -1,37 +1,43 @@
-package fr.insee.survey.datacollectionmanagement.questioning.domain;
-
-import jakarta.persistence.*;
-import lombok.*;
-
-import java.util.Set;
-
-@Entity
-@Getter
-@Setter@NoArgsConstructor
-@Table(indexes = {
- @Index(name = "idPartitioning_index", columnList = "idPartitioning"),
- @Index(name = "surveyUnitId_index", columnList = "survey_unit_id_su")
-
-})
-public class Questioning {
-
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "questioning_seq")
- private Long id;
-
- @NonNull
- private String modelName;
- @NonNull
- private String idPartitioning;
-
- @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
- private Set questioningAccreditations;
-
- @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
- private Set questioningEvents;
-
- @ManyToOne(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
- @NonNull
- private SurveyUnit surveyUnit;
-
-}
+package fr.insee.survey.datacollectionmanagement.questioning.domain;
+
+import jakarta.persistence.*;
+import lombok.*;
+
+import java.util.Set;
+
+@Entity
+@Getter
+@Setter@NoArgsConstructor
+@Table(indexes = {
+ @Index(name = "idPartitioning_index", columnList = "idPartitioning"),
+ @Index(name = "surveyUnitId_index", columnList = "survey_unit_id_su")
+
+})
+public class Questioning {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "questioning_seq")
+ private Long id;
+
+ @NonNull
+ private String modelName;
+ @NonNull
+ private String idPartitioning;
+
+ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ private Set questioningAccreditations;
+
+ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ private Set questioningEvents;
+
+ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ private Set questioningCommunications;
+
+ @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ private Set questioningComments;
+
+ @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+ @NonNull
+ private SurveyUnit surveyUnit;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningAccreditation.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningAccreditation.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningAccreditation.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningAccreditation.java
diff --git a/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningComment.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningComment.java
new file mode 100644
index 00000000..fb27893e
--- /dev/null
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningComment.java
@@ -0,0 +1,20 @@
+package fr.insee.survey.datacollectionmanagement.questioning.domain;
+
+import jakarta.persistence.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Entity
+@Getter
+@Setter
+public class QuestioningComment {
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "quest_comment_seq")
+ private Long id;
+ @Column(length = 2000)
+ private String comment;
+ private String author;
+ private Date date;
+}
diff --git a/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningCommunication.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningCommunication.java
new file mode 100644
index 00000000..654d99ef
--- /dev/null
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningCommunication.java
@@ -0,0 +1,32 @@
+package fr.insee.survey.datacollectionmanagement.questioning.domain;
+
+import fr.insee.survey.datacollectionmanagement.questioning.enums.StatusCommunication;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeCommunicationEvent;
+import jakarta.persistence.*;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Entity
+@Getter
+@Setter
+@Table(indexes = {
+ @Index(name = "idQuestioningComm_index", columnList = "questioning_id")
+})
+public class QuestioningCommunication {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "questioning_communication_seq")
+ private Long id;
+
+ private Date date;
+ @Enumerated(EnumType.STRING)
+ private TypeCommunicationEvent type;
+
+ @ManyToOne
+ private Questioning questioning;
+ @Enumerated(EnumType.STRING)
+ private StatusCommunication status;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningEvent.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningEvent.java
similarity index 90%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningEvent.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningEvent.java
index aac2ce8f..06e16a88 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningEvent.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/QuestioningEvent.java
@@ -1,57 +1,57 @@
-package fr.insee.survey.datacollectionmanagement.questioning.domain;
-
-import com.fasterxml.jackson.annotation.JsonManagedReference;
-import com.fasterxml.jackson.databind.JsonNode;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
-import jakarta.persistence.*;
-import lombok.Getter;
-import lombok.Setter;
-import org.hibernate.annotations.JdbcTypeCode;
-import org.hibernate.type.SqlTypes;
-
-import java.util.Date;
-
-@Entity
-@Getter
-@Setter
-@Table(indexes = {
- @Index(name = "idQuestioning_index", columnList = "questioning_id")
-})
-public class QuestioningEvent {
-
- @Id
- @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "questioning_event_seq")
- private Long id;
-
- private Date date;
- @Enumerated(EnumType.STRING)
- private TypeQuestioningEvent type;
-
- @ManyToOne
- private Questioning questioning;
-
- @ManyToOne(fetch = FetchType.EAGER)
- @JoinColumn(name = "id_upload")
- @JsonManagedReference
- private Upload upload;
-
- @JdbcTypeCode(SqlTypes.JSON)
- @Column(columnDefinition = "jsonb")
- private JsonNode payload;
-
- public QuestioningEvent(Date date, TypeQuestioningEvent type, Questioning questioning) {
- this.date = date;
- this.type = type;
- this.questioning = questioning;
- }
-
- public QuestioningEvent() {
- }
-
- @Override
- public String toString() {
- return "QuestioningEvent [id=" + id + ", date=" + date + ", type=" + type + ", payload=" + payload
- + "]";
- }
-
-}
+package fr.insee.survey.datacollectionmanagement.questioning.domain;
+
+import com.fasterxml.jackson.annotation.JsonManagedReference;
+import com.fasterxml.jackson.databind.JsonNode;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
+import jakarta.persistence.*;
+import lombok.Getter;
+import lombok.Setter;
+import org.hibernate.annotations.JdbcTypeCode;
+import org.hibernate.type.SqlTypes;
+
+import java.util.Date;
+
+@Entity
+@Getter
+@Setter
+@Table(indexes = {
+ @Index(name = "idQuestioning_index", columnList = "questioning_id")
+})
+public class QuestioningEvent {
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "questioning_event_seq")
+ private Long id;
+
+ private Date date;
+ @Enumerated(EnumType.STRING)
+ private TypeQuestioningEvent type;
+
+ @ManyToOne
+ private Questioning questioning;
+
+ @ManyToOne(fetch = FetchType.EAGER)
+ @JoinColumn(name = "id_upload")
+ @JsonManagedReference
+ private Upload upload;
+
+ @JdbcTypeCode(SqlTypes.JSON)
+ @Column(columnDefinition = "jsonb")
+ private JsonNode payload;
+
+ public QuestioningEvent(Date date, TypeQuestioningEvent type, Questioning questioning) {
+ this.date = date;
+ this.type = type;
+ this.questioning = questioning;
+ }
+
+ public QuestioningEvent() {
+ }
+
+ @Override
+ public String toString() {
+ return "QuestioningEvent [id=" + id + ", date=" + date + ", type=" + type + ", payload=" + payload
+ + "]";
+ }
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnit.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitAddress.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitAddress.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitAddress.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitAddress.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitComment.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitComment.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitComment.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/SurveyUnitComment.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Upload.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Upload.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Upload.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/domain/Upload.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/EventOrderRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/EventOrderRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/EventOrderRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/EventOrderRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorServiceRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorServiceRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorServiceRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/OperatorServiceRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningAccreditationRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningAccreditationRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningAccreditationRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningAccreditationRepository.java
diff --git a/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningCommentRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningCommentRepository.java
new file mode 100644
index 00000000..e352dc94
--- /dev/null
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningCommentRepository.java
@@ -0,0 +1,8 @@
+package fr.insee.survey.datacollectionmanagement.questioning.repository;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningComment;
+import org.springframework.data.jpa.repository.JpaRepository;
+
+public interface QuestioningCommentRepository extends JpaRepository {
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningEventRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningEventRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningEventRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningEventRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningRepository.java
similarity index 54%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningRepository.java
index 0ce0f3b6..85b88662 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningRepository.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/QuestioningRepository.java
@@ -1,6 +1,8 @@
package fr.insee.survey.datacollectionmanagement.questioning.repository;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.Set;
@@ -10,7 +12,13 @@ public interface QuestioningRepository extends JpaRepository
Set findByIdPartitioning(String idPartitioning);
Questioning findByIdPartitioningAndSurveyUnitIdSu(String idPartitioning,
- String surveyUnitIdSu);
+ String surveyUnitIdSu);
+
+ Page findBySurveyUnitIdSuOrSurveyUnitIdentificationCodeOrQuestioningAccreditationsIdContact(
+ String surveyUnitIdSu, String surveyUnitIdentificationCode, String idContact, Pageable pageable);
Set findBySurveyUnitIdSu(String idSu);
+
+ Page findAll(Pageable pageable);
+
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitAddressRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitAddressRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitAddressRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitAddressRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitCommentRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitCommentRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitCommentRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitCommentRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitRepository.java
similarity index 97%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitRepository.java
index a82a9646..c5692d29 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitRepository.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/SurveyUnitRepository.java
@@ -1,47 +1,47 @@
-package fr.insee.survey.datacollectionmanagement.questioning.repository;
-
-import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
-import fr.insee.survey.datacollectionmanagement.questioning.dto.SearchSurveyUnitDto;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.repository.JpaRepository;
-import org.springframework.data.jpa.repository.Query;
-
-import java.util.List;
-
-public interface SurveyUnitRepository extends JpaRepository {
-
- List findAllByIdentificationCode(String identificationCode);
-
- @Query(nativeQuery = true, value = """
- SELECT
- *
- FROM
- survey_unit su
- WHERE
- UPPER(su.id_su) LIKE CONCAT(UPPER(:param), '%')
- """)
- Page findByIdentifier(String param, Pageable pageable);
-
- @Query(nativeQuery = true, value = """
- SELECT
- *
- FROM
- survey_unit su
- WHERE
- UPPER(su.identification_code) LIKE CONCAT(UPPER(:param), '%')
-
- """)
- Page findByIdentificationCode(String param, Pageable pageable);
-
- @Query(nativeQuery = true, value = """
- SELECT
- *
- FROM
- survey_unit su
- WHERE
- UPPER(su.identification_name) LIKE CONCAT(UPPER(:param), '%')
-
- """)
- Page findByIdentificationName(String param, Pageable pageable);
-}
+package fr.insee.survey.datacollectionmanagement.questioning.repository;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.SearchSurveyUnitDto;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Query;
+
+import java.util.List;
+
+public interface SurveyUnitRepository extends JpaRepository {
+
+ List findAllByIdentificationCode(String identificationCode);
+
+ @Query(nativeQuery = true, value = """
+ SELECT
+ *
+ FROM
+ survey_unit su
+ WHERE
+ UPPER(su.id_su) LIKE CONCAT(UPPER(:param), '%')
+ """)
+ Page findByIdentifier(String param, Pageable pageable);
+
+ @Query(nativeQuery = true, value = """
+ SELECT
+ *
+ FROM
+ survey_unit su
+ WHERE
+ UPPER(su.identification_code) LIKE CONCAT(UPPER(:param), '%')
+
+ """)
+ Page findByIdentificationCode(String param, Pageable pageable);
+
+ @Query(nativeQuery = true, value = """
+ SELECT
+ *
+ FROM
+ survey_unit su
+ WHERE
+ UPPER(su.identification_name) LIKE CONCAT(UPPER(:param), '%')
+
+ """)
+ Page findByIdentificationName(String param, Pageable pageable);
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/UploadRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/UploadRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/UploadRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/repository/UploadRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/SourceAccreditation.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/SourceAccreditation.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/SourceAccreditation.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/SourceAccreditation.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/User.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/User.java
similarity index 84%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/User.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/User.java
index 102d04aa..de2fcb99 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/User.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/User.java
@@ -1,5 +1,6 @@
package fr.insee.survey.datacollectionmanagement.user.domain;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserRoleTypeEnum;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
@@ -15,11 +16,6 @@
@Table(name = "InternalUsers")
public class User {
- public enum UserRoleType {
- ADMINISTRATEUR, RESPONSABLE, GESTIONNAIRE, ASSISTANCE
- }
-
-
@Id
private String identifier;
private String name;
@@ -30,7 +26,7 @@ public enum UserRoleType {
@JdbcTypeCode(SqlTypes.INTEGER)
@Enumerated(EnumType.ORDINAL)
- private UserRoleType role;
+ private UserRoleTypeEnum role;
@OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
private Set userEvents;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/UserEvent.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/UserEvent.java
similarity index 89%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/UserEvent.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/UserEvent.java
index 178b78c4..0009baf5 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/UserEvent.java
+++ b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/domain/UserEvent.java
@@ -1,6 +1,7 @@
package fr.insee.survey.datacollectionmanagement.user.domain;
import com.fasterxml.jackson.databind.JsonNode;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
import jakarta.persistence.*;
import lombok.*;
import org.hibernate.annotations.JdbcTypeCode;
@@ -14,10 +15,6 @@
@NoArgsConstructor
public class UserEvent {
- public enum UserEventType {
- CREATE, UPDATE, DELETE
- }
-
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "user_event_seq")
private Long id;
@@ -27,7 +24,7 @@ public enum UserEventType {
@NonNull
@Enumerated(EnumType.ORDINAL)
@JdbcTypeCode(SqlTypes.INTEGER)
- private UserEventType type;
+ private UserEventTypeEnum type;
@ManyToOne
private User user;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/SourceAccreditationRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/SourceAccreditationRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/SourceAccreditationRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/SourceAccreditationRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserEventRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserEventRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserEventRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserEventRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/user/repository/UserRepository.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/view/domain/View.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/view/domain/View.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/view/domain/View.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/view/domain/View.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/view/repository/ViewRepository.java b/platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/view/repository/ViewRepository.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/view/repository/ViewRepository.java
rename to platine-management-db/src/main/java/fr/insee/survey/datacollectionmanagement/view/repository/ViewRepository.java
diff --git a/platine-management-service/pom.xml b/platine-management-service/pom.xml
new file mode 100644
index 00000000..f6f62eb4
--- /dev/null
+++ b/platine-management-service/pom.xml
@@ -0,0 +1,62 @@
+
+
+ 4.0.0
+
+ fr.insee.survey
+ platine-management
+ ${revision}${changelist}
+
+
+ platine-management-service
+
+
+ 1.0.2
+ 5.0.0
+
+
+
+
+ fr.insee.survey
+ platine-management-shared
+ ${project.version}
+
+
+
+ fr.insee.survey
+ platine-management-db
+ ${project.version}
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ org.jeasy
+ easy-random-core
+ ${easy-version}
+
+
+
+ com.github.javafaker
+ javafaker
+ ${javafaker-version}
+
+
+ org.yaml
+ snakeyaml
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/AddressService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/AddressService.java
similarity index 57%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/AddressService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/AddressService.java
index 9af53e06..ce77763c 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/AddressService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/AddressService.java
@@ -9,16 +9,16 @@
@Service
public interface AddressService {
- public Address findById(Long id);
+ Address findById(Long id);
- public Page findAll(Pageable pageable);
+ Page findAll(Pageable pageable);
- public Address saveAddress(Address address);
+ Address saveAddress(Address address);
- public void deleteAddressById(Long id);
+ void deleteAddressById(Long id);
- public AddressDto convertToDto(Address address);
+ AddressDto convertToDto(Address address);
- public Address convertToEntity(AddressDto addressDto);
+ Address convertToEntity(AddressDto addressDto);
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactEventService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactEventService.java
similarity index 87%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactEventService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactEventService.java
index 4e39b430..46c89998 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactEventService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactEventService.java
@@ -3,7 +3,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -23,6 +23,6 @@ public interface ContactEventService {
public Set findContactEventsByContact (Contact contact);
- ContactEvent createContactEvent(Contact contact, ContactEventType type, JsonNode payload);
+ ContactEvent createContactEvent(Contact contact, ContactEventTypeEnum type, JsonNode payload);
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/ContactService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/AddressServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/AddressServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/AddressServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/AddressServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactEventServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactEventServiceImpl.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactEventServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactEventServiceImpl.java
index 63d15226..a851fd96 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactEventServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactEventServiceImpl.java
@@ -3,7 +3,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactEventRepository;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
@@ -47,7 +47,7 @@ public Set findContactEventsByContact(Contact contact) {
}
@Override
- public ContactEvent createContactEvent(Contact contact, ContactEventType type, JsonNode payload) {
+ public ContactEvent createContactEvent(Contact contact, ContactEventTypeEnum type, JsonNode payload) {
ContactEvent contactEventCreate = new ContactEvent();
contactEventCreate.setContact(contact);
contactEventCreate.setType(type);
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
index 076f901b..a8a7066f 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/contact/service/impl/ContactServiceImpl.java
@@ -3,8 +3,8 @@
import com.fasterxml.jackson.databind.JsonNode;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
import fr.insee.survey.datacollectionmanagement.contact.dto.SearchContactDto;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactRepository;
import fr.insee.survey.datacollectionmanagement.contact.service.AddressService;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactEventService;
@@ -79,7 +79,7 @@ public Contact createContactAddressEvent(Contact contact, JsonNode payload) {
if (contact.getAddress() != null) {
addressService.saveAddress(contact.getAddress());
}
- ContactEvent newContactEvent = contactEventService.createContactEvent(contact, ContactEventType.create,
+ ContactEvent newContactEvent = contactEventService.createContactEvent(contact, ContactEventTypeEnum.create,
payload);
contact.setContactEvents(new HashSet<>(Collections.singletonList(newContactEvent)));
return saveContact(contact);
@@ -98,7 +98,7 @@ public Contact updateContactAddressEvent(Contact contact, JsonNode payload) thro
}
Set setContactEventsContact = existingContact.getContactEvents();
- ContactEvent contactEventUpdate = contactEventService.createContactEvent(contact, ContactEventType.update,
+ ContactEvent contactEventUpdate = contactEventService.createContactEvent(contact, ContactEventTypeEnum.update,
payload);
setContactEventsContact.add(contactEventUpdate);
contact.setContactEvents(setContactEventsContact);
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/Dataloader.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/Dataloader.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/Dataloader.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/Dataloader.java
index e75d8095..ca0f244d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/Dataloader.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/Dataloader.java
@@ -2,7 +2,7 @@
import fr.insee.survey.datacollectionmanagement.questioning.domain.EventOrder;
import fr.insee.survey.datacollectionmanagement.questioning.repository.EventOrderRepository;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderPoc.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderPoc.java
similarity index 88%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderPoc.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderPoc.java
index f6cb3160..c6f72d3a 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderPoc.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/dataloader/DataloaderPoc.java
@@ -4,19 +4,20 @@
import com.github.javafaker.Name;
import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact.Gender;
import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent.ContactEventType;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import fr.insee.survey.datacollectionmanagement.contact.repository.AddressRepository;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactEventRepository;
import fr.insee.survey.datacollectionmanagement.contact.repository.ContactRepository;
+import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.*;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.metadata.repository.*;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
import fr.insee.survey.datacollectionmanagement.questioning.domain.*;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.repository.*;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.view.domain.View;
import fr.insee.survey.datacollectionmanagement.view.repository.ViewRepository;
import jakarta.annotation.PostConstruct;
@@ -32,7 +33,7 @@
@Component
@Slf4j
-@Profile(("demo"))
+@Profile("demo")
@RequiredArgsConstructor
public class DataloaderPoc {
@@ -84,12 +85,13 @@ public void init() {
Faker faker = new Faker();
initOrder();
- //initContact(faker);
-
- /*initDataForOneSource(faker, "DVM", 2, PeriodicityEnum.M, 12, 3, 1);
- initDataForOneSource(faker, "DVT", 3, PeriodicityEnum.T, 4, 2, 1);
- initDataForOneSource(faker, "DVX", 2, PeriodicityEnum.X, 1, 2, 1);
- initDataForOneSource(faker, "DVB", 2, PeriodicityEnum.B, 6, 1, 1);*/
+ if (contactRepository.count() == 0) {
+ initContact(faker);
+ initDataForOneSource(faker, "DVM", 2, PeriodicityEnum.M, 12, 3);
+ initDataForOneSource(faker, "DVT", 3, PeriodicityEnum.T, 4, 2);
+ initDataForOneSource(faker, "DVX", 2, PeriodicityEnum.X, 1, 2);
+ initDataForOneSource(faker, "DVB", 2, PeriodicityEnum.B, 6, 1);
+ }
}
@@ -223,9 +225,7 @@ private void initContact(Faker faker) {
listContact.add(c);
if ((i + 1) % 10000 == 0) {
- //addressRepository.saveAll(listAddresses);
contactRepository.saveAll(listContact);
- //listAddresses = new ArrayList<>();
listContact = new ArrayList<>();
long end = System.currentTimeMillis();
@@ -239,7 +239,7 @@ private void initContact(Faker faker) {
for (Long j = nbContactEvents; j < 300; j++) {
Contact contact = contactRepository.findRandomContact();
ContactEvent contactEvent = new ContactEvent();
- contactEvent.setType(ContactEventType.create);
+ contactEvent.setType(ContactEventTypeEnum.create);
contactEvent.setEventDate(new Date());
contactEvent.setContact(contact);
contactEventRepository.save(contactEvent);
@@ -267,13 +267,12 @@ private Contact initOneContact(Faker faker) {
a.setZipCode(fakeAddress.zipCode());
a.setCityName(fakeAddress.cityName());
addressRepository.save(a);
- //listAddresses.add(a);
c.setIdentifier(randomString(7).toUpperCase());
c.setLastName(name);
c.setFirstName(firstName);
c.setPhone(faker.phoneNumber().phoneNumber());
- c.setGender(Gender.valueOf(faker.demographic().sex()));
+ c.setGender(GenderEnum.valueOf(faker.demographic().sex()));
c.setFunction(faker.job().title());
c.setComment(faker.beer().name());
c.setEmail(firstName.toLowerCase() + "." + name.toLowerCase() + "@cocorico.fr");
@@ -283,7 +282,7 @@ private Contact initOneContact(Faker faker) {
}
private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysBySource, PeriodicityEnum periodicity,
- int nbCampaignsBySource, int nbPartByCampaign, int nbQuestioningsByPart) {
+ int nbCampaignsBySource, int nbPartByCampaign) {
int year = Calendar.getInstance().get(Calendar.YEAR);
@@ -316,23 +315,19 @@ private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysB
log.info("{} campaigns exist in database", campaignRepository.count());
- // while (sourceRepository.count() < 10) {
-
Source source = new Source();
- String nameSource = sourceName;
-
- if (!StringUtils.contains(nameSource, " ") && sourceRepository.findById(nameSource).isEmpty()) {
+ if (!StringUtils.contains(sourceName, " ") && sourceRepository.findById(sourceName).isEmpty()) {
- source.setId(nameSource);
- source.setLongWording("Have you ever heard about " + nameSource + " ?");
- source.setShortWording("Source about " + nameSource);
+ source.setId(sourceName);
+ source.setLongWording("Have you ever heard about " + sourceName + " ?");
+ source.setShortWording("Source about " + sourceName);
source.setPeriodicity(periodicity);
source.setMandatoryMySurveys(false);
sourceRepository.save(source);
Set setSurveys = new HashSet<>();
- Integer i = rnd.nextInt();
+ int i = rnd.nextInt();
if (i % 2 == 0) {
setSourcesInsee.add(source);
source.setOwner(ownerInsee);
@@ -348,11 +343,11 @@ private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysB
for (int j = 0; j < nbSurveysBySource; j++) {
Survey survey = new Survey();
- String id = nameSource + (year - j);
+ String id = sourceName + (year - j);
survey.setId(id);
survey.setYear(year - j);
survey.setLongObjectives("The purpose of this survey is to find out everything you can about "
- + nameSource
+ + sourceName
+ ". Your response is essential to ensure the quality and reliability of the results of this survey.");
survey.setShortObjectives("All about " + id);
survey.setCommunication("Communication around " + id);
@@ -361,7 +356,7 @@ private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysB
survey.setCnisUrl("http://cnis/" + id);
survey.setNoticeUrl("http://notice/" + id);
survey.setVisaNumber(year + randomString(6).toUpperCase());
- survey.setLongWording("Survey " + nameSource + " " + (year - j));
+ survey.setLongWording("Survey " + sourceName + " " + (year - j));
survey.setShortWording(id);
setSurveys.add(survey);
surveyRepository.save(survey);
@@ -374,10 +369,10 @@ private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysB
String period = periodValue < 10 ? periodicity + "0" + periodValue : periodicity + String.valueOf(periodValue);
campaign.setYear(year - j);
campaign.setPeriod(PeriodEnum.valueOf(period));
- String idampaign = nameSource + (year - j) + period;
+ String idampaign = sourceName + (year - j) + period;
campaign.setId(idampaign);
campaign.setCampaignWording(
- "Campaign about " + nameSource + " in " + (year - j) + " and period " + period);
+ "Campaign about " + sourceName + " in " + (year - j) + " and period " + period);
if (campaignRepository.findById(idampaign).isEmpty()) {
@@ -398,7 +393,7 @@ private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysB
setParts.add(part);
part.setCampaign(campaign);
partitioningRepository.save(part);
- initQuestionning(faker, part, nbQuestioningsByPart);
+ initQuestionning(faker, part);
}
campaign.setSurvey(survey);
campaign.setPartitionings(setParts);
@@ -425,11 +420,7 @@ private void initDataForOneSource(Faker faker, String sourceName, int nbSurveysB
}
}
- private void initQuestionning(Faker faker, Partitioning part, int nbQuestionings) {
-
- //Long nbExistingQuestionings = questioningRepository.count();
-
- //log.info("{} questionings exist in database", nbExistingQuestionings);
+ private void initQuestionning(Faker faker, Partitioning part) {
long start = System.currentTimeMillis();
Questioning qu;
@@ -441,7 +432,7 @@ private void initQuestionning(Faker faker, Partitioning part, int nbQuestionings
log.info("{} survey units exist in database", surveyUnitRepository.count());
- for (int i = 0; i < nbQuestionings; i++) {
+ for (int i = 0; i < 1; i++) {
SurveyUnit su = new SurveyUnit();
fakeSiren = randomNumeric(9);
@@ -522,9 +513,8 @@ private void initQuestionning(Faker faker, Partitioning part, int nbQuestionings
}
- questioningEvents.stream().forEach(questioningEventRepository::save);
+ questioningEvents.forEach(questioningEventRepository::save);
- //for (int j = 0; j < 4; j++) {
accreditation = new QuestioningAccreditation();
accreditation.setIdContact(initOneContact(faker).getIdentifier());
accreditation.setQuestioning(qu);
@@ -543,7 +533,6 @@ private void initQuestionning(Faker faker, Partitioning part, int nbQuestionings
questioningAccreditations.add(accreditation);
questioningAccreditationRepository.save(accreditation);
initOneView(accreditation);
- // }
qu.setQuestioningEvents(questioningEvents);
qu.setQuestioningAccreditations(questioningAccreditations);
questioningRepository.save(qu);
@@ -557,31 +546,15 @@ private void initQuestionning(Faker faker, Partitioning part, int nbQuestionings
}
- private void initView() {
- if (viewRepository.count() == 0) {
-
- List listAccreditations = questioningAccreditationRepository.findAll();
- listAccreditations.stream().forEach(this::initOneView);
-
- Iterable listContacts = contactRepository.findAll();
- for (Contact contact : listContacts) {
- if (viewRepository.findByIdentifier(contact.getIdentifier()).isEmpty()) {
- View view = new View();
- view.setIdentifier(contact.getIdentifier());
- viewRepository.save(view);
-
- }
- }
- }
- }
-
private void initOneView(QuestioningAccreditation a) {
Partitioning p = partitioningRepository.findById(a.getQuestioning().getIdPartitioning()).orElse(null);
View view = new View();
- view.setIdentifier(contactRepository.findById(a.getIdContact()).orElse(null).getIdentifier());
- view.setCampaignId(p.getCampaign().getId());
- view.setIdSu(a.getQuestioning().getSurveyUnit().getIdSu());
- viewRepository.save(view);
+ view.setIdentifier(contactRepository.findById(a.getIdContact()).orElseThrow(() -> new NotFoundException(String.format("Contact %s not found", a.getIdContact()))).getIdentifier());
+ if (p != null) {
+ view.setCampaignId(p.getCampaign().getId());
+ view.setIdSu(a.getQuestioning().getSurveyUnit().getIdSu());
+ viewRepository.save(view);
+ }
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/EventException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/EventException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/EventException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/EventException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ForbiddenAccessException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ForbiddenAccessException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/ForbiddenAccessException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ForbiddenAccessException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ImpossibleToDeleteException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ImpossibleToDeleteException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/ImpossibleToDeleteException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/ImpossibleToDeleteException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotFoundException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotFoundException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotFoundException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotFoundException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotMatchException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotMatchException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotMatchException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/NotMatchException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/exception/RessourceNotValidatedException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/RessourceNotValidatedException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/exception/RessourceNotValidatedException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/exception/RessourceNotValidatedException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/CampaignService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/CampaignService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/CampaignService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/CampaignService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/OwnerService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/OwnerService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/OwnerService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/OwnerService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/PartitioningService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/PartitioningService.java
similarity index 79%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/PartitioningService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/PartitioningService.java
index 60bbea05..c7d3ca71 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/PartitioningService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/PartitioningService.java
@@ -1,22 +1,22 @@
-package fr.insee.survey.datacollectionmanagement.metadata.service;
-
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
-
-import java.util.Date;
-
-public interface PartitioningService {
-
- Partitioning findById(String id);
-
- Partitioning insertOrUpdatePartitioning(Partitioning partitioning);
-
- void deletePartitioningById(String id);
-
- boolean isOnGoing(Partitioning part, Date date);
-
- String findSuitableParameterValue(Partitioning part, Parameters.ParameterEnum paramValue);
-
-
-
-}
+package fr.insee.survey.datacollectionmanagement.metadata.service;
+
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
+
+import java.util.Date;
+
+public interface PartitioningService {
+
+ Partitioning findById(String id);
+
+ Partitioning insertOrUpdatePartitioning(Partitioning partitioning);
+
+ void deletePartitioningById(String id);
+
+ boolean isOnGoing(Partitioning part, Date date);
+
+ String findSuitableParameterValue(Partitioning part, ParameterEnum paramValue);
+
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SourceService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SourceService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SourceService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SourceService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SupportService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SupportService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SupportService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SupportService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SurveyService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SurveyService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SurveyService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/SurveyService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/CampaignServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/OwnerServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/OwnerServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/OwnerServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/OwnerServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/PartioningServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/PartioningServiceImpl.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/PartioningServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/PartioningServiceImpl.java
index c643451f..6c91cbcc 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/PartioningServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/PartioningServiceImpl.java
@@ -1,65 +1,66 @@
-package fr.insee.survey.datacollectionmanagement.metadata.service.impl;
-
-import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
-import fr.insee.survey.datacollectionmanagement.metadata.repository.PartitioningRepository;
-import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.util.Date;
-import java.util.Optional;
-import java.util.Set;
-
-@Service
-@Slf4j
-@RequiredArgsConstructor
-public class PartioningServiceImpl implements PartitioningService {
-
- private final PartitioningRepository partitioningRepository;
-
- @Override
- public Partitioning findById(String id) {
- return partitioningRepository.findById(id).
- orElseThrow(() -> new NotFoundException(String.format("Partitioning %s not found", id)));
-
- }
-
- @Override
- public Partitioning insertOrUpdatePartitioning(Partitioning partitioning) {
- return partitioningRepository.save(partitioning);
-
- }
-
-
- @Override
- public void deletePartitioningById(String id) {
- partitioningRepository.deleteById(id);
- }
-
- @Override
- public boolean isOnGoing(Partitioning part, Date date) {
- return part.getClosingDate().compareTo(date) > 0 && part.getOpeningDate().compareTo(date) < 0;
- }
-
- @Override
- public String findSuitableParameterValue(Partitioning part, Parameters.ParameterEnum paramValue) {
- return findParameterValueInSet(part.getParams(), paramValue)
- .orElse(findParameterValueInSet(part.getCampaign().getParams(), paramValue)
- .orElse(findParameterValueInSet(part.getCampaign().getSurvey().getParams(), paramValue)
- .orElse(findParameterValueInSet(part.getCampaign().getSurvey().getSource().getParams(), paramValue)
- .orElse(""))));
- }
-
- private Optional findParameterValueInSet(Set params, Parameters.ParameterEnum paramValue) {
- return params.stream()
- .filter(param -> param.getParamId().equals(paramValue))
- .map(Parameters::getParamValue)
- .findFirst();
- }
-
-
-
-}
+package fr.insee.survey.datacollectionmanagement.metadata.service.impl;
+
+import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.repository.PartitioningRepository;
+import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.Optional;
+import java.util.Set;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class PartioningServiceImpl implements PartitioningService {
+
+ private final PartitioningRepository partitioningRepository;
+
+ @Override
+ public Partitioning findById(String id) {
+ return partitioningRepository.findById(id).
+ orElseThrow(() -> new NotFoundException(String.format("Partitioning %s not found", id)));
+
+ }
+
+ @Override
+ public Partitioning insertOrUpdatePartitioning(Partitioning partitioning) {
+ return partitioningRepository.save(partitioning);
+
+ }
+
+
+ @Override
+ public void deletePartitioningById(String id) {
+ partitioningRepository.deleteById(id);
+ }
+
+ @Override
+ public boolean isOnGoing(Partitioning part, Date date) {
+ return part.getClosingDate().compareTo(date) > 0 && part.getOpeningDate().compareTo(date) < 0;
+ }
+
+ @Override
+ public String findSuitableParameterValue(Partitioning part, ParameterEnum paramValue) {
+ return findParameterValueInSet(part.getParams(), paramValue)
+ .orElse(findParameterValueInSet(part.getCampaign().getParams(), paramValue)
+ .orElse(findParameterValueInSet(part.getCampaign().getSurvey().getParams(), paramValue)
+ .orElse(findParameterValueInSet(part.getCampaign().getSurvey().getSource().getParams(), paramValue)
+ .orElse(""))));
+ }
+
+ private Optional findParameterValueInSet(Set params, ParameterEnum paramValue) {
+ return params.stream()
+ .filter(param -> param.getParamId().equals(paramValue))
+ .map(Parameters::getParamValue)
+ .findFirst();
+ }
+
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SourceServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SourceServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SourceServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SourceServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SupportServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SupportServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SupportServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SupportServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SurveyServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SurveyServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SurveyServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/service/impl/SurveyServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/CheckHabilitationService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/CheckHabilitationService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/CheckHabilitationService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/CheckHabilitationService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MonitoringService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MonitoringService.java
similarity index 85%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MonitoringService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MonitoringService.java
index c2ae6d96..b40a458c 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MonitoringService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MonitoringService.java
@@ -1,8 +1,8 @@
package fr.insee.survey.datacollectionmanagement.query.service;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
import org.springframework.stereotype.Service;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogFollowUpDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogProgressDto;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MoogService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MoogService.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MoogService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MoogService.java
index e4b9482c..598f518b 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MoogService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MoogService.java
@@ -1,10 +1,10 @@
package fr.insee.survey.datacollectionmanagement.query.service;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogExtractionRowDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogQuestioningEventDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogSearchDto;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
import fr.insee.survey.datacollectionmanagement.view.domain.View;
import org.springframework.stereotype.Service;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MySurveysService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MySurveysService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MySurveysService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/MySurveysService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/QuestioningInformationsService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/QuestioningInformationsService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/QuestioningInformationsService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/QuestioningInformationsService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplNoAuth.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplNoAuth.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplNoAuth.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplNoAuth.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplOidc.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplOidc.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplOidc.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplOidc.java
index b1019bba..5bc8d80b 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplOidc.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/CheckHabilitationServiceImplOidc.java
@@ -1,11 +1,12 @@
package fr.insee.survey.datacollectionmanagement.query.service.impl;
-import fr.insee.survey.datacollectionmanagement.config.auth.user.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.AuthConstants;
+import fr.insee.survey.datacollectionmanagement.constants.AuthorityRoleEnum;
import fr.insee.survey.datacollectionmanagement.constants.UserRoles;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.query.service.CheckHabilitationService;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserRoleTypeEnum;
import fr.insee.survey.datacollectionmanagement.user.service.UserService;
import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
import lombok.RequiredArgsConstructor;
@@ -63,7 +64,7 @@ public boolean checkHabilitation(String role, String idSu, String campaignId, Li
if (isUserInRole(userRoles, AuthorityRoleEnum.INTERNAL_USER.securityRole())) {
String userRole = user.getRole().toString();
- if (userRole.equals(User.UserRoleType.ASSISTANCE.toString())) {
+ if (userRole.equals(UserRoleTypeEnum.ASSISTANCE.toString())) {
log.warn("User '{}' has assistance profile - check habilitation: false", userId);
return false;
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MonitoringServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MonitoringServiceImpl.java
similarity index 97%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MonitoringServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MonitoringServiceImpl.java
index e02d7fee..22d101b0 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MonitoringServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MonitoringServiceImpl.java
@@ -1,11 +1,11 @@
package fr.insee.survey.datacollectionmanagement.query.service.impl;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogFollowUpDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogProgressDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogRowProgressDto;
import fr.insee.survey.datacollectionmanagement.query.repository.MonitoringRepository;
import fr.insee.survey.datacollectionmanagement.query.service.MonitoringService;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MoogServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MoogServiceImpl.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MoogServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MoogServiceImpl.java
index 7332602d..6d39e86a 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MoogServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MoogServiceImpl.java
@@ -1,17 +1,16 @@
package fr.insee.survey.datacollectionmanagement.query.service.impl;
-import fr.insee.survey.datacollectionmanagement.config.JSONCollectionWrapper;
import fr.insee.survey.datacollectionmanagement.constants.UserRoles;
import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.service.ContactService;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
import fr.insee.survey.datacollectionmanagement.metadata.service.CampaignService;
import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
-import fr.insee.survey.datacollectionmanagement.query.domain.MoogCampaign;
+import fr.insee.survey.datacollectionmanagement.query.dto.MoogCampaignDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogExtractionRowDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogQuestioningEventDto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogSearchDto;
@@ -19,6 +18,7 @@
import fr.insee.survey.datacollectionmanagement.query.service.MoogService;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import fr.insee.survey.datacollectionmanagement.util.JSONCollectionWrapper;
import fr.insee.survey.datacollectionmanagement.view.domain.View;
import fr.insee.survey.datacollectionmanagement.view.service.ViewService;
import lombok.RequiredArgsConstructor;
@@ -65,7 +65,7 @@ public List transformListViewToListMoogSearchDto(List listV
MoogSearchDto moogSearchDto = new MoogSearchDto();
Contact c = contactService.findByIdentifier(view.getIdentifier());
Campaign camp = campaignService.findById(view.getCampaignId());
- MoogCampaign moogCampaign = new MoogCampaign();
+ MoogCampaignDto moogCampaign = new MoogCampaignDto();
moogCampaign.setId(view.getCampaignId());
moogCampaign.setLabel(camp.getCampaignWording());
moogCampaign
@@ -101,7 +101,7 @@ public List getMoogEvents(String campaign, String idSu)
List moogEvents = moogRepository.getEventsByIdSuByCampaign(campaign, idSu);
Campaign camp = campaignService.findById(campaign);
- MoogCampaign moogCampaign = new MoogCampaign();
+ MoogCampaignDto moogCampaign = new MoogCampaignDto();
moogCampaign.setId(campaign);
moogCampaign.setLabel(camp.getCampaignWording());
moogCampaign.setCollectionEndDate(camp.getPartitionings().iterator().next().getClosingDate().getTime());
@@ -129,8 +129,8 @@ public String getReadOnlyUrl(String idCampaign, String surveyUnitId) throws NotF
for (Partitioning part : setParts) {
Questioning questioning = questioningService.findByIdPartitioningAndSurveyUnitIdSu(part.getId(), surveyUnitId);
if (questioning != null) {
- String accessBaseUrl = partitioningService.findSuitableParameterValue(part, Parameters.ParameterEnum.URL_REDIRECTION);
- String typeUrl = partitioningService.findSuitableParameterValue(part, Parameters.ParameterEnum.URL_TYPE);
+ String accessBaseUrl = partitioningService.findSuitableParameterValue(part, ParameterEnum.URL_REDIRECTION);
+ String typeUrl = partitioningService.findSuitableParameterValue(part, ParameterEnum.URL_TYPE);
String sourceId = campaign.getSurvey().getSource().getId().toLowerCase();
return questioningService.getAccessUrl(accessBaseUrl, typeUrl, UserRoles.REVIEWER, questioning, surveyUnitId, sourceId);
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MySurveysServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MySurveysServiceImpl.java
similarity index 91%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MySurveysServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MySurveysServiceImpl.java
index c2755375..7505088d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MySurveysServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/MySurveysServiceImpl.java
@@ -1,83 +1,83 @@
-package fr.insee.survey.datacollectionmanagement.query.service.impl;
-
-import fr.insee.survey.datacollectionmanagement.constants.UserRoles;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Survey;
-import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
-import fr.insee.survey.datacollectionmanagement.query.dto.MyQuestioningDto;
-import fr.insee.survey.datacollectionmanagement.query.service.MySurveysService;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningAccreditation;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-
-@Service
-@Slf4j
-@RequiredArgsConstructor
-public class MySurveysServiceImpl implements MySurveysService {
-
- private final QuestioningAccreditationService questioningAccreditationService;
-
- private final PartitioningService partitioningService;
-
- private final QuestioningEventService questioningEventService;
-
- private final QuestioningService questioningService;
-
-
- @Override
- public List getListMySurveys(String id) {
- List listSurveys = new ArrayList<>();
- List accreditations = questioningAccreditationService.findByContactIdentifier(id);
-
- for (QuestioningAccreditation questioningAccreditation : accreditations) {
- MyQuestioningDto surveyDto = new MyQuestioningDto();
- Questioning questioning = questioningAccreditation.getQuestioning();
- Partitioning part = partitioningService.findById(questioning.getIdPartitioning());
- Survey survey = part.getCampaign().getSurvey();
- String surveyUnitId = questioning.getSurveyUnit().getIdSu();
- surveyDto.setSurveyWording(survey.getLongWording());
- surveyDto.setSurveyObjectives(survey.getLongObjectives());
- String accessBaseUrl = partitioningService.findSuitableParameterValue(part, Parameters.ParameterEnum.URL_REDIRECTION);
- String typeUrl = partitioningService.findSuitableParameterValue(part, Parameters.ParameterEnum.URL_TYPE);
- String sourceId = survey.getSource().getId().toLowerCase();
- surveyDto.setAccessUrl(
- questioningService.getAccessUrl(accessBaseUrl,typeUrl, UserRoles.INTERVIEWER, questioning, surveyUnitId, sourceId));
- surveyDto.setIdentificationCode(surveyUnitId);
- surveyDto.setOpeningDate(new Timestamp(part.getOpeningDate().getTime()));
- surveyDto.setClosingDate(new Timestamp(part.getClosingDate().getTime()));
- surveyDto.setReturnDate(new Timestamp(part.getReturnDate().getTime()));
- surveyDto.setMandatoryMySurveys(part.getCampaign().getSurvey().getSource().getMandatoryMySurveys());
-
- Optional questioningEvent = questioningEventService.getLastQuestioningEvent(
- questioning, TypeQuestioningEvent.MY_QUESTIONINGS_EVENTS);
- if (questioningEvent.isPresent()) {
- surveyDto.setQuestioningStatus(questioningEvent.get().getType().name());
- surveyDto.setQuestioningDate(new Timestamp(questioningEvent.get().getDate().getTime()));
- } else {
- log.debug("No questioningEvents found for questioning {} for identifier {}",
- questioning.getId(), id);
-
-
- }
- listSurveys.add(surveyDto);
-
- }
- log.info("Get my questionings for id {} - nb results: {}", id, listSurveys.size());
- return listSurveys;
- }
-
-
-}
+package fr.insee.survey.datacollectionmanagement.query.service.impl;
+
+import fr.insee.survey.datacollectionmanagement.constants.UserRoles;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Survey;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
+import fr.insee.survey.datacollectionmanagement.query.dto.MyQuestioningDto;
+import fr.insee.survey.datacollectionmanagement.query.service.MySurveysService;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningAccreditation;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Service;
+
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class MySurveysServiceImpl implements MySurveysService {
+
+ private final QuestioningAccreditationService questioningAccreditationService;
+
+ private final PartitioningService partitioningService;
+
+ private final QuestioningEventService questioningEventService;
+
+ private final QuestioningService questioningService;
+
+
+ @Override
+ public List getListMySurveys(String id) {
+ List listSurveys = new ArrayList<>();
+ List accreditations = questioningAccreditationService.findByContactIdentifier(id);
+
+ for (QuestioningAccreditation questioningAccreditation : accreditations) {
+ MyQuestioningDto surveyDto = new MyQuestioningDto();
+ Questioning questioning = questioningAccreditation.getQuestioning();
+ Partitioning part = partitioningService.findById(questioning.getIdPartitioning());
+ Survey survey = part.getCampaign().getSurvey();
+ String surveyUnitId = questioning.getSurveyUnit().getIdSu();
+ surveyDto.setSurveyWording(survey.getLongWording());
+ surveyDto.setSurveyObjectives(survey.getLongObjectives());
+ String accessBaseUrl = partitioningService.findSuitableParameterValue(part, ParameterEnum.URL_REDIRECTION);
+ String typeUrl = partitioningService.findSuitableParameterValue(part, ParameterEnum.URL_TYPE);
+ String sourceId = survey.getSource().getId().toLowerCase();
+ surveyDto.setAccessUrl(
+ questioningService.getAccessUrl(accessBaseUrl,typeUrl, UserRoles.INTERVIEWER, questioning, surveyUnitId, sourceId));
+ surveyDto.setIdentificationCode(surveyUnitId);
+ surveyDto.setOpeningDate(new Timestamp(part.getOpeningDate().getTime()));
+ surveyDto.setClosingDate(new Timestamp(part.getClosingDate().getTime()));
+ surveyDto.setReturnDate(new Timestamp(part.getReturnDate().getTime()));
+ surveyDto.setMandatoryMySurveys(part.getCampaign().getSurvey().getSource().getMandatoryMySurveys());
+
+ Optional questioningEvent = questioningEventService.getLastQuestioningEvent(
+ questioning, TypeQuestioningEvent.MY_QUESTIONINGS_EVENTS);
+ if (questioningEvent.isPresent()) {
+ surveyDto.setQuestioningStatus(questioningEvent.get().getType().name());
+ surveyDto.setQuestioningDate(new Timestamp(questioningEvent.get().getDate().getTime()));
+ } else {
+ log.debug("No questioningEvents found for questioning {} for identifier {}",
+ questioning.getId(), id);
+
+
+ }
+ listSurveys.add(surveyDto);
+
+ }
+ log.info("Get my questionings for id {} - nb results: {}", id, listSurveys.size());
+ return listSurveys;
+ }
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImpl.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImpl.java
index 7b7ff6cd..ef685acc 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImpl.java
@@ -1,6 +1,7 @@
package fr.insee.survey.datacollectionmanagement.query.service.impl;
import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
import fr.insee.survey.datacollectionmanagement.metadata.service.CampaignService;
@@ -95,7 +96,7 @@ private QuestioningInformationsDto mapQuestioningInformationsDto(QuestioningInfo
return questioningInformationsDto;
}
- protected String getFormattedPhone(String phone, String phone2) {
+ public String getFormattedPhone(String phone, String phone2) {
if (phone != null && StringUtils.isNotBlank(phone)) {
return phone;
}
@@ -119,16 +120,16 @@ private static AddressInformationsDto getAddressInformationsDto(QuestioningInfor
return addressDto;
}
- protected static String getFormattedCivility(String gender, String firstName, String lastName) {
+ public static String getFormattedCivility(String gender, String firstName, String lastName) {
String formattedGender = "";
String formattedFirstName = "";
String formattedLastName = "";
if (gender != null) {
- if (gender.equalsIgnoreCase(Contact.Gender.Male.name())) {
+ if (gender.equalsIgnoreCase(GenderEnum.Male.name())) {
formattedGender = "M.";
}
- if (gender.equalsIgnoreCase((Contact.Gender.Female.name()))) {
+ if (gender.equalsIgnoreCase((GenderEnum.Female.name()))) {
formattedGender = "Mme";
}
}
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/comparator/LastQuestioningEventComparator.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/comparator/LastQuestioningEventComparator.java
new file mode 100644
index 00000000..6a3b0b69
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/comparator/LastQuestioningEventComparator.java
@@ -0,0 +1,34 @@
+package fr.insee.survey.datacollectionmanagement.questioning.comparator;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.EventOrder;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.service.EventOrderService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.stereotype.Component;
+
+import java.util.Comparator;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+@Component
+@RequiredArgsConstructor
+public class LastQuestioningEventComparator implements Comparator, InitializingBean {
+
+ private final EventOrderService eventOrderService;
+ private Map eventOrderCache;
+
+ @Override
+ public void afterPropertiesSet() {
+ eventOrderCache = eventOrderService.findAll().stream()
+ .collect(Collectors.toMap(EventOrder::getStatus, EventOrder::getEventOrder));
+ }
+
+ @Override
+ public int compare(QuestioningEvent o1, QuestioningEvent o2) {
+ Integer eventOrder1 = eventOrderCache.get(o1.getType().name());
+ Integer eventOrder2 = eventOrderCache.get(o2.getType().name());
+
+ return Integer.compare(eventOrder2, eventOrder1);
+ }
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/EventOrderService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/EventOrderService.java
similarity index 80%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/EventOrderService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/EventOrderService.java
index 31fb0255..890bb833 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/EventOrderService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/EventOrderService.java
@@ -2,7 +2,11 @@
import fr.insee.survey.datacollectionmanagement.questioning.domain.EventOrder;
+import java.util.List;
+
public interface EventOrderService {
EventOrder findByStatus(String status);
+
+ List findAll();
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningAccreditationService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningAccreditationService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningAccreditationService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningAccreditationService.java
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommentService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommentService.java
new file mode 100644
index 00000000..23931b26
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommentService.java
@@ -0,0 +1,14 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningComment;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentInputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentOutputDto;
+
+public interface QuestioningCommentService {
+
+ QuestioningComment saveQuestioningComment(QuestioningComment questioningComment);
+
+ QuestioningComment convertToEntity(QuestioningCommentInputDto questioningCommentDto);
+
+ QuestioningCommentOutputDto convertToOutputDto(QuestioningComment questioningComment);
+}
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommunicationService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommunicationService.java
new file mode 100644
index 00000000..e0058ea5
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommunicationService.java
@@ -0,0 +1,20 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningCommunication;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommunicationDto;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.util.Optional;
+
+@Service
+public interface QuestioningCommunicationService {
+
+ Optional getLastQuestioningCommunication(Questioning questioning);
+
+ QuestioningCommunicationDto convertToDto(QuestioningCommunication questioningCommunication) ;
+
+ QuestioningCommunication convertToEntity(QuestioningCommunicationDto questioningCommunicationDto) throws ParseException;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningEventService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningEventService.java
similarity index 68%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningEventService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningEventService.java
index 040172ef..096f33f0 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningEventService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningEventService.java
@@ -2,16 +2,18 @@
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningEventDto;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import org.springframework.stereotype.Service;
+import java.text.ParseException;
import java.util.List;
import java.util.Optional;
@Service
public interface QuestioningEventService {
- public QuestioningEvent findbyId(Long id);
+ QuestioningEvent findbyId(Long id);
public QuestioningEvent saveQuestioningEvent(QuestioningEvent questioningEvent);
@@ -28,4 +30,10 @@ public interface QuestioningEventService {
Optional getLastQuestioningEvent(Questioning questioning, List events);
Long countIdUploadInEvents(Long idupload);
+
+
+ QuestioningEventDto convertToDto(QuestioningEvent questioningEvent) ;
+
+ QuestioningEvent convertToEntity(QuestioningEventDto questioningEventDto) throws ParseException;
+
}
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningService.java
new file mode 100644
index 00000000..d122efb9
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningService.java
@@ -0,0 +1,41 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service;
+
+import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
+import fr.insee.survey.datacollectionmanagement.query.dto.QuestioningDetailsDto;
+import fr.insee.survey.datacollectionmanagement.query.dto.SearchQuestioningDto;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.Pageable;
+
+import java.util.Set;
+
+public interface QuestioningService {
+
+ Page findAll(Pageable pageable);
+
+ Questioning findbyId(Long id);
+
+ Questioning saveQuestioning(Questioning questioning);
+
+ void deleteQuestioning(Long id);
+
+ Set findByIdPartitioning(String idPartitioning);
+
+ Questioning findByIdPartitioningAndSurveyUnitIdSu(String idPartitioning, String surveyUnitIdSu);
+
+ /**
+ * Delete questionings attached to one partitioning
+ *
+ * @param partitioning
+ * @return nb questioning deleted
+ */
+ int deleteQuestioningsOfOnePartitioning(Partitioning partitioning);
+
+ Set findBySurveyUnitIdSu(String idSu);
+
+ String getAccessUrl(String baseUrl, String typeUrl, String role, Questioning questioning, String surveyUnitId, String sourceId);
+
+ Page searchQuestioning(String param, Pageable pageable);
+
+ QuestioningDetailsDto getQuestioningDetails(Long id);
+}
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitCommentService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitCommentService.java
new file mode 100644
index 00000000..4e9b3ed8
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitCommentService.java
@@ -0,0 +1,17 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnitComment;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitCommentInputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitCommentOutputDto;
+
+public interface SurveyUnitCommentService {
+
+ SurveyUnitComment saveSurveyUnitComment(SurveyUnitComment surveyUnitComment);
+
+ SurveyUnitComment convertToEntity(SurveyUnitCommentInputDto surveyUnitCommentDto);
+
+ SurveyUnitCommentOutputDto convertToOutputDto(SurveyUnit surveyUnit);
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/UploadService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/UploadService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/UploadService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/UploadService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/EventOrderServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/EventOrderServiceImpl.java
similarity index 87%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/EventOrderServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/EventOrderServiceImpl.java
index 34a3ba1c..8d95a7ac 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/EventOrderServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/EventOrderServiceImpl.java
@@ -7,6 +7,8 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
+import java.util.List;
+
@Service
@Slf4j
@RequiredArgsConstructor
@@ -14,13 +16,13 @@ public class EventOrderServiceImpl implements EventOrderService {
private final EventOrderRepository eventOrderRepository;
- public EventOrder saveAndFlush(EventOrder order) {
- return eventOrderRepository.saveAndFlush(order);
- }
-
@Override
public EventOrder findByStatus(String status) {
return eventOrderRepository.findByStatus(status);
}
+ public List findAll() {
+ return eventOrderRepository.findAll();
+ }
+
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningAccreditationServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningAccreditationServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningAccreditationServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningAccreditationServiceImpl.java
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningCommentServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningCommentServiceImpl.java
new file mode 100644
index 00000000..6851b293
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningCommentServiceImpl.java
@@ -0,0 +1,37 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
+
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningComment;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentInputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentOutputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.repository.QuestioningCommentRepository;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningCommentService;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.modelmapper.ModelMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+@Slf4j
+@RequiredArgsConstructor
+public class QuestioningCommentServiceImpl implements QuestioningCommentService {
+
+ private final QuestioningCommentRepository questioningCommentRepository;
+ private final ModelMapper modelMapper;
+
+ @Override
+ public QuestioningComment saveQuestioningComment(QuestioningComment questioningComment) {
+ return questioningCommentRepository.save(questioningComment);
+ }
+
+ @Override
+ public QuestioningComment convertToEntity(QuestioningCommentInputDto questioningCommentDto) {
+ return modelMapper.map(questioningCommentDto, QuestioningComment.class);
+ }
+
+ @Override
+ public QuestioningCommentOutputDto convertToOutputDto(QuestioningComment questioningComment) {
+ return modelMapper.map(questioningComment, QuestioningCommentOutputDto.class);
+ }
+
+}
diff --git a/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningCommunicationServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningCommunicationServiceImpl.java
new file mode 100644
index 00000000..fc20f6ad
--- /dev/null
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningCommunicationServiceImpl.java
@@ -0,0 +1,35 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningCommunication;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommunicationDto;
+import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningCommunicationService;
+import lombok.RequiredArgsConstructor;
+import org.modelmapper.ModelMapper;
+import org.springframework.stereotype.Service;
+
+import java.text.ParseException;
+import java.util.Comparator;
+import java.util.Optional;
+
+@RequiredArgsConstructor
+@Service
+public class QuestioningCommunicationServiceImpl implements QuestioningCommunicationService {
+ private final ModelMapper modelMapper;
+
+ @Override
+ public Optional getLastQuestioningCommunication(Questioning questioning) {
+ return questioning.getQuestioningCommunications().stream().max(Comparator.comparing(QuestioningCommunication::getDate));
+ }
+
+ @Override
+ public QuestioningCommunicationDto convertToDto(QuestioningCommunication questioningCommunication) {
+ return modelMapper.map(questioningCommunication, QuestioningCommunicationDto.class);
+ }
+
+ @Override
+ public QuestioningCommunication convertToEntity(QuestioningCommunicationDto questioningCommunicationDto) throws ParseException {
+ return modelMapper.map(questioningCommunicationDto, QuestioningCommunication.class);
+ }
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningEventServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningEventServiceImpl.java
similarity index 73%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningEventServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningEventServiceImpl.java
index 36b7d773..4f7283d7 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningEventServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningEventServiceImpl.java
@@ -1,15 +1,19 @@
package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
+
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
+import fr.insee.survey.datacollectionmanagement.questioning.comparator.LastQuestioningEventComparator;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningEventDto;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.repository.QuestioningEventRepository;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
-import fr.insee.survey.datacollectionmanagement.questioning.util.LastQuestioningEventComparator;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
import lombok.RequiredArgsConstructor;
+import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;
+import java.text.ParseException;
import java.util.List;
import java.util.Optional;
@@ -21,6 +25,8 @@ public class QuestioningEventServiceImpl implements QuestioningEventService {
private final QuestioningEventRepository questioningEventRepository;
+ private final ModelMapper modelMapper;
+
@Override
public QuestioningEvent findbyId(Long id) {
return questioningEventRepository.findById(id).orElseThrow(() -> new NotFoundException(String.format("QuestioningEvent %s not found", id)));
@@ -51,4 +57,12 @@ public Long countIdUploadInEvents(Long idupload) {
return questioningEventRepository.countByUploadId(idupload);
}
+
+ public QuestioningEventDto convertToDto(QuestioningEvent questioningEvent) {
+ return modelMapper.map(questioningEvent, QuestioningEventDto.class);
+ }
+
+ public QuestioningEvent convertToEntity(QuestioningEventDto questioningEventDto) throws ParseException {
+ return modelMapper.map(questioningEventDto, QuestioningEvent.class);
+ }
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java
similarity index 53%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java
index 9a69690a..100ad0d4 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImpl.java
@@ -1,28 +1,36 @@
package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
-import fr.insee.survey.datacollectionmanagement.config.ApplicationConfig;
import fr.insee.survey.datacollectionmanagement.constants.UserRoles;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.service.PartitioningService;
+import fr.insee.survey.datacollectionmanagement.query.dto.QuestioningDetailsDto;
+import fr.insee.survey.datacollectionmanagement.query.dto.SearchQuestioningDto;
+import fr.insee.survey.datacollectionmanagement.query.dto.SearchQuestioningDtoImpl;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.*;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.repository.QuestioningRepository;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitService;
+import fr.insee.survey.datacollectionmanagement.questioning.service.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
+import org.modelmapper.ModelMapper;
import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Optional;
import java.util.Set;
-import static fr.insee.survey.datacollectionmanagement.questioning.util.UrlTypeEnum.*;
+import static fr.insee.survey.datacollectionmanagement.questioning.enums.UrlTypeEnum.*;
+
@Service
@RequiredArgsConstructor
@@ -32,11 +40,19 @@ public class QuestioningServiceImpl implements QuestioningService {
private final SurveyUnitService surveyUnitService;
+ private final PartitioningService partitioningService;
+
private final QuestioningEventService questioningEventService;
private final QuestioningAccreditationService questioningAccreditationService;
- private final ApplicationConfig applicationConfig;
+ private final QuestioningCommunicationService questioningCommunicationService;
+
+ private final QuestioningCommentService questioningCommentService;
+
+ private final ModelMapper modelMapper;
+
+ private final String questioningUrl;
private static final String PATH_LOGOUT = "pathLogout";
private static final String PATH_ASSISTANCE = "pathAssistance";
@@ -107,7 +123,7 @@ public Set findBySurveyUnitIdSu(String idSu) {
*/
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());
+ baseUrl = StringUtils.defaultIfEmpty(baseUrl, questioningUrl);
typeUrl = StringUtils.defaultIfEmpty(typeUrl, V3.name());
if (typeUrl.equalsIgnoreCase(V1.name())) {
@@ -123,6 +139,30 @@ public String getAccessUrl(String baseUrl, String typeUrl, String role, Question
return "";
}
+ @Override
+ public Page searchQuestioning(String param, Pageable pageable) {
+ Page pageQuestionings;
+ if (!StringUtils.isEmpty(param)) {
+ pageQuestionings = questioningRepository.findBySurveyUnitIdSuOrSurveyUnitIdentificationCodeOrQuestioningAccreditationsIdContact(param, param, param, pageable);
+ } else {
+ pageQuestionings = questioningRepository.findAll(pageable);
+
+ }
+
+
+ List searchDtos = pageQuestionings
+ .stream()
+ .map(this::convertToSearchDto).toList();
+
+ return new PageImpl<>(searchDtos, pageable, pageQuestionings.getTotalElements());
+ }
+
+ @Override
+ public QuestioningDetailsDto getQuestioningDetails(@PathVariable("id") Long id) {
+ Questioning questioning = findbyId(id);
+ return convertToDetailsDto(questioning);
+ }
+
/**
* Builds a V1 access URL based on the provided parameters.
@@ -185,4 +225,56 @@ protected String buildV3Url(String baseUrl, String role, String modelName, Strin
return "";
}
+
+ private SearchQuestioningDto convertToSearchDto(Questioning questioning) {
+ SearchQuestioningDtoImpl searchQuestioningDto = modelMapper.map(questioning, SearchQuestioningDtoImpl.class);
+ searchQuestioningDto.setCampaignId(partitioningService.findById(questioning.getIdPartitioning()).getCampaign().getId());
+ searchQuestioningDto.setListContactIdentifiers(questioning.getQuestioningAccreditations().stream().map(QuestioningAccreditation::getIdContact).toList());
+ Optional lastQuestioningEvent = questioningEventService.getLastQuestioningEvent(questioning, TypeQuestioningEvent.STATE_EVENTS);
+ lastQuestioningEvent.ifPresent(event -> searchQuestioningDto.setLastEvent(event.getType().name()));
+ Optional questioningCommunication = questioning.getQuestioningCommunications().stream().sorted(Comparator.comparing(QuestioningCommunication::getDate)).findFirst();
+ questioningCommunication.ifPresent(comm -> searchQuestioningDto.setLastCommunication(comm.getType().name()));
+ Optional validatedQuestioningEvent = questioningEventService.getLastQuestioningEvent(questioning, TypeQuestioningEvent.VALIDATED_EVENTS);
+ validatedQuestioningEvent.ifPresent(event -> searchQuestioningDto.setValidationDate(event.getDate()));
+ return searchQuestioningDto;
+ }
+
+ private QuestioningDetailsDto convertToDetailsDto(Questioning questioning) {
+ QuestioningDetailsDto questioningDetailsDto = modelMapper.map(questioning, QuestioningDetailsDto.class);
+ questioningDetailsDto.setCampaignId(partitioningService.findById(questioning.getIdPartitioning()).getCampaign().getId());
+ questioningDetailsDto.setListContactIdentifiers(questioning.getQuestioningAccreditations().stream().map(QuestioningAccreditation::getIdContact).toList());
+ Optional lastQuestioningEvent = questioningEventService.getLastQuestioningEvent(questioning, TypeQuestioningEvent.STATE_EVENTS);
+ lastQuestioningEvent.ifPresent(event -> {
+ questioningDetailsDto.setLastEvent(event.getType().name());
+ questioningDetailsDto.setDateLastEvent(event.getDate());
+ });
+ Optional questioningCommunication = questioningCommunicationService.getLastQuestioningCommunication(questioning);
+ questioningCommunication.ifPresent(comm -> {
+ questioningDetailsDto.setLastCommunication(comm.getType().name());
+ questioningDetailsDto.setDateLastCommunication(comm.getDate());
+ });
+ Optional validatedQuestioningEvent = questioningEventService.getLastQuestioningEvent(questioning, TypeQuestioningEvent.VALIDATED_EVENTS);
+ validatedQuestioningEvent.ifPresent(event -> questioningDetailsDto.setValidationDate(event.getDate()));
+ questioningDetailsDto.setReadOnlyUrl(getReadOnlyUrl(questioning.getIdPartitioning(), questioning.getSurveyUnit().getIdSu()));
+ questioningDetailsDto.setListEvents(questioning.getQuestioningEvents().stream().map(questioningEventService::convertToDto).toList());
+ questioningDetailsDto.setListCommunications(questioning.getQuestioningCommunications().stream().map(questioningCommunicationService::convertToDto).toList());
+ questioningDetailsDto.setListComments(questioning.getQuestioningComments().stream().map(questioningCommentService::convertToOutputDto).toList());
+ return questioningDetailsDto;
+ }
+
+ public String getReadOnlyUrl(String idPart, String surveyUnitId) throws NotFoundException {
+
+ Partitioning part = partitioningService.findById(idPart);
+ Questioning questioning = findByIdPartitioningAndSurveyUnitIdSu(part.getId(), surveyUnitId);
+ if (questioning != null) {
+ String accessBaseUrl = partitioningService.findSuitableParameterValue(part, ParameterEnum.URL_REDIRECTION);
+ String typeUrl = partitioningService.findSuitableParameterValue(part, ParameterEnum.URL_TYPE);
+ String sourceId = part.getCampaign().getSurvey().getSource().getId().toLowerCase();
+ return getAccessUrl(accessBaseUrl, typeUrl, UserRoles.REVIEWER, questioning, surveyUnitId, sourceId);
+
+ }
+ return "";
+
+ }
+
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitCommentServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitCommentServiceImpl.java
similarity index 54%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitCommentServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitCommentServiceImpl.java
index f8cd6a17..2971ceaa 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitCommentServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitCommentServiceImpl.java
@@ -1,10 +1,14 @@
package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnit;
import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnitComment;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitCommentInputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.SurveyUnitCommentOutputDto;
import fr.insee.survey.datacollectionmanagement.questioning.repository.SurveyUnitCommentRepository;
import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitCommentService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;
@Service
@@ -13,8 +17,19 @@
public class SurveyUnitCommentServiceImpl implements SurveyUnitCommentService {
private final SurveyUnitCommentRepository surveyUnitCommentRepository;
+ private final ModelMapper modelMapper;
@Override
public SurveyUnitComment saveSurveyUnitComment(SurveyUnitComment surveyUnitComment) {
return surveyUnitCommentRepository.save(surveyUnitComment);
}
+
+ @Override
+ public SurveyUnitComment convertToEntity(SurveyUnitCommentInputDto surveyUnitCommentDto) {
+ return modelMapper.map(surveyUnitCommentDto, SurveyUnitComment.class);
+ }
+
+ @Override
+ public SurveyUnitCommentOutputDto convertToOutputDto(SurveyUnit surveyUnit) {
+ return modelMapper.map(surveyUnit, SurveyUnitCommentOutputDto.class);
+ }
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/SurveyUnitServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/UploadServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/UploadServiceImpl.java
similarity index 93%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/UploadServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/UploadServiceImpl.java
index 22eec767..95d09785 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/UploadServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/UploadServiceImpl.java
@@ -1,6 +1,7 @@
package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.ObjectNode;
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.exception.RessourceNotValidatedException;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
@@ -12,14 +13,13 @@
import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.domain.Upload;
import fr.insee.survey.datacollectionmanagement.questioning.dto.UploadDto;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import fr.insee.survey.datacollectionmanagement.questioning.repository.UploadRepository;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningService;
import fr.insee.survey.datacollectionmanagement.questioning.service.UploadService;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import net.minidev.json.JSONObject;
import org.springframework.stereotype.Service;
import java.util.*;
@@ -73,11 +73,11 @@ public ResultUpload save(String idCampaign, UploadDto uploadDto) throws Ressourc
qe.setUpload(up);
qe.setType(TypeQuestioningEvent.valueOf(mmDto.getStatus()));
qe.setQuestioning(quest.get());
- JSONObject jo = new JSONObject();
- jo.put("source", "Moog IHM - Post Event by upload");
- jo.put("author", mmDto.getIdContact());
- ObjectMapper objectMapper = new ObjectMapper();
- qe.setPayload(objectMapper.readTree(jo.toString()));
+ ObjectNode payload = JsonNodeFactory.instance.objectNode();
+
+ payload.put("source", "Moog IHM - Post Event by upload");
+ payload.put("author", mmDto.getIdContact());
+ qe.setPayload(payload);
qe.setDate(today);
liste.add(questioningEventService.saveQuestioningEvent(qe));
if (quest.isPresent()) {
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/exception/RoleException.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/exception/RoleException.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/exception/RoleException.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/exception/RoleException.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/SourceAccreditationService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/SourceAccreditationService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/service/SourceAccreditationService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/SourceAccreditationService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserEventService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserEventService.java
similarity index 81%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserEventService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserEventService.java
index 8fd8898e..b5dd18aa 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserEventService.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserEventService.java
@@ -4,6 +4,7 @@
import com.fasterxml.jackson.databind.JsonNode;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
@@ -23,7 +24,7 @@ public interface UserEventService {
public Set findUserEventsByUser (User user);
- UserEvent createUserEvent(User user, UserEvent.UserEventType type, JsonNode payload);
+ UserEvent createUserEvent(User user, UserEventTypeEnum type, JsonNode payload);
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/UserService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/SourceAccreditationServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/SourceAccreditationServiceImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/SourceAccreditationServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/SourceAccreditationServiceImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserEventServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserEventServiceImpl.java
similarity index 91%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserEventServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserEventServiceImpl.java
index b5f323bd..19054b85 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserEventServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserEventServiceImpl.java
@@ -5,6 +5,7 @@
import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
import fr.insee.survey.datacollectionmanagement.user.repository.UserEventRepository;
import fr.insee.survey.datacollectionmanagement.user.service.UserEventService;
import lombok.RequiredArgsConstructor;
@@ -47,7 +48,7 @@ public Set findUserEventsByUser(User user) {
}
@Override
- public UserEvent createUserEvent(User user, UserEvent.UserEventType type, JsonNode payload) {
+ public UserEvent createUserEvent(User user, UserEventTypeEnum type, JsonNode payload) {
UserEvent userEventCreate = new UserEvent();
userEventCreate.setUser(user);
userEventCreate.setType(type);
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserServiceImpl.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserServiceImpl.java
index c18071bd..2cb54695 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/user/service/impl/UserServiceImpl.java
@@ -6,6 +6,7 @@
import fr.insee.survey.datacollectionmanagement.user.domain.SourceAccreditation;
import fr.insee.survey.datacollectionmanagement.user.domain.User;
import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
import fr.insee.survey.datacollectionmanagement.user.repository.UserRepository;
import fr.insee.survey.datacollectionmanagement.user.service.SourceAccreditationService;
import fr.insee.survey.datacollectionmanagement.user.service.UserEventService;
@@ -56,7 +57,7 @@ public void deleteUser(String identifier) {
@Override
public User createUser(User user, JsonNode payload) {
- UserEvent newUserEvent = userEventService.createUserEvent(user, UserEvent.UserEventType.CREATE,
+ UserEvent newUserEvent = userEventService.createUserEvent(user, UserEventTypeEnum.CREATE,
payload);
user.setUserEvents(new HashSet<>(Arrays.asList(newUserEvent)));
return saveUser(user);
@@ -68,7 +69,7 @@ public User updateUser(User user, JsonNode payload) {
User existingUser = findByIdentifier(user.getIdentifier());
Set setUserEventsUser = existingUser.getUserEvents();
- UserEvent userEventUpdate = userEventService.createUserEvent(user, UserEvent.UserEventType.UPDATE,
+ UserEvent userEventUpdate = userEventService.createUserEvent(user, UserEventTypeEnum.UPDATE,
payload);
setUserEventsUser.add(userEventUpdate);
user.setUserEvents(setUserEventsUser);
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/view/service/ViewService.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/view/service/ViewService.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/view/service/ViewService.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/view/service/ViewService.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/view/serviceImpl/ViewServiceImpl.java b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/view/service/impl/ViewServiceImpl.java
similarity index 97%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/view/serviceImpl/ViewServiceImpl.java
rename to platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/view/service/impl/ViewServiceImpl.java
index 768ff10c..d0667c8d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/view/serviceImpl/ViewServiceImpl.java
+++ b/platine-management-service/src/main/java/fr/insee/survey/datacollectionmanagement/view/service/impl/ViewServiceImpl.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.view.serviceImpl;
+package fr.insee.survey.datacollectionmanagement.view.service.impl;
import fr.insee.survey.datacollectionmanagement.metadata.domain.Campaign;
import fr.insee.survey.datacollectionmanagement.view.domain.View;
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImplTest.java b/platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImplTest.java
similarity index 100%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImplTest.java
rename to platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/query/service/impl/QuestioningInformationsServiceImplTest.java
diff --git a/platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommunicationServiceTest.java b/platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommunicationServiceTest.java
new file mode 100644
index 00000000..c2c9b8ed
--- /dev/null
+++ b/platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningCommunicationServiceTest.java
@@ -0,0 +1,85 @@
+package fr.insee.survey.datacollectionmanagement.questioning.service;
+
+import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
+import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningCommunication;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeCommunicationEvent;
+import fr.insee.survey.datacollectionmanagement.questioning.service.impl.QuestioningCommunicationServiceImpl;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+import org.modelmapper.ModelMapper;
+
+import java.time.Instant;
+import java.time.temporal.ChronoUnit;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Optional;
+import java.util.Set;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+
+class QuestioningCommunicationServiceTest {
+
+ static QuestioningCommunicationService questioningCommunicationService;
+
+ @BeforeAll
+ static void init() {
+ questioningCommunicationService = new QuestioningCommunicationServiceImpl(new ModelMapper());
+ }
+
+ @Test
+ @DisplayName("Get last communication with 0 communication")
+ void getLastQuestioningCommunication0() {
+ Questioning questioning = new Questioning();
+ Set questioningCommunications = new HashSet<>();
+ questioning.setQuestioningCommunications(questioningCommunications);
+
+ assertEquals(Optional.empty(), questioningCommunicationService.getLastQuestioningCommunication(questioning));
+ }
+
+ @Test
+ @DisplayName("Get last communication with 1 communication")
+ void getLastQuestioningCommunication1() {
+ Questioning questioning = new Questioning();
+
+ Set questioningCommunications = new HashSet<>();
+ QuestioningCommunication questioningCommunicationOuv = initQuestioningCommunication(TypeCommunicationEvent.COURRIER_OUVERTURE, new Date());
+ questioningCommunications.add(questioningCommunicationOuv);
+
+ questioning.setQuestioningCommunications(questioningCommunications);
+
+ Optional optionalQuestioningCommunication = questioningCommunicationService.getLastQuestioningCommunication(questioning);
+ assertNotEquals(Optional.empty(), optionalQuestioningCommunication);
+ assertEquals(TypeCommunicationEvent.COURRIER_OUVERTURE, optionalQuestioningCommunication.get().getType());
+ }
+
+
+ @Test
+ @DisplayName("Get last communication with 2 communications")
+ void getLastQuestioningCommunication2() {
+ Questioning questioning = new Questioning();
+
+ Set questioningCommunications = new HashSet<>();
+ QuestioningCommunication questioningCommunicationOuv = initQuestioningCommunication(TypeCommunicationEvent.COURRIER_OUVERTURE, Date.from(Instant.now().minus(1, ChronoUnit.DAYS)));
+ QuestioningCommunication questioningCommunicationRel = initQuestioningCommunication(TypeCommunicationEvent.COURRIER_RELANCE, new Date());
+
+ questioningCommunications.add(questioningCommunicationOuv);
+ questioningCommunications.add(questioningCommunicationRel);
+
+
+ questioning.setQuestioningCommunications(questioningCommunications);
+
+ Optional optionalQuestioningCommunication = questioningCommunicationService.getLastQuestioningCommunication(questioning);
+ assertNotEquals(Optional.empty(), optionalQuestioningCommunication);
+ assertEquals(TypeCommunicationEvent.COURRIER_RELANCE, optionalQuestioningCommunication.get().getType());
+ }
+
+ private static QuestioningCommunication initQuestioningCommunication(TypeCommunicationEvent typeCommunicationEvent, Date date) {
+ QuestioningCommunication questioningCommunication = new QuestioningCommunication();
+ questioningCommunication.setDate(date);
+ questioningCommunication.setType(typeCommunicationEvent);
+ return questioningCommunication;
+ }
+
+}
\ No newline at end of file
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImplTest.java b/platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImplTest.java
similarity index 69%
rename from src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImplTest.java
rename to platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImplTest.java
index ad9c13ad..aa8ce2cb 100644
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImplTest.java
+++ b/platine-management-service/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/impl/QuestioningServiceImplTest.java
@@ -1,34 +1,20 @@
package fr.insee.survey.datacollectionmanagement.questioning.service.impl;
-import fr.insee.survey.datacollectionmanagement.config.ApplicationConfig;
+
import fr.insee.survey.datacollectionmanagement.constants.UserRoles;
-import fr.insee.survey.datacollectionmanagement.questioning.repository.QuestioningRepository;
-import fr.insee.survey.datacollectionmanagement.questioning.repository.dummy.QuestioningRepositoryDummy;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningEventService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.SurveyUnitService;
-import fr.insee.survey.datacollectionmanagement.questioning.service.dummy.QuestioningAccreditationServiceDummy;
-import fr.insee.survey.datacollectionmanagement.questioning.service.dummy.QuestioningEventServiceDummy;
-import fr.insee.survey.datacollectionmanagement.questioning.service.dummy.SurveyUnitServiceDummy;
-import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.assertj.core.api.Assertions.assertThat;
-
+@ExtendWith(MockitoExtension.class)
class QuestioningServiceImplTest {
+ @InjectMocks
QuestioningServiceImpl questioningService;
- @BeforeEach
- void init() {
- QuestioningRepository questioningRepository = new QuestioningRepositoryDummy();
- SurveyUnitService surveyUnitService = new SurveyUnitServiceDummy();
- QuestioningEventService questioningEventService = new QuestioningEventServiceDummy();
- QuestioningAccreditationService questioningAccreditationService = new QuestioningAccreditationServiceDummy();
- ApplicationConfig applicationConfig = new ApplicationConfig();
- questioningService = new QuestioningServiceImpl(questioningRepository, surveyUnitService, questioningEventService, questioningAccreditationService, applicationConfig);
- }
@Test
@DisplayName("Check the V1 url in interviewer mode")
diff --git a/platine-management-shared/pom.xml b/platine-management-shared/pom.xml
new file mode 100644
index 00000000..168bbf36
--- /dev/null
+++ b/platine-management-shared/pom.xml
@@ -0,0 +1,13 @@
+
+
+ 4.0.0
+
+ fr.insee.survey
+ platine-management
+ ${revision}${changelist}
+
+
+ platine-management-shared
+
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthConstants.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthConstants.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthConstants.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthConstants.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthorityRoleEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthorityRoleEnum.java
similarity index 78%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthorityRoleEnum.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthorityRoleEnum.java
index 1e150106..e09f81fb 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/auth/user/AuthorityRoleEnum.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/AuthorityRoleEnum.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config.auth.user;
+package fr.insee.survey.datacollectionmanagement.constants;
public enum AuthorityRoleEnum {
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/constants/UserRoles.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/UserRoles.java
similarity index 99%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/constants/UserRoles.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/UserRoles.java
index df7c0020..e79e9581 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/constants/UserRoles.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/constants/UserRoles.java
@@ -1,10 +1,10 @@
package fr.insee.survey.datacollectionmanagement.constants;
public class UserRoles {
-
private UserRoles() {
throw new IllegalStateException("Utility class");
}
+
public static final String INTERVIEWER = "interviewer";
public static final String REVIEWER = "reviewer";
-}
+}
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/AddressDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/AddressDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/AddressDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/AddressDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDetailsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDetailsDto.java
similarity index 85%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDetailsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDetailsDto.java
index f9a26fd6..5571263d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDetailsDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDetailsDto.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.contact.dto;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import fr.insee.survey.datacollectionmanagement.contact.validation.ContactGenderValid;
import lombok.Getter;
import lombok.Setter;
@@ -14,7 +14,7 @@ public class ContactDetailsDto {
private String identifier;
private String externalId;
@ContactGenderValid
- private Contact.Gender civility;
+ private GenderEnum civility;
private String lastName;
private String firstName;
private String function;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactEventDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactEventDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactEventDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/ContactEventDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDtoImpl.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDtoImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDtoImpl.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/dto/SearchContactDtoImpl.java
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/ContactEventTypeEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/ContactEventTypeEnum.java
new file mode 100644
index 00000000..ae810cc1
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/ContactEventTypeEnum.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.contact.enums;
+
+public enum ContactEventTypeEnum {
+ create, update, merged, firstConnect, reinitPassword
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/ContactParamEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/ContactParamEnum.java
similarity index 89%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/ContactParamEnum.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/ContactParamEnum.java
index 7558230d..aa774986 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/util/ContactParamEnum.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/ContactParamEnum.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.contact.util;
+package fr.insee.survey.datacollectionmanagement.contact.enums;
import lombok.Getter;
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/GenderEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/GenderEnum.java
new file mode 100644
index 00000000..d834eabf
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/enums/GenderEnum.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.contact.enums;
+
+public enum GenderEnum {
+ Female, Male, Undefined
+}
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValid.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValid.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValid.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValid.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValidator.java
similarity index 76%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValidator.java
index f2de33f6..c5f7181d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValidator.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactEventTypeValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.contact.validation;
-import fr.insee.survey.datacollectionmanagement.contact.domain.ContactEvent;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactEventTypeEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
@@ -18,6 +18,6 @@ public void initialize(ContactEventTypeValid constraintAnnotation) {
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null)
return false;
- return Arrays.stream(ContactEvent.ContactEventType.values()).anyMatch(v -> value.equalsIgnoreCase(v.name()));
+ return Arrays.stream(ContactEventTypeEnum.values()).anyMatch(v -> value.equalsIgnoreCase(v.name()));
}
}
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValid.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValid.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValid.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValid.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValidator.java
similarity index 78%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValidator.java
index d82bd99c..a309ea59 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValidator.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactGenderValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.contact.validation;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
@@ -18,6 +18,6 @@ public void initialize(ContactGenderValid constraintAnnotation) {
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null)
return false;
- return Arrays.stream(Contact.Gender.values()).anyMatch(v -> value.equals(v.name()));
+ return Arrays.stream(GenderEnum.values()).anyMatch(v -> value.equals(v.name()));
}
}
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactParamValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactParamValidator.java
similarity index 90%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactParamValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactParamValidator.java
index f3c36398..ee26c6b0 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactParamValidator.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ContactParamValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.contact.validation;
-import fr.insee.survey.datacollectionmanagement.contact.util.ContactParamEnum;
+import fr.insee.survey.datacollectionmanagement.contact.enums.ContactParamEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ValidContactParam.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ValidContactParam.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ValidContactParam.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/contact/validation/ValidContactParam.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/heathcheck/dto/HealthcheckDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/healthcheck/dto/HealthcheckDto.java
similarity index 57%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/heathcheck/dto/HealthcheckDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/healthcheck/dto/HealthcheckDto.java
index 237f679f..6e50d96e 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/heathcheck/dto/HealthcheckDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/healthcheck/dto/HealthcheckDto.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.heathcheck.dto;
+package fr.insee.survey.datacollectionmanagement.healthcheck.dto;
import lombok.Data;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignDto.java
similarity index 78%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignDto.java
index 67a1f4c6..462218e9 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignDto.java
@@ -1,16 +1,16 @@
-package fr.insee.survey.datacollectionmanagement.metadata.dto;
-
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
-import jakarta.validation.constraints.NotBlank;
-import lombok.Data;
-
-@Data
-public class CampaignDto {
-
- @NotBlank
- private String id;
- private String surveyId;
- private int year;
- private String campaignWording;
- private PeriodEnum period;
-}
+package fr.insee.survey.datacollectionmanagement.metadata.dto;
+
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
+import jakarta.validation.constraints.NotBlank;
+import lombok.Data;
+
+@Data
+public class CampaignDto {
+
+ @NotBlank
+ private String id;
+ private String surveyId;
+ private int year;
+ private String campaignWording;
+ private PeriodEnum period;
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignEventDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignEventDto.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignEventDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignEventDto.java
index ef7d8b91..9448734c 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignEventDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignEventDto.java
@@ -1,13 +1,13 @@
-package fr.insee.survey.datacollectionmanagement.metadata.dto;
-
-import java.util.Date;
-
-import lombok.Data;
-
-@Data
-public class CampaignEventDto {
-
- private Long id;
- private String type;
- private Date date;
-}
+package fr.insee.survey.datacollectionmanagement.metadata.dto;
+
+import java.util.Date;
+
+import lombok.Data;
+
+@Data
+public class CampaignEventDto {
+
+ private Long id;
+ private String type;
+ private Date date;
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignMoogDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignMoogDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignMoogDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignMoogDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java
similarity index 84%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java
index 7ba74db9..511f14f7 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/CampaignPartitioningsDto.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.dto;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
import jakarta.validation.constraints.NotBlank;
import lombok.Data;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/MetadataDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/MetadataDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/MetadataDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/MetadataDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OnGoingDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OnGoingDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OnGoingDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OnGoingDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OpenDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OpenDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OpenDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OpenDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OwnerDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OwnerDto.java
similarity index 94%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OwnerDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OwnerDto.java
index 3c4ecc6f..d3f29f8b 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OwnerDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/OwnerDto.java
@@ -1,17 +1,17 @@
-package fr.insee.survey.datacollectionmanagement.metadata.dto;
-
-import jakarta.validation.constraints.NotBlank;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class OwnerDto {
-
- @NotBlank
- private String id;
- private String label;
- private String ministry;
- private String logo;
-
-}
+package fr.insee.survey.datacollectionmanagement.metadata.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class OwnerDto {
+
+ @NotBlank
+ private String id;
+ private String label;
+ private String ministry;
+ private String logo;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/ParamsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/ParamsDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/ParamsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/ParamsDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PartitioningDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PartitioningDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PartitioningDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PartitioningDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodicityDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodicityDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodicityDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/PeriodicityDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceDto.java
similarity index 77%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceDto.java
index 9c9da516..83786fa1 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceDto.java
@@ -1,17 +1,17 @@
-package fr.insee.survey.datacollectionmanagement.metadata.dto;
-
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class SourceDto {
-
- private String id;
- private String longWording;
- private String shortWording;
- private PeriodicityEnum periodicity;
- private boolean mandatoryMySurveys;
-
-}
+package fr.insee.survey.datacollectionmanagement.metadata.dto;
+
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class SourceDto {
+
+ private String id;
+ private String longWording;
+ private String shortWording;
+ private PeriodicityEnum periodicity;
+ private boolean mandatoryMySurveys;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceOnlineStatusDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceOnlineStatusDto.java
similarity index 63%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceOnlineStatusDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceOnlineStatusDto.java
index d3b4d5c5..f38c7e6d 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceOnlineStatusDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SourceOnlineStatusDto.java
@@ -1,7 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.dto;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodicityEnum;
-import io.swagger.v3.oas.annotations.media.Schema;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodicityEnum;
import jakarta.validation.constraints.NotBlank;
import lombok.Getter;
import lombok.Setter;
@@ -15,9 +14,7 @@ public class SourceOnlineStatusDto {
private String longWording;
private String shortWording;
private PeriodicityEnum periodicity;
- @Schema(description = "Indicates whether or not you need to use the my surveys portal", defaultValue = "false")
private boolean mandatoryMySurveys = false;
- @Schema(description = "Indicates if the source should be force closed", defaultValue = "false")
private boolean forceClose = false;
private String messageInfoSurveyOffline = "";
private String messageSurveyOffline = "";
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SupportDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SupportDto.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SupportDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SupportDto.java
index 8ae7c2e0..1aa2abf6 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SupportDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SupportDto.java
@@ -1,22 +1,22 @@
-package fr.insee.survey.datacollectionmanagement.metadata.dto;
-
-import jakarta.validation.constraints.NotBlank;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class SupportDto {
-
- @NotBlank
- private String id;
- private String label;
- private String phoneNumber;
- private String mail;
- private String countryName;
- private String streetNumber;
- private String streetName;
- private String city;
- private String zipCode;
-
-}
+package fr.insee.survey.datacollectionmanagement.metadata.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class SupportDto {
+
+ @NotBlank
+ private String id;
+ private String label;
+ private String phoneNumber;
+ private String mail;
+ private String countryName;
+ private String streetNumber;
+ private String streetName;
+ private String city;
+ private String zipCode;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SurveyDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SurveyDto.java
similarity index 96%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SurveyDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SurveyDto.java
index a408b27a..d91ae83c 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SurveyDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/dto/SurveyDto.java
@@ -1,27 +1,27 @@
-package fr.insee.survey.datacollectionmanagement.metadata.dto;
-
-import jakarta.validation.constraints.NotBlank;
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class SurveyDto {
-
- @NotBlank
- private String id;
- @NotBlank
- private String sourceId;
- private Integer year;
- private Integer sampleSize;
- private String longWording;
- private String shortWording;
- private String shortObjectives;
- private String longObjectives;
- private String visaNumber;
- private String cnisUrl;
- private String diffusionUrl;
- private String noticeUrl;
- private String specimenUrl;
- private String communication;
-}
+package fr.insee.survey.datacollectionmanagement.metadata.dto;
+
+import jakarta.validation.constraints.NotBlank;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class SurveyDto {
+
+ @NotBlank
+ private String id;
+ @NotBlank
+ private String sourceId;
+ private Integer year;
+ private Integer sampleSize;
+ private String longWording;
+ private String shortWording;
+ private String shortObjectives;
+ private String longObjectives;
+ private String visaNumber;
+ private String cnisUrl;
+ private String diffusionUrl;
+ private String noticeUrl;
+ private String specimenUrl;
+ private String communication;
+}
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/ParameterEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/ParameterEnum.java
new file mode 100644
index 00000000..c672001e
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/ParameterEnum.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.metadata.enums;
+
+public enum ParameterEnum {
+ URL_REDIRECTION,URL_TYPE, MAIL_ASSISTANCE;
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PartitioningStatusEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PartitioningStatusEnum.java
similarity index 91%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PartitioningStatusEnum.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PartitioningStatusEnum.java
index 5ccc401b..d4564d43 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PartitioningStatusEnum.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PartitioningStatusEnum.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.metadata.util;
+package fr.insee.survey.datacollectionmanagement.metadata.enums;
public enum PartitioningStatusEnum {
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodEnum.java
new file mode 100644
index 00000000..4a8db9ab
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodEnum.java
@@ -0,0 +1,147 @@
+package fr.insee.survey.datacollectionmanagement.metadata.enums;
+
+import lombok.Getter;
+
+@Getter
+public enum PeriodEnum {
+
+ A00(PeriodicityEnum.A, PeriodNameEnum.ANNUAL.getValue()),
+ X00(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X01(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X02(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X03(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X04(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X05(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X06(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X07(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X08(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X09(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X10(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X11(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X12(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X13(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X14(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X15(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X16(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X17(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X18(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X19(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X20(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X21(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X22(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X23(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X24(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X25(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X26(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X27(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X28(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X29(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X30(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X31(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X32(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X33(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X34(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X35(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X36(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X37(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X38(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X39(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X40(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X41(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X42(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X43(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X44(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X45(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X46(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X47(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X48(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X49(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X50(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X51(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X52(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X53(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X54(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X55(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X56(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X57(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X58(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X59(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X60(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X61(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X62(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X63(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X64(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X65(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X66(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X67(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X68(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X69(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X70(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X71(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X72(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X73(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X74(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X75(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X76(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X77(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X78(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X79(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X80(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X81(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X82(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X83(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X84(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X85(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X86(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X87(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X88(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X89(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X90(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X91(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X92(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X93(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X94(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X95(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X96(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X97(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X98(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ X99(PeriodicityEnum.X, PeriodNameEnum.PLURIANNUAL.getValue()),
+ S01(PeriodicityEnum.S, PeriodNameEnum.FIRST_SEMESTER.getValue()),
+ S02(PeriodicityEnum.S, PeriodNameEnum.SECOND_SEMESTER.getValue()),
+ T01(PeriodicityEnum.T, PeriodNameEnum.FIRST_TRIMESTER.getValue()),
+ T02(PeriodicityEnum.T, PeriodNameEnum.SECOND_TRIMESTER.getValue()),
+ T03(PeriodicityEnum.T, PeriodNameEnum.THIRD_TRIMESTER.getValue()),
+ T04(PeriodicityEnum.T, PeriodNameEnum.FOURTH_TRIMESTER.getValue()),
+ M01(PeriodicityEnum.M, PeriodNameEnum.JANUARY.getValue()),
+ M02(PeriodicityEnum.M, PeriodNameEnum.FEBRUARY.getValue()),
+ M03(PeriodicityEnum.M, PeriodNameEnum.MARCH.getValue()),
+ M04(PeriodicityEnum.M, PeriodNameEnum.APRIL.getValue()),
+ M05(PeriodicityEnum.M, PeriodNameEnum.MAY.getValue()),
+ M06(PeriodicityEnum.M, PeriodNameEnum.JUNE.getValue()),
+ M07(PeriodicityEnum.M, PeriodNameEnum.JULY.getValue()),
+ M08(PeriodicityEnum.M, PeriodNameEnum.AUGUST.getValue()),
+ M09(PeriodicityEnum.M, PeriodNameEnum.SEPTEMBER.getValue()),
+ M10(PeriodicityEnum.M, PeriodNameEnum.OCTOBER.getValue()),
+ M11(PeriodicityEnum.M, PeriodNameEnum.NOVEMBER.getValue()),
+ M12(PeriodicityEnum.M, PeriodNameEnum.DECEMBER.getValue()),
+ B01(PeriodicityEnum.B, PeriodNameEnum.FIRST_BIMESTER.getValue()),
+ B02(PeriodicityEnum.B, PeriodNameEnum.SECOND_BIMESTER.getValue()),
+ B03(PeriodicityEnum.B, PeriodNameEnum.THIRD_BIMESTER.getValue()),
+ B04(PeriodicityEnum.B, PeriodNameEnum.FOURTH_BIMESTER.getValue()),
+ B05(PeriodicityEnum.B, PeriodNameEnum.FIFTH_BIMESTER.getValue()),
+ B06(PeriodicityEnum.B, PeriodNameEnum.SIXTH_BIMESTER.getValue()),
+
+ ;
+
+ PeriodEnum(PeriodicityEnum period, String value) {
+ this.value = value;
+ this.period = period;
+ }
+
+ final PeriodicityEnum period;
+
+ final String value;
+
+
+
+}
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodNameEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodNameEnum.java
new file mode 100644
index 00000000..fad24439
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodNameEnum.java
@@ -0,0 +1,41 @@
+package fr.insee.survey.datacollectionmanagement.metadata.enums;
+
+public enum PeriodNameEnum {
+ ANNUAL("annuel"),
+ PLURIANNUAL("pluriannuel"),
+ FIRST_SEMESTER("1er semestre"),
+ SECOND_SEMESTER("2nd semestre"),
+ FIRST_TRIMESTER("1er trimestre"),
+ SECOND_TRIMESTER("2e trimestre"),
+ THIRD_TRIMESTER("3e trimestre"),
+ FOURTH_TRIMESTER("4e trimestre"),
+ JANUARY("janvier"),
+ FEBRUARY("février"),
+ MARCH("mars"),
+ APRIL("avril"),
+ MAY("mai"),
+ JUNE("juin"),
+ JULY("juillet"),
+ AUGUST("août"),
+ SEPTEMBER("septembre"),
+ OCTOBER("octobre"),
+ NOVEMBER("novembre"),
+ DECEMBER("décembre"),
+ FIRST_BIMESTER("1er bimestre"),
+ SECOND_BIMESTER("2e bimestre"),
+ THIRD_BIMESTER("3e bimestre"),
+ FOURTH_BIMESTER("4e bimestre"),
+ FIFTH_BIMESTER("5e bimestre"),
+ SIXTH_BIMESTER("6e bimestre");
+
+ private final String value;
+
+ PeriodNameEnum(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PeriodicityEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodicityEnum.java
similarity index 80%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PeriodicityEnum.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodicityEnum.java
index 134c733e..a01c2091 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PeriodicityEnum.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/enums/PeriodicityEnum.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.metadata.util;
+package fr.insee.survey.datacollectionmanagement.metadata.enums;
import lombok.Getter;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValid.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValid.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValid.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValid.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValidator.java
similarity index 77%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValidator.java
index 57b11b57..e09d416f 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValidator.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/validation/ParameterEnumValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.metadata.validation;
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Parameters;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.ParameterEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
@@ -18,6 +18,6 @@ public void initialize(ParameterEnumValid constraintAnnotation) {
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null)
return false;
- return Arrays.stream(Parameters.ParameterEnum.values()).anyMatch(v -> value.equals(v.name()));
+ return Arrays.stream(ParameterEnum.values()).anyMatch(v -> value.equals(v.name()));
}
}
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
similarity index 81%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
index 840bb164..18a868bd 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AccreditationDetailDto.java
@@ -1,7 +1,8 @@
package fr.insee.survey.datacollectionmanagement.query.dto;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
+
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AddressInformationsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AddressInformationsDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AddressInformationsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AddressInformationsDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AssistanceDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AssistanceDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AssistanceDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/AssistanceDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactAccreditationDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactAccreditationDto.java
similarity index 81%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactAccreditationDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactAccreditationDto.java
index 0b0bd19e..a30be6f4 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactAccreditationDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactAccreditationDto.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.query.dto;
-import fr.insee.survey.datacollectionmanagement.contact.domain.Contact;
import fr.insee.survey.datacollectionmanagement.contact.dto.AddressDto;
+import fr.insee.survey.datacollectionmanagement.contact.enums.GenderEnum;
import lombok.Data;
@Data
@@ -10,7 +10,7 @@ public class ContactAccreditationDto {
private String identifier;
private String externalId;
private boolean isMain;
- private Contact.Gender civility;
+ private GenderEnum civility;
private String lastName;
private String firstName;
private String function;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactInformationsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactInformationsDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactInformationsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/ContactInformationsDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/EligibleDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/EligibleDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/EligibleDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/EligibleDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/HabilitationDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/HabilitationDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/HabilitationDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/HabilitationDto.java
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogCampaignDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogCampaignDto.java
new file mode 100644
index 00000000..8fd25f66
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogCampaignDto.java
@@ -0,0 +1,14 @@
+package fr.insee.survey.datacollectionmanagement.query.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class MoogCampaignDto {
+ private String id;
+ private String label;
+ private Long collectionStartDate;
+ private Long collectionEndDate;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogExtractionRowDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogExtractionRowDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogExtractionRowDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogExtractionRowDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogFollowUpDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogFollowUpDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogFollowUpDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogFollowUpDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogProgressDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogProgressDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogProgressDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogProgressDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogQuestioningEventDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogQuestioningEventDto.java
similarity index 95%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogQuestioningEventDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogQuestioningEventDto.java
index 507bc6af..6d6df928 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogQuestioningEventDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogQuestioningEventDto.java
@@ -1,17 +1,17 @@
-package fr.insee.survey.datacollectionmanagement.query.dto;
-
-import java.io.Serializable;
-
-import lombok.Getter;
-import lombok.Setter;
-
-@Getter
-@Setter
-public class MoogQuestioningEventDto implements Serializable {
-
- private String idManagementMonitoringInfo;
- private MoogSearchDto surveyUnit;
- private String status;
- private String upload;
- private Long dateInfo;
-}
+package fr.insee.survey.datacollectionmanagement.query.dto;
+
+import java.io.Serializable;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class MoogQuestioningEventDto implements Serializable {
+
+ private String idManagementMonitoringInfo;
+ private MoogSearchDto surveyUnit;
+ private String status;
+ private String upload;
+ private Long dateInfo;
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogRowProgressDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogRowProgressDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogRowProgressDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogRowProgressDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogSearchDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogSearchDto.java
similarity index 81%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogSearchDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogSearchDto.java
index 39b64e05..f5821e77 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogSearchDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogSearchDto.java
@@ -2,7 +2,6 @@
import java.io.Serializable;
-import fr.insee.survey.datacollectionmanagement.query.domain.MoogCampaign;
import lombok.Getter;
import lombok.Setter;
@@ -14,7 +13,7 @@ public class MoogSearchDto implements Serializable {
private String idContact;
private String idSu;
private String address;
- private MoogCampaign campaign;
+ private MoogCampaignDto campaign;
private String firstName;
private String lastname;
private String batchNumber;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogUploadQuestioningEventDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogUploadQuestioningEventDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogUploadQuestioningEventDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MoogUploadQuestioningEventDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MyQuestioningDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MyQuestioningDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MyQuestioningDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/MyQuestioningDto.java
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningDetailsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningDetailsDto.java
new file mode 100644
index 00000000..a205c257
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningDetailsDto.java
@@ -0,0 +1,31 @@
+package fr.insee.survey.datacollectionmanagement.query.dto;
+
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommentOutputDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningCommunicationDto;
+import fr.insee.survey.datacollectionmanagement.questioning.dto.QuestioningEventDto;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+@Getter
+@Setter
+public class QuestioningDetailsDto {
+ private Long questioningId;
+ private String campaignId;
+ private List listContactIdentifiers;
+ private String surveyUnitId;
+ private String surveyUnitIdentificationCode;
+ private String surveyUnitIdentificationName;
+ private String surveyUnitLabel;
+ private List listEvents;
+ private String lastEvent;
+ private Date dateLastEvent;
+ private List listCommunications;
+ private String lastCommunication;
+ private Date dateLastCommunication;
+ private List listComments;
+ private Date validationDate;
+ private String readOnlyUrl;
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningInformationsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningInformationsDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningInformationsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningInformationsDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningWebclientDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningWebclientDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningWebclientDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/QuestioningWebclientDto.java
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchQuestioningDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchQuestioningDto.java
new file mode 100644
index 00000000..9c3de6a8
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchQuestioningDto.java
@@ -0,0 +1,22 @@
+package fr.insee.survey.datacollectionmanagement.query.dto;
+
+import java.util.Date;
+import java.util.List;
+
+public interface SearchQuestioningDto {
+ Long getQuestioningId();
+
+ String getCampaignId();
+
+ List getListContactIdentifiers();
+
+ String getSurveyUnitId();
+
+ String getSurveyUnitIdentificationCode();
+
+ String getLastEvent();
+
+ String getLastCommunication();
+
+ Date getValidationDate();
+}
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchQuestioningDtoImpl.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchQuestioningDtoImpl.java
new file mode 100644
index 00000000..b261056d
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchQuestioningDtoImpl.java
@@ -0,0 +1,23 @@
+package fr.insee.survey.datacollectionmanagement.query.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+import java.util.List;
+
+@Getter
+@Setter
+public class SearchQuestioningDtoImpl implements SearchQuestioningDto {
+
+ private Long questioningId;
+ private String campaignId;
+ private List listContactIdentifiers;
+ private String surveyUnitId;
+ private String surveyUnitIdentificationCode;
+ private String lastEvent;
+ private String lastCommunication;
+ private Date validationDate;
+
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchSurveyUnitContactDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchSurveyUnitContactDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchSurveyUnitContactDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SearchSurveyUnitContactDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/StateDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/StateDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/StateDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/StateDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitInformationsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitInformationsDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitInformationsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitInformationsDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitPartitioningDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitPartitioningDto.java
similarity index 73%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitPartitioningDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitPartitioningDto.java
index b14fec4a..332d9bb4 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitPartitioningDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/dto/SurveyUnitPartitioningDto.java
@@ -1,7 +1,7 @@
package fr.insee.survey.datacollectionmanagement.query.dto;
-import fr.insee.survey.datacollectionmanagement.metadata.util.PeriodEnum;
-import fr.insee.survey.datacollectionmanagement.questioning.util.TypeQuestioningEvent;
+import fr.insee.survey.datacollectionmanagement.metadata.enums.PeriodEnum;
+import fr.insee.survey.datacollectionmanagement.questioning.enums.TypeQuestioningEvent;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/UserRoleValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/UserRoleValidator.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/UserRoleValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/UserRoleValidator.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/ValidUserRole.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/ValidUserRole.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/ValidUserRole.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/query/validation/ValidUserRole.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningAccreditationDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningAccreditationDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningAccreditationDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningAccreditationDto.java
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommentInputDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommentInputDto.java
new file mode 100644
index 00000000..63237d8c
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommentInputDto.java
@@ -0,0 +1,11 @@
+package fr.insee.survey.datacollectionmanagement.questioning.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class QuestioningCommentInputDto {
+ private String comment;
+ private String author;
+}
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommentOutputDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommentOutputDto.java
new file mode 100644
index 00000000..27d70ee1
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommentOutputDto.java
@@ -0,0 +1,14 @@
+package fr.insee.survey.datacollectionmanagement.questioning.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Getter
+@Setter
+public class QuestioningCommentOutputDto {
+ private String comment;
+ private String author;
+ private Date commentDate;
+}
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommunicationDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommunicationDto.java
new file mode 100644
index 00000000..ba76f6cc
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningCommunicationDto.java
@@ -0,0 +1,18 @@
+package fr.insee.survey.datacollectionmanagement.questioning.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.Date;
+
+@Getter
+@Setter
+public class QuestioningCommunicationDto {
+
+ private Long id;
+ private Long questioningId;
+ private Date date;
+ private String type;
+ private String status;
+
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningEventDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningEventDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningEventDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/QuestioningEventDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDtoImpl.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDtoImpl.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDtoImpl.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SearchSurveyUnitDtoImpl.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitAddressDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitAddressDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitAddressDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitAddressDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentInputDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentInputDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentInputDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentInputDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentOutputDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentOutputDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentOutputDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitCommentOutputDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDetailsDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDetailsDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDetailsDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDetailsDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/SurveyUnitDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/UploadDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/UploadDto.java
similarity index 79%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/UploadDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/UploadDto.java
index 2a9f6e75..f37af748 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/UploadDto.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/dto/UploadDto.java
@@ -1,7 +1,6 @@
package fr.insee.survey.datacollectionmanagement.questioning.dto;
import fr.insee.survey.datacollectionmanagement.query.dto.MoogUploadQuestioningEventDto;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
import lombok.Getter;
import lombok.Setter;
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/StatusCommunication.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/StatusCommunication.java
new file mode 100644
index 00000000..32f137b7
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/StatusCommunication.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.questioning.enums;
+
+public enum StatusCommunication {
+ AUTOMATIC, MANUAL
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/SurveyUnitParamEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/SurveyUnitParamEnum.java
similarity index 89%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/SurveyUnitParamEnum.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/SurveyUnitParamEnum.java
index 062494c3..b19b908f 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/SurveyUnitParamEnum.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/SurveyUnitParamEnum.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.questioning.util;
+package fr.insee.survey.datacollectionmanagement.questioning.enums;
import lombok.Getter;
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/TypeCommunicationEvent.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/TypeCommunicationEvent.java
new file mode 100644
index 00000000..5c0d5caf
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/TypeCommunicationEvent.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.questioning.enums;
+
+public enum TypeCommunicationEvent {
+ COURRIER_OUVERTURE, MAIL_OUVERTURE, COURRIER_RELANCE, MAIL_RELANCE, COURRIER_MED, COURRIER_CNR;
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/TypeQuestioningEvent.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/TypeQuestioningEvent.java
similarity index 79%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/TypeQuestioningEvent.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/TypeQuestioningEvent.java
index b27b32c3..a22068f4 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/TypeQuestioningEvent.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/TypeQuestioningEvent.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.questioning.util;
+package fr.insee.survey.datacollectionmanagement.questioning.enums;
import java.util.Arrays;
import java.util.List;
@@ -41,4 +41,9 @@ public enum TypeQuestioningEvent {
VALPAP,
VALINT,
REFUSAL);
+
+ public static final List VALIDATED_EVENTS = Arrays.asList(
+ VALINT,
+ VALPAP);
}
+
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/UrlTypeEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/UrlTypeEnum.java
new file mode 100644
index 00000000..2a3780ff
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/enums/UrlTypeEnum.java
@@ -0,0 +1,7 @@
+package fr.insee.survey.datacollectionmanagement.questioning.enums;
+
+public enum UrlTypeEnum {
+ V1,
+ V2,
+ V3,
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/SourceAccreditationDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/SourceAccreditationDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/SourceAccreditationDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/SourceAccreditationDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserDto.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserEventDto.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserEventDto.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserEventDto.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/dto/UserEventDto.java
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/enums/UserEventTypeEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/enums/UserEventTypeEnum.java
new file mode 100644
index 00000000..17e5efd4
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/enums/UserEventTypeEnum.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.user.enums;
+
+public enum UserEventTypeEnum {
+ CREATE, UPDATE, DELETE
+}
diff --git a/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/enums/UserRoleTypeEnum.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/enums/UserRoleTypeEnum.java
new file mode 100644
index 00000000..82e71813
--- /dev/null
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/enums/UserRoleTypeEnum.java
@@ -0,0 +1,5 @@
+package fr.insee.survey.datacollectionmanagement.user.enums;
+
+public enum UserRoleTypeEnum {
+ ADMINISTRATEUR, RESPONSABLE, GESTIONNAIRE, ASSISTANCE
+}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValid.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValid.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValid.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValid.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValidator.java
similarity index 77%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValidator.java
index 8c3a168c..9fdc4d66 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValidator.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/InternalUserRoleValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.user.validation;
-import fr.insee.survey.datacollectionmanagement.user.domain.User;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserRoleTypeEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
@@ -18,6 +18,6 @@ public void initialize(InternalUserRoleValid constraintAnnotation) {
public boolean isValid(String value, ConstraintValidatorContext context) {
if(value == null)
return false;
- return Arrays.stream(User.UserRoleType.values()).anyMatch(v -> value.equalsIgnoreCase(v.name()));
+ return Arrays.stream(UserRoleTypeEnum.values()).anyMatch(v -> value.equalsIgnoreCase(v.name()));
}
}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValid.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValid.java
similarity index 100%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValid.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValid.java
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValidator.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValidator.java
similarity index 76%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValidator.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValidator.java
index dac2ba8f..66b39bb7 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValidator.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/user/validation/UserEventTypeValidator.java
@@ -1,6 +1,6 @@
package fr.insee.survey.datacollectionmanagement.user.validation;
-import fr.insee.survey.datacollectionmanagement.user.domain.UserEvent;
+import fr.insee.survey.datacollectionmanagement.user.enums.UserEventTypeEnum;
import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext;
@@ -18,6 +18,6 @@ public void initialize(UserEventTypeValid constraintAnnotation) {
public boolean isValid(String value, ConstraintValidatorContext context) {
if (value == null)
return false;
- return Arrays.stream(UserEvent.UserEventType.values()).anyMatch(v -> value.equalsIgnoreCase(v.name()));
+ return Arrays.stream(UserEventTypeEnum.values()).anyMatch(v -> value.equalsIgnoreCase(v.name()));
}
}
\ No newline at end of file
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/JSONCollectionWrapper.java b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/util/JSONCollectionWrapper.java
similarity index 86%
rename from src/main/java/fr/insee/survey/datacollectionmanagement/config/JSONCollectionWrapper.java
rename to platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/util/JSONCollectionWrapper.java
index 2dfd13a9..91fe597c 100644
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/JSONCollectionWrapper.java
+++ b/platine-management-shared/src/main/java/fr/insee/survey/datacollectionmanagement/util/JSONCollectionWrapper.java
@@ -1,4 +1,4 @@
-package fr.insee.survey.datacollectionmanagement.config;
+package fr.insee.survey.datacollectionmanagement.util;
import java.util.Collection;
diff --git a/pom.xml b/pom.xml
index ed422a29..1646ec4d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,42 +3,46 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
+ pom
+ fr.insee.survey
+ platine-management
+ ${revision}${changelist}
+ platine-management
+ Modules for platine management back office
+
org.springframework.boot
spring-boot-starter-parent
- 3.3.6
-
+ 3.4.1
+
- fr.insee.survey
- platine-management
- 2.6.2
- platine-management
- REST API for communication between DB and Platine-Management UI and Platine-My-Surveys UI
-
+
+
+ platine-management-service
+ platine-management-shared
+ platine-management-db
+ platine-management-api
+
+
+ 2.7.3
+
21
- 2.6.0
- 3.2.0
- 3.1.0
- 5.0.0
- 42.7.3
- 1.0.2
+ 21
+ 21
+ UTF-8
+ UTF-8
+
+ -Dfile.encoding=UTF-8
inseefr
https://sonarcloud.io
- 7.18.0
+ target
+ ${project.basedir}/../pilotage-api/target/site/jacoco-aggregate/jacoco.xml
+ 3.2.0
+
-
- org.springframework.boot
- spring-boot-starter-web
-
-
- org.springframework.boot
- spring-boot-starter-tomcat
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
org.springframework.boot
spring-boot-starter-validation
@@ -48,137 +52,17 @@
modelmapper
${modelmapper-version}
-
- org.springframework.boot
- spring-boot-devtools
- runtime
- true
-
-
- org.springframework.boot
- spring-boot-starter-mail
-
org.projectlombok
lombok
true
- org.springdoc
- springdoc-openapi-starter-webmvc-ui
- ${springdoc-version}
-
-
-
- jakarta.ws.rs
- jakarta.ws.rs-api
- ${jakarta-version}
-
-
-
- com.fasterxml.jackson.dataformat
- jackson-dataformat-xml
-
-
- jakarta.xml.bind
- jakarta.xml.bind-api
-
-
-
- org.postgresql
- postgresql
- ${postgres-version}
-
-
-
- org.springframework.boot
- spring-boot-starter-oauth2-resource-server
-
-
- org.springframework.boot
- spring-boot-starter-security
-
-
- org.springframework.security
- spring-security-oauth2-client
-
-
-
-
- org.junit.platform
- junit-platform-suite
- test
-
-
- io.cucumber
- cucumber-java
- ${cucumber.version}
- test
-
-
- io.cucumber
- cucumber-spring
- ${cucumber.version}
-
-
- io.cucumber
- cucumber-junit-platform-engine
- ${cucumber.version}
-
-
-
-
-
-
- org.jeasy
- easy-random-core
- ${easy-version}
-
-
- com.github.javafaker
- javafaker
- ${javafaker-version}
-
-
- org.yaml
- snakeyaml
-
-
-
-
-
-
- org.springframework.security
- spring-security-test
- test
-
-
- org.springframework.boot
- spring-boot-starter-test
- test
-
-
- com.h2database
- h2
- test
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-starter-actuator
-
-
-
-
- io.micrometer
- micrometer-registry-prometheus
+ com.fasterxml.jackson.core
+ jackson-databind
-
coverage
@@ -200,11 +84,6 @@
report
-
-
- XML
-
-
@@ -216,27 +95,37 @@
- org.springframework.boot
- spring-boot-maven-plugin
+ org.codehaus.mojo
+ flatten-maven-plugin
+ 1.6.0
+
+ true
+
- build-info
+ flatten
+ process-resources
- build-info
+ flatten
+
+
+
+ flatten.clean
+ clean
+
+ clean
-
-
-
- org.projectlombok
- lombok
-
-
-
+
+
+
+ org.apache.maven.plugins
+ maven-surefire-plugin
+
+
+
-
-
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/config/OpenAPIConfiguration.java b/src/main/java/fr/insee/survey/datacollectionmanagement/config/OpenAPIConfiguration.java
deleted file mode 100644
index 8f907222..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/config/OpenAPIConfiguration.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.config;
-
-
-import fr.insee.survey.datacollectionmanagement.constants.AuthConstants;
-import io.swagger.v3.oas.models.Components;
-import io.swagger.v3.oas.models.OpenAPI;
-import io.swagger.v3.oas.models.info.Info;
-import io.swagger.v3.oas.models.security.*;
-import lombok.RequiredArgsConstructor;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.info.BuildProperties;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.Arrays;
-
-
-@Configuration
-@ConditionalOnProperty(name = "springdoc.swagger-ui.enabled", havingValue = "true", matchIfMissing = true)
-@RequiredArgsConstructor
-public class OpenAPIConfiguration {
-
- private final BuildProperties buildProperties;
-
- private final ApplicationConfig applicationConfig;
-
-
- @Bean public OpenAPI customOpenAPI() {
-
- switch(applicationConfig.getAuthType()) {
-
- case AuthConstants.OIDC:
-
- OAuthFlows flows = new OAuthFlows();
- OAuthFlow flow = new OAuthFlow();
-
- flow.setAuthorizationUrl(applicationConfig.getKeyCloakUrl() + "/realms/" + applicationConfig.getKeycloakRealm() + "/protocol/openid-connect/auth");
- flow.setTokenUrl(applicationConfig.getKeyCloakUrl() + "/realms/" + applicationConfig.getKeycloakRealm() + "/protocol/openid-connect/token");
- Scopes scopes = new Scopes();
- // scopes.addString("global", "accessEverything");
- flow.setScopes(scopes);
- flows = flows.authorizationCode(flow);
-
- return new OpenAPI()
- .components(
- new Components().addSecuritySchemes("oauth2", new SecurityScheme().type(SecurityScheme.Type.OAUTH2).flows(flows)))
- .info(new Info().title(buildProperties.getName()).version(buildProperties.getVersion()))
- .addSecurityItem(new SecurityRequirement().addList("oauth2", Arrays.asList("read", "write")));
-
- default:
- return new OpenAPI()
- .info(new Info().title(buildProperties.getName()).version(buildProperties.getVersion()));
-
- }
-
- }
-
-
-
-}
-
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PeriodEnum.java b/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PeriodEnum.java
deleted file mode 100644
index 2db05522..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/metadata/util/PeriodEnum.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.metadata.util;
-
-import lombok.Getter;
-
-@Getter
-public enum PeriodEnum {
-
- A00(PeriodicityEnum.A, "annuel"),
- X00(PeriodicityEnum.X, "pluriannuel"),
- X01(PeriodicityEnum.X, "pluriannuel"),
- X02(PeriodicityEnum.X, "pluriannuel"),
- X03(PeriodicityEnum.X, "pluriannuel"),
- X04(PeriodicityEnum.X, "pluriannuel"),
- X05(PeriodicityEnum.X, "pluriannuel"),
- X06(PeriodicityEnum.X, "pluriannuel"),
- X07(PeriodicityEnum.X, "pluriannuel"),
- X08(PeriodicityEnum.X, "pluriannuel"),
- X09(PeriodicityEnum.X, "pluriannuel"),
- X10(PeriodicityEnum.X, "pluriannuel"),
- X11(PeriodicityEnum.X, "pluriannuel"),
- X12(PeriodicityEnum.X, "pluriannuel"),
- X13(PeriodicityEnum.X, "pluriannuel"),
- X14(PeriodicityEnum.X, "pluriannuel"),
- X15(PeriodicityEnum.X, "pluriannuel"),
- X16(PeriodicityEnum.X, "pluriannuel"),
- X17(PeriodicityEnum.X, "pluriannuel"),
- X18(PeriodicityEnum.X, "pluriannuel"),
- X19(PeriodicityEnum.X, "pluriannuel"),
- X20(PeriodicityEnum.X, "pluriannuel"),
- X21(PeriodicityEnum.X, "pluriannuel"),
- X22(PeriodicityEnum.X, "pluriannuel"),
- X23(PeriodicityEnum.X, "pluriannuel"),
- X24(PeriodicityEnum.X, "pluriannuel"),
- X25(PeriodicityEnum.X, "pluriannuel"),
- X26(PeriodicityEnum.X, "pluriannuel"),
- X27(PeriodicityEnum.X, "pluriannuel"),
- X28(PeriodicityEnum.X, "pluriannuel"),
- X29(PeriodicityEnum.X, "pluriannuel"),
- X30(PeriodicityEnum.X, "pluriannuel"),
- X31(PeriodicityEnum.X, "pluriannuel"),
- X32(PeriodicityEnum.X, "pluriannuel"),
- X33(PeriodicityEnum.X, "pluriannuel"),
- X34(PeriodicityEnum.X, "pluriannuel"),
- X35(PeriodicityEnum.X, "pluriannuel"),
- X36(PeriodicityEnum.X, "pluriannuel"),
- X37(PeriodicityEnum.X, "pluriannuel"),
- X38(PeriodicityEnum.X, "pluriannuel"),
- X39(PeriodicityEnum.X, "pluriannuel"),
- X40(PeriodicityEnum.X, "pluriannuel"),
- X41(PeriodicityEnum.X, "pluriannuel"),
- X42(PeriodicityEnum.X, "pluriannuel"),
- X43(PeriodicityEnum.X, "pluriannuel"),
- X44(PeriodicityEnum.X, "pluriannuel"),
- X45(PeriodicityEnum.X, "pluriannuel"),
- X46(PeriodicityEnum.X, "pluriannuel"),
- X47(PeriodicityEnum.X, "pluriannuel"),
- X48(PeriodicityEnum.X, "pluriannuel"),
- X49(PeriodicityEnum.X, "pluriannuel"),
- X50(PeriodicityEnum.X, "pluriannuel"),
- X51(PeriodicityEnum.X, "pluriannuel"),
- X52(PeriodicityEnum.X, "pluriannuel"),
- X53(PeriodicityEnum.X, "pluriannuel"),
- X54(PeriodicityEnum.X, "pluriannuel"),
- X55(PeriodicityEnum.X, "pluriannuel"),
- X56(PeriodicityEnum.X, "pluriannuel"),
- X57(PeriodicityEnum.X, "pluriannuel"),
- X58(PeriodicityEnum.X, "pluriannuel"),
- X59(PeriodicityEnum.X, "pluriannuel"),
- X60(PeriodicityEnum.X, "pluriannuel"),
- X61(PeriodicityEnum.X, "pluriannuel"),
- X62(PeriodicityEnum.X, "pluriannuel"),
- X63(PeriodicityEnum.X, "pluriannuel"),
- X64(PeriodicityEnum.X, "pluriannuel"),
- X65(PeriodicityEnum.X, "pluriannuel"),
- X66(PeriodicityEnum.X, "pluriannuel"),
- X67(PeriodicityEnum.X, "pluriannuel"),
- X68(PeriodicityEnum.X, "pluriannuel"),
- X69(PeriodicityEnum.X, "pluriannuel"),
- X70(PeriodicityEnum.X, "pluriannuel"),
- X71(PeriodicityEnum.X, "pluriannuel"),
- X72(PeriodicityEnum.X, "pluriannuel"),
- X73(PeriodicityEnum.X, "pluriannuel"),
- X74(PeriodicityEnum.X, "pluriannuel"),
- X75(PeriodicityEnum.X, "pluriannuel"),
- X76(PeriodicityEnum.X, "pluriannuel"),
- X77(PeriodicityEnum.X, "pluriannuel"),
- X78(PeriodicityEnum.X, "pluriannuel"),
- X79(PeriodicityEnum.X, "pluriannuel"),
- X80(PeriodicityEnum.X, "pluriannuel"),
- X81(PeriodicityEnum.X, "pluriannuel"),
- X82(PeriodicityEnum.X, "pluriannuel"),
- X83(PeriodicityEnum.X, "pluriannuel"),
- X84(PeriodicityEnum.X, "pluriannuel"),
- X85(PeriodicityEnum.X, "pluriannuel"),
- X86(PeriodicityEnum.X, "pluriannuel"),
- X87(PeriodicityEnum.X, "pluriannuel"),
- X88(PeriodicityEnum.X, "pluriannuel"),
- X89(PeriodicityEnum.X, "pluriannuel"),
- X90(PeriodicityEnum.X, "pluriannuel"),
- X91(PeriodicityEnum.X, "pluriannuel"),
- X92(PeriodicityEnum.X, "pluriannuel"),
- X93(PeriodicityEnum.X, "pluriannuel"),
- X94(PeriodicityEnum.X, "pluriannuel"),
- X95(PeriodicityEnum.X, "pluriannuel"),
- X96(PeriodicityEnum.X, "pluriannuel"),
- X97(PeriodicityEnum.X, "pluriannuel"),
- X98(PeriodicityEnum.X, "pluriannuel"),
- X99(PeriodicityEnum.X, "pluriannuel"),
- S01(PeriodicityEnum.S, "1er semestre"),
- S02(PeriodicityEnum.S, "2nd semestre"),
- T01(PeriodicityEnum.T, "1er trimestre"),
- T02(PeriodicityEnum.T, "2e trimestre"),
- T03(PeriodicityEnum.T, "3e trimestre"),
- T04(PeriodicityEnum.T, "4e trimestre"),
- M01(PeriodicityEnum.M, "janvier"),
- M02(PeriodicityEnum.M, "février"),
- M03(PeriodicityEnum.M, "mars"),
- M04(PeriodicityEnum.M, "avril"),
- M05(PeriodicityEnum.M, "mai"),
- M06(PeriodicityEnum.M, "juin"),
- M07(PeriodicityEnum.M, "juillet"),
- M08(PeriodicityEnum.M, "août"),
- M09(PeriodicityEnum.M, "septembre"),
- M10(PeriodicityEnum.M, "octobre"),
- M11(PeriodicityEnum.M, "novembre"),
- M12(PeriodicityEnum.M, "décembre"),
- B01(PeriodicityEnum.B, "1er bimestre"),
- B02(PeriodicityEnum.B, "2e bimestre"),
- B03(PeriodicityEnum.B, "3e bimestre"),
- B04(PeriodicityEnum.B, "4e bimestre"),
- B05(PeriodicityEnum.B, "5e bimestre"),
- B06(PeriodicityEnum.B, "6e bimestre"),
-
- ;
-
- PeriodEnum(PeriodicityEnum period, String value) {
- this.value = value;
- this.period = period;
- }
-
- final PeriodicityEnum period;
-
- final String value;
-
- public static PeriodEnum fromValue(String v) {
- for (PeriodEnum c : PeriodEnum.values()) {
- if (c.value.equals(v)) {
- return c;
- }
- }
- throw new IllegalArgumentException(v);
- }
-
-}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MoogRepository.java b/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MoogRepository.java
deleted file mode 100644
index 01bc3f14..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/query/repository/MoogRepository.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.query.repository;
-
-import fr.insee.survey.datacollectionmanagement.contact.domain.Address;
-import fr.insee.survey.datacollectionmanagement.contact.service.AddressService;
-import fr.insee.survey.datacollectionmanagement.exception.NotFoundException;
-import fr.insee.survey.datacollectionmanagement.query.dto.MoogExtractionRowDto;
-import fr.insee.survey.datacollectionmanagement.query.dto.MoogQuestioningEventDto;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Repository;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.List;
-
-@Repository
-@RequiredArgsConstructor
-@Slf4j
-public class MoogRepository {
-
- private final JdbcTemplate jdbcTemplate;
-
- private final AddressService addressService;
-
- final String getEventsQuery = "SELECT qe.id, date, type, survey_unit_id_su, campaign_id "
- + " FROM questioning_event qe join questioning q on qe.questioning_id=q.id join partitioning p on q.id_partitioning=p.id "
- + " WHERE survey_unit_id_su=? AND campaign_id=? ";
-
-
- public List getEventsByIdSuByCampaign(String idCampaign, String idSu) {
- List progress = jdbcTemplate.query(getEventsQuery, new RowMapper() {
- public MoogQuestioningEventDto mapRow(ResultSet rs, int rowNum) throws SQLException {
- MoogQuestioningEventDto moogEvent = new MoogQuestioningEventDto();
- moogEvent.setIdManagementMonitoringInfo(rs.getString("id"));
- moogEvent.setStatus(rs.getString("type"));
- moogEvent.setDateInfo(rs.getTimestamp("date").getTime());
- return moogEvent;
- }
- }, new Object[]{idSu, idCampaign});
-
- return progress;
- }
-
- final String extractionQuery =
- """
- select
- id_su,
- identifier as id_contact,
- first_name as firstname,
- last_name as lastname,
- address_id as address,
- date as dateinfo,
- type as status,
- batch_num
- from
- (
- select
- id,
- campaign_id,
- A.id_su,
- A.identifier,
- first_name,
- last_name,
- address_id,
- id_partitioning as batch_num
- from
- (
- select
- campaign_id,
- id_su,
- contact.identifier,
- first_name,
- last_name,
- address_id
- from
- view
- left join contact on
- contact.identifier = view.identifier
- where
- campaign_id = ?
- ) as A
- left join questioning q on
- A.id_su = q.survey_unit_id_su
- and q.id_partitioning in (
- select
- id
- from
- partitioning p
- where
- p.campaign_id = ?)
- ) as B
- left join questioning_event on
- B.id = questioning_event.questioning_id
- """;
-
-
- public List getExtraction(String idCampaign) {
- List extraction = jdbcTemplate.query(extractionQuery, new RowMapper() {
-
- public MoogExtractionRowDto mapRow(ResultSet rs, int rowNum) throws SQLException {
- MoogExtractionRowDto ev = new MoogExtractionRowDto();
-
- ev.setAddress("addresse non connue");
-
- ev.setStatus(rs.getString("status"));
- ev.setDateInfo(rs.getString("dateinfo"));
- ev.setIdSu(rs.getString("id_su"));
- ev.setIdContact(rs.getString("id_contact"));
- ev.setLastname(rs.getString("lastname"));
- ev.setFirstname(rs.getString("firstname"));
- try {
- Address address = addressService.findById(rs.getLong("address"));
- ev.setAddress(address.toStringMoog());
- }
- catch (NotFoundException e){
- log.info("Address not found");
- }
-
-
- ev.setBatchNumber(rs.getString("batch_num"));
-
- return ev;
- }
- }, new Object[]{idCampaign, idCampaign});
-
- return extraction;
- }
-
- final String surveyUnitFollowUpQuery = """
- select
- distinct on
- (id_su) id_su,
- batch_num,
- case
- when type in ('PND') then 1
- else 0
- end as PND
- from
- (
- select
- A.id_su,
- A.identifier,
- q.id,
- q.id_partitioning as batch_num
- from
- (
- select
- id_su,
- identifier
- from
- public.view v
- where
- campaign_id = ?)as A
- left join questioning q on
- q.survey_unit_id_su = A.id_su
- and q.id_partitioning in (
- select
- id
- from
- partitioning p
- where
- p.campaign_id = ?)) as B
- left join questioning_event qe on
- B.id = qe.questioning_id
- where
- B.id_su not in (
- select
- distinct on
- (id_su) id_su
- from
- (
- select
- id_su,
- identifier,
- id,
- id_partitioning as batch_num
- from
- (
- select
- id_su,
- identifier
- from
- public.view
- where
- campaign_id = ?)as A
- left join questioning q on
- q.survey_unit_id_su = A.id_su
- and q.id_partitioning in (
- select
- id
- from
- partitioning p
- where
- p.campaign_id = ?)) as B
- left join questioning_event on
- B.id = questioning_event.questioning_id
- where
- type in ('VALINT', 'VALPAP', 'HC', 'REFUSAL', 'WASTE'))
- order by
- id_su,
- pnd desc;
-
- """;
- ;
-
- public List getSurveyUnitToFollowUp(String idCampaign) {
-
- List followUp = jdbcTemplate.query(surveyUnitFollowUpQuery,
- new RowMapper() {
- public MoogExtractionRowDto mapRow(ResultSet rs, int rowNum) throws SQLException {
- MoogExtractionRowDto er = new MoogExtractionRowDto();
- er.setIdSu(rs.getString("id_su"));
- er.setPnd(rs.getInt("PND"));
- er.setBatchNumber(rs.getString("batch_num"));
-
- return er;
- }
- }, new Object[]{idCampaign, idCampaign, idCampaign, idCampaign});
-
- return followUp;
-
- }
-}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningService.java b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningService.java
deleted file mode 100644
index 26b250d7..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/QuestioningService.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.questioning.service;
-
-import fr.insee.survey.datacollectionmanagement.metadata.domain.Partitioning;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
-import java.util.Set;
-
-public interface QuestioningService {
-
- public Page findAll(Pageable pageable);
-
- public Questioning findbyId(Long id);
-
- public Questioning saveQuestioning(Questioning questioning);
-
- public void deleteQuestioning(Long id);
-
- public Set findByIdPartitioning(String idPartitioning);
-
- public Questioning findByIdPartitioningAndSurveyUnitIdSu(String idPartitioning, String surveyUnitIdSu);
-
- /**
- * Delete questionings attached to one partitioning
- *
- * @param partitioning
- * @return nb questioning deleted
- */
- public int deleteQuestioningsOfOnePartitioning(Partitioning partitioning);
-
- public Set findBySurveyUnitIdSu(String idSu);
-
- public String getAccessUrl(String baseUrl, String typeUrl, String role, Questioning questioning, String surveyUnitId, String sourceId);
-
-
-}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitCommentService.java b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitCommentService.java
deleted file mode 100644
index 34440680..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/service/SurveyUnitCommentService.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.questioning.service;
-
-import fr.insee.survey.datacollectionmanagement.questioning.domain.SurveyUnitComment;
-
-public interface SurveyUnitCommentService {
-
- SurveyUnitComment saveSurveyUnitComment(SurveyUnitComment surveyUnitComment);
-
-
-}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/LastQuestioningEventComparator.java b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/LastQuestioningEventComparator.java
deleted file mode 100644
index 8ba70685..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/LastQuestioningEventComparator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.questioning.util;
-
-import fr.insee.survey.datacollectionmanagement.questioning.domain.EventOrder;
-import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningEvent;
-import fr.insee.survey.datacollectionmanagement.questioning.service.EventOrderService;
-import lombok.RequiredArgsConstructor;
-import org.springframework.stereotype.Component;
-
-import java.util.Comparator;
-
-@Component
-@RequiredArgsConstructor
-public class LastQuestioningEventComparator implements Comparator {
-
- private final EventOrderService eventOrderService;
-
- @Override
- public int compare(QuestioningEvent o1, QuestioningEvent o2) {
- EventOrder eventOrder1 = eventOrderService.findByStatus(o1.getType().name());
- EventOrder eventOrder2 = eventOrderService.findByStatus(o2.getType().name());
-
- return Integer.compare(eventOrder2.getEventOrder(), eventOrder1.getEventOrder());
- }
-
-}
diff --git a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/UrlTypeEnum.java b/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/UrlTypeEnum.java
deleted file mode 100644
index fe2251cf..00000000
--- a/src/main/java/fr/insee/survey/datacollectionmanagement/questioning/util/UrlTypeEnum.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.questioning.util;
-
-public enum UrlTypeEnum {
- V1,
- V2,
- V3,
-}
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplicationTests.java b/src/test/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplicationTests.java
deleted file mode 100644
index 36d8de69..00000000
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/DatacollectionManagementApplicationTests.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package fr.insee.survey.datacollectionmanagement;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-
-@SpringBootTest
-@EnableJpaRepositories
-class DatacollectionManagementApplicationTests {
-
- @Test
- void contextLoads() {
- }
-
-}
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/repository/dummy/QuestioningRepositoryDummy.java b/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/repository/dummy/QuestioningRepositoryDummy.java
deleted file mode 100644
index 625976e1..00000000
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/repository/dummy/QuestioningRepositoryDummy.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.questioning.repository.dummy;
-
-import fr.insee.survey.datacollectionmanagement.questioning.domain.Questioning;
-import fr.insee.survey.datacollectionmanagement.questioning.repository.QuestioningRepository;
-import org.springframework.data.domain.Example;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.repository.query.FluentQuery;
-
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.function.Function;
-
-public class QuestioningRepositoryDummy implements QuestioningRepository {
- @Override
- public Set findByIdPartitioning(String idPartitioning) {
- return null;
- }
-
- @Override
- public Questioning findByIdPartitioningAndSurveyUnitIdSu(String idPartitioning, String surveyUnitIdSu) {
- return null;
- }
-
- @Override
- public Set findBySurveyUnitIdSu(String idSu) {
- return null;
- }
-
- @Override
- public void flush() {
-
- }
-
- @Override
- public S saveAndFlush(S entity) {
- return null;
- }
-
- @Override
- public List saveAllAndFlush(Iterable entities) {
- return null;
- }
-
- @Override
- public void deleteAllInBatch(Iterable entities) {
-
- }
-
- @Override
- public void deleteAllByIdInBatch(Iterable longs) {
-
- }
-
- @Override
- public void deleteAllInBatch() {
-
- }
-
- @Override
- public Questioning getOne(Long aLong) {
- return null;
- }
-
- @Override
- public Questioning getById(Long aLong) {
- return null;
- }
-
- @Override
- public Questioning getReferenceById(Long aLong) {
- return null;
- }
-
- @Override
- public Optional findOne(Example example) {
- return Optional.empty();
- }
-
- @Override
- public List findAll(Example example) {
- return null;
- }
-
- @Override
- public List findAll(Example example, Sort sort) {
- return null;
- }
-
- @Override
- public Page findAll(Example example, Pageable pageable) {
- return null;
- }
-
- @Override
- public long count(Example example) {
- return 0;
- }
-
- @Override
- public boolean exists(Example example) {
- return false;
- }
-
- @Override
- public R findBy(Example example, Function, R> queryFunction) {
- return null;
- }
-
- @Override
- public S save(S entity) {
- return null;
- }
-
- @Override
- public List saveAll(Iterable entities) {
- return null;
- }
-
- @Override
- public Optional findById(Long aLong) {
- return Optional.empty();
- }
-
- @Override
- public boolean existsById(Long aLong) {
- return false;
- }
-
- @Override
- public List findAll() {
- return null;
- }
-
- @Override
- public List findAllById(Iterable longs) {
- return null;
- }
-
- @Override
- public long count() {
- return 0;
- }
-
- @Override
- public void deleteById(Long aLong) {
-
- }
-
- @Override
- public void delete(Questioning entity) {
-
- }
-
- @Override
- public void deleteAllById(Iterable extends Long> longs) {
-
- }
-
- @Override
- public void deleteAll(Iterable extends Questioning> entities) {
-
- }
-
- @Override
- public void deleteAll() {
-
- }
-
- @Override
- public List findAll(Sort sort) {
- return null;
- }
-
- @Override
- public Page findAll(Pageable pageable) {
- return null;
- }
-}
diff --git a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/dummy/QuestioningAccreditationServiceDummy.java b/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/dummy/QuestioningAccreditationServiceDummy.java
deleted file mode 100644
index f67d5670..00000000
--- a/src/test/java/fr/insee/survey/datacollectionmanagement/questioning/service/dummy/QuestioningAccreditationServiceDummy.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package fr.insee.survey.datacollectionmanagement.questioning.service.dummy;
-
-import fr.insee.survey.datacollectionmanagement.questioning.domain.QuestioningAccreditation;
-import fr.insee.survey.datacollectionmanagement.questioning.service.QuestioningAccreditationService;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-
-import java.util.List;
-
-public class QuestioningAccreditationServiceDummy implements QuestioningAccreditationService {
- @Override
- public List