diff --git a/.gitignore b/.gitignore index 2498109a..90c2987e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ out/ ### VS Code ### .vscode/ +/.smarttomcat/ +*.trig \ No newline at end of file diff --git a/README.md b/README.md index 11013ebf..1c8aa92e 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,13 @@ [![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/3702/badge)](https://bestpractices.coreinfrastructure.org/projects/3702) An API specification for accessing statistical metadata + +## Contribute to Metadata-API + +If you contribute to Metadata-API, you may fall in troubles with IntelliJ because the module [`metadata-api-interface`](./interface) +contains generated source code which can be ignored by IntelliJ and cause failures in `metadata-api-impl` builds. To prevent this, +the directory `interface/target/generated-sources/openapi/src/main/java` must be marked as a _Generated Sources Root_. This can be done in two steps : +1. Run maven clean then maven install for the whole project (all modules) +2. Two possibilities. Either : +- by executing the action "Reload All Maven Projects" : the directory is marked automatically +- by marking the directory manually : right-click on the directory in project explorer > "Mark directory as" diff --git a/compose.yaml b/compose.yaml new file mode 100644 index 00000000..6e46b52c --- /dev/null +++ b/compose.yaml @@ -0,0 +1,9 @@ +name: metadata-api +services: + graphdb: + image: ontotext/graphdb:10.8.4 + restart: always + ports: + - "7200:7200" + environment: + GDB_JAVA_OPTS: "-Xmx1g -Xms512M" diff --git a/impl/pom.xml b/impl/pom.xml new file mode 100644 index 00000000..de7cfb5b --- /dev/null +++ b/impl/pom.xml @@ -0,0 +1,119 @@ + + 4.0.0 + + + fr.insee.rmes + metadata-api-parent + 3.8.4 + + + metadata-api-impl + + jar + + + + fr.insee.rmes + metadata-api-interface + ${project.version} + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.openapitools + jackson-databind-nullable + + + org.springframework.boot + spring-boot-starter-validation + + + org.slf4j + slf4j-api + + + org.freemarker + freemarker + + + org.projectlombok + lombok + true + + + org.springframework.boot + spring-boot-starter-test + test + + + jakarta.platform + jakarta.jakartaee-web-api + provided + + + org.springframework.boot + spring-boot-starter-web + + + joda-time + joda-time + 2.12.7 + + + jakarta.ws.rs + jakarta.ws.rs-api + 3.1.0 + + + + org.testcontainers + testcontainers + 1.21.3 + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + + + org.projectlombok + lombok + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + \ No newline at end of file diff --git a/schemas/metadata-api.xsd b/impl/schemas/metadata-api.xsd similarity index 100% rename from schemas/metadata-api.xsd rename to impl/schemas/metadata-api.xsd diff --git a/impl/src/main/java/fr/insee/rmes/metadata/Metadata.java b/impl/src/main/java/fr/insee/rmes/metadata/Metadata.java new file mode 100644 index 00000000..2d31957f --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/Metadata.java @@ -0,0 +1,11 @@ +package fr.insee.rmes.metadata; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class Metadata { + public static void main(String[] args) { + SpringApplication.run(Metadata.class, args); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoAireDAttractionDesVillesEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoAireDAttractionDesVillesEndpoints.java new file mode 100644 index 00000000..2deddd7c --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoAireDAttractionDesVillesEndpoints.java @@ -0,0 +1,53 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.AireDAttractionDesVilles2020; +import fr.insee.rmes.metadata.model.Pays; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsAireDAttractionDesVilles; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoAireDAttractionDesVillesEndpoints implements GeoAireDAttractionDesVillesApi { + + private final RequestProcessor requestProcessor; + + public GeoAireDAttractionDesVillesEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcogaav (String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, AireDAttractionDesVilles2020.class, "none")) + .executeQuery() + .singleResult(AireDAttractionDesVilles2020.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogaavdesc (String code, LocalDate date, TypeEnumDescendantsAireDAttractionDesVilles type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, AireDAttractionDesVilles2020.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogaavliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, AireDAttractionDesVilles2020.class, "none")) + .executeQuery() + .listResult(AireDAttractionDesVilles2020.class) + .toResponseEntity(); + + } + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoArrondissementEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoArrondissementEndpoints.java new file mode 100644 index 00000000..11b204fe --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoArrondissementEndpoints.java @@ -0,0 +1,63 @@ +package fr.insee.rmes.metadata.api; + + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.Arrondissement; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumAscendantsArrondissement; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsArrondissement; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoArrondissementEndpoints implements GeoArrondissementApi { + + private final RequestProcessor requestProcessor; + + public GeoArrondissementEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity> getcogarrasc (String code, LocalDate date, TypeEnumAscendantsArrondissement type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Arrondissement.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogarr(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, Arrondissement.class, "sousPrefecture")) + .executeQuery() + .singleResult(Arrondissement.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogarrdes (String code, LocalDate date, TypeEnumDescendantsArrondissement type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Arrondissement.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogarrliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, Arrondissement.class, "*")) + .executeQuery() + .listResult(Arrondissement.class) + .toResponseEntity(); + + } + +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoArrondissementMunipalEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoArrondissementMunipalEndpoints.java new file mode 100644 index 00000000..1452c094 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoArrondissementMunipalEndpoints.java @@ -0,0 +1,51 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoArrondissementMunipalEndpoints implements GeoArrondissementMunicipalApi { + + private final RequestProcessor requestProcessor; + + public GeoArrondissementMunipalEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity> getcogarrmuasc (String code, LocalDate date, TypeEnumAscendantsArrondissementMunicipal type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, ArrondissementMunicipal.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogarrmu (String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, ArrondissementMunicipal.class, "none")) + .executeQuery() + .singleResult(ArrondissementMunicipal.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogarrmuliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, ArrondissementMunicipal.class, "none")) + .executeQuery() + .listResult(ArrondissementMunicipal.class) + .toResponseEntity(); + + } + +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoBassinDeVieEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoBassinDeVieEndpoints.java new file mode 100644 index 00000000..101dff2b --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoBassinDeVieEndpoints.java @@ -0,0 +1,53 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.BassinDeVie2022; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsBassinDeVie; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoBassinDeVieEndpoints implements GeoBassinDeVieApi { + + private final RequestProcessor requestProcessor; + + public GeoBassinDeVieEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcogbass(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, BassinDeVie2022.class, "none")) + .executeQuery() + .singleResult(BassinDeVie2022.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogbassdes (String code, LocalDate date, TypeEnumDescendantsBassinDeVie type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, BassinDeVie2022.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogbassliste (LocalDate date, String filtreNom) { + String finalFiltreNom = filtreNom == null ? "*" : filtreNom; + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, BassinDeVie2022.class, finalFiltreNom,"none", true)) + .executeQuery() + .listResult(BassinDeVie2022.class) + .toResponseEntity(); + + } + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCantonEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCantonEndpoints.java new file mode 100644 index 00000000..6d754108 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCantonEndpoints.java @@ -0,0 +1,52 @@ +package fr.insee.rmes.metadata.api; + + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoCantonEndpoints implements GeoCantonApi { + + private final RequestProcessor requestProcessor; + + public GeoCantonEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity> getcogcanasc (String code, LocalDate date, TypeEnumAscendantsCanton type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Canton.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogcan(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, Canton.class, "bureauCentralisateur")) + .executeQuery() + .singleResult(Canton.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcanliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, Canton.class, "*")) + .executeQuery() + .listResult(Canton.class) + .toResponseEntity(); + + } + +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCantonOuVilleEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCantonOuVilleEndpoints.java new file mode 100644 index 00000000..911c857b --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCantonOuVilleEndpoints.java @@ -0,0 +1,63 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoCantonOuVilleEndpoints implements GeoCantonEtVilleApi{ + + private final RequestProcessor requestProcessor; + + public GeoCantonOuVilleEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity> getcogcanvilasc (String code, LocalDate date, TypeEnumAscendantsCantonOuVille type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, CantonOuVille.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogcanvil(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, CantonOuVille.class, "none")) + .executeQuery() + .singleResult(CantonOuVille.class) + .toResponseEntity(); + + } + + @Override + public ResponseEntity> getcogcanvildes(String code, LocalDate date, TypeEnumDescendantsCantonOuVille type, String filtreNom) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, filtreNom, CantonOuVille.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcanvilliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, CantonOuVille.class, "none")) + .executeQuery() + .listResult(CantonOuVille.class) + .toResponseEntity(); + + } + + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCirconscriptionTerritorialeEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCirconscriptionTerritorialeEndpoints.java new file mode 100644 index 00000000..7a9da58d --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCirconscriptionTerritorialeEndpoints.java @@ -0,0 +1,44 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoCirconscriptionTerritorialeEndpoints implements GeoCirconscriptionTerritorialeApi{ + + private final RequestProcessor requestProcessor; + + public GeoCirconscriptionTerritorialeEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity> getcogcirasc (String code, LocalDate date, TypeEnumAscendantsCirconscriptionTerritoriale type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, CirconscriptionTerritoriale.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogcir(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, CirconscriptionTerritoriale.class, "none")) + .executeQuery() + .singleResult(CirconscriptionTerritoriale.class) + .toResponseEntity(); + + } + + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCollectiviteDOutreMerEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCollectiviteDOutreMerEndpoints.java new file mode 100644 index 00000000..1d61c5db --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCollectiviteDOutreMerEndpoints.java @@ -0,0 +1,42 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.CollectiviteDOutreMer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoCollectiviteDOutreMerEndpoints implements GeoCollectiviteDOutreMerApi{ + + private final RequestProcessor requestProcessor; + + public GeoCollectiviteDOutreMerEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcogcoll(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, CollectiviteDOutreMer.class, "none")) + .executeQuery() + .singleResult(CollectiviteDOutreMer.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcollliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, CollectiviteDOutreMer.class, "none")) + .executeQuery() + .listResult(CollectiviteDOutreMer.class) + .toResponseEntity(); + + } + + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneAssocieeEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneAssocieeEndpoints.java new file mode 100644 index 00000000..75fd5769 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneAssocieeEndpoints.java @@ -0,0 +1,55 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoCommuneAssocieeEndpoints implements GeoCommuneAssocieeApi{ + + private final RequestProcessor requestProcessor; + + public GeoCommuneAssocieeEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity> getcogcomaasc (String code, LocalDate date, TypeEnumAscendantsCommuneAssociee type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, CommuneAssociee.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogcoma(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, CommuneAssociee.class, "none")) + .executeQuery() + .singleResult(CommuneAssociee.class) + .toResponseEntity(); + + } + + @Override + public ResponseEntity> getcogcomaliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, CommuneAssociee.class, "none")) + .executeQuery() + .listResult(CommuneAssociee.class) + .toResponseEntity(); + + } + + + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneDelegueeEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneDelegueeEndpoints.java new file mode 100644 index 00000000..06fd91ff --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneDelegueeEndpoints.java @@ -0,0 +1,54 @@ +package fr.insee.rmes.metadata.api; + + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoCommuneDelegueeEndpoints implements GeoCommuneDelegueeApi{ + + private final RequestProcessor requestProcessor; + + public GeoCommuneDelegueeEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity> getcogcomdasc (String code, LocalDate date, TypeEnumAscendantsCommuneDeleguee type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, CommuneDeleguee.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogcomd (String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, CommuneDeleguee.class, "none")) + .executeQuery() + .singleResult(CommuneDeleguee.class) + .toResponseEntity(); + + } + + @Override + public ResponseEntity> getcogcomdliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, CommuneDeleguee.class, "none")) + .executeQuery() + .listResult(CommuneDeleguee.class) + .toResponseEntity(); + + } + + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneEndpoints.java new file mode 100644 index 00000000..8911188a --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoCommuneEndpoints.java @@ -0,0 +1,99 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.PrecedentsSuivantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.ProjetesRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoCommuneEndpoints implements GeoCommuneApi { + + private final RequestProcessor requestProcessor; + + public GeoCommuneEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity getcogcom(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, Commune.class, "none")) + .executeQuery() + .singleResult(Commune.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcomliste(LocalDate date, String filtreNom, Boolean com) { + String finalFiltreNom = filtreNom == null ? "*" : filtreNom; + boolean finalcom = (com != null) && com; + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, Commune.class, finalFiltreNom, "none", finalcom)) + .executeQuery() + .listResult(TerritoireBase.class) + .toResponseEntity(); + + } + + @Override + public ResponseEntity> getcogcomdesc( String code, LocalDate date, TypeEnumDescendantsCommune type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Commune.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcomasc( String code, LocalDate date, TypeEnumAscendantsCommune type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Commune.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcomprec( String code, LocalDate date) { + return requestProcessor.queryforFindPrecedentsSuivants() + .with(new PrecedentsSuivantsRequestParametizer(code, date, Commune.class, true)) + .executeQuery() + .listResult(TerritoireBase.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcomproj( String code, LocalDate dateProjection, LocalDate date) { + //le booléen previous est calculé en fonction du paramètre dateProjection (paramètre obligatoire) et du paramètre date valorisé à la date du jour si absent + // (facultatif). La valorisation de date à la date du jour dans ParameterValueDecoder n'est pas conservée en dehors de la méthode + // => obligé de valoriser date ici aussi + if (date == null) { + date = LocalDate.now(); + } + boolean previous = !dateProjection.isAfter(date); + return requestProcessor.queryforFindProjetes() + .with(new ProjetesRequestParametizer(code, dateProjection, date, Commune.class, previous)) + .executeQuery() + .listResult(TerritoireBase.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogcomsuiv(String code, LocalDate date) { + return requestProcessor.queryforFindPrecedentsSuivants() + .with(new PrecedentsSuivantsRequestParametizer(code, date, Commune.class, false)) + .executeQuery() + .listResult(TerritoireBase.class) + .toResponseEntity(); + } +} + + + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoDepartementEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoDepartementEndpoints.java new file mode 100644 index 00000000..7861c6b5 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoDepartementEndpoints.java @@ -0,0 +1,97 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.PrecedentsSuivantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.ProjetesRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoDepartementEndpoints implements GeoDepartementApi { + + private final RequestProcessor requestProcessor; + + public GeoDepartementEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity> getcogdepdesc(String code, LocalDate date, TypeEnumDescendantsDepartement type, String filtreNom) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, filtreNom, Departement.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogdepasc(String code, LocalDate date, TypeEnumAscendantsDepartement type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Departement.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogdepprec(String code, LocalDate date) { + return requestProcessor.queryforFindPrecedentsSuivants() + .with(new PrecedentsSuivantsRequestParametizer(code, date, Departement.class, true)) + .executeQuery() + .listResult(TerritoireBaseChefLieu.class) + .toResponseEntity(); + } + + + + @Override + public ResponseEntity> getcogdepproj(String code, LocalDate dateProjection, LocalDate date) { + //le booléen previous est calculé en fonction du paramètre dateProjection (paramètre obligatoire) et du paramètre date valorisé à la date du jour si absent + // (facultatif). La valorisation de date à la date du jour dans ParameterValueDecoder n'est pas conservée en dehors de la méthode + // => obligé de valoriser date ici aussi + if (date == null) { + date = LocalDate.now(); + } + boolean previous = !dateProjection.isAfter(date); + return requestProcessor.queryforFindProjetes() + .with(new ProjetesRequestParametizer(code, dateProjection, date, Departement.class, previous)) + .executeQuery() + .listResult(TerritoireBaseChefLieu.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogdepsuiv(String code, LocalDate date) { + return requestProcessor.queryforFindPrecedentsSuivants() + .with(new PrecedentsSuivantsRequestParametizer(code, date, Departement.class, false)) + .executeQuery() + .listResult(TerritoireBaseChefLieu.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogdep(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, Departement.class,"prefecture")) + .executeQuery() + .singleResult(Departement.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogdepts(LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, Departement.class, "prefecture", true)) + .executeQuery() + .listResult(TerritoireBaseChefLieu.class) + .toResponseEntity(); + + } + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoDistrictEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoDistrictEndpoints.java new file mode 100644 index 00000000..99decfc8 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoDistrictEndpoints.java @@ -0,0 +1,41 @@ +package fr.insee.rmes.metadata.api; + + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoDistrictEndpoints implements GeoDistrictApi { + + private final RequestProcessor requestProcessor; + + public GeoDistrictEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity> getcogdisasc (String code, LocalDate date, TypeEnumAscendantsDistrict type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, District.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity getcogdis(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, District.class, "none")) + .executeQuery() + .singleResult(District.class).toResponseEntity(); + } +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoIntercommunaliteEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoIntercommunaliteEndpoints.java new file mode 100644 index 00000000..1a6fd9a4 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoIntercommunaliteEndpoints.java @@ -0,0 +1,54 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoIntercommunaliteEndpoints implements GeoIntercommunaliteApi { + + private final RequestProcessor requestProcessor; + + public GeoIntercommunaliteEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcoginterco(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, Intercommunalite.class,"none")) + .executeQuery() + .singleResult(Intercommunalite.class).toResponseEntity(); + } + + + @Override + public ResponseEntity> getcogintercodes (String code, LocalDate date, TypeEnumDescendantsIntercommunalite type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Intercommunalite.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + + @Override + public ResponseEntity> getcogintercoliste (LocalDate date, String filtreNom) { + String finalFiltreNom = filtreNom == null ? "*" : filtreNom; + + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, Intercommunalite.class, finalFiltreNom,"none", true)) + .executeQuery() + .listResult(Intercommunalite.class) + .toResponseEntity(); + + } +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoIrisEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoIrisEndpoints.java new file mode 100644 index 00000000..dfc6e5a5 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoIrisEndpoints.java @@ -0,0 +1,51 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.Commune; +import fr.insee.rmes.metadata.model.Iris; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoIrisEndpoints implements GeoIrisApi { + + private final RequestProcessor requestProcessor; + + public GeoIrisEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity getcogiris(String code, LocalDate date) { + //cf carte https://github.com/orgs/InseeFr/projects/9/views/5?filterQuery=-application%3AColectica+-scope%3Atechnique+iris&pane=issue&itemId=49451501&issue=InseeFr%7CMetadata-API%7C103 + String code_commune=code.substring(0, 5); +// RequestProcessor.ListResult types = requestProcessor.queryforFindIrisDescendantsCommune() +// .with(new TerritoireRequestParametizer(code_commune, Commune.class)) +// .executeQuery().listResult(String.class); + + // Exécuter la requête et obtenir le résultat + RequestProcessor.ListeResultatsIris types = requestProcessor.queryforFindIrisDescendantsCommune() + .with(new TerritoireRequestParametizer(code_commune, Commune.class)) + .executeQuery() + .listeResultatsIris(String.class); +//plante à la méthode unmarshallAll' + + // Obtenir la liste des résultats + List typeList = types.getList(); + +//condition à mettre : si l'un des types de la liste finit par "#Iris\r\n", cf https://github.com/InseeFr/Metadata-API/blob/main/src/main/java/fr/insee/rmes/utils/IrisUtils.java#L8 + boolean containsIris = typeList.contains("http://rdf.insee.fr/def/geo#Iris"); + + +//bloc de fin pour que ça compile mais à revoir + return requestProcessor.queryforFindIris() + .with(new TerritoireRequestParametizer(code, date, Iris.class, "none")) + .executeQuery() + .singleResult(Iris.class).toResponseEntity(); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoPaysEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoPaysEndpoints.java new file mode 100644 index 00000000..f0331508 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoPaysEndpoints.java @@ -0,0 +1,52 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.Pays; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsPays; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoPaysEndpoints implements GeoPaysApi { + + private final RequestProcessor requestProcessor; + + public GeoPaysEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcogpays (String code, LocalDate date) { + return requestProcessor.queryforFindPays() + .with(new TerritoireRequestParametizer(code, date, Pays.class, "none")) + .executeQuery() + .singleResult(Pays.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogpaysdesc(String code, LocalDate date, TypeEnumDescendantsPays type) { + return requestProcessor.queryforFindDescendantsPays() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, Pays.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + + @Override + public ResponseEntity> getcogpayslist (LocalDate date) { + return requestProcessor.queryforFindPays() + .with(new TerritoireRequestParametizer(date, Pays.class, "none")) + .executeQuery() + .listResult(Pays.class) + .toResponseEntity(); + + } + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoRegionEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoRegionEndpoints.java new file mode 100644 index 00000000..ad407b3b --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoRegionEndpoints.java @@ -0,0 +1,52 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.Region; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsRegion; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoRegionEndpoints implements GeoRegionApi { + + private final RequestProcessor requestProcessor; + + public GeoRegionEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + + @Override + public ResponseEntity getcogreg(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, Region.class,"prefectureDeRegion")) + .executeQuery() + .singleResult(Region.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcogregdes (String code, LocalDate date, TypeEnumDescendantsRegion type, String filtreNom) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, filtreNom, Region.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + + @Override + public ResponseEntity> getcogregliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, Region.class, "prefectureDeRegion")) + .executeQuery() + .listResult(Region.class) + .toResponseEntity(); + + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoUniteUrbaineEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoUniteUrbaineEndpoints.java new file mode 100644 index 00000000..a16d9682 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoUniteUrbaineEndpoints.java @@ -0,0 +1,52 @@ +package fr.insee.rmes.metadata.api; + + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsUniteUrbaine; +import fr.insee.rmes.metadata.model.UniteUrbaine2020; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + +@Controller +public class GeoUniteUrbaineEndpoints implements GeoUniteUrbaineApi { + + private final RequestProcessor requestProcessor; + + public GeoUniteUrbaineEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcoguu(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, UniteUrbaine2020.class, "none")) + .executeQuery() + .singleResult(UniteUrbaine2020.class).toResponseEntity(); + } + + @Override + public ResponseEntity> getcoguudes (String code, LocalDate date, TypeEnumDescendantsUniteUrbaine type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, UniteUrbaine2020.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcoguuliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, UniteUrbaine2020.class, "none")) + .executeQuery() + .listResult(UniteUrbaine2020.class) + .toResponseEntity(); + } + +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/GeoZoneDEmploiEndpoints.java b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoZoneDEmploiEndpoints.java new file mode 100644 index 00000000..f79fba4a --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/GeoZoneDEmploiEndpoints.java @@ -0,0 +1,57 @@ +package fr.insee.rmes.metadata.api; + +import fr.insee.rmes.metadata.api.requestprocessor.RequestProcessor; +import fr.insee.rmes.metadata.model.TerritoireTousAttributs; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsZoneDEmploi; +import fr.insee.rmes.metadata.model.ZoneDEmploi2020; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; + +import java.time.LocalDate; +import java.util.List; + + +@Controller +public class GeoZoneDEmploiEndpoints implements GeoZoneDEmploiApi{ + + private final RequestProcessor requestProcessor; + + public GeoZoneDEmploiEndpoints(RequestProcessor requestProcessor) { + this.requestProcessor = requestProcessor; + } + + @Override + public ResponseEntity getcogze(String code, LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(code, date, ZoneDEmploi2020.class, "none")) + .executeQuery() + .singleResult(ZoneDEmploi2020.class) + .toResponseEntity(); + + } + + + @Override + public ResponseEntity> getcogzedesc(String code, LocalDate date, TypeEnumDescendantsZoneDEmploi type) { + return requestProcessor.queryforFindAscendantsDescendants() + .with(new AscendantsDescendantsRequestParametizer(code, date, type, ZoneDEmploi2020.class)) + .executeQuery() + .listResult(TerritoireTousAttributs.class) + .toResponseEntity(); + } + + @Override + public ResponseEntity> getcogzeliste (LocalDate date) { + return requestProcessor.queryforFindTerritoire() + .with(new TerritoireRequestParametizer(date, ZoneDEmploi2020.class, "none")) + .executeQuery() + .listResult(ZoneDEmploi2020.class) + .toResponseEntity(); + + } + + + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/api/requestprocessor/RequestProcessor.java b/impl/src/main/java/fr/insee/rmes/metadata/api/requestprocessor/RequestProcessor.java new file mode 100644 index 00000000..8d15d21e --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/api/requestprocessor/RequestProcessor.java @@ -0,0 +1,124 @@ +package fr.insee.rmes.metadata.api.requestprocessor; + +import fr.insee.rmes.metadata.queries.Query; +import fr.insee.rmes.metadata.queries.parameters.AscendantsDescendantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.TerritoireRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.PrecedentsSuivantsRequestParametizer; +import fr.insee.rmes.metadata.queries.parameters.ProjetesRequestParametizer; +import fr.insee.rmes.metadata.queryexecutor.Csv; +import fr.insee.rmes.metadata.queryexecutor.QueryExecutor; +import fr.insee.rmes.metadata.unmarshaller.Unmarshaller; +import fr.insee.rmes.metadata.utils.EndpointsUtils; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Component; +import java.nio.file.Path; +import java.util.List; +import static fr.insee.rmes.metadata.queries.QueryBuilder.*; + + +@Component +public record RequestProcessor(fr.insee.rmes.metadata.queries.QueryBuilder queryBuilder, QueryExecutor queryExecutor, Unmarshaller unmarshaller) { + + public RequestProcessor.QueryBuilder queryforFindAscendantsDescendants() { + return new RequestProcessor.QueryBuilder(ASCENDANTS_OR_DESCENDANTS, this); + } + + public RequestProcessor.QueryBuilder queryforFindPrecedentsSuivants() { + return new RequestProcessor.QueryBuilder(PRECEDENTS, this); + } + + public RequestProcessor.QueryBuilder queryforFindProjetes() { + return new RequestProcessor.QueryBuilder(PROJETES, this); + } + + public RequestProcessor.QueryBuilder queryforFindTerritoire() { + return new RequestProcessor.QueryBuilder(TERRITOIRE, this); + } + + public RequestProcessor.QueryBuilder queryforFindIrisDescendantsCommune() { + return new RequestProcessor.QueryBuilder(LIEN_COMMUNE_IRIS, this); + } + + public RequestProcessor.QueryBuilder queryforFindPays() { + return new RequestProcessor.QueryBuilder(LIEN_PAYS, this); + } + + public RequestProcessor.QueryBuilder queryforFindDescendantsPays() { + return new RequestProcessor.QueryBuilder(DESCENDANTS_PAYS, this); + } + + + public RequestProcessor.QueryBuilder queryforFindIris() { + return new RequestProcessor.QueryBuilder(IRIS, this); + } + + + public record QueryBuilder(Path queryPath, RequestProcessor requestProcessor) { + public ExecutableQuery with(AscendantsDescendantsRequestParametizer ascendantsDescendantsRequestParametizer) { + return new ExecutableQuery(requestProcessor.queryBuilder().build(ascendantsDescendantsRequestParametizer.toParameters(), queryPath), requestProcessor); + } + public ExecutableQuery with(TerritoireRequestParametizer territoireRequestParametizer) { + return new ExecutableQuery(requestProcessor.queryBuilder().build(territoireRequestParametizer.toParameters(), queryPath), requestProcessor); + } + + public ExecutableQuery with(PrecedentsSuivantsRequestParametizer precedentsRequestParametizer) { + return new ExecutableQuery(requestProcessor.queryBuilder().build(precedentsRequestParametizer.toParameters(), queryPath), requestProcessor); + } + + public ExecutableQuery with(ProjetesRequestParametizer projetesRequestParametizer) { + return new ExecutableQuery(requestProcessor.queryBuilder().build(projetesRequestParametizer.toParameters(), queryPath), requestProcessor); + } + } + + + + + public record ExecutableQuery(Query query, RequestProcessor requestProcessor) { + public QueryResult executeQuery() { + return new QueryResult(requestProcessor.queryExecutor().execute(query), requestProcessor); + } + } + + public record QueryResult(Csv csv,RequestProcessor requestProcessor) { + public ListResult listResult(Class clazz) { + return new ListResult<>(requestProcessor.unmarshaller().unmarshalList(csv, clazz)); + } + public SingleResult singleResult(Class clazz) { + return new SingleResult<>(requestProcessor.unmarshaller().unmarshalOrNull(csv, clazz)); + } + public ListeResultatsIris listeResultatsIris(Class clazz) { + List list = requestProcessor.unmarshaller().unmarshalList(csv, clazz); + return new ListeResultatsIris<>(list); + } + + } + + public record ListResult(List result){ + + public ResponseEntity> toResponseEntity() { + return EndpointsUtils.toResponseEntity(result); + } + } + + public record SingleResult(E result){ +// public ResponseEntity toResponseEntity() {return new ResponseEntity<>(result, HttpStatus.OK);} + public ResponseEntity toResponseEntity() {return EndpointsUtils.toResponseEntity(result);} + } + + + + public record ListeResultatsIris(List result){ + public boolean contains(String value) { + return result.stream().anyMatch(item -> item.toString().equals(value)); + } + public ListeResultatsIris(List result) { + this.result = result; + } + + public List getList() { + return result; + } + + } + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/config/LogRequestFilter.java b/impl/src/main/java/fr/insee/rmes/metadata/config/LogRequestFilter.java new file mode 100644 index 00000000..aa1a02e7 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/config/LogRequestFilter.java @@ -0,0 +1,46 @@ +package fr.insee.rmes.metadata.config; + +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.annotation.WebFilter; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.ws.rs.container.ContainerRequestContext; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.filter.AbstractRequestLoggingFilter; + +import java.io.IOException; + + +@Slf4j +@WebFilter +public class LogRequestFilter extends AbstractRequestLoggingFilter { + + public LogRequestFilter() { + super.setIncludeQueryString(true); + super.setIncludePayload(true); + } + + + private StringBuilder logRequest(ContainerRequestContext requestContext) { + StringBuilder sb = new StringBuilder(); + sb.append(requestContext.getMethod()).append(" ").append(requestContext.getUriInfo().getPath()); + return sb; + } + + @Override + protected void beforeRequest(HttpServletRequest request, String message) { + log.info(message); + } + + @Override + protected void afterRequest(HttpServletRequest request, String message) { + log.info(message); + } + + @Override + protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { + super.doFilterInternal(request, response, filterChain); + log.info("REQUEST PROCESSED WITH STATUS: {}", response.getStatus()); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/config/MetadataConfig.java b/impl/src/main/java/fr/insee/rmes/metadata/config/MetadataConfig.java new file mode 100644 index 00000000..10caae61 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/config/MetadataConfig.java @@ -0,0 +1,47 @@ +package fr.insee.rmes.metadata.config; + +import freemarker.cache.FileTemplateLoader; +import freemarker.cache.MultiTemplateLoader; +import freemarker.cache.TemplateLoader; +import freemarker.template.Configuration; +import freemarker.template.TemplateExceptionHandler; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.web.servlet.ServletComponentScan; +import org.springframework.context.annotation.Bean; + +import java.io.File; +import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Locale; + +@org.springframework.context.annotation.Configuration +@Slf4j +@ServletComponentScan +public class MetadataConfig { + + @Bean + public Configuration freemarkerConfiguration(@Value("${fr.insee.rmes.metadata.api.freemarker.locale-language}") String localLanguage) throws URISyntaxException, IOException { + var configuration = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); + URL freemarkerTemplatesDirectory = MetadataConfig.class.getClassLoader().getResource("request"); + FileTemplateLoader fileTemplateLoader = new FileTemplateLoader( + new File(freemarkerTemplatesDirectory.toURI()) + ); + MultiTemplateLoader mtl = new MultiTemplateLoader(new TemplateLoader[]{fileTemplateLoader}); + + log.info("Init freemarker templateloader {}", freemarkerTemplatesDirectory); + configuration.setTemplateLoader(mtl); + + configuration.setDefaultEncoding("UTF-8"); + configuration.setLocale(Locale.of(localLanguage)); + + configuration.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); + + configuration.setLogTemplateExceptions(false); + + configuration.setWrapUncheckedExceptions(true); + + return configuration; + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/Query.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/Query.java new file mode 100644 index 00000000..eca845c3 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/Query.java @@ -0,0 +1,10 @@ +package fr.insee.rmes.metadata.queries; + +import java.io.Writer; + +public record Query(String value) { + public Query (Writer out){ + this(out.toString()); + } + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/QueryBuilder.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/QueryBuilder.java new file mode 100644 index 00000000..17e7d784 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/QueryBuilder.java @@ -0,0 +1,43 @@ +package fr.insee.rmes.metadata.queries; + +import freemarker.template.Configuration; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.io.StringWriter; +import java.io.Writer; +import java.nio.file.Path; +import java.util.Map; + +@Component +@Slf4j +public record QueryBuilder (Configuration freemarkerConfiguration) { + public static final Path ASCENDANTS_OR_DESCENDANTS = Path.of("geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh"); + public static final Path TERRITOIRE = Path.of("geographie/getTerritoireByCodeDateNomCommune.ftlh"); + public static final Path PRECEDENTS = Path.of("geographie/getPreviousOrNextByCodeTypeDate.ftlh"); + public static final Path PROJETES = Path.of("geographie/getProjectionByCodeTypeDate.ftlh"); +// public static final Path IRIS = Path.of("geographie/getIrisByCodeDate.ftlh"); + public static final Path IRIS = Path.of("geographie/getTerritoireByCodeDateNomcommune.ftlh"); + public static final Path LIEN_COMMUNE_IRIS = Path.of("geographie/hasIrisDescendant.ftlh"); + public static final Path LIEN_PAYS = Path.of("geographie/getPays.ftlh"); + public static final Path DESCENDANTS_PAYS = Path.of("geographie/getPaysDescendants.ftlh"); + + + public Query build(Map parameters, Path queryfile) { + Template template; + Writer out = new StringWriter(); + try { + template = freemarkerConfiguration.getTemplate(queryfile.toString()); + template.process(parameters, out); + } + catch (IOException | TemplateException e) { + //TODO lever une Exception non contrôlée et utiliser un ExceptionHandler au niveau des contrôleurs pour traiter l'erreur + log.error("Can't read query {} : ", queryfile, e); + } + return new Query(out); + } + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/AscendantsDescendantsRequestParametizer.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/AscendantsDescendantsRequestParametizer.java new file mode 100644 index 00000000..95f6821d --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/AscendantsDescendantsRequestParametizer.java @@ -0,0 +1,215 @@ +package fr.insee.rmes.metadata.queries.parameters; + +import fr.insee.rmes.metadata.model.*; + +import java.lang.reflect.RecordComponent; +import java.time.LocalDate; + +public record AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsAireDAttractionDesVilles typeEnumDescendantsAireDAttractionDesVilles, + TypeEnumDescendantsArrondissement typeEnumDescendantsArrondissement, + TypeEnumAscendantsArrondissement typeEnumAscendantsArrondissement, + TypeEnumAscendantsArrondissementMunicipal typeEnumAscendantsArrondissementMunicipal, + TypeEnumDescendantsBassinDeVie typeEnumDescendantsBassinDeVie, + TypeEnumAscendantsCanton typeEnumAscendantsCanton, + TypeEnumAscendantsCantonOuVille typeEnumAscendantsCantonOuVille, + TypeEnumDescendantsCantonOuVille typeEnumDescendantsCantonOuVille, + TypeEnumAscendantsCirconscriptionTerritoriale typeEnumAscendantsCirconscriptionTerritoriale, + TypeEnumAscendantsCommune typeEnumAscendantsCommune, + TypeEnumDescendantsCommune typeEnumDescendantsCommune, + TypeEnumAscendantsCommuneAssociee typeEnumAscendantsCommuneAssociee, + TypeEnumAscendantsCommuneDeleguee typeEnumAscendantsCommuneDeleguee, + TypeEnumAscendantsDepartement typeEnumAscendantsDepartement, + TypeEnumDescendantsDepartement typeEnumDescendantsDepartement, + TypeEnumAscendantsDistrict typeEnumAscendantsDistrict, + TypeEnumDescendantsIntercommunalite typeEnumDescendantsIntercommunalite, + TypeEnumDescendantsPays typeEnumDescendantsPays, + TypeEnumDescendantsRegion typeEnumDescendantsRegion, + TypeEnumDescendantsUniteUrbaine typeEnumDescendantsUniteUrbaine, + TypeEnumDescendantsZoneDEmploi typeEnumDescendantsZoneDEmploi, + String filtreNom, + Class typeOrigine, + boolean ascendant) implements ParametersForQuery { + + //for geo/aireDAttractionDesVilles/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsAireDAttractionDesVilles typeEnumDescendantsAireDAttractionDesVilles, + Class typeOrigine) { + this(code, date, typeEnumDescendantsAireDAttractionDesVilles, null,null, null,null, null, null, null, null, null, null, null,null,null, null, null, null, null,null,null,null,null,typeOrigine, false); + } + + //for geo/arrondissement/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsArrondissement typeEnum, + Class typeOrigine) { + this(code, date, null, typeEnum, null, null,null, null, null, null, null,null, null,null, null,null,null, null, null, null, null, null,null,null, typeOrigine, false); + } + + //for geo/arrondissement/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsArrondissement typeEnum, + Class typeOrigine) { + this(code, date, null, null, typeEnum, null,null,null, null, null,null, null, null, null,null, null, null, null,null, null,null, null,null, null,typeOrigine, true); + } + + //for geo/arrondissementMunicipal/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsArrondissementMunicipal typeEnum, + Class typeOrigine) { + this(code, date, null, null, null, typeEnum, null, null,null, null,null, null, null,null, null, null, null,null, null,null, null, null,null,null, typeOrigine, true); + } + + //for geo/bassinDeVie2022/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsBassinDeVie typeEnumDescendantsBassinDeVie, + Class typeOrigine) { + this(code, date, null, null, null, null, typeEnumDescendantsBassinDeVie, null,null,null, null, null,null, null, null, null,null, null, null,null,null, null, null, null,typeOrigine, false); + } + + //for geo/canton/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsCanton typeEnumAscendantsCanton, + Class typeOrigine) { + this(code, date, null, null, null, null, null, typeEnumAscendantsCanton, null, null,null,null, null,null, null, null, null,null, null, null, null,null,null, null,typeOrigine, true); + } + + //for geo/cantonOuVille/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsCantonOuVille typeEnumAscendantsCantonOuVille, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, typeEnumAscendantsCantonOuVille, null,null, null,null,null, null, null,null, null, null,null, null,null, null, null,typeOrigine, true); + } + + //for geo/cantonOuVille/{code}/decendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsCantonOuVille typeEnumDescendantsCantonOuVille, + String filtreNom, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null, typeEnumDescendantsCantonOuVille, null,null,null, null,null,null, null, null, null, null,null,null, null, null,typeOrigine, false); + } + + //for geo/circonscriptionTerritoriale/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsCirconscriptionTerritoriale typeEnumAscendantsCirconscriptionTerritoriale, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, typeEnumAscendantsCirconscriptionTerritoriale, null,null,null, null,null, null, null, null,null,null, null, null, null,typeOrigine, true); + } + + //for geo/commune/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsCommune typeEnumAscendantsCommune, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null,null, null, null, typeEnumAscendantsCommune, null, null,null,null, null,null, null, null, null, null,null,null,typeOrigine, true); + } + + //for geo/commune/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsCommune typeEnumDescendantsCommune, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null,null, null, null, null,typeEnumDescendantsCommune,null, null, null,null,null, null, null, null,null,null,null,typeOrigine, false); + } + + //for geo/communeAssociee/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsCommuneAssociee typeEnumAscendantsCommuneAssociee, + Class typeOrigine) { + this(code, date, null, null, null,null, null, null, null,null, null, null,null, typeEnumAscendantsCommuneAssociee, null,null,null, null,null, null, null,null, null,null,typeOrigine, true); + } + + //for geo/communeDeleguee/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsCommuneDeleguee typeEnumAscendantsCommuneDeleguee, + Class typeOrigine) { + this(code, date, null, null, null, null,null, null,null, null, null, null,null, null, typeEnumAscendantsCommuneDeleguee, null, null,null, null,null,null, null,null, null,typeOrigine, true); + } + + //for geo/departement/{code}/ascendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsDepartement typeEnum, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null,typeEnum,null , null,null, null,null,null,null, null,typeOrigine, true); + } + + //for geo/departement/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsDepartement typeEnumDescendantsDepartement, + String filtreNom, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null, null,typeEnumDescendantsDepartement, null, null,null,null, null,null,filtreNom, typeOrigine, false); + } + + + //for geo/district/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumAscendantsDistrict typeEnumAscendantsDistrict, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null,null, null, null, null, null, null, null, null,null, typeEnumAscendantsDistrict, null,null,null, null,null,null, typeOrigine, true); + } + + //for geo/intercommunalite/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsIntercommunalite typeEnumDescendantsIntercommunalite, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null, null,null,null, typeEnumDescendantsIntercommunalite,null, null,null, null,null,typeOrigine, false); + } + + //for geo/pays/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsPays typeEnumDescendantsPays, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null, null,null,null, null,typeEnumDescendantsPays, null,null, null,null,typeOrigine, false); + } + + //for geo/region/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsRegion typeEnumDescendantsRegion, + String filtreNom, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null, null,null,null, null,null, typeEnumDescendantsRegion,null,null,filtreNom, typeOrigine, false); + } + + //for geo/uniteUrbaine2020/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsUniteUrbaine typeEnumDescendantsUniteUrbaine, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null, null,null,null, null,null, null,typeEnumDescendantsUniteUrbaine, null,null,typeOrigine, false); + } + + //for geo/zoneDEmploi2020/{code}/descendants + public AscendantsDescendantsRequestParametizer(String code, + LocalDate date, + TypeEnumDescendantsZoneDEmploi typeEnumDescendantsZoneDEmploi, + Class typeOrigine) { + this(code, date, null, null, null, null, null, null, null,null, null, null, null, null, null, null,null,null, null,null, null,null, typeEnumDescendantsZoneDEmploi,null,typeOrigine, false); + } + + @Override + public ParameterValueDecoder findParameterValueDecoder(RecordComponent recordComponent) { + if ("filtreNom".equals(recordComponent.getName())){ + return new ParameterValueDecoder.DelegaterDecoder<>(stringValue -> stringValue ==null?"*": stringValue.toString()); + } + return ParametersForQuery.super.findParameterValueDecoder(recordComponent); + } +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ParameterValueDecoder.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ParameterValueDecoder.java new file mode 100644 index 00000000..bc3aed35 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ParameterValueDecoder.java @@ -0,0 +1,100 @@ +package fr.insee.rmes.metadata.queries.parameters; + +import fr.insee.rmes.metadata.model.*; + +import java.lang.reflect.RecordComponent; +import java.time.LocalDate; +import java.util.function.Function; + +@FunctionalInterface +interface ParameterValueDecoder{ + + String STRING_CLASS = "java.lang.String"; + String BOOLEAN_CLASS = "boolean"; + String CLASS_CLASS = "java.lang.Class"; + String LOCALE_DATE_CLASS = "java.time.LocalDate"; + String ENUM_DESCENDANTS_AIREDATTRACTIONDESVILLES_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsAireDAttractionDesVilles"; + String ENUM_DESCENDANTS_ARRONDISSEMENT_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsArrondissement"; + String ENUM_ASCENDANTS_ARRONDISSEMENT_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsArrondissement"; + String ENUM_ASCENDANTS_ARRONDISSEMENTMUNICIPAL_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsArrondissementMunicipal"; + String ENUM_DESCENDANTS_BASSINDEVIE_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsBassinDeVie"; + String ENUM_ASCENDANTS_CANTON_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsCanton"; + String ENUM_ASCENDANTS_CANTONOUVILLE_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsCantonOuVille"; + String ENUM_DESCENDANTS_CANTONOUVILLE_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsCantonOuVille"; + String ENUM_ASCENDANTS_CIRCONSCRIPTIONTERRITORIALE_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsCirconscriptionTerritoriale"; + String ENUM_ASCENDANTS_COMMUNEASSOCIEE_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsCommuneAssociee"; + String ENUM_ASCENDANTS_COMMUNEDELEGUEE_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsCommuneDeleguee"; + String ENUM_ASCENDANTS_DISTRICT_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsDistrict"; + String ENUM_DESCENDANTS_DEPARTEMENT_CLASS= "fr.insee.rmes.metadata.model.TypeEnumDescendantsDepartement"; + String ENUM_ASCENDANTS_DEPARTEMENT_CLASS= "fr.insee.rmes.metadata.model.TypeEnumAscendantsDepartement"; + String ENUM_DESCENDANTS_COMMUNE_CLASS= "fr.insee.rmes.metadata.model.TypeEnumDescendantsCommune"; + String ENUM_ASCENDANTS_COMMUNE_CLASS = "fr.insee.rmes.metadata.model.TypeEnumAscendantsCommune"; + String ENUM_DESCENDANTS_INTERCOMMUNALITE_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsIntercommunalite"; + String ENUM_DESCENDANTS_PAYS_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsPays"; + String ENUM_DESCENDANTS_REGION_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsRegion"; + String ENUM_DESCENDANTS_UNITEURBAINE_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsUniteUrbaine"; + String ENUM_DESCENDANTS_ZONEDEMPLOI_CLASS="fr.insee.rmes.metadata.model.TypeEnumDescendantsZoneDEmploi"; + + static ParameterValueDecoder of(Class type) { + return switch (type.getName()){ + case BOOLEAN_CLASS -> bool -> (boolean) bool ?"true":"false"; + case CLASS_CLASS -> clazz -> ((Class)clazz).getSimpleName(); + case STRING_CLASS -> String::valueOf; + case LOCALE_DATE_CLASS -> localDate -> String.valueOf(localDate==null?LocalDate.now():localDate); + case ENUM_DESCENDANTS_AIREDATTRACTIONDESVILLES_CLASS -> enumAavValue -> enumAavValue ==null?"none": ((TypeEnumDescendantsAireDAttractionDesVilles)enumAavValue).getValue(); + case ENUM_DESCENDANTS_ARRONDISSEMENT_CLASS -> enumArrValue -> enumArrValue ==null?"none": ((TypeEnumDescendantsArrondissement)enumArrValue).getValue(); + case ENUM_ASCENDANTS_ARRONDISSEMENT_CLASS -> enumArrValue -> enumArrValue ==null?"none": ((TypeEnumAscendantsArrondissement)enumArrValue).getValue(); + case ENUM_ASCENDANTS_ARRONDISSEMENTMUNICIPAL_CLASS -> enumArrMuValue -> enumArrMuValue ==null?"none": ((TypeEnumAscendantsArrondissementMunicipal)enumArrMuValue).getValue(); + case ENUM_DESCENDANTS_BASSINDEVIE_CLASS -> enumBassValue -> enumBassValue ==null?"none": ((TypeEnumDescendantsBassinDeVie)enumBassValue).getValue(); + case ENUM_ASCENDANTS_CANTON_CLASS -> enumCanValue -> enumCanValue ==null?"none": ((TypeEnumAscendantsCanton)enumCanValue).getValue(); + case ENUM_ASCENDANTS_CANTONOUVILLE_CLASS -> enumCanOuVilValue -> enumCanOuVilValue ==null?"none": ((TypeEnumAscendantsCantonOuVille)enumCanOuVilValue).getValue(); + case ENUM_DESCENDANTS_CANTONOUVILLE_CLASS -> enumCanOuVilValue -> enumCanOuVilValue ==null?"none": ((TypeEnumDescendantsCantonOuVille)enumCanOuVilValue).getValue(); + case ENUM_ASCENDANTS_CIRCONSCRIPTIONTERRITORIALE_CLASS -> enumCirValue -> enumCirValue ==null?"none": ((TypeEnumAscendantsCirconscriptionTerritoriale)enumCirValue).getValue(); + case ENUM_ASCENDANTS_COMMUNE_CLASS -> enumComValue -> enumComValue ==null?"none": ((TypeEnumAscendantsCommune)enumComValue).getValue(); + case ENUM_DESCENDANTS_COMMUNE_CLASS -> enumComDesValue -> enumComDesValue ==null?"none": ((TypeEnumDescendantsCommune)enumComDesValue).getValue(); + case ENUM_ASCENDANTS_COMMUNEASSOCIEE_CLASS -> enumComAValue -> enumComAValue ==null?"none": ((TypeEnumAscendantsCommuneAssociee)enumComAValue).getValue(); + case ENUM_ASCENDANTS_COMMUNEDELEGUEE_CLASS -> enumComDValue -> enumComDValue ==null?"none": ((TypeEnumAscendantsCommuneDeleguee)enumComDValue).getValue(); + case ENUM_ASCENDANTS_DISTRICT_CLASS -> enumDisValue -> enumDisValue ==null?"none": ((TypeEnumAscendantsDistrict)enumDisValue).getValue(); + case ENUM_DESCENDANTS_DEPARTEMENT_CLASS -> enumDepAscValue -> enumDepAscValue ==null?"none": ((TypeEnumDescendantsDepartement)enumDepAscValue).getValue(); + case ENUM_ASCENDANTS_DEPARTEMENT_CLASS -> enumDepDesValue -> enumDepDesValue ==null?"none": ((TypeEnumAscendantsDepartement)enumDepDesValue).getValue(); + case ENUM_DESCENDANTS_INTERCOMMUNALITE_CLASS -> enumIntercoValue -> enumIntercoValue ==null?"none": ((TypeEnumDescendantsIntercommunalite)enumIntercoValue).getValue(); + case ENUM_DESCENDANTS_PAYS_CLASS -> enumPaysValue -> enumPaysValue ==null?"none": ((TypeEnumDescendantsPays)enumPaysValue).getValue(); + case ENUM_DESCENDANTS_REGION_CLASS -> enumRegValue -> enumRegValue ==null?"none": ((TypeEnumDescendantsRegion)enumRegValue).getValue(); + case ENUM_DESCENDANTS_UNITEURBAINE_CLASS -> enumUuValue -> enumUuValue ==null?"none": ((TypeEnumDescendantsUniteUrbaine)enumUuValue).getValue(); + case ENUM_DESCENDANTS_ZONEDEMPLOI_CLASS -> enumZeValue -> enumZeValue ==null?"none": ((TypeEnumDescendantsZoneDEmploi)enumZeValue).getValue(); + case String ignored when Enum.class.isAssignableFrom(type) -> simpleEnum -> ((Enum)simpleEnum).name(); + default -> throw new IllegalArgumentException("Unsupported type: " + type.getName()); + }; + + } + + String decode(T value); + + /** + * Class for custom decoder in {@link ParametersForQuery} records such as {@link AscendantsDescendantsRequestParametizer} which + * need to customize decoder for a type which has yet a standard decoder in the children of ParameterValueDecoder + *

+ * For example {@link AscendantsDescendantsRequestParametizer} needs a custom treatment for Strings for attribute filtreNom. + * So it overrides the method {@link ParametersForQuery#findParameterValueDecoder(RecordComponent)} and for the attribute + * filtreNom, it returns its custom decoder with this kind of code : + * + * if ("filtreNom".equals(recordComponent.getName())){ + * return new ParameterValueDecoder.DelegaterDecoder(value -> value ==null?"*": value); + * } + * + *

+ * The DelegaterDecoder is never be returned by + * { @link fr.insee.rmes.metadata.queries.parameters.ParameterValueDecoder#of(java.lang.Class)} and can only be + * used when explicitly instanced in a method such as {@link AscendantsDescendantsRequestParametizer#findParameterValueDecoder(RecordComponent)} + * + * @param delegatedDecoder : a function applied to decode the value + * @param : the type for which the instance will decode + */ + record DelegaterDecoder(Function delegatedDecoder) implements ParameterValueDecoder { + @Override + public String decode(U value) { + return delegatedDecoder.apply(value); + } + } + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ParametersForQuery.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ParametersForQuery.java new file mode 100644 index 00000000..d52476f4 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ParametersForQuery.java @@ -0,0 +1,37 @@ +package fr.insee.rmes.metadata.queries.parameters; + +import java.lang.reflect.RecordComponent; +import java.util.Arrays; +import java.util.Map; +import java.util.stream.Collectors; + +import static org.springframework.util.ReflectionUtils.invokeMethod; + +public interface ParametersForQuery> { + default Map toParameters(){ + RecordComponent[] recordComponents = this.getClass().getRecordComponents(); + if (recordComponents ==null){ + throw new RuntimeException("Class " + this.getClass().getName() + " has no record components"); + } + return Arrays.stream(recordComponents) + .collect(Collectors.toMap( + RecordComponent::getName, + this::decodeValue + )); + } + + private String decodeValue(RecordComponent recordComponent) { + ParameterValueDecoder decoder = (ParameterValueDecoder) findParameterValueDecoder(recordComponent); + return decoder.decode(value(recordComponent)); + } + + private Object value(RecordComponent recordComponent){ + return invokeMethod(recordComponent.getAccessor(), this); + } + + default ParameterValueDecoder findParameterValueDecoder(RecordComponent recordComponent){ + return ParameterValueDecoder.of(recordComponent.getType()); + } + + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/PrecedentsSuivantsRequestParametizer.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/PrecedentsSuivantsRequestParametizer.java new file mode 100644 index 00000000..a7789f31 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/PrecedentsSuivantsRequestParametizer.java @@ -0,0 +1,17 @@ +package fr.insee.rmes.metadata.queries.parameters; + +import java.lang.reflect.RecordComponent; +import java.time.LocalDate; + +public record PrecedentsSuivantsRequestParametizer(String code, + LocalDate date, + Class typeOrigine, + boolean previous) implements ParametersForQuery { + + + @Override + public ParameterValueDecoder findParameterValueDecoder(RecordComponent recordComponent) { + return ParametersForQuery.super.findParameterValueDecoder(recordComponent); + } +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ProjetesRequestParametizer.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ProjetesRequestParametizer.java new file mode 100644 index 00000000..f8de69d9 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/ProjetesRequestParametizer.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.queries.parameters; + +import java.lang.reflect.RecordComponent; +import java.time.LocalDate; + + + public record ProjetesRequestParametizer(String code, + LocalDate dateProjection, + LocalDate date, + Class typeOrigine, + boolean previous) implements ParametersForQuery { + + + @Override + public ParameterValueDecoder findParameterValueDecoder(RecordComponent recordComponent) { + return ParametersForQuery.super.findParameterValueDecoder(recordComponent); + } + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/TerritoireRequestParametizer.java b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/TerritoireRequestParametizer.java new file mode 100644 index 00000000..62fc6404 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queries/parameters/TerritoireRequestParametizer.java @@ -0,0 +1,57 @@ +package fr.insee.rmes.metadata.queries.parameters; + +import java.lang.reflect.RecordComponent; +import java.time.LocalDate; + +public record TerritoireRequestParametizer(String code, + LocalDate date, + Class typeOrigine, + String filtreNom, + String chefLieu, + boolean com) implements ParametersForQuery { + + //for geo/departement/{code} and geo/region/{code} + public TerritoireRequestParametizer(String code, + LocalDate date, + Class typeOrigine, + String chefLieu) { + this(code, date, typeOrigine, "*", chefLieu, true); + } + + //for geo/departements + public TerritoireRequestParametizer(LocalDate date, + Class typeOrigine, + String chefLieu, + boolean com) { + this("none", date, typeOrigine, "*", chefLieu, com); +} + + //for geo/communes and geo/bassinsDeVie2022 + public TerritoireRequestParametizer(LocalDate date, + Class typeOrigine, + String filtreNom, + String chefLieu, + boolean com) { + this("none", date, typeOrigine, filtreNom, chefLieu, com); + } + + //forgeo/arrondissements, geo/aireDAttractionDesVilles2020, etc + public TerritoireRequestParametizer(LocalDate date, + Class typeOrigine, + String chefLieu) { + this("none", date, typeOrigine, "*", chefLieu, true); + } + + //for geo/iris/{code} (hasIrisDescendant) + public TerritoireRequestParametizer(String code, + Class typeOrigine) { + this(code, LocalDate.now(), typeOrigine, "*", "prefecture", true); + } + + @Override + public ParameterValueDecoder findParameterValueDecoder(RecordComponent recordComponent) { + return ParametersForQuery.super.findParameterValueDecoder(recordComponent); + } + + +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queryexecutor/Csv.java b/impl/src/main/java/fr/insee/rmes/metadata/queryexecutor/Csv.java new file mode 100644 index 00000000..8533a25e --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queryexecutor/Csv.java @@ -0,0 +1,4 @@ +package fr.insee.rmes.metadata.queryexecutor; + +public record Csv(String content) { +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/queryexecutor/QueryExecutor.java b/impl/src/main/java/fr/insee/rmes/metadata/queryexecutor/QueryExecutor.java new file mode 100644 index 00000000..4fc853d3 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/queryexecutor/QueryExecutor.java @@ -0,0 +1,59 @@ +package fr.insee.rmes.metadata.queryexecutor; + +import fr.insee.rmes.metadata.queries.Query; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpRequest; +import org.springframework.http.HttpStatusCode; +import org.springframework.http.client.ClientHttpResponse; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestClient; + +@Slf4j +@Component +public record QueryExecutor(RestClient restClient, String urlTemplate) { + + @Autowired + public QueryExecutor(@Value("${fr.insee.rmes.metadata.api.sparqlEndpoint}") String sparqlEndpoint) { + this(RestClient.builder() + .defaultHeader(HttpHeaders.ACCEPT, "text/csv") + .build(),sparqlEndpoint + "?query={query}" + ); + } + + public static final String PREFIXES = + """ + PREFIX igeo: + PREFIX dcterms: + PREFIX xkos: + PREFIX evoc: + PREFIX skos: + PREFIX dc: + PREFIX insee: + PREFIX rdf: + PREFIX pav: + PREFIX xsd: + PREFIX prov: + PREFIX sdmx-mm: + """; + + public Csv execute(@NonNull Query query) { + String prefixedQuery = PREFIXES + query.value(); + return new Csv(restClient.get() + .uri(urlTemplate, prefixedQuery) + .retrieve() + .onStatus(HttpStatusCode::is4xxClientError, + (HttpRequest request, ClientHttpResponse response) -> { + log.error(""" + Encoded request in error : {} + raw request in error : {} + """, request.getURI(), prefixedQuery); + throw new RuntimeException("Error "+response.getStatusText()+" with message "+new String(response.getBody().readAllBytes())); + }) + .body(String.class)); + } + +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/unmarshaller/JacksonUnmarshaller.java b/impl/src/main/java/fr/insee/rmes/metadata/unmarshaller/JacksonUnmarshaller.java new file mode 100644 index 00000000..f9e59ed5 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/unmarshaller/JacksonUnmarshaller.java @@ -0,0 +1,111 @@ +package fr.insee.rmes.metadata.unmarshaller; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.*; +import com.fasterxml.jackson.databind.Module; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.dataformat.csv.CsvMapper; +import com.fasterxml.jackson.dataformat.csv.CsvSchema; +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; +import fr.insee.rmes.metadata.model.*; +import fr.insee.rmes.metadata.queryexecutor.Csv; +import lombok.NonNull; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +import java.io.IOException; +import java.util.List; +import java.util.Optional; +import java.util.function.Function; + +import static fr.insee.rmes.metadata.model.Departement.TypeArticleEnum._0_CHARNIERE_DE_; + +@Component +@Slf4j +// TODO proposer une autre implémentation d'unmarshaller ? +public record JacksonUnmarshaller(CsvMapper csvMapper) implements Unmarshaller { + + public JacksonUnmarshaller() { + this(CsvMapper.csvBuilder().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS) + .addModule(enumModule(TerritoireBase.TypeArticleEnum.class, TerritoireBase.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(TerritoireTousAttributs.TypeArticleEnum.class, TerritoireTousAttributs.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(TerritoireBaseChefLieu.TypeArticleEnum.class, TerritoireBaseChefLieu.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(AireDAttractionDesVilles2020.TypeArticleEnum.class, AireDAttractionDesVilles2020.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(Arrondissement.TypeArticleEnum.class, Arrondissement.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(ArrondissementMunicipal.TypeArticleEnum.class, ArrondissementMunicipal.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(BassinDeVie2022.TypeArticleEnum.class, BassinDeVie2022.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(Canton.TypeArticleEnum.class, Canton.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(CantonOuVille.TypeArticleEnum.class, CantonOuVille.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(CirconscriptionTerritoriale.TypeArticleEnum.class, CirconscriptionTerritoriale.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(CollectiviteDOutreMer.TypeArticleEnum.class, CollectiviteDOutreMer.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(Commune.TypeArticleEnum.class, Commune.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(CommuneAssociee.TypeArticleEnum.class, CommuneAssociee.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(CommuneDeleguee.TypeArticleEnum.class, CommuneDeleguee.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(District.TypeArticleEnum.class, District.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(Departement.TypeArticleEnum.class, Departement.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(Intercommunalite.TypeArticleEnum.class, Intercommunalite.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(Region.TypeArticleEnum.class, Region.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(UniteUrbaine2020.TypeArticleEnum.class, UniteUrbaine2020.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(enumModule(ZoneDEmploi2020.TypeArticleEnum.class, ZoneDEmploi2020.TypeArticleEnum._0_CHARNIERE_DE_)) + .addModule(new JavaTimeModule()) + .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) + .build()); + } + + + private static > Module enumModule(Class enumClass, E defaultValue) { + var module = new SimpleModule(); + module.addDeserializer(enumClass, new JsonDeserializer<>() { + @Override + public E deserialize(JsonParser parser, DeserializationContext ctxt) { + try { + return enumClass.getEnumConstants()[Integer.parseInt(parser.getValueAsString())]; + } catch (NumberFormatException | IOException e) { + return defaultValue; + } + } + }); + return module; + } + + @Override + public Optional unmarshal(@NonNull Csv csv, @NonNull Class targetClass) { + return unmarshallAll(csv.content(), targetClass, Optional.empty(), l-> l.isEmpty()?Optional.empty():Optional.of(l.getFirst())); + } + + @Override + public G unmarshalOrNull(@NonNull Csv csv, @NonNull Class targetClass) { + return unmarshallAll(csv.content(), targetClass, null, + l -> l.isEmpty() ? null : l.getFirst()); + } + + @Override + public List unmarshalList(@NonNull Csv csv, @NonNull Class targetClass) { + return unmarshallAll(csv.content(), targetClass, List.of(), Function.identity()); + } + + private R unmarshallAll(String csv, Class targetClass, R resultEmpty, Function, R> extractResults){ + log.atDebug().log(() -> "Deserialize for "+findReturned(targetClass, resultEmpty) + +". CSV header is "+ csv.lines().limit(1).findFirst().orElse(null)); + CsvSchema schema = CsvSchema.emptySchema() + .withHeader() + .withNullValue(""); + ObjectReader reader = csvMapper.readerFor(targetClass).with(schema); + List results; + try (MappingIterator mappingIterator = reader.readValues(csv)) { + results = mappingIterator.readAll(); + } catch (IOException e) { + log.error("While reading \n{}\nMESSAGE : {}\n===> RETURN WILL BE EMPTY", csv, e.getMessage()); + return resultEmpty; + } + return extractResults.apply(results); + } + + private String findReturned(Class targetClass, R resultEmpty) { + return switch (resultEmpty){ + case List ignored -> "List<"+targetClass.getName()+">"; + case Optional ignored -> targetClass.getName(); + default -> "Unknown wrapper for "+targetClass.getName(); + }; + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/unmarshaller/Unmarshaller.java b/impl/src/main/java/fr/insee/rmes/metadata/unmarshaller/Unmarshaller.java new file mode 100644 index 00000000..e859c3d8 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/unmarshaller/Unmarshaller.java @@ -0,0 +1,15 @@ +package fr.insee.rmes.metadata.unmarshaller; + +import fr.insee.rmes.metadata.queryexecutor.Csv; +import lombok.NonNull; + +import java.util.List; +import java.util.Optional; + +public interface Unmarshaller { + Optional unmarshal(@NonNull Csv csv, @NonNull Class targetClass); + + G unmarshalOrNull(@NonNull Csv csv, @NonNull Class targetClass); + + List unmarshalList(@NonNull Csv csv, @NonNull Class targetClass); +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/EndpointsUtils.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/EndpointsUtils.java new file mode 100644 index 00000000..eb197801 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/EndpointsUtils.java @@ -0,0 +1,44 @@ +package fr.insee.rmes.metadata.utils; + +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import java.util.List; + +public class EndpointsUtils { + + private EndpointsUtils() {} + + public static ResponseEntity> toResponseEntity(List result) { + if (result == null || result.isEmpty()) { + return ResponseEntity.notFound().build(); + } + + MediaType contentType = MediaType.APPLICATION_JSON; + if (isXmlRequest()) { + contentType = MediaType.APPLICATION_XML; + } + + return ResponseEntity.ok() + .contentType(contentType) + .body(result); + } + + private static boolean isXmlRequest() { + return false; + } + + public static ResponseEntity toResponseEntity(E result) { + if (result == null) { + return ResponseEntity.notFound().build(); + } + + MediaType contentType = MediaType.APPLICATION_JSON; + if (isXmlRequest()) { + contentType = MediaType.APPLICATION_XML; + } + + return ResponseEntity.ok() + .contentType(contentType) + .body(result); + } +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsArrondissementConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsArrondissementConverter.java new file mode 100644 index 00000000..c822fc5d --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsArrondissementConverter.java @@ -0,0 +1,21 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsArrondissement; +import fr.insee.rmes.metadata.model.TypeEnumAscendantsDepartement; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class TypeEnumAscendantsArrondissementConverter implements Converter { + @Override + public TypeEnumAscendantsArrondissement convert(String source) { + for (TypeEnumAscendantsArrondissement type : TypeEnumAscendantsArrondissement.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsArrondissement : " + source); + } +} + + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsArrondissementMunicipalConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsArrondissementMunicipalConverter.java new file mode 100644 index 00000000..7fe3c4a4 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsArrondissementMunicipalConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsArrondissementMunicipal; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumAscendantsArrondissementMunicipalConverter implements Converter { + @Override + public TypeEnumAscendantsArrondissementMunicipal convert(String source) { + for (TypeEnumAscendantsArrondissementMunicipal type : TypeEnumAscendantsArrondissementMunicipal.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsArrondissementMunicipal : " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCantonConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCantonConverter.java new file mode 100644 index 00000000..1243592f --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCantonConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsCanton; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumAscendantsCantonConverter implements Converter { + @Override + public TypeEnumAscendantsCanton convert(String source) { + for (TypeEnumAscendantsCanton type : TypeEnumAscendantsCanton.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsCanton : " + source); + } +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCantonOuVilleConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCantonOuVilleConverter.java new file mode 100644 index 00000000..f8d6835e --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCantonOuVilleConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsCantonOuVille; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + + +@Component +public class TypeEnumAscendantsCantonOuVilleConverter implements Converter { + @Override + public TypeEnumAscendantsCantonOuVille convert(String source) { + for (TypeEnumAscendantsCantonOuVille type : TypeEnumAscendantsCantonOuVille.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsCantonOuVille : " + source); + } +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCirconscriptionTerritorialeConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCirconscriptionTerritorialeConverter.java new file mode 100644 index 00000000..25294089 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCirconscriptionTerritorialeConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsCirconscriptionTerritoriale; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + + +@Component +public class TypeEnumAscendantsCirconscriptionTerritorialeConverter implements Converter { + @Override + public TypeEnumAscendantsCirconscriptionTerritoriale convert(String source) { + for (TypeEnumAscendantsCirconscriptionTerritoriale type : TypeEnumAscendantsCirconscriptionTerritoriale.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsCirconscriptionTerritoriale : " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneAssocieeConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneAssocieeConverter.java new file mode 100644 index 00000000..2a25e59f --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneAssocieeConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsCommuneAssociee; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumAscendantsCommuneAssocieeConverter implements Converter { + @Override + public TypeEnumAscendantsCommuneAssociee convert(String source) { + for (TypeEnumAscendantsCommuneAssociee type : TypeEnumAscendantsCommuneAssociee.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsCommuneAssociee : " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneConverter.java new file mode 100644 index 00000000..105efe83 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneConverter.java @@ -0,0 +1,21 @@ +package fr.insee.rmes.metadata.utils; + + + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsCommune; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class TypeEnumAscendantsCommuneConverter implements Converter { + @Override + public TypeEnumAscendantsCommune convert(String source) { + for (TypeEnumAscendantsCommune type : TypeEnumAscendantsCommune.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumInclusDansCommune: " + source); + } +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneDelegueeConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneDelegueeConverter.java new file mode 100644 index 00000000..953cb158 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsCommuneDelegueeConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsCommuneDeleguee; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumAscendantsCommuneDelegueeConverter implements Converter { + @Override + public TypeEnumAscendantsCommuneDeleguee convert(String source) { + for (TypeEnumAscendantsCommuneDeleguee type : TypeEnumAscendantsCommuneDeleguee.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsCommuneDeleguee : " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsDepartementConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsDepartementConverter.java new file mode 100644 index 00000000..ec03fa2f --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsDepartementConverter.java @@ -0,0 +1,18 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsDepartement; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class TypeEnumAscendantsDepartementConverter implements Converter { + @Override + public TypeEnumAscendantsDepartement convert(String source) { + for (TypeEnumAscendantsDepartement type : TypeEnumAscendantsDepartement.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsDepartement : " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsDistrictConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsDistrictConverter.java new file mode 100644 index 00000000..da3ac4f1 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumAscendantsDistrictConverter.java @@ -0,0 +1,21 @@ +package fr.insee.rmes.metadata.utils; + + +import fr.insee.rmes.metadata.model.TypeEnumAscendantsDistrict; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumAscendantsDistrictConverter implements Converter { + @Override + public TypeEnumAscendantsDistrict convert(String source) { + for (TypeEnumAscendantsDistrict type : TypeEnumAscendantsDistrict.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumAscendantsDistrict : " + source); + } +} + diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsAireDAttractionDesVillesConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsAireDAttractionDesVillesConverter.java new file mode 100644 index 00000000..d23a1b3b --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsAireDAttractionDesVillesConverter.java @@ -0,0 +1,18 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsAireDAttractionDesVilles; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class TypeEnumDescendantsAireDAttractionDesVillesConverter implements Converter { + @Override + public TypeEnumDescendantsAireDAttractionDesVilles convert(String source) { + for (TypeEnumDescendantsAireDAttractionDesVilles type : TypeEnumDescendantsAireDAttractionDesVilles.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsAireDAttractionDesVilles: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsArrondissementConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsArrondissementConverter.java new file mode 100644 index 00000000..7d593fc2 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsArrondissementConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsArrondissement; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsArrondissementConverter implements Converter { + @Override + public TypeEnumDescendantsArrondissement convert(String source) { + for (TypeEnumDescendantsArrondissement type : TypeEnumDescendantsArrondissement.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsArrondissement: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsBassinDeVieConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsBassinDeVieConverter.java new file mode 100644 index 00000000..ab97182e --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsBassinDeVieConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsBassinDeVie; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsBassinDeVieConverter implements Converter { + @Override + public TypeEnumDescendantsBassinDeVie convert(String source) { + for (TypeEnumDescendantsBassinDeVie type : TypeEnumDescendantsBassinDeVie.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsBassinDeVie: " + source); + } +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsCantonOuVilleConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsCantonOuVilleConverter.java new file mode 100644 index 00000000..95175b2f --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsCantonOuVilleConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsCantonOuVille; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsCantonOuVilleConverter implements Converter { + @Override + public TypeEnumDescendantsCantonOuVille convert(String source) { + for (TypeEnumDescendantsCantonOuVille type : TypeEnumDescendantsCantonOuVille.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsCantonOuVille: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsCommuneConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsCommuneConverter.java new file mode 100644 index 00000000..a443692e --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsCommuneConverter.java @@ -0,0 +1,18 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsCommune; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class TypeEnumDescendantsCommuneConverter implements Converter { + @Override + public TypeEnumDescendantsCommune convert(String source) { + for (TypeEnumDescendantsCommune type : TypeEnumDescendantsCommune.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsCommune: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsDepartementConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsDepartementConverter.java new file mode 100644 index 00000000..259c9c3b --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsDepartementConverter.java @@ -0,0 +1,18 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsDepartement; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + +@Component +public class TypeEnumDescendantsDepartementConverter implements Converter { + @Override + public TypeEnumDescendantsDepartement convert(String source) { + for (TypeEnumDescendantsDepartement type : TypeEnumDescendantsDepartement.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsDepartement: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsIntercommunaliteConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsIntercommunaliteConverter.java new file mode 100644 index 00000000..05b3380b --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsIntercommunaliteConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsIntercommunalite; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsIntercommunaliteConverter implements Converter { + @Override + public TypeEnumDescendantsIntercommunalite convert(String source) { + for (TypeEnumDescendantsIntercommunalite type : TypeEnumDescendantsIntercommunalite.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsIntercommunalite: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsPaysConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsPaysConverter.java new file mode 100644 index 00000000..171511c8 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsPaysConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsPays; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsPaysConverter implements Converter { + @Override + public TypeEnumDescendantsPays convert(String source) { + for (TypeEnumDescendantsPays type : TypeEnumDescendantsPays.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsPays: " + source); + } +} \ No newline at end of file diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsRegionConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsRegionConverter.java new file mode 100644 index 00000000..50be02be --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsRegionConverter.java @@ -0,0 +1,20 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsIntercommunalite; +import fr.insee.rmes.metadata.model.TypeEnumDescendantsRegion; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsRegionConverter implements Converter { + @Override + public TypeEnumDescendantsRegion convert(String source) { + for (TypeEnumDescendantsRegion type : TypeEnumDescendantsRegion.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsRegion: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsUniteUrbaineConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsUniteUrbaineConverter.java new file mode 100644 index 00000000..8ed0014c --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsUniteUrbaineConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsUniteUrbaine; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsUniteUrbaineConverter implements Converter { + @Override + public TypeEnumDescendantsUniteUrbaine convert(String source) { + for (TypeEnumDescendantsUniteUrbaine type : TypeEnumDescendantsUniteUrbaine.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsUniteUrbaine: " + source); + } +} diff --git a/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsZoneDEmploiConverter.java b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsZoneDEmploiConverter.java new file mode 100644 index 00000000..7e977ac8 --- /dev/null +++ b/impl/src/main/java/fr/insee/rmes/metadata/utils/TypeEnumDescendantsZoneDEmploiConverter.java @@ -0,0 +1,19 @@ +package fr.insee.rmes.metadata.utils; + +import fr.insee.rmes.metadata.model.TypeEnumDescendantsZoneDEmploi; +import org.springframework.core.convert.converter.Converter; +import org.springframework.stereotype.Component; + + +@Component +public class TypeEnumDescendantsZoneDEmploiConverter implements Converter { + @Override + public TypeEnumDescendantsZoneDEmploi convert(String source) { + for (TypeEnumDescendantsZoneDEmploi type : TypeEnumDescendantsZoneDEmploi.values()) { + if (type.getValue().equalsIgnoreCase(source)) { + return type; + } + } + throw new IllegalArgumentException("Invalid value for TypeEnumDescendantsZoneDEmploi: " + source); + } +} diff --git a/src/main/java/fr/insee/rmes/utils/IrisUtils.java b/impl/src/main/java/fr/insee/rmes/oldqueries/IrisUtils.java similarity index 82% rename from src/main/java/fr/insee/rmes/utils/IrisUtils.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/IrisUtils.java index 8c1f5f15..ff21d242 100644 --- a/src/main/java/fr/insee/rmes/utils/IrisUtils.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/IrisUtils.java @@ -1,10 +1,8 @@ -package fr.insee.rmes.utils; +package fr.insee.rmes.oldqueries; public class IrisUtils { - private final SparqlUtils sparqlUtils=new SparqlUtils(); - public boolean hasIrisDescendant(String codeCommune) { String sparqlQuery = String.format( "SELECT DISTINCT ?type\n" @@ -24,8 +22,7 @@ public boolean hasIrisDescendant(String codeCommune) { + "}\n" + "ORDER BY ?type", codeCommune, codeCommune); - var type=this.sparqlUtils.executeSparqlQuery(sparqlQuery); - return type.endsWith("#Iris\r\n"); + return false; } } diff --git a/src/main/java/fr/insee/rmes/queries/classifications/ActivitesQueries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/ActivitesQueries.java similarity index 78% rename from src/main/java/fr/insee/rmes/queries/classifications/ActivitesQueries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/ActivitesQueries.java index a6cde8e3..8a66fe7e 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/ActivitesQueries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/ActivitesQueries.java @@ -1,8 +1,6 @@ -package fr.insee.rmes.queries.classifications; +package fr.insee.rmes.oldqueries.classifications; -import org.joda.time.DateTime; - -import fr.insee.rmes.config.Configuration; +import java.time.LocalDateTime; public class ActivitesQueries { @@ -10,7 +8,7 @@ private ActivitesQueries() { throw new IllegalStateException("Utility class"); } - public static String getActiviteByCodeAndDate(String code, DateTime date) { + public static String getActiviteByCodeAndDate(String code, LocalDateTime date) { return "SELECT ?code ?uri ?intitule ?dateDebutValidite ?dateFinValidite WHERE { \n" + "?classification dcterms:issued ?dateDebutValidite . \n" + "FILTER (?dateDebutValidite <= '" @@ -30,22 +28,22 @@ public static String getActiviteByCodeAndDate(String code, DateTime date) { + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" + "VALUES ?classification { <" - + Configuration.getBaseHost() + //+ Configuration.getBaseHost() + "/codes/na73/na> \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/naf/naf> \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/nafr1/naf> \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/nafr2/naf> } \n" + "}"; } public static String getActiviteByCode(String code) { - return getActiviteByCodeAndDate(code, DateTime.now()); + return getActiviteByCodeAndDate(code, LocalDateTime.now()); } public static String getActivites(String code) { @@ -60,16 +58,16 @@ public static String getActivites(String code) { + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" + "VALUES ?classification { <" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/na73/na> \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/naf/naf> \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/nafr1/naf> \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/nafr2/naf> } \n" + "} \n" + "ORDER BY ?dateDebutValidite"; diff --git a/src/main/java/fr/insee/rmes/queries/classifications/CJQueries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/CJQueries.java similarity index 90% rename from src/main/java/fr/insee/rmes/queries/classifications/CJQueries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/CJQueries.java index 693b2ba1..aae0b977 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/CJQueries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/CJQueries.java @@ -1,8 +1,6 @@ -package fr.insee.rmes.queries.classifications; +package fr.insee.rmes.oldqueries.classifications; -import org.joda.time.DateTime; - -import fr.insee.rmes.config.Configuration; +import java.time.LocalDateTime; public class CJQueries { @@ -17,10 +15,10 @@ public static String getCategorieJuridiqueNiveauII(String code) { + "{ \n" + "SELECT ?lastCJThirdLevel WHERE { \n" + "?lastCJThirdLevel xkos:organizedBy <" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/concepts/cj/cjNiveauII> . \n" + "BIND(STRBEFORE(STRAFTER(STR(?lastCJThirdLevel), '" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/cj/cj'), '/niveauII') AS ?lastCJVersion) \n" + "BIND(xsd:float(?lastCJVersion) AS ?lastCJVersionFloat)" + "} \n" @@ -41,10 +39,10 @@ public static String getCategorieJuridiqueNiveauIII(String code) { + "{ \n" + "SELECT ?lastCJThirdLevel WHERE { \n" + "?lastCJThirdLevel xkos:organizedBy <" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/concepts/cj/cjNiveauIII> . \n" + "BIND(STRBEFORE(STRAFTER(STR(?lastCJThirdLevel), '" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/cj/cj'), '/niveauIII') AS ?lastCJVersion) \n" + "BIND(xsd:float(?lastCJVersion) AS ?lastCJVersionFloat)" + "} \n" @@ -54,7 +52,7 @@ public static String getCategorieJuridiqueNiveauIII(String code) { + "}"; } - public static String getCJByCodeAndDate(String code, DateTime date) { + public static String getCJByCodeAndDate(String code, LocalDateTime date) { return "SELECT ?code ?uri ?intitule ?dateDebutValidite ?dateFinValidite WHERE { \n" + "?classification dcterms:issued ?dateDebutValidite . \n" + "FILTER(REGEX(STR(?classification), '/codes/cj/')) \n" @@ -78,7 +76,7 @@ public static String getCJByCodeAndDate(String code, DateTime date) { } public static String getCJByCode(String code) { - return getCJByCodeAndDate(code, DateTime.now()); + return getCJByCodeAndDate(code, LocalDateTime.now()); } public static String getCJ(String code) { diff --git a/src/main/java/fr/insee/rmes/queries/classifications/ClassificationsQueries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/ClassificationsQueries.java similarity index 98% rename from src/main/java/fr/insee/rmes/queries/classifications/ClassificationsQueries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/ClassificationsQueries.java index 8e65bf6d..1e549697 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/ClassificationsQueries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/ClassificationsQueries.java @@ -1,4 +1,4 @@ -package fr.insee.rmes.queries.classifications; +package fr.insee.rmes.oldqueries.classifications; public class ClassificationsQueries { diff --git a/src/main/java/fr/insee/rmes/queries/classifications/CorrespondencesQueries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/CorrespondencesQueries.java similarity index 99% rename from src/main/java/fr/insee/rmes/queries/classifications/CorrespondencesQueries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/CorrespondencesQueries.java index b45df06f..2a1b3fef 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/CorrespondencesQueries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/CorrespondencesQueries.java @@ -1,4 +1,4 @@ -package fr.insee.rmes.queries.classifications; +package fr.insee.rmes.oldqueries.classifications; public class CorrespondencesQueries { diff --git a/src/main/java/fr/insee/rmes/queries/classifications/Na1973Queries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Na1973Queries.java similarity index 79% rename from src/main/java/fr/insee/rmes/queries/classifications/Na1973Queries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Na1973Queries.java index 16d2ece4..2ccf9dc0 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/Na1973Queries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Na1973Queries.java @@ -1,6 +1,5 @@ -package fr.insee.rmes.queries.classifications; +package fr.insee.rmes.oldqueries.classifications; -import fr.insee.rmes.config.Configuration; public class Na1973Queries { @@ -14,7 +13,7 @@ public static String getGroupeNA1973(String code) { + code + "' . \n" + "<" - + Configuration.getBaseHost() + //+ Configuration.getBaseHost() + "/codes/na73/groupes> skos:member ?uri . \n" + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" diff --git a/src/main/java/fr/insee/rmes/queries/classifications/Naf1993Queries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf1993Queries.java similarity index 79% rename from src/main/java/fr/insee/rmes/queries/classifications/Naf1993Queries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf1993Queries.java index 9a2807f1..44f3f314 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/Naf1993Queries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf1993Queries.java @@ -1,6 +1,4 @@ -package fr.insee.rmes.queries.classifications; - -import fr.insee.rmes.config.Configuration; +package fr.insee.rmes.oldqueries.classifications; public class Naf1993Queries { @@ -14,7 +12,7 @@ public static String getClasseNAF1993(String code) { + code + "' . \n" + "<" - + Configuration.getBaseHost() + //+ Configuration.getBaseHost() + "/codes/naf/classes> skos:member ?uri . \n" + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" diff --git a/src/main/java/fr/insee/rmes/queries/classifications/Naf2003Queries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf2003Queries.java similarity index 79% rename from src/main/java/fr/insee/rmes/queries/classifications/Naf2003Queries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf2003Queries.java index 63213de7..d0a5c0f3 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/Naf2003Queries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf2003Queries.java @@ -1,6 +1,4 @@ -package fr.insee.rmes.queries.classifications; - -import fr.insee.rmes.config.Configuration; +package fr.insee.rmes.oldqueries.classifications; public class Naf2003Queries { @@ -14,7 +12,7 @@ public static String getClasseNAF2003(String code) { + code + "' . \n" + "<" - + Configuration.getBaseHost() + // + Configuration.getBaseHost() + "/codes/nafr1/classes> skos:member ?uri . \n" + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" diff --git a/src/main/java/fr/insee/rmes/queries/classifications/Naf2008Queries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf2008Queries.java similarity index 83% rename from src/main/java/fr/insee/rmes/queries/classifications/Naf2008Queries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf2008Queries.java index 989ac20f..8f56e50e 100644 --- a/src/main/java/fr/insee/rmes/queries/classifications/Naf2008Queries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/classifications/Naf2008Queries.java @@ -1,6 +1,4 @@ -package fr.insee.rmes.queries.classifications; - -import fr.insee.rmes.config.Configuration; +package fr.insee.rmes.oldqueries.classifications; public class Naf2008Queries { @@ -14,7 +12,7 @@ public static String getClasseNAF2008(String code) { + code + "' . \n" + "<" - + Configuration.getBaseHost() + //+ Configuration.getBaseHost() + "/codes/nafr2/classes> skos:member ?uri . \n" + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" @@ -27,7 +25,7 @@ public static String getSousClasseNAF2008(String code) { + code + "' . \n" + "<" - + Configuration.getBaseHost() + //+ Configuration.getBaseHost() + "/codes/nafr2/sousClasses> skos:member ?uri . \n" + "?uri skos:prefLabel ?intitule \n" + "FILTER (lang(?intitule) = 'fr') \n" diff --git a/src/main/java/fr/insee/rmes/queries/concepts/ConceptsQueries.java b/impl/src/main/java/fr/insee/rmes/oldqueries/concepts/ConceptsQueries.java similarity index 50% rename from src/main/java/fr/insee/rmes/queries/concepts/ConceptsQueries.java rename to impl/src/main/java/fr/insee/rmes/oldqueries/concepts/ConceptsQueries.java index 138a8200..099928a3 100644 --- a/src/main/java/fr/insee/rmes/queries/concepts/ConceptsQueries.java +++ b/impl/src/main/java/fr/insee/rmes/oldqueries/concepts/ConceptsQueries.java @@ -1,13 +1,6 @@ -package fr.insee.rmes.queries.concepts; +package fr.insee.rmes.oldqueries.concepts; -import java.util.HashMap; -import java.util.Map; - -import org.apache.commons.lang3.StringUtils; - -import fr.insee.rmes.queries.Queries; - -public class ConceptsQueries extends Queries { +public class ConceptsQueries { private static final String QUERIES_FOLDER = "concepts/"; @@ -21,24 +14,14 @@ public static String getConceptsByLabel(String label) { + "?uri skos:prefLabel ?intitule . \n" + "FILTER(lang(?intitule) = 'fr') \n" + "FILTER(CONTAINS(LCASE(STR(?intitule)),\"" - + (StringUtils.isEmpty(label) ? "" : label.toLowerCase()) + // + (StringUtils.isEmpty(label) ? "" : label.toLowerCase()) + "\")) \n" + "BIND(EXISTS{?uri dcterms:replaces|^dcterms:replaces ?repl } AS ?hasLink) \n" + "}" + "ORDER BY ?intitule"; } - public static String getConceptById(String id) { - Map params = new HashMap<>(); - params.put("conceptId", id); - return buildRequest(QUERIES_FOLDER, "getConceptByCode.ftlh", params); - } - public static String getConceptLinks(String id) { - Map params = new HashMap<>(); - params.put("uriConcept", "http://id.insee.fr/concepts/definition/"+id); - return buildRequest(QUERIES_FOLDER, "getLinkedConceptsQuery.ftlh", params); - } } diff --git a/impl/src/main/resources/application.properties b/impl/src/main/resources/application.properties new file mode 100644 index 00000000..f2f21cf3 --- /dev/null +++ b/impl/src/main/resources/application.properties @@ -0,0 +1,2 @@ +fr.insee.rmes.metadata.api.sparqlEndpoint=http://localhost:7200/repositories/data +fr.insee.rmes.metadata.api.freemarker.locale-language=fr \ No newline at end of file diff --git a/src/main/resources/request/concepts/getConceptByCode.ftlh b/impl/src/main/resources/request/concepts/getConceptByCode.ftlh similarity index 100% rename from src/main/resources/request/concepts/getConceptByCode.ftlh rename to impl/src/main/resources/request/concepts/getConceptByCode.ftlh diff --git a/src/main/resources/request/concepts/getLinkedConceptsQuery.ftlh b/impl/src/main/resources/request/concepts/getLinkedConceptsQuery.ftlh similarity index 100% rename from src/main/resources/request/concepts/getLinkedConceptsQuery.ftlh rename to impl/src/main/resources/request/concepts/getLinkedConceptsQuery.ftlh diff --git a/src/main/resources/request/geographie/getAllProjectionByTypeDate.ftlh b/impl/src/main/resources/request/geographie/getAllProjectionByTypeDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getAllProjectionByTypeDate.ftlh rename to impl/src/main/resources/request/geographie/getAllProjectionByTypeDate.ftlh diff --git a/src/main/resources/request/geographie/getAscendantsIrisByCodeTypeDate.ftlh b/impl/src/main/resources/request/geographie/getAscendantsIrisByCodeTypeDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getAscendantsIrisByCodeTypeDate.ftlh rename to impl/src/main/resources/request/geographie/getAscendantsIrisByCodeTypeDate.ftlh diff --git a/src/main/resources/request/geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh b/impl/src/main/resources/request/geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh similarity index 62% rename from src/main/resources/request/geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh rename to impl/src/main/resources/request/geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh index 959b32e3..7903b3f5 100644 --- a/src/main/resources/request/geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh +++ b/impl/src/main/resources/request/geographie/getAscendantsOrDescendantsByCodeTypeDate.ftlh @@ -1,4 +1,4 @@ -SELECT DISTINCT ?uri ?code ?type ?typeArticle ?intitule ?intituleSansArticle ?dateCreation ?dateSuppression ?chefLieu ?typeDIris +SELECT DISTINCT ?uri ?code (STRAFTER(STR(?typeAvecIri), "#") AS ?type) ?typeArticle ?intitule ?intituleSansArticle ?dateCreation ?dateSuppression ?chefLieu ?typeDIris FROM WHERE { ?origine a igeo:${typeOrigine} ; @@ -11,7 +11,7 @@ FROM ?uri igeo:codeINSEE ?code ; - a ?type ; + a ?typeAvecIri ; igeo:codeArticle ?typeArticle ; igeo:nom ?intitule ; igeo:nomSansArticle ?intituleSansArticle . @@ -19,8 +19,85 @@ FROM ?uri igeo:typeDIRIS ?uriTypeDIris ; BIND(SUBSTR(STR(?uriTypeDIris ), STRLEN(STR(?uriTypeDIris )), 1) AS ?typeDIris) } -<#if type != "none"> - ?uri a igeo:${type} . + +<#if typeEnumDescendantsAireDAttractionDesVilles != "none"> + ?uri a igeo:${typeEnumDescendantsAireDAttractionDesVilles} . + + +<#if typeEnumDescendantsArrondissement != "none"> + ?uri a igeo:${typeEnumDescendantsArrondissement} . + + +<#if typeEnumAscendantsArrondissement != "none"> + ?uri a igeo:${typeEnumAscendantsArrondissement} . + + +<#if typeEnumAscendantsArrondissementMunicipal != "none"> + ?uri a igeo:${typeEnumAscendantsArrondissementMunicipal} . + + +<#if typeEnumDescendantsBassinDeVie != "none"> + ?uri a igeo:${typeEnumDescendantsBassinDeVie} . + + +<#if typeEnumAscendantsCanton != "none"> + ?uri a igeo:${typeEnumAscendantsCanton} . + + +<#if typeEnumAscendantsCantonOuVille != "none"> + ?uri a igeo:${typeEnumAscendantsCantonOuVille} . + + +<#if typeEnumDescendantsCantonOuVille != "none"> + ?uri a igeo:${typeEnumDescendantsCantonOuVille} . + + +<#if typeEnumAscendantsCirconscriptionTerritoriale != "none"> + ?uri a igeo:${typeEnumAscendantsCirconscriptionTerritoriale} . + + +<#if typeEnumAscendantsCommune != "none"> + ?uri a igeo:${typeEnumAscendantsCommune} . + + +<#if typeEnumDescendantsCommune != "none"> + ?uri a igeo:${typeEnumDescendantsCommune} . + + +<#if typeEnumAscendantsCommuneAssociee != "none"> + ?uri a igeo:${typeEnumAscendantsCommuneAssociee} . + + +<#if typeEnumAscendantsCommuneDeleguee != "none"> + ?uri a igeo:${typeEnumAscendantsCommuneDeleguee} . + + +<#if typeEnumAscendantsDepartement != "none"> + ?uri a igeo:${typeEnumAscendantsDepartement} . + + +<#if typeEnumDescendantsDepartement != "none"> + ?uri a igeo:${typeEnumDescendantsDepartement} . + + +<#if typeEnumAscendantsDistrict != "none"> + ?uri a igeo:${typeEnumAscendantsDistrict} . + + +<#if typeEnumDescendantsIntercommunalite != "none"> + ?uri a igeo:${typeEnumDescendantsIntercommunalite} . + + +<#if typeEnumDescendantsRegion != "none"> + ?uri a igeo:${typeEnumDescendantsRegion} . + + +<#if typeEnumDescendantsUniteUrbaine != "none"> + ?uri a igeo:${typeEnumDescendantsUniteUrbaine} . + + +<#if typeEnumDescendantsZoneDEmploi != "none"> + ?uri a igeo:${typeEnumDescendantsZoneDEmploi} . OPTIONAL { @@ -52,12 +129,12 @@ FROM igeo:date ?dateSuppressionOrigine. } - OPTIONAL { + FILTER(!BOUND(?dateCreationOrigine) || ?dateCreationOrigine <= '${date}'^^xsd:date) - } - OPTIONAL { + + FILTER(!BOUND(?dateSuppressionOrigine) || ?dateSuppressionOrigine > '${date}'^^xsd:date) - } + OPTIONAL { ?evenementCreation igeo:creation ?uri ; igeo:date ?dateCreation . @@ -70,7 +147,7 @@ FROM <#if filtreNom !='*'> - BIND("${filtreNom ?no_esc}" AS ?query). + BIND("${filtreNom}" AS ?query). # Formattage du nom avec article pour comparaison non polluée par majuscules et accents BIND (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?intitule), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "[-_\']", " "), "[^a-z0-9() ]", ""), "[ ]{2,}", " ") AS ?formattedNom) . # Formattage du nom sans article pour comparaison non polluée par majuscules et accents diff --git a/src/main/resources/request/geographie/getCommunesByCodeDate.ftlh b/impl/src/main/resources/request/geographie/getCommunesByCodeDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getCommunesByCodeDate.ftlh rename to impl/src/main/resources/request/geographie/getCommunesByCodeDate.ftlh diff --git a/impl/src/main/resources/request/geographie/getCommunesCantonsByCodeDate.ftlh b/impl/src/main/resources/request/geographie/getCommunesCantonsByCodeDate.ftlh new file mode 100644 index 00000000..6e9e1545 --- /dev/null +++ b/impl/src/main/resources/request/geographie/getCommunesCantonsByCodeDate.ftlh @@ -0,0 +1,28 @@ +SELECT ?uri ?type ?code ?typeArticle ?intitule ?intituleSansArticle ?dateCreation ?dateSuppression ?chefLieu +WHERE { +?commune a igeo:Commune ; +igeo:codeINSEE '${code}' . +?ressource a igeo:Canton; +a ?typeRDF; +^igeo:subdivisionDirecteDe|^igeo:territoireCommunAvec ?commune ; +igeo:codeINSEE ?code; +igeo:codeArticle ?typeArticle ; +igeo:nom ?intitule ; +igeo:nomSansArticle ?intituleSansArticle . +BIND(STRAFTER(STR(?typeRDF),"http://rdf.insee.fr/def/geo#") AS ?type). +BIND(STR(?ressource) AS ?uri). +OPTIONAL {?commune (^igeo:creation/igeo:date) ?dateCreationCommune. } +OPTIONAL {?commune (^igeo:suppression/igeo:date) ?dateSuppressionCommune. } +OPTIONAL {?ressource (^igeo:creation/igeo:date) ?dateCreation. } +OPTIONAL {?ressource (^igeo:suppression/igeo:date) ?dateSuppression. } +OPTIONAL {?ressource igeo:bureauCentralisateur ?chefLieuRDF. ?chefLieuRDF igeo:codeINSEE ?chefLieu.} +OPTIONAL {?chefLieuRDF ^igeo:creation/igeo:date ?dateCreationChefLieu.} +OPTIONAL {?chefLieuRDF ^igeo:suppression/igeo:date ?dateSuppressionChefLieu.} +FILTER(!BOUND(?dateCreationCommune) || (?dateCreationCommune) <= '${date}'^^xsd:date) +FILTER(!BOUND(?dateSuppressionCommune) || xsd:dateTime(?dateSuppressionCommune) > '${date}'^^xsd:date) +FILTER(!BOUND(?dateCreation) || xsd:dateTime(?dateCreation) <= '${date}'^^xsd:date) +FILTER(!BOUND(?dateSuppression) || xsd:dateTime(?dateSuppression) > '${date}'^^xsd:date) +FILTER(!BOUND(?dateCreationChefLieu) || xsd:dateTime(?dateCreationChefLieu) <= '${date}'^^xsd:date) +FILTER(!BOUND(?dateSuppressionChefLieu) || (?dateSuppressionChefLieu) > '${date}'^^xsd:date) +} +ORDER BY ?code \ No newline at end of file diff --git a/src/main/resources/request/geographie/getIrisByCodeDate.ftlh b/impl/src/main/resources/request/geographie/getIrisByCodeDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getIrisByCodeDate.ftlh rename to impl/src/main/resources/request/geographie/getIrisByCodeDate.ftlh diff --git a/src/main/resources/request/geographie/getIrisList.ftlh b/impl/src/main/resources/request/geographie/getIrisList.ftlh similarity index 100% rename from src/main/resources/request/geographie/getIrisList.ftlh rename to impl/src/main/resources/request/geographie/getIrisList.ftlh diff --git a/impl/src/main/resources/request/geographie/getPays.ftlh b/impl/src/main/resources/request/geographie/getPays.ftlh new file mode 100644 index 00000000..0274213f --- /dev/null +++ b/impl/src/main/resources/request/geographie/getPays.ftlh @@ -0,0 +1,29 @@ +SELECT DISTINCT ?uri ?type ?code ?intitule ?intituleComplet ?iso3166alpha2 ?iso3166alpha3 ?iso3166num ?dateCreation ?dateSuppression +FROM +WHERE { +?s a igeo:Pays . +<#if code != "none"> + ?s igeo:codeINSEE '${code}' . + BIND('${code}' as ?code) + ?s a ?typeRDF ; +<#else> + ?s igeo:codeINSEE ?code ; + a ?typeRDF ; + +igeo:nom ?intitule . +OPTIONAL {?s igeo:nomLong ?intituleComplet .} +OPTIONAL {?s igeo:codeIso3166alpha2 ?iso3166alpha2 .} +OPTIONAL {?s igeo:codeIso3166alpha3 ?iso3166alpha3 .} +OPTIONAL {?s igeo:codeIso3166num ?iso3166num .} +BIND(STRAFTER(STR(?typeRDF),"#") AS ?type). +BIND(STR(?s) AS ?uri). +OPTIONAL {?s ^igeo:creation/igeo:date ?dateCreation } +OPTIONAL {?s ^igeo:suppression/igeo:date ?dateSuppression } + +<#if date != "*"> + FILTER(!BOUND(?dateCreation) || ?dateCreation <= '${date}'^^xsd:date) + FILTER(!BOUND(?dateSuppression) || ?dateSuppression > '${date}'^^xsd:date) + +} + +ORDER BY ?code \ No newline at end of file diff --git a/impl/src/main/resources/request/geographie/getPaysDescendants.ftlh b/impl/src/main/resources/request/geographie/getPaysDescendants.ftlh new file mode 100644 index 00000000..27df3c5e --- /dev/null +++ b/impl/src/main/resources/request/geographie/getPaysDescendants.ftlh @@ -0,0 +1,32 @@ +SELECT ?uri ?type ?code ?intitule ?intituleComplet ?dateCreation ?dateSuppression +FROM +WHERE { +{ +SELECT DISTINCT ?uri (STRAFTER(STR(?typeAvecIri), "#") AS ?type) ?code ?intitule ?intituleComplet ?dateCreation ?dateSuppression ?dateCreationParent ?dateSuppressionParent +WHERE { +?parent a igeo:Pays ; +igeo:codeINSEE '${code}' ; + +(^igeo:subdivisionDirecteDe)+ ?ressource . + +<#if typeEnumDescendantsPays != "none"> + ?ressource a ?typeRDF . + ?ressource a igeo:${type} ; +<#else> + ?ressource a ?typeRDF ; + +igeo:codeINSEE ?code ; +igeo:nom ?intitule ; +OPTIONAL {?ressource igeo:nomLong ?intituleComplet .} +BIND(STR(?typeRDF) AS ?typeAvecIri). +BIND(STR(?ressource) AS ?uri). +OPTIONAL {?parent (^igeo:creation/igeo:date) ?dateCreationParent.} +OPTIONAL {?parent (^igeo:suppression/igeo:date) ?dateSuppressionParent.} +OPTIONAL {?ressource (^igeo:creation/igeo:date) ?dateCreation.} +OPTIONAL {?ressource (^igeo:suppression/igeo:date) ?dateSuppression.} +} +} +FILTER(!BOUND(?dateCreation) || ?dateCreation <= '${date}'^^xsd:date) +FILTER(!BOUND(?dateSuppression) || ?dateSuppression > '${date}'^^xsd:date) +} +ORDER BY ?type ?code \ No newline at end of file diff --git a/src/main/resources/request/geographie/getPreviousOrNextByCodeTypeDate.ftlh b/impl/src/main/resources/request/geographie/getPreviousOrNextByCodeTypeDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getPreviousOrNextByCodeTypeDate.ftlh rename to impl/src/main/resources/request/geographie/getPreviousOrNextByCodeTypeDate.ftlh diff --git a/src/main/resources/request/geographie/getProjectionByCodeTypeDate.ftlh b/impl/src/main/resources/request/geographie/getProjectionByCodeTypeDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getProjectionByCodeTypeDate.ftlh rename to impl/src/main/resources/request/geographie/getProjectionByCodeTypeDate.ftlh diff --git a/src/main/resources/request/geographie/getTerritoireByCodeAndDate.ftlh b/impl/src/main/resources/request/geographie/getTerritoireByCodeAndDate.ftlh similarity index 100% rename from src/main/resources/request/geographie/getTerritoireByCodeAndDate.ftlh rename to impl/src/main/resources/request/geographie/getTerritoireByCodeAndDate.ftlh diff --git a/impl/src/main/resources/request/geographie/getTerritoireByCodeDateNomcommune.ftlh b/impl/src/main/resources/request/geographie/getTerritoireByCodeDateNomcommune.ftlh new file mode 100644 index 00000000..8ab5cd59 --- /dev/null +++ b/impl/src/main/resources/request/geographie/getTerritoireByCodeDateNomcommune.ftlh @@ -0,0 +1,87 @@ +<#ftl output_format="plainText"> +SELECT DISTINCT ?uri (STRAFTER(STR(?typeAvecIri), "#") AS ?type) ?code ?typeArticle ?intitule ?intituleSansArticle ?dateCreation ?dateSuppression ?chefLieu ?intitule ?categorieJuridique ?intituleComplet +FROM +FROM +WHERE { + + ?uri a igeo:${typeOrigine} ; + a ?typeAvecIri ; + igeo:codeArticle ?typeArticle ; + igeo:nom ?intitule ; + igeo:nomSansArticle ?intituleSansArticle ; + + +<#if com != "true"> + (igeo:subdivisionDirecteDe/a) ?parent; + + + +<#if typeOrigine == "Intercommunalite"> + + + OPTIONAL { + ?uri a igeo:${typeOrigine} ; + igeo:nomIntercommunalite ?intituleComplet . + } + + OPTIONAL { + ?uri a igeo:${typeOrigine} ; + insee:categorieJuridique ?cj. + ?cj skos:prefLabel ?categorieJuridique. + } + +<#if code != "none"> + ?uri igeo:codeINSEE '${code}' . + BIND('${code}' as ?code) +<#else> + ?uri igeo:codeINSEE ?code . + + OPTIONAL { + ?evenementCreation igeo:creation ?uri ; + igeo:date ?dateCreation . +} + + OPTIONAL { + ?evenementSuppression igeo:suppression ?uri ; + igeo:date ?dateSuppression. + } + +<#if chefLieu != "none"> + OPTIONAL { + ?uri igeo:${chefLieu} ?chefLieuRDF . + ?chefLieuRDF igeo:codeINSEE ?chefLieu. + OPTIONAL { + ?evenementCreationChefLieu igeo:creation ?chefLieuRDF ; + igeo:date ?dateCreationChefLieu . + } + OPTIONAL { + ?evenementSuppressionChefLieu igeo:suppression ?chefLieuRDF ; + igeo:date ?dateSuppressionChefLieu. + } + + <#if date != "*"> + FILTER(!BOUND(?dateCreationChefLieu) || ?dateCreationChefLieu <= '${date}'^^xsd:date) + FILTER(!BOUND(?dateSuppressionChefLieu) || ?dateSuppressionChefLieu > '${date}'^^xsd:date) + + + } + +<#if filtreNom != "*"> + BIND("${filtreNom}" AS ?query). + BIND (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?intitule), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "[-_\']", " "), "[^a-z0-9() ]", ""), "[ ]{2,}", " ") AS ?formattedNom) . + BIND (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?intituleSansArticle), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "[-_']", " "), "[^a-z0-9() ]", ""), "[ ]{2,}", " ") AS ?formattedNomSansArticle) . + BIND (CONCAT("^", REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?query), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "([^/]+)[/]", "$1-sur-"),"([^\\\\]+)[\\\\]", "$1-sous-"), "[-_']", " "),"[^a-z0-9() ]", ""), "[ ]{2,}", " "), "^st(e)? ", "saint$1 "), "") AS ?formattedQuery) . + FILTER (REGEX(?formattedNom, ?formattedQuery) || REGEX(?formattedNomSansArticle, ?formattedQuery)) + +<#if com != "true"> + FILTER(REGEX(STR(?parent), "(Departement|Arrondissement)$")) + +<#if date != "*"> + FILTER(!BOUND(?dateCreation) || ?dateCreation <= '${date}'^^xsd:date) + FILTER(!BOUND(?dateSuppression) || ?dateSuppression > '${date}'^^xsd:date) + + + +} +ORDER BY ?code + \ No newline at end of file diff --git a/impl/src/main/resources/request/geographie/hasIrisDescendant.ftlh b/impl/src/main/resources/request/geographie/hasIrisDescendant.ftlh new file mode 100644 index 00000000..449c200e --- /dev/null +++ b/impl/src/main/resources/request/geographie/hasIrisDescendant.ftlh @@ -0,0 +1,16 @@ +SELECT DISTINCT ?type +FROM +WHERE { + { + ?origine a igeo:Commune ; + igeo:codeINSEE '${code}' . + } + UNION + { + ?origine a igeo:ArrondissementMunicipal ; + igeo:codeINSEE '${code}' . + } + ?uri igeo:subdivisionDirecteDe+ ?origine . + ?uri a ?type . +} +ORDER BY ?type \ No newline at end of file diff --git a/src/main/resources/request/operations/getCreatorsByObjectQuery.ftlh b/impl/src/main/resources/request/operations/getCreatorsByObjectQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getCreatorsByObjectQuery.ftlh rename to impl/src/main/resources/request/operations/getCreatorsByObjectQuery.ftlh diff --git a/src/main/resources/request/operations/getDocumentationRubricsByIdSimsQuery.ftlh b/impl/src/main/resources/request/operations/getDocumentationRubricsByIdSimsQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getDocumentationRubricsByIdSimsQuery.ftlh rename to impl/src/main/resources/request/operations/getDocumentationRubricsByIdSimsQuery.ftlh diff --git a/src/main/resources/request/operations/getDocumentationTitleByIdSimsQuery.ftlh b/impl/src/main/resources/request/operations/getDocumentationTitleByIdSimsQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getDocumentationTitleByIdSimsQuery.ftlh rename to impl/src/main/resources/request/operations/getDocumentationTitleByIdSimsQuery.ftlh diff --git a/src/main/resources/request/operations/getDocumentsQueryByIdSimsIdRubric.ftlh b/impl/src/main/resources/request/operations/getDocumentsQueryByIdSimsIdRubric.ftlh similarity index 100% rename from src/main/resources/request/operations/getDocumentsQueryByIdSimsIdRubric.ftlh rename to impl/src/main/resources/request/operations/getDocumentsQueryByIdSimsIdRubric.ftlh diff --git a/src/main/resources/request/operations/getIndicBySeriesQuery.ftlh b/impl/src/main/resources/request/operations/getIndicBySeriesQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getIndicBySeriesQuery.ftlh rename to impl/src/main/resources/request/operations/getIndicBySeriesQuery.ftlh diff --git a/src/main/resources/request/operations/getIndicatorByIdQuery.ftlh b/impl/src/main/resources/request/operations/getIndicatorByIdQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getIndicatorByIdQuery.ftlh rename to impl/src/main/resources/request/operations/getIndicatorByIdQuery.ftlh diff --git a/src/main/resources/request/operations/getLinkDifferentTypeByObjectQuery.ftlh b/impl/src/main/resources/request/operations/getLinkDifferentTypeByObjectQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getLinkDifferentTypeByObjectQuery.ftlh rename to impl/src/main/resources/request/operations/getLinkDifferentTypeByObjectQuery.ftlh diff --git a/src/main/resources/request/operations/getLinkSameTypeByObjectQuery.ftlh b/impl/src/main/resources/request/operations/getLinkSameTypeByObjectQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getLinkSameTypeByObjectQuery.ftlh rename to impl/src/main/resources/request/operations/getLinkSameTypeByObjectQuery.ftlh diff --git a/src/main/resources/request/operations/getListFamilies.ftlh b/impl/src/main/resources/request/operations/getListFamilies.ftlh similarity index 100% rename from src/main/resources/request/operations/getListFamilies.ftlh rename to impl/src/main/resources/request/operations/getListFamilies.ftlh diff --git a/src/main/resources/request/operations/getListIndicators.ftlh b/impl/src/main/resources/request/operations/getListIndicators.ftlh similarity index 100% rename from src/main/resources/request/operations/getListIndicators.ftlh rename to impl/src/main/resources/request/operations/getListIndicators.ftlh diff --git a/src/main/resources/request/operations/getListOperations.ftlh b/impl/src/main/resources/request/operations/getListOperations.ftlh similarity index 100% rename from src/main/resources/request/operations/getListOperations.ftlh rename to impl/src/main/resources/request/operations/getListOperations.ftlh diff --git a/src/main/resources/request/operations/getListSeries.ftlh b/impl/src/main/resources/request/operations/getListSeries.ftlh similarity index 100% rename from src/main/resources/request/operations/getListSeries.ftlh rename to impl/src/main/resources/request/operations/getListSeries.ftlh diff --git a/src/main/resources/request/operations/getOperationBySeriesQuery.ftlh b/impl/src/main/resources/request/operations/getOperationBySeriesQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getOperationBySeriesQuery.ftlh rename to impl/src/main/resources/request/operations/getOperationBySeriesQuery.ftlh diff --git a/src/main/resources/request/operations/getOrganismByObjectQuery.ftlh b/impl/src/main/resources/request/operations/getOrganismByObjectQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getOrganismByObjectQuery.ftlh rename to impl/src/main/resources/request/operations/getOrganismByObjectQuery.ftlh diff --git a/src/main/resources/request/operations/getSeriesByIdQuery.ftlh b/impl/src/main/resources/request/operations/getSeriesByIdQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getSeriesByIdQuery.ftlh rename to impl/src/main/resources/request/operations/getSeriesByIdQuery.ftlh diff --git a/src/main/resources/request/operations/getSeriesByIndicQuery.ftlh b/impl/src/main/resources/request/operations/getSeriesByIndicQuery.ftlh similarity index 100% rename from src/main/resources/request/operations/getSeriesByIndicQuery.ftlh rename to impl/src/main/resources/request/operations/getSeriesByIndicQuery.ftlh diff --git a/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/GeoPaysQueriesTest.java b/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/GeoPaysQueriesTest.java new file mode 100644 index 00000000..16b41aa5 --- /dev/null +++ b/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/GeoPaysQueriesTest.java @@ -0,0 +1,25 @@ +package fr.insee.rmes.metadata.api.testcontainers.queries; + +import fr.insee.rmes.metadata.api.GeoDepartementEndpoints; +import org.junit.Assert; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.time.LocalDate; + +@SpringBootTest +@Tag("integration") +class GeoPaysQueriesTest extends TestcontainerTest{ + + @Autowired + GeoDepartementEndpoints endpoints; + + @Test + void should_return_all_datasets_based_on_stamp() { + var d = endpoints.getcogdep("75", LocalDate.now()); + Assert.assertEquals("Paris", d.getBody().getIntitule()); + } +} + diff --git a/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/GraphDBContainer.java b/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/GraphDBContainer.java new file mode 100644 index 00000000..05498af9 --- /dev/null +++ b/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/GraphDBContainer.java @@ -0,0 +1,66 @@ +package fr.insee.rmes.metadata.api.testcontainers.queries; + +import org.testcontainers.containers.Container; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.utility.MountableFile; +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; + +public class GraphDBContainer extends GenericContainer { + public static final String DOCKER_ENTRYPOINT_INITDB = "/docker-entrypoint-initdb"; + private String folder; + + public GraphDBContainer(final String dockerImageName) { + super(dockerImageName); + withExposedPorts(7200); + } + + @Override + public void start() { + super.start(); + withInitFolder("/testcontainers").withExposedPorts(7200); + + withRepository("config.ttl"); + withTrigFiles("statements.trig"); + } + + public GraphDBContainer withInitFolder(String folder){ + this.folder = folder; + return this; + } + + public GraphDBContainer withRepository(String ttlFile) { + try { + String path = copyFile(ttlFile); + execInContainer("curl", "-X", "POST", "-H", "Content-Type:multipart/form-data", "-F", "config=@" + path, "http://localhost:7200/rest/repositories"); + } catch (IOException | InterruptedException e) { + throw new AssertionError("The TTL file was not loaded"); + } + return this; + } + + public GraphDBContainer withTrigFiles(String file) { + try { + String path = copyFile(file); + execInContainer("curl", "-X", "POST", "-H", "Content-Type: application/x-trig", "--data-binary", "@" + path, "http://localhost:7200/repositories/data/statements"); + } catch (IOException | InterruptedException e) { + throw new AssertionError("The Trig file was not loaded"); + } + return this; + } + + private String copyFile(String file) throws IOException, InterruptedException { + String fullPath = DOCKER_ENTRYPOINT_INITDB + "/" + file; + copyFileToContainer(MountableFile.forClasspathResource(this.folder + "/" + file), fullPath); + assertThatFileExists(file); + return fullPath; + } + + private void assertThatFileExists(String file) throws IOException, InterruptedException { + Container.ExecResult lsResult = execInContainer("ls", "-al", DOCKER_ENTRYPOINT_INITDB); + String stdout = lsResult.getStdout(); + assertThat(stdout).withFailMessage("Expecting file %1$s to be in folder %2$s of container", file, DOCKER_ENTRYPOINT_INITDB).contains(file); + } +} + diff --git a/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/TestcontainerTest.java b/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/TestcontainerTest.java new file mode 100644 index 00000000..eae5d5a8 --- /dev/null +++ b/impl/src/test/java/fr/insee/rmes/metadata/api/testcontainers/queries/TestcontainerTest.java @@ -0,0 +1,31 @@ +package fr.insee.rmes.metadata.api.testcontainers.queries; + +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; + +@Slf4j +public class TestcontainerTest { + static GraphDBContainer container = new GraphDBContainer("ontotext/graphdb:10.8.8").withReuse(true); + + @BeforeAll + static void startContainer(){ + container.start(); + + } + + @AfterAll + static void stopContainer(){ + //container.stop(); + } + + + @DynamicPropertySource + static void overrideSpringProperties(DynamicPropertyRegistry registry) { + String url = "http://" + container.getHost() + ":" + container.getMappedPort(7200)+ "/repositories/data"; + log.info("Graphdb URL: " + url); + registry.add("fr.insee.rmes.metadata.api.sparqlEndpoint", () -> url) ; + } +} diff --git a/impl/src/test/resources/testcontainers/config.ttl b/impl/src/test/resources/testcontainers/config.ttl new file mode 100644 index 00000000..baaf1aef --- /dev/null +++ b/impl/src/test/resources/testcontainers/config.ttl @@ -0,0 +1,36 @@ +@prefix config: . +@prefix rdfs: . +@prefix xsd: . + +<#data> a , config:Repository; + "data"; + [ + "graphdb:SailRepository"; + [ + "http://example.org/owlim#"; + "false"; + ""; + "true"; + "false"; + "false"; + "true"; + "true"; + "32"; + "10000000"; + ("default" "iri"); + "none"; + "default"; + ""; + "true"; + "0"; + "0"; + "false"; + "file-repository"; + "rdfsplus-optimized"; + "storage"; + + "false"; + "graphdb:Sail" + ] + ]; + rdfs:label "" . diff --git a/interface/pom.xml b/interface/pom.xml new file mode 100644 index 00000000..37e5c100 --- /dev/null +++ b/interface/pom.xml @@ -0,0 +1,115 @@ + + 4.0.0 + + + fr.insee.rmes + metadata-api-parent + 3.8.4 + + + metadata-api-interface + jar + + + + fr.insee.rmes + metadata-api-oas + ${project.version} + + + jakarta.platform + jakarta.jakartaee-web-api + provided + + + org.springframework + spring-web + provided + + + org.springframework + spring-context + provided + + + org.openapitools + jackson-databind-nullable + provided + + + org.springframework.boot + spring-boot + provided + + + org.springframework.boot + spring-boot-autoconfigure + provided + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + initialize + + unpack-dependencies + + + ${project.build.directory} + metadata-api-oas + + + + + + org.openapitools + openapi-generator-maven-plugin + ${openapitools-generator.version} + + + + generate + + + ${project.baseUri}/target/openapi.yaml + spring + fr.insee.rmes.metadata.model + fr.insee.rmes.metadata.api + true + true + + DepartementListeDescendants_inner=Territoire_TousAttributs,DepartementListeAscendants_inner=Territoire_TousAttributs,CommunesListe_inner=TerritoireBase,CommuneListeAscendants_inner=Territoire_TousAttributs,DepartementListeProjetesAvecChefLieu_inner=TerritoireBase_ChefLieu + true + false + false + false + + true + spring-boot + none + none + none + true + false + false + true + true + + @com.fasterxml.jackson.annotation.JsonInclude(com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL) + + + + + + + + + + \ No newline at end of file diff --git a/oas/pom.xml b/oas/pom.xml new file mode 100644 index 00000000..ce9612f9 --- /dev/null +++ b/oas/pom.xml @@ -0,0 +1,15 @@ + + 4.0.0 + + + fr.insee.rmes + metadata-api-parent + 3.8.4 + + + + metadata-api-oas + + \ No newline at end of file diff --git a/oas/src/main/resources/openapi.yaml b/oas/src/main/resources/openapi.yaml new file mode 100644 index 00000000..37c2dad5 --- /dev/null +++ b/oas/src/main/resources/openapi.yaml @@ -0,0 +1,4974 @@ +openapi: 3.1.0 +info: + title: API RMéS + description: API sur les métadonnées de l'Insee + version: 3.7.2 +externalDocs: + description: 'This API is open source : the sources can be found there' + url: https://github.com/InseeFr/Metadata-API +servers: + - url: http://localhost:8080/metadata-api +tags: + # - name: nomenclatures + # description: Nomenclatures API + # - name: concepts + # description: Concepts API + # - name: operations + # description: Operations API + - name: geoAireDAttractionDesVilles + description: 'API géographie : aire d''attraction des villes 2020' + - name: geoArrondissement + description: 'API géographie : Arrondissement' + - name: geoArrondissementMunicipal + description: 'API géographie : Arrondissement municipal' + - name: geoBassinDeVie + description: 'API géographie : Bassin de vie 2022' + - name: geoCanton + description: 'API géographie : Canton' + - name: geoCantonEtVille + description: 'API géographie : Canton ou ville' + - name: geoCirconscriptionTerritoriale + description: 'API géographie : CirconscriptionTerritoriale' + - name: geoCollectiviteDOutreMer + description: 'API géographie : Collectivité d''outre-mer' + - name: geoCommune + description: 'API géographie : Commune' + - name: geoCommuneAssociee + description: 'API géographie : Commune associée' + - name: geoCommuneDeleguee + description: 'API géographie : Commune déléguée' + - name: geoDepartement + description: 'API géographie : Département' + - name: geoDistrict + description: 'API géographie : District' + - name: geoIntercommunalite + description: 'API géographie : Intercommunalité' + - name: geoIris + description: 'API géographie : Iris' + - name: geoPays + description: 'API géographie : Pays' + - name: geoRegion + description: 'API géographie : Région' + - name: geoUniteUrbaine + description: 'API géographie : Unité urbaine 2020' + - name: geoZoneDEmploi + description: 'API géographie : Zone d''emploi' + - name: geo + description: 'API géographie : Générique' + +paths: + + /geo/aireDAttractionDesVilles2020/{code}: + get: + tags: + - geoAireDAttractionDesVilles + summary: 'Informations sur une aire d''attraction française identifiée par son code (trois caractères)' + operationId: 'getcogaav' + parameters: + - $ref: '#/components/parameters/codeAireDAttractionDesVillesInPath' + - $ref: '#/components/parameters/dateAireDAttractionDesVillesActive' + responses: + '200': + $ref: '#/components/responses/AireDAttractionDesVilles200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/aireDAttractionDesVilles2020/{code}/descendants: + get: + tags: + - geoAireDAttractionDesVilles + summary: 'Informations concernant les territoires inclus dans l''aire d''attraction' + operationId: 'getcogaavdesc' + parameters: + - $ref: '#/components/parameters/codeAireDAttractionDesVillesInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsAireDAttractionDesVilles' + - $ref: '#/components/parameters/typeTerritoireDescendantAireDAttractionDesVilles' + responses: + '200': + $ref: '#/components/responses/AireDAttractionDesVillesListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/airesDAttractionDesVilles2020: + get: + tags: + - geoAireDAttractionDesVilles + summary: 'Informations sur toutes les aires d''attraction actives à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogaavliste' + parameters: + - $ref: '#/components/parameters/dateAiresDAttractionDesVillesActives' + responses: + '200': + $ref: '#/components/responses/AiresDAttractionDesVillesListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/arrondissement/{code}/ascendants: + get: + tags: + - geoArrondissement + summary: 'Informations concernant les territoires qui contiennent l''arrondissement' + operationId: 'getcogarrasc' + parameters: + - $ref: '#/components/parameters/codeArrondissementInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsArrondissement' + - $ref: '#/components/parameters/typeTerritoireAscendantArrondissement' + responses: + '200': + $ref: '#/components/responses/ArrondissementListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/arrondissement/{code}: + get: + tags: + - geoArrondissement + summary: 'Informations sur un arrondissement identifié par son code (trois ou quatre caractères)' + operationId: 'getcogarr' + parameters: + - $ref: '#/components/parameters/codeArrondissementInPath' + - $ref: '#/components/parameters/dateArrondissementActif' + responses: + '200': + $ref: '#/components/responses/Arrondissement200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/arrondissement/{code}/descendants: + get: + tags: + - geoArrondissement + summary: 'Informations concernant les territoires inclus dans l''arrondissement' + operationId: 'getcogarrdes' + parameters: + - $ref: '#/components/parameters/codeArrondissementInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsArrondissement' + - $ref: '#/components/parameters/typeTerritoireDescendantArrondissement' + responses: + '200': + $ref: '#/components/responses/ArrondissementListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/arrondissements: + get: + tags: + - geoArrondissement + summary: 'Informations sur tous les arrondissements atifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogarrliste' + parameters: + - $ref: '#/components/parameters/dateArrondissementsActifs' + responses: + '200': + $ref: '#/components/responses/ArrondissementsListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/arrondissementMunicipal/{code}/ascendants: + get: + tags: + - geoArrondissementMunicipal + summary: 'Informations concernant les territoires qui contiennent l''arrondissement municipal' + operationId: 'getcogarrmuasc' + parameters: + - $ref: '#/components/parameters/codeArrondissementMunicipalInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsArrondissementMunicipal' + - $ref: '#/components/parameters/typeTerritoireAscendantArrondissementMunicipal' + responses: + '200': + $ref: '#/components/responses/ArrondissementMunicipalListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/arrondissementMunicipal/{code}: + get: + tags: + - geoArrondissementMunicipal + summary: 'Informations sur un arrondissement municipal identifié par son code (cinq caractères)' + operationId: 'getcogarrmu' + parameters: + - $ref: '#/components/parameters/codeArrondissementMunicipalInPath' + - $ref: '#/components/parameters/dateArrondissementMunicipalActif' + responses: + '200': + $ref: '#/components/responses/ArrondissementMunicipal200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/arrondissementsMunicipaux: + get: + tags: + - geoArrondissementMunicipal + summary: 'Informations sur tous les arrondissements municipaux actifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogarrmuliste' + parameters: + - $ref: '#/components/parameters/dateArrondissementsMunicipauxActifs' + responses: + '200': + $ref: '#/components/responses/ArrondissementsMunicipauxListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + + /geo/bassinDeVie2022/{code}: + get: + tags: + - geoBassinDeVie + summary: 'Informations sur un bassin de vie identifié par son code (neuf caractères)' + operationId: 'getcogbass' + parameters: + - $ref: '#/components/parameters/codeBassinDeVieInPath' + - $ref: '#/components/parameters/dateBassinDeVieActif' + responses: + '200': + $ref: '#/components/responses/BassinDeVie200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/bassinDeVie2022/{code}/descendants: + get: + tags: + - geoBassinDeVie + summary: 'Informations concernant les territoires inclus dans le bassin de vie' + operationId: 'getcogbassdes' + parameters: + - $ref: '#/components/parameters/codeBassinDeVieInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsBassinDeVie' + - $ref: '#/components/parameters/typeTerritoireDescendantBassinDeVie' + responses: + '200': + $ref: '#/components/responses/BassinDeVieListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/bassinsDeVie2022: + get: + tags: + - geoBassinDeVie + summary: 'Informations sur tous les bassins de vie actifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogbassliste' + parameters: + - $ref: '#/components/parameters/dateBassinsDeVieActifs' + - $ref: '#/components/parameters/filtreNomBassinDeVie' + responses: + '200': + $ref: '#/components/responses/BassinsDeVieListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/canton/{code}/ascendants: + get: + tags: + - geoCanton + summary: 'Informations concernant les territoires qui contiennent le canton' + operationId: 'getcogcanasc' + parameters: + - $ref: '#/components/parameters/codeCantonInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsCanton' + - $ref: '#/components/parameters/typeTerritoireAscendantCanton' + responses: + '200': + $ref: '#/components/responses/CantonListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/canton/{code}: + get: + tags: + - geoCanton + summary: 'Informations sur un canton identifié par son code (quatre chiffres pour la Métropole ou cinq chiffres pour les DOM ou 2A/2B plus 2 chiffres pour la Corse)' + operationId: 'getcogcan' + parameters: + - $ref: '#/components/parameters/codeCantonInPath' + - $ref: '#/components/parameters/dateCantonActif' + responses: + '200': + $ref: '#/components/responses/Canton200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/cantons: + get: + tags: + - geoCanton + summary: 'Informations sur tous les cantons actifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogcanliste' + parameters: + - $ref: '#/components/parameters/dateCantonsActifs' + responses: + '200': + $ref: '#/components/responses/CantonsListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/cantonOuVille/{code}/ascendants: + get: + tags: + - geoCantonEtVille + summary: 'Informations concernant les territoires qui contiennent le canton-ou-ville' + operationId: 'getcogcanvilasc' + parameters: + - $ref: '#/components/parameters/codeCantonOuVilleInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsCantonOuVille' + - $ref: '#/components/parameters/typeTerritoireAscendantCantonOuVille' + responses: + '200': + $ref: '#/components/responses/CantonOuVilleListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/cantonOuVille/{code}: + get: + tags: + - geoCantonEtVille + summary: 'Informations sur un canton-ou-ville identifié par son code (quatre chiffres pour la Métropole ou cinq pour les DOM)' + operationId: 'getcogcanvil' + parameters: + - $ref: '#/components/parameters/codeCantonOuVilleInPath' + - $ref: '#/components/parameters/dateCantonOuVilleActif' + responses: + '200': + $ref: '#/components/responses/CantonOuVille200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/cantonOuVille/{code}/descendants: + get: + tags: + - geoCantonEtVille + summary: 'Informations concernant les territoires inclus dans le canton-ou-ville' + operationId: 'getcogcanvildes' + parameters: + - $ref: '#/components/parameters/codeCantonOuVilleInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsCantonOuVille' + - $ref: '#/components/parameters/typeTerritoireDescendantCantonOuVille' + - $ref: '#/components/parameters/filtreNomDescendant' + responses: + '200': + $ref: '#/components/responses/CantonOuVilleListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/cantonsEtVilles: + get: + tags: + - geoCantonEtVille + summary: 'Informations sur tous les cantons et villes actifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogcanvilliste' + parameters: + - $ref: '#/components/parameters/dateCantonsEtVillesActifs' + responses: + '200': + $ref: '#/components/responses/CantonsEtVilles200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/circonscriptionTerritoriale/{code}/ascendants: + get: + tags: + - geoCirconscriptionTerritoriale + summary: 'Informations concernant les territoires qui contiennent la circonscription territoriale' + operationId: 'getcogcirasc' + parameters: + - $ref: '#/components/parameters/codeCirconscriptionTerritorialeInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsCirconscriptionTerritoriale' + - $ref: '#/components/parameters/typeTerritoireAscendantCirconscriptionTerritoriale' + responses: + '200': + $ref: '#/components/responses/CirconscriptionTerritorialeListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/circonscriptionTerritoriale/{code}: + get: + tags: + - geoCirconscriptionTerritoriale + summary: 'Informations sur une circonscription territoriale identifiée par son code (cinq caractères)' + operationId: 'getcogcir' + parameters: + - $ref: '#/components/parameters/codeCirconscriptionTerritorialeInPath' + - $ref: '#/components/parameters/dateCirconscriptionTerritorialeActive' + responses: + '200': + $ref: '#/components/responses/CirconscriptionTerritoriale200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/collectiviteDOutreMer/{code}: + get: + tags: + - geoCollectiviteDOutreMer + summary: 'Informations sur une collectivité d''outre-mer identifiée par son code (trois caractères)' + operationId: 'getcogcoll' + parameters: + - $ref: '#/components/parameters/codeCollectiviteDOutreMerInPath' + - $ref: '#/components/parameters/dateCollectiviteDOutreMerActive' + responses: + '200': + $ref: '#/components/responses/CollectiviteDOutreMer200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/collectivitesDOutreMer: + get: + tags: + - geoCollectiviteDOutreMer + summary: 'Informations sur toutes les collectivités d''outre-mer actives à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogcollliste' + parameters: + - $ref: '#/components/parameters/dateCollectivitesDOutreMerActives' + responses: + '200': + $ref: '#/components/responses/CollectivitesDOutreMerListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/commune/{code}/ascendants: + get: + tags: + - geoCommune + summary: 'Informations concernant les territoires qui contiennent la commune' + operationId: 'getcogcomasc' + parameters: + - $ref: '#/components/parameters/codeCommuneInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsCommune' + - $ref: '#/components/parameters/typeTerritoireAscendantCommune' + responses: + '200': + $ref: '#/components/responses/CommuneListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + # utiliser responses.200.links.getcogcom.operationID : getcogcom + /geo/commune/{code}: + get: + tags: + - geoCommune + summary: 'Informations sur une commune française identifiée par son code (cinq caractères)' + operationId: getcogcom + parameters: + - $ref: '#/components/parameters/codeCommuneInPath' + - $ref: '#/components/parameters/dateActive' + responses: + '200': + $ref: '#/components/responses/Commune200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/commune/{code}/descendants: + get: + tags: + - geoCommune + summary: 'Informations concernant les territoires inclus dans la commune' + operationId: 'getcogcomdesc' + parameters: + - $ref: '#/components/parameters/codeCommuneInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsCommune' + - $ref: '#/components/parameters/typeTerritoireDescendantCommune' + responses: + '200': + $ref: '#/components/responses/CommuneListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/communes: + get: + tags: + - geoCommune + summary: Informations sur toutes les communes actives à la date donnée. Par défaut, c'est la date courante. + operationId: 'getcogcomliste' + parameters: + - $ref: '#/components/parameters/dateCommunesActives' + - $ref: '#/components/parameters/filtreNomCommune' + - $ref: '#/components/parameters/com' + responses: + '200': + $ref: '#/components/responses/CommunesListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/commune/{code}/precedents: + get: + tags: + - geoCommune + summary: 'Informations concernant les departements qui précèdent la commune' + operationId: 'getcogcomprec' + parameters: + - $ref: '#/components/parameters/codeCommuneInPath' + - $ref: '#/components/parameters/dateCommuneDepart' + responses: + '200': + $ref: '#/components/responses/CommuneListePrecedents200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/commune/{code}/projetes: + get: + tags: + - geoCommune + summary: 'Informations concernant les communes qui résultent de la projection de la commune à la date passée en paramètre.' + operationId: 'getcogcomproj' + parameters: + - $ref: '#/components/parameters/codeCommuneInPath' + - $ref: '#/components/parameters/dateCommuneDepart' + - $ref: '#/components/parameters/dateProjectionCommuneInPath' + responses: + '200': + $ref: '#/components/responses/CommuneListeProjetes200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/commune/{code}/suivants: + get: + tags: + - geoCommune + summary: 'Informations concernant les communes qui succèdent à la commune' + operationId: 'getcogcomsuiv' + parameters: + - $ref: '#/components/parameters/codeCommuneInPath' + - $ref: '#/components/parameters/dateCommuneSuivantInPath' + responses: + '200': + $ref: '#/components/responses/CommuneListeSuivants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/communeAssociee/{code}/ascendants: + get: + tags: + - geoCommuneAssociee + summary: 'Informations concernant les territoires qui contiennent la commune associée' + operationId: 'getcogcomaasc' + parameters: + - $ref: '#/components/parameters/codeCommuneAssocieeInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsCommuneAssociee' + - $ref: '#/components/parameters/typeTerritoireAscendantCommuneAssociee' + responses: + '200': + $ref: '#/components/responses/CommuneAssocieeListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/communeAssociee/{code}: + get: + tags: + - geoCommuneAssociee + summary: 'Informations sur une commune associée identifiée par son code (cinq caractères)' + operationId: 'getcogcoma' + parameters: + - $ref: '#/components/parameters/codeCommuneAssocieeInPath' + - $ref: '#/components/parameters/dateCommuneAssocieeActive' + responses: + '200': + $ref: '#/components/responses/CommuneAssociee200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/communesAssociees: + get: + tags: + - geoCommuneAssociee + summary: 'Informations sur toutes les communes associées actives à la date donnée. Par défaut, c''est la date courante.' + operationId: 'getcogcomaliste' + parameters: + - $ref: '#/components/parameters/dateCommunesAssocieesActives' + responses: + '200': + $ref: '#/components/responses/CommunesAssocieesListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/communeDeleguee/{code}/ascendants: + get: + tags: + - geoCommuneDeleguee + summary: 'Informations concernant les territoires qui contiennent la commune déléguée' + operationId: 'getcogcomdasc' + parameters: + - $ref: '#/components/parameters/codeCommuneDelegueeInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsCommuneDeleguee' + - $ref: '#/components/parameters/typeTerritoireAscendantCommuneDeleguee' + responses: + '200': + $ref: '#/components/responses/CommuneDelegueeListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/communeDeleguee/{code}: + get: + tags: + - geoCommuneDeleguee + summary: 'Informations sur une commune déléguée identifiée par son code (cinq caractères)' + operationId: 'getcogcomd' + parameters: + - $ref: '#/components/parameters/codeCommuneDelegueeInPath' + - $ref: '#/components/parameters/dateCommuneDelegueeActive' + responses: + '200': + $ref: '#/components/responses/CommuneDeleguee200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/communesDeleguees: + get: + tags: + - geoCommuneDeleguee + summary: 'Informations sur toutes les communes déléguées actives à la date donnée. Par défaut, c''est la date courante.' + operationId: 'getcogcomdliste' + parameters: + - $ref: '#/components/parameters/dateCommunesDelegueesActives' + responses: + '200': + $ref: '#/components/responses/CommunesDelegueesListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + + /geo/departement/{code}/ascendants: + get: + tags: + - geoDepartement + summary: 'Informations concernant les territoires qui contiennent le departement' + operationId: 'getcogdepasc' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsDepartement' + - $ref: '#/components/parameters/typeTerritoireAscendantDepartement' + responses: + '200': + $ref: '#/components/responses/DepartementListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departement/{code}: + get: + tags: + - geoDepartement + summary: 'Informations sur un departement identifié par son code (deux ou trois caractères)' + operationId: 'getcogdep' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateDepartementActif' + responses: + '200': + $ref: '#/components/responses/Departement200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/departement/{code}/descendants: + get: + tags: + - geoDepartement + summary: 'Informations concernant les territoires inclus dans le departement' + operationId: 'getcogdepdesc' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsDepartement' + - $ref: '#/components/parameters/typeTerritoireDescendantDepartement' + - $ref: '#/components/parameters/filtreNomDescendant' + responses: + '200': + $ref: '#/components/responses/DepartementListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departements: + get: + tags: + - geoDepartement + summary: 'Informations sur tous les départements actifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogdepts' + parameters: + - $ref: '#/components/parameters/dateDepartementsInPath' + responses: + '200': + $ref: '#/components/responses/DepartementsListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departement/{code}/precedents: + get: + tags: + - geoDepartement + summary: 'Informations concernant les departements qui précèdent le departement' + operationId: 'getcogdepprec' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateDepartementDepart' + responses: + '200': + $ref: '#/components/responses/DepartementListePrecedents200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departement/{code}/projetes: + get: + tags: + - geoDepartement + summary: 'Informations concernant les départements qui résultent de la projection du département à la date passée en paramètre.' + operationId: 'getcogdepproj' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateDepartementDepart' + - $ref: '#/components/parameters/dateProjectionInPath' + responses: + '200': + $ref: '#/components/responses/DepartementListeProjetes200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/departement/{code}/suivants: + get: + tags: + - geoDepartement + summary: 'Informations concernant les départements qui succèdent au département' + operationId: 'getcogdepsuiv' + parameters: + - $ref: '#/components/parameters/codeDepInPath' + - $ref: '#/components/parameters/dateDepartementSuivantInPath' + responses: + '200': + $ref: '#/components/responses/DepartementListeSuivants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/district/{code}/ascendants: + get: + tags: + - geoDistrict + summary: 'Informations concernant les territoires qui contiennent le district' + operationId: 'getcogdisasc' + parameters: + - $ref: '#/components/parameters/codeDistrictInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsAscendantsDistrict' + - $ref: '#/components/parameters/typeTerritoireAscendantDistrict' + responses: + '200': + $ref: '#/components/responses/DistrictListeAscendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/district/{code}: + get: + tags: + - geoDistrict + summary: 'Informations sur un district identifié par son code (cinq caractères)' + operationId: 'getcogdis' + parameters: + - $ref: '#/components/parameters/codeDistrictInPath' + - $ref: '#/components/parameters/dateDistrictActif' + responses: + '200': + $ref: '#/components/responses/District200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/intercommunalite/{code}: + get: + tags: + - geoIntercommunalite + summary: 'Informations sur une intercommunalité identifiée par son code (neuf caractères)' + operationId: 'getcoginterco' + parameters: + - $ref: '#/components/parameters/codeIntercommunaliteInPath' + - $ref: '#/components/parameters/dateIntercommunaliteActive' + responses: + '200': + $ref: '#/components/responses/Intercommunalite200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/intercommunalite/{code}/descendants: + get: + tags: + - geoIntercommunalite + summary: 'Informations concernant les territoires inclus dans l''intercommunalité' + operationId: 'getcogintercodes' + parameters: + - $ref: '#/components/parameters/codeIntercommunaliteInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsIntercommunalite' + - $ref: '#/components/parameters/typeTerritoireDescendantIntercommunalite' + responses: + '200': + $ref: '#/components/responses/IntercommunaliteListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/intercommunalites: + get: + tags: + - geoIntercommunalite + summary: 'Informations sur toutes les intercommunalités actives à la date donnée. Par défaut, c''est la date courante.' + operationId: 'getcogintercoliste' + parameters: + - $ref: '#/components/parameters/dateIntercommunalitesActives' + - $ref: '#/components/parameters/filtreNomIntercommunalite' + responses: + '200': + $ref: '#/components/responses/IntercommunalitesListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + + /geo/iris/{code}: + get: + tags: + - geoIris + summary: 'Informations sur un Iris identifié par son code (neuf chiffres pour la métropole ou 2A/2B plus 7 chiffres pour la Corse)' + operationId: 'getcogiris' + parameters: + - $ref: '#/components/parameters/codeIrisInPath' + - $ref: '#/components/parameters/dateIrisActive' + responses: + '200': + $ref: '#/components/responses/Iris200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/pays/{code}: + get: + tags: + - geoPays + summary: 'Informations sur un pays identifié par son code (cinq chiffres, les deux premiers étant 99)' + operationId: 'getcogpays' + parameters: + - $ref: '#/components/parameters/codePaysInPath' + - $ref: '#/components/parameters/datePaysActif' + responses: + '200': + $ref: '#/components/responses/Pays200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/pays/{code}/descendants: + get: + tags: + - geoPays + summary: 'Informations concernant les territoires inclus dans le pays' + operationId: 'getcogpaysdesc' + parameters: + - $ref: '#/components/parameters/codePaysInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsPays' + - $ref: '#/components/parameters/typeTerritoireDescendantPays' + responses: + '200': + $ref: '#/components/responses/PaysListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/pays: + get: + tags: + - geoPays + summary: 'Informations sur tous les pays actifs à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogpayslist' + parameters: + - $ref: '#/components/parameters/datePaysListActifs' + responses: + '200': + $ref: '#/components/responses/PaysListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + /geo/region/{code}: + get: + tags: + - geoRegion + summary: 'Informations sur une région identifiée par son code (deux chiffres)' + operationId: 'getcogreg' + parameters: + - $ref: '#/components/parameters/codeRegInPath' + - $ref: '#/components/parameters/dateRegionActive' + responses: + '200': + $ref: '#/components/responses/Region200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/region/{code}/descendants: + get: + tags: + - geoRegion + summary: 'Informations concernant les territoires inclus dans la région' + operationId: 'getcogregdes' + parameters: + - $ref: '#/components/parameters/codeRegInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsRegion' + - $ref: '#/components/parameters/typeTerritoireDescendantRegion' + - $ref: '#/components/parameters/filtreNomDescendant' + responses: + '200': + $ref: '#/components/responses/RegionListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/regions: + get: + tags: + - geoRegion + summary: 'Informations sur toutes les régions actives à la date données. Par défaut, c''est la date courante.' + operationId: 'getcogregliste' + parameters: + - $ref: '#/components/parameters/dateRegionsActives' + responses: + '200': + $ref: '#/components/responses/RegionsListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + + /geo/uniteUrbaine2020/{code}: + get: + tags: + - geoUniteUrbaine + summary: 'Informations sur une unité urbaine identifiée par son code (cinq chiffres ou 1 chiffre, 1 lettre et 3 chiffres)' + operationId: 'getcoguu' + parameters: + - $ref: '#/components/parameters/codeUniteUrbaineInPath' + - $ref: '#/components/parameters/dateUniteUrbaineActive' + responses: + '200': + $ref: '#/components/responses/UniteUrbaine200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/uniteUrbaine2020/{code}/descendants: + get: + tags: + - geoUniteUrbaine + summary: 'Informations concernant les territoires inclus dans l''unité urbaine' + operationId: 'getcoguudes' + parameters: + - $ref: '#/components/parameters/codeUniteUrbaineInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsUniteUrbaine' + - $ref: '#/components/parameters/typeTerritoireDescendantUniteUrbaine' + responses: + '200': + $ref: '#/components/responses/UniteUrbaineListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/unitesUrbaines2020: + get: + tags: + - geoUniteUrbaine + summary: 'Informations sur toutes les unités urbaines actives à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcoguuliste' + parameters: + - $ref: '#/components/parameters/dateUnitesUrbainesActives' + responses: + '200': + $ref: '#/components/responses/UnitesUrbainesListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + + + /geo/zoneDEmploi2020/{code}: + get: + tags: + - geoZoneDEmploi + summary: 'Informations sur une zone d''emploi française identifiée par son code (quatre chiffres)' + operationId: 'getcogze' + parameters: + - $ref: '#/components/parameters/codeZoneDEmploiInPath' + - $ref: '#/components/parameters/dateZoneDEmploiActive' + responses: + '200': + $ref: '#/components/responses/ZoneDEmploi200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/zoneDEmploi2020/{code}/descendants: + get: + tags: + - geoZoneDEmploi + summary: 'Informations concernant les territoires inclus dans la zone d''emploi' + operationId: 'getcogzedesc' + parameters: + - $ref: '#/components/parameters/codeZoneDEmploiInPath' + - $ref: '#/components/parameters/dateTerritoiresActifsDescendantsZoneDEmploi' + - $ref: '#/components/parameters/typeTerritoireDescendantZoneDEmplooi' + responses: + '200': + $ref: '#/components/responses/ZoneDEmploiListeDescendants200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + /geo/zonesDEmploi2020: + get: + tags: + - geoZoneDEmploi + summary: 'Informations sur toutes les zones d''emploi actives à la date donnée. Par défaut, c’est la date courante.' + operationId: 'getcogzeliste' + parameters: + - $ref: '#/components/parameters/dateZonesDEmploiActives' + responses: + '200': + $ref: '#/components/responses/ZonesDEmploiListe200' + '400': + $ref: '#/components/responses/IncorrectRequest' + '404': + $ref: '#/components/responses/NotFound' + '406': + $ref: '#/components/responses/NotAcceptable' + '500': + $ref: '#/components/responses/ServerError' + +components: + parameters: + codeTerritoireInPath: + name: 'code' + in: path + description: 'Code identifiant un territoire' + required: true + schema: + type: string + dateActive: + in: query + description: |- + Filtre pour renvoyer la commune active à la date donnée. Par défaut, c'est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + dateProjectionInPath: + required: true + in: query + description: |- + Date vers laquelle est projeté le departement. Paramètre obligatoire (format : 'AAAA-MM-JJ') + name: dateProjection + schema: + $ref: '#/components/schemas/Date1950ParDefaut' + typeTerritoire: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnum' + filtreNomDescendant: + name: 'filtreNom' + in: query + description: 'Filtre sur le nom des territoires renvoyés' + schema: + type: string + codeDepInPath: + name: 'code' + in: path + description: 'Code du département (deux ou trois caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeDep' + dateDepartementActif: + in: query + description: |- + Filtre pour renvoyer le département actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateDepartementsInPath: + in: query + description: |- + Filtre pour renvoyer les départements actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsDepartement: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans le département actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsDepartement: + in: query + description: |- + Filtre pour renvoyer les territoires contenant le département actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantDepartement: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsDepartement' + typeTerritoireAscendantDepartement: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsDepartement' + + + codeAireDAttractionDesVillesInPath: + name: 'code' + in: path + description: 'Code de l''aire d''attraction (trois chiffres)' + required: true + schema: + $ref: '#/components/schemas/CodeAireDAttractionDesVilles' + dateAireDAttractionDesVillesActive: + in: query + description: |- + Filtre pour renvoyer l'aire d'attraction active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateAiresDAttractionDesVillesActives: + in: query + description: |- + Filtre pour renvoyer les aires d'attraction actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsAireDAttractionDesVilles: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans l'aire d'attraction active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantAireDAttractionDesVilles: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsAireDAttractionDesVilles' + codeArrondissementInPath: + name: 'code' + in: path + description: 'Code de l''arrondissement (trois ou quatre caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeArrondissement' + dateArrondissementActif: + in: query + description: |- + Filtre pour renvoyer l'arrondissement actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsArrondissement: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans l'arrondissement actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantArrondissement: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsArrondissement' + dateArrondissementsActifs: + in: query + description: |- + Filtre pour renvoyer les arrondissements actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsArrondissement: + in: query + description: |- + Filtre pour renvoyer les territoires contenant l'arrondissement actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantArrondissement: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsArrondissement' + + codeArrondissementMunicipalInPath: + name: 'code' + in: path + description: 'Code de l''arrondissement municipal (cinq caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeArrondissementMunicipal' + dateArrondissementMunicipalActif: + in: query + description: |- + Filtre pour renvoyer l'arrondissement municipal actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateArrondissementsMunicipauxActifs: + in: query + description: |- + Filtre pour renvoyer les arrondissements municipaux actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsArrondissementMunicipal: + in: query + description: |- + Filtre pour renvoyer les territoires contenant l'arrondissement municipal actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantArrondissementMunicipal: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsArrondissementMunicipal' + + dateDepartementDepart: + in: query + description: |- + Filtre pour préciser le département de départ. Par défaut, c’est la date courante qui est utilisée (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateDepartementSuivantInPath: + name: 'date' + in: query + description: |- + Filtre pour préciser le département de départ. Par défaut, c’est la date courante qui est utilisée (format : 'AAAA-MM-JJ') + schema: + $ref: '#/components/schemas/Date1950ParDefaut' + codeCommuneInPath: + required: true + name: code + in: path + description: 'Code de la commune (cinq caractères)' + schema: + $ref: '#/components/schemas/CodeCom' + dateCommuneDepart: + in: query + description: |- + Filtre pour préciser la commune de départ. Par défaut, c’est la date courante qui est utilisée (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateCommuneSuivantInPath: + name: 'date' + in: query + description: |- + Filtre pour préciser la commune de départ. Par défaut, c’est la date courante qui est utilisée (format : 'AAAA-MM-JJ') + schema: + $ref: '#/components/schemas/Date1945ParDefaut' + dateProjectionCommuneInPath: + required: true + in: query + description: |- + Date vers laquelle est projeté le departement. Paramètre obligatoire (format : 'AAAA-MM-JJ') + name: dateProjection + schema: + $ref: '#/components/schemas/Date1945ParDefaut' + dateTerritoiresActifsDescendantsCommune: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans la commune active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsCommune: + in: query + description: |- + Filtre pour renvoyer les territoires contenant la commune active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateCommunesActives: + in: query + description: |- + Filtre pour renvoyer les communes actives à la date donnée. Par défaut, c'est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantCommune: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsCommune' + typeTerritoireAscendantCommune: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsCommune' + filtreNomCommune: + name: 'filtreNom' + in: query + description: 'Filtre sur le nom de la commune' + schema: + type: string + example: 'Bonnay' + com: + name: 'com' + in: 'query' + description: |- + Sélectionner "true" pour inclure les collectivités d'outre-mer + schema: + type: boolean + example: false + + codeCommuneAssocieeInPath: + name: 'code' + in: path + description: 'Code de la commune associée (cinq caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeCommuneAssociee' + dateCommuneAssocieeActive: + in: query + description: |- + Filtre pour renvoyer la commune associée active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateCommunesAssocieesActives: + in: query + description: |- + Filtre pour renvoyer les communes associées actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsCommuneAssociee: + in: query + description: |- + Filtre pour renvoyer les territoires contenant la commune associée active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantCommuneAssociee: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsCommuneAssociee' + + codeCommuneDelegueeInPath: + name: 'code' + in: path + description: 'Code de la commune déléguée (cinq caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeCommuneDeleguee' + dateCommuneDelegueeActive: + in: query + description: |- + Filtre pour renvoyer la commune déléguée active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateCommunesDelegueesActives: + in: query + description: |- + Filtre pour renvoyer les communes déléguées actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsCommuneDeleguee: + in: query + description: |- + Filtre pour renvoyer les territoires contenant la commune déléguée active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantCommuneDeleguee: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsCommuneDeleguee' + + codeDistrictInPath: + name: 'code' + in: path + description: 'Code du district (cinq caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeDistrict' + dateDistrictActif: + in: query + description: |- + Filtre pour renvoyer le district actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsDistrict: + in: query + description: |- + Filtre pour renvoyer les territoires contenant le district actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantDistrict: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsDistrict' + + dateIntercommunaliteActive: + in: query + description: |- + Filtre pour renvoyer l'intercommunalité active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + codeIntercommunaliteInPath: + name: 'code' + in: path + description: 'Code de l''intercommunalité (neuf caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeInterco' + dateTerritoiresActifsDescendantsIntercommunalite: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans l'intercommunalité active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantIntercommunalite: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsIntercommunalite' + dateIntercommunalitesActives: + in: query + description: |- + Filtre pour renvoyer les intercommunalités actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + filtreNomIntercommunalite: + in: query + description: |- + Filtre sur le nom de l'intercommunalité + name: filtreNom + schema: + type: 'string' + format: string + + dateIrisActive: + in: query + description: |- + Filtre pour renvoyer l'Iris active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + codeIrisInPath: + name: 'code' + in: path + description: 'Code Insee de l''Iris (neuf caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeIris' + + codePaysInPath: + name: 'code' + in: path + description: 'Code de lu pays (cinq chiffres, débutant par 99)' + required: true + schema: + $ref: '#/components/schemas/CodePays' + datePaysActif: + in: query + description: |- + Filtre pour renvoyer le pays actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsPays: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans le pays à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantPays: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsPays' + datePaysListActifs: + in: query + description: |- + Filtre pour renvoyer les pays actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + + codeRegInPath: + name: 'code' + in: path + description: 'Code de la région (deux chiffres)' + required: true + schema: + $ref: '#/components/schemas/CodeReg' + dateRegionActive: + in: query + description: |- + Filtre pour renvoyer la région active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsRegion: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans la région active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantRegion: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsRegion' + dateRegionsActives: + in: query + description: |- + Filtre pour renvoyer les régions actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + + codeUniteUrbaineInPath: + name: 'code' + in: path + description: 'Code de l''unité urbaine (cinq chiffres ou 1 chiffre, 1 lettre et 3 chiffres)' + required: true + schema: + $ref: '#/components/schemas/CodeUniteUrbaine' + dateUniteUrbaineActive: + in: query + description: |- + Filtre pour renvoyer l'unité urbaine active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsUniteUrbaine: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans l'unité urbaine active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantUniteUrbaine: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsUniteUrbaine' + dateUnitesUrbainesActives: + in: query + description: |- + Filtre pour renvoyer les unités urbaines actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + + codeBassinDeVieInPath: + name: 'code' + in: path + description: 'Code du bassin de vie (cinq caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeBassinDeVie' + dateBassinDeVieActif: + in: query + description: |- + Filtre pour renvoyer le bassin de vie actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsBassinDeVie: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans le bassin de vie actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + dateBassinsDeVieActifs: + in: query + description: |- + Filtre pour renvoyer les bassins de vie actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantBassinDeVie: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsBassinDeVie' + filtreNomBassinDeVie: + in: query + description: |- + Filtre sur le nom du bassin de vie + name: filtreNom + schema: + type: 'string' + format: string + + codeCantonInPath: + name: 'code' + in: path + description: 'Code du canton (quatre chiffres pour la Métropole ou cinq chiffres pour les DOM ou 2A/2B plus 2 chiffres pour la Corse)' + required: true + schema: + $ref: '#/components/schemas/CodeCanton' + dateCantonActif: + in: query + description: |- + Filtre pour renvoyer le canton actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateCantonsActifs: + in: query + description: |- + Filtre pour renvoyer les cantons actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsCanton: + in: query + description: |- + Filtre pour renvoyer les territoires contenant le canton actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantCanton: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsCanton' + + codeCantonOuVilleInPath: + name: 'code' + in: path + description: 'Code du canton-ou-ville (quatre caractères, ou cinq pour les DOM, exemple : 97602)' + required: true + schema: + $ref: '#/components/schemas/CodeCantonOuVille' + dateCantonOuVilleActif: + in: query + description: |- + Filtre pour renvoyer le canton-ou-ville actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsCantonOuVille: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans canton-ou ville actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantCantonOuVille: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsCantonOuVille' + filtreNomDescendantSansExemple: + name: 'filtreNom' + in: query + description: 'Filtre sur le nom des territoires renvoyés' + schema: + type: string + dateCantonsEtVillesActifs: + in: query + description: |- + Filtre pour renvoyer les cantons et villes actifs à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsCantonOuVille: + in: query + description: |- + Filtre pour renvoyer les territoires contenant le canton-ou-ville actif à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantCantonOuVille: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsCantonOuVille' + + codeCirconscriptionTerritorialeInPath: + name: 'code' + in: path + description: 'Code de la circonscription territoriale (cinq caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeCirconscriptionTerritoriale' + dateCirconscriptionTerritorialeActive: + in: query + description: |- + Filtre pour renvoyer la circonscription territoriale active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsAscendantsCirconscriptionTerritoriale: + in: query + description: |- + Filtre pour renvoyer les territoires contenant la circonscription territoriale active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + typeTerritoireAscendantCirconscriptionTerritoriale: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumAscendantsCirconscriptionTerritoriale' + + codeCollectiviteDOutreMerInPath: + name: 'code' + in: path + description: 'Code de la collectivité d''outre-mer (trois caractères)' + required: true + schema: + $ref: '#/components/schemas/CodeCollectiviteDOutreMer' + dateCollectiviteDOutreMerActive: + in: query + description: |- + Filtre pour renvoyer la collectivité d'outre-mer à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateCollectivitesDOutreMerActives: + in: query + description: |- + Filtre pour renvoyer les collectivités d'outre-mer à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + + codeZoneDEmploiInPath: + name: 'code' + in: path + description: 'Code de la zone d''emploi (quatre chiffres)' + required: true + schema: + $ref: '#/components/schemas/CodeZoneDEmploi' + dateZoneDEmploiActive: + in: query + description: |- + Filtre pour renvoyer la zone d'emploi active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ') + name: date + schema: + type: 'string' + format: date + dateTerritoiresActifsDescendantsZoneDEmploi: + in: query + description: |- + Filtre pour renvoyer les territoires inclus dans la zone d'emploi active à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). + name: date + schema: + type: 'string' + format: date + typeTerritoireDescendantZoneDEmplooi: + name: 'type' + in: query + description: 'Filtre sur le type de territoire renvoyé' + schema: + $ref: '#/components/schemas/TypeEnumDescendantsZoneDEmploi' + dateZonesDEmploiActives: + in: query + description: |- + Filtre pour renvoyer les zones d'emploi actives à la date donnée. Par défaut, c’est la date courante (format : 'AAAA-MM-JJ'). Le paramètre '*' permet de renvoyer tout l'historique. + name: date + schema: + type: 'string' + format: date + + examples: + + AireDAttractionDesVilles2020: + value: + code: '062' + uri: 'http://id.insee.fr/geo/aireDAttractionDesVilles2020/858ff6ab-fb4c-4a03-896c-18a20ed01a45' + type: 'AireDAttractionDesVilles2020' + dateCreation: '2020-01-01' + intituleSansArticle: 'Angoulême' + typeArticle: '1' + intitule: 'Angoulême' + AireDAttractionDesVillesListeDescendants: + value: + - code: '16003' + uri: 'http://id.insee.fr/geo/commune/5300719a-d772-4059-b380-c46704662250' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Agris' + typeArticle: '0' + intitule: 'Agris' + ListeAiresDAttractionDesVilles2020: + value: + - code: '001' + uri: 'http://id.insee.fr/geo/aireDAttractionDesVilles2020/3a65c4b6-8157-48be-bead-b74066f8456a' + type: 'AireDAttractionDesVilles2020' + dateCreation: '2020-01-01' + intituleSansArticle: 'Paris' + typeArticle: '0' + intitule: 'Paris' + + ArrondissementListeAscendants: + value: + - code: '67' + uri: 'http://id.insee.fr/geo/departement/e62b35df-f168-4dfa-b60f-ef6cdb3279a0' + type: 'Departement' + dateCreation: '1943-01-01' + intituleSansArticle: 'Bas-Rhin' + typeArticle: '2' + chefLieu: '67482' + intitule: 'Bas-Rhin' + Arrondissement: + value: + code: '674' + uri: 'http://id.insee.fr/geo/arrondissement/7f59df93-132b-400f-9aa6-b3c6be1018eb' + type: 'Arrondissement' + dateCreation: '2018-12-31' + intituleSansArticle: 'Saverne' + typeArticle: '0' + chefLieu: '67437' + intitule: 'Saverne' + ArrondissementListeDescendants: + value: + - code: '67004' + uri: 'http://id.insee.fr/geo/communeDeleguee/ec8ebfef-57c2-4e97-9d5c-f07b2e46fa36' + type: 'CommuneDeleguee' + dateCreation: '2016-01-01' + intituleSansArticle: 'Allenwiller' + typeArticle: '1' + intitule: 'Allenwiller' + ListeArrondissements: + value: + - code: '011' + uri: 'http://id.insee.fr/geo/arrondissement/cc3aee67-96dc-4e9a-ae4e-26860a90e0d5' + type: 'Arrondissement' + dateCreation: '2017-01-01' + intituleSansArticle: 'Belley' + typeArticle: '0' + chefLieu: '01034' + intitule: 'Belley' + + ArrondissementMunicipalListeAscendants: + value: + - code: '84' + uri: 'http://id.insee.fr/geo/region/c12b23e7-d2e7-4443-ac4b-de8de5ce22f2' + type: 'Region' + dateCreation: '2016-01-01' + intituleSansArticle: 'Auvergne-Rhône-Alpes' + typeArticle: '1' + chefLieu: '69123' + intitule: 'Auvergne-Rhône-Alpes' + ArrondissementMunicipal: + value: + code: '69385' + uri: 'http://id.insee.fr/geo/arrondissementMunicipal/cd9f4663-684c-455d-b62e-39e51c6fad99' + type: 'ArrondissementMunicipal' + dateCreation: '1964-08-12' + intituleSansArticle: 'Lyon 5e Arrondissement' + typeArticle: '0' + intitule: 'Lyon 5e Arrondissement' + ListeArrondissementsMunicipaux: + value: + - code: '13201' + uri: 'http://id.insee.fr/geo/arrondissementMunicipal/d2ae811d-f0b8-4bac-972d-01dabe292665' + type: 'ArrondissementMunicipal' + dateCreation: '1946-10-18' + intituleSansArticle: 'Marseille 1er Arrondissement' + typeArticle: '0' + intitule: 'Marseille 1er Arrondissement' + + BassinDeVie2022: + value: + code: '01004' + uri: 'http://id.insee.fr/geo/bassinDeVie2022/0e5bcc78-f043-404d-92af-d3d660772675' + type: 'BassinDeVie2022' + dateCreation: '2022-01-01' + intituleSansArticle: 'Ambérieu-en-Bugey' + typeArticle: '1' + intitule: 'Ambérieu-en-Bugey' + BassinDeVieListeDescendants: + value: + - code: '01002' + uri: 'http://id.insee.fr/geo/commune/43018c68-c278-433a-b285-3531e8d5347e' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Abergement-de-Varey' + typeArticle: '5' + intitule: 'L''Abergement-de-Varey' + ListeBassinsDeVie: + value: + - code: '01004' + uri: 'http://id.insee.fr/geo/bassinDeVie2022/0e5bcc78-f043-404d-92af-d3d660772675' + type: 'BassinDeVie2022' + dateCreation: '2022-01-01' + intituleSansArticle: 'Ambérieu-en-Bugey' + typeArticle: '1' + intitule: 'Ambérieu-en-Bugey' + + CantonListeAscendants: + value: + - code: '84' + uri: 'http://id.insee.fr/geo/region/c12b23e7-d2e7-4443-ac4b-de8de5ce22f2' + type: 'Region' + dateCreation: '2016-01-01' + intituleSansArticle: 'Auvergne-Rhône-Alpes' + typeArticle: '1' + chefLieu: '69123' + intitule: 'Auvergne-Rhône-Alpes' + Canton: + value: + code: '0101' + uri: 'http://id.insee.fr/geo/canton/f96a2438-478f-4ebb-b659-434305dff18f' + type: 'Canton' + dateCreation: '2016-01-01' + chefLieu: '01004' + intituleSansArticle: 'Ambérieu-en-Bugey' + typeArticle: '1' + intitule: 'Ambérieu-en-Bugey' + ListeCantons: + value: + - code: '0101' + uri: 'http://id.insee.fr/geo/canton/f96a2438-478f-4ebb-b659-434305dff18f' + type: 'Canton' + dateCreation: '2016-01-01' + chefLieu: '01004' + intituleSansArticle: 'Ambérieu-en-Bugey' + typeArticle: '1' + intitule: 'Ambérieu-en-Bugey' + + CantonOuVilleListeAscendants: + value: + - code: '84' + uri: 'http://id.insee.fr/geo/region/c12b23e7-d2e7-4443-ac4b-de8de5ce22f2' + type: 'Region' + dateCreation: '2016-01-01' + intituleSansArticle: 'Auvergne-Rhône-Alpes' + typeArticle: '1' + chefLieu: '69123' + intitule: 'Auvergne-Rhône-Alpes' + CantonOuVille: + value: + code: '0101' + uri: 'http://id.insee.fr/geo/cantonOuVille/5e75ead7-7564-4480-83b0-7e16a7d8acf7' + type: 'CantonOuVille' + dateCreation: '2016-01-01' + intituleSansArticle: 'Ambérieu-en-Bugey' + typeArticle: '1' + intitule: 'Ambérieu-en-Bugey' + CantonOuVilleListeDescendants: + value: + - code: '0102' + uri: 'http://id.insee.fr/geo/commune/43018c68-c278-433a-b285-3531e8d5347e' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Abergement-de-Varey' + typeArticle: '5' + intitule: 'L''Abergement-de-Varey' + ListeCantonsEtVilles: + value: + - code: '0101' + uri: 'http://id.insee.fr/geo/cantonOuVille/5e75ead7-7564-4480-83b0-7e16a7d8acf7' + type: 'CantonOuVille' + dateCreation: '2016-01-01' + intituleSansArticle: 'Ambérieu-en-Bugey' + typeArticle: '1' + intitule: 'Ambérieu-en-Bugey' + + + CirconscriptionTerritorialeListeAscendants: + value: + - code: '986' + uri: 'http://id.insee.fr/geo/collectiviteDOutreMer/ecfac5cd-a301-4dff-bed9-dfc54421bf6c' + type: 'CollectiviteDOutreMer' + dateCreation: '2008-01-01' + intituleSansArticle: 'Wallis-et-Futuna' + typeArticle: '0' + intitule: 'Wallis-et-Futuna' + CirconscriptionTerritoriale: + value: + code: '98611' + uri: 'http://id.insee.fr/geo/circonscriptionTerritoriale/31f556e9-55e5-4e48-9dac-2d8113fa609e' + type: 'CirconscriptionTerritoriale' + dateCreation: '2008-01-01' + intituleSansArticle: 'Alo' + typeArticle: '1' + intitule: 'Alo' + + CollectiviteDOutreMer: + value: + code: '988' + uri: 'http://id.insee.fr/geo/collectiviteDOutreMer/bc93b612-59f5-463a-a05f-e5ed9013dc8d' + type: 'CollectiviteDOutreMer' + dateCreation: '2008-01-01' + intituleSansArticle: 'Nouvelle-Calédonie' + typeArticle: '0' + intitule: 'Nouvelle-Calédonie' + ListeCollectivitesDOutreMer: + value: + - code: '975' + uri: 'http://id.insee.fr/geo/collectiviteDOutreMer/352968dd-fcc7-4950-8b71-8c94053cb126' + type: 'CollectiviteDOutreMer' + dateCreation: '2008-01-01' + intituleSansArticle: 'Saint-Pierre-et-Miquelon' + typeArticle: '0' + intitule: 'Saint-Pierre-et-Miquelon' + + + CommuneListeAscendants: + value: + - code: '024' + uri: 'http://id.insee.fr/geo/aireDAttractionDesVilles2020/9d05148e-a733-4bc4-9223-e8a27618c7c0' + type: 'AireDAttractionDesVilles2020' + dateCreation: '2020-01-01' + intituleSansArticle: 'Caen' + typeArticle: '0' + intitule: 'Caen' + - code: '14752' + uri: 'http://id.insee.fr/geo/bassinDeVie2022/a2f90771-4ff4-498e-9464-9cd75cdf2db7' + type: 'BassinDeVie2022' + dateCreation: '2022-01-01' + intituleSansArticle: 'Villers-Bocage' + typeArticle: '0' + intitule: 'Villers-Bocage' + - code: '1401' + uri: 'http://id.insee.fr/geo/cantonOuVille/decd5410-bd2c-4561-b2c1-c1ef258fa3c0' + type: 'CantonOuVille' + dateCreation: '2021-02-26' + intituleSansArticle: 'Monts d’Aunay' + typeArticle: '4' + intitule: 'Les Monts d’Aunay' + - code: '1401' + uri: 'http://id.insee.fr/geo/canton/25982682-5635-40ad-8040-09110edb43e1' + type: 'Canton' + dateCreation: '2021-02-26' + chefLieu: '14027' + intitule: 'Les Monts d’Aunay' + intituleSansArticle: 'Monts d’Aunay' + typeArticle: '4' + - code: '14' + uri: 'http://id.insee.fr/geo/departement/b01dce92-b91f-4648-80e7-536bd1823c2c' + type: 'Departement' + dateCreation: '2018-01-01' + intituleSansArticle: 'Calvados' + typeArticle: '2' + chefLieu: '14118' + intitule: 'Calvados' + - code: '200069524' + uri: 'http://id.insee.fr/geo/intercommunalite/208f94f5-28b8-421b-b153-e651cee0781f' + type: 'Intercommunalite' + dateCreation: '2017-01-01' + intituleSansArticle: 'Pré-Bocage Intercom' + typeArticle: 'X' + intitule: 'Pré-Bocage Intercom' + - code: '28' + uri: 'http://id.insee.fr/geo/region/a7ac0f8e-d4d4-4ff2-9135-f0e0b6371aed' + type: 'Region' + dateCreation: '2016-01-01' + intituleSansArticle: 'Normandie' + typeArticle: '0' + chefLieu: '76540' + intitule: 'Normandie' + - code: '2804' + uri: 'http://id.insee.fr/geo/zoneDEmploi2020/4de3edd0-840a-437b-aa63-bba467c1a3ab' + type: 'ZoneDEmploi2020' + dateCreation: '2020-01-01' + intituleSansArticle: 'Caen' + typeArticle: '0' + intitule: 'Caen' + Commune: + value: + code: '14475' + uri: 'http://id.insee.fr/geo/commune/4b88116a-9ede-42f5-aef5-a70304de593b' + type: 'Commune' + dateCreation: '2017-01-01' + intituleSansArticle: 'Val d''Arry' + typeArticle: '0' + intitule: 'Val d''Arry' + CommuneListeDescendants: + value: + - code: '14373' + uri: 'http://id.insee.fr/geo/communeDeleguee/33afe07c-f132-4cdd-a188-4500c6928e62' + type: 'CommuneDeleguee' + dateCreation: '2017-01-01' + intituleSansArticle: 'Locheur' + typeArticle: '2' + intitule: 'Le Locheur' + - code: '14432' + uri: 'http://id.insee.fr/geo/communeDeleguee/92b6f5a8-2766-4561-88f2-d7958529c488' + type: 'CommuneDeleguee' + dateCreation: '2017-01-01' + intituleSansArticle: 'Missy' + typeArticle: '0' + intitule: 'Missy' + - code: '14475' + uri: 'http://id.insee.fr/geo/communeDeleguee/75df6d90-905e-428f-a410-d3e56f2683f2' + type: 'CommuneDeleguee' + dateCreation: '2017-01-01' + intituleSansArticle: 'Noyers-Bocage' + typeArticle: '0' + intitule: 'Noyers-Bocage' + - code: '14702' + uri: 'http://id.insee.fr/geo/communeDeleguee/2a818192-2ffb-4955-b45d-a34f38753e87' + type: 'CommuneDeleguee' + dateCreation: '2017-01-01' + intituleSansArticle: 'Tournay-sur-Odon' + typeArticle: '0' + intitule: 'Tournay-sur-Odon' + CommunesListe: + value: + - code: '25073' + uri: 'http://id.insee.fr/geo/commune/2ac33139-2a97-4b09-87b3-263cbf14c0b6' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Bonnay' + typeArticle: '0' + intitule: 'Bonnay' + - code: '71042' + uri: 'http://id.insee.fr/geo/commune/2ee9b3c8-9861-40a0-af5e-f84ce2f2b3bc' + type: 'Commune' + dateCreation: '2023-01-01' + intituleSansArticle: 'Bonnay-Saint-Ythaire' + typeArticle: '0' + intitule: 'Bonnay-Saint-Ythaire' + - code: '80112' + uri: 'http://id.insee.fr/geo/commune/98c861ac-6da4-4f18-ba45-665bae059c5f' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Bonnay' + typeArticle: '0' + intitule: 'Bonnay' + CommuneListePrecedents: + value: + - code: '14373' + uri: 'http://id.insee.fr/geo/commune/9b9298ba-d31f-4570-82f1-ad821704a413' + type: 'Commune' + dateCreation: '1943-01-01' + dateSuppression: '2017-01-01' + intituleSansArticle: 'Locheur' + typeArticle: '2' + intitule: 'Le Locheur' + - code: '14475' + uri: 'http://id.insee.fr/geo/commune/871d067a-a559-419c-a881-3602bb9fc7a1' + type: 'Commune' + dateCreation: '2016-01-01' + dateSuppression: '2017-01-01' + intituleSansArticle: 'Noyers-Missy' + typeArticle: '0' + intitule: 'Noyers-Missy' + - code: '14702' + uri: 'http://id.insee.fr/geo/commune/69441f11-d773-46d7-838b-ac22102415d1' + type: 'Commune' + dateCreation: '1957-04-13' + dateSuppression: '2017-01-01' + intituleSansArticle: 'Tournay-sur-Odon' + typeArticle: '0' + intitule: 'Tournay-sur-Odon' + CommuneListeProjetes: + value: + - code: '14373' + uri: 'http://id.insee.fr/geo/commune/9b9298ba-d31f-4570-82f1-ad821704a413' + type: 'Commune' + dateCreation: '1943-01-01' + dateSuppression: '2017-01-01' + intituleSansArticle: 'Locheur' + typeArticle: '2' + intitule: 'Le Locheur' + - code: '14432' + uri: 'http://id.insee.fr/geo/commune/3a20a2ae-553b-4700-8009-e18fe26e0038' + type: 'Commune' + dateCreation: '1943-01-01' + dateSuppression: '2016-01-01' + intituleSansArticle: 'Missy' + typeArticle: '0' + intitule: 'Missy' + - code: '14475' + uri: 'http://id.insee.fr/geo/commune/95745cb6-90c1-4207-a45c-6c4cef0a7db4' + type: 'Commune' + dateCreation: '1943-01-01' + dateSuppression: '1958-10-13' + intituleSansArticle: 'Noyers' + typeArticle: '0' + intitule: 'Noyers' + - code: '14702' + uri: 'http://id.insee.fr/geo/commune/5ff04633-e954-446d-b5aa-f49027b4b6b6' + type: 'Commune' + dateCreation: '1943-01-01' + dateSuppression: '1957-04-13-01-01' + intituleSansArticle: 'Tournay' + typeArticle: '0' + intitule: 'Tournay' + CommuneListeSuivants: + value: + - code: '14475' + uri: 'http://id.insee.fr/geo/commune/c2e2d19d-1ace-4cdc-b80d-c37a1aa59d1e' + type: 'Commune' + dateCreation: '1958-10-13' + dateSuppression: '2016-01-01' + intituleSansArticle: 'Noyers-Bocage' + typeArticle: '0' + intitule: 'Noyers-Bocage' + + CommuneAssocieeListeAscendants: + value: + - code: '32' + uri: 'http://id.insee.fr/geo/region/9c60accf-61a2-4f61-9546-875924d210ec' + type: 'Region' + dateCreation: '2016-12-31' + intituleSansArticle: 'Hauts-de-France' + typeArticle: '4' + chefLieu: '59350' + intitule: 'Hauts-de-France' + CommuneAssociee: + value: + code: '59355' + uri: 'http://id.insee.fr/geo/communeAssociee/84564ad2-a211-4744-9e01-1bb1900e2e68' + type: 'CommuneAssociee' + dateCreation: '2000-02-27' + intituleSansArticle: 'Lomme' + typeArticle: '0' + intitule: 'Lomme' + ListeCommunesAssociees: + value: + - code: '01120' + uri: 'http://id.insee.fr/geo/communeAssociee/2c8fa8e3-dc3b-4b8a-907a-82e4d07bce2c' + type: 'CommuneAssociee' + dateCreation: '1973-01-01' + intituleSansArticle: 'Cordieux' + typeArticle: '0' + intitule: 'Cordieux' + + CommuneDelegueeListeAscendants: + value: + - code: '76' + uri: 'http://id.insee.fr/geo/region/862793ee-891d-4831-b9c9-a94cfe2e6f7b' + type: 'Region' + dateCreation: '2016-09-29' + intituleSansArticle: 'Occitanie' + typeArticle: '1' + chefLieu: '31555' + intitule: 'Occitanie' + CommuneDeleguee: + value: + - code: '46248' + uri: 'http://id.insee.fr/geo/communeDeleguee/c333331f-b09b-4253-b012-dc0d0a65a290' + type: 'CommuneDeleguee' + dateCreation: '2017-01-01' + intituleSansArticle: 'Sainte-Alauzie' + typeArticle: '0' + intitule: 'Sainte-Alauzie' + ListeCommunesDeleguees: + value: + - code: '01015' + uri: 'http://id.insee.fr/geo/communeDeleguee/3c07001c-7efe-40f9-90fc-6a892af20238' + type: 'CommuneDeleguee' + dateCreation: '2016-01-01' + intituleSansArticle: 'Arbignieu' + typeArticle: '0' + intitule: 'Arbignieu' + + + DepartementListeAscendants: + value: + - code: '53' + uri: 'http://id.insee.fr/geo/region/6c83500c-454c-4d69-aec5-b988fb6f6f1c' + type: 'Region' + dateCreation: '2019-01-01' + intituleSansArticle: 'Bretagne' + typeArticle: '0' + chefLieu: '35238' + intitule: 'Bretagne' + Departement: + value: + code: '22' + uri: 'http://id.insee.fr/geo/departement/f07f6a49-9dce-4f2d-a99e-5d61eedf2827' + type: 'Departement' + dateCreation: '1990-03-08' + intituleSansArticle: 'Côtes-d''Armor' + typeArticle: '4' + chefLieu: '22278' + intitule: 'Côtes-d''Armor' + DepartementListeDescendants: + value: + - code: '221' + uri: 'http://id.insee.fr/geo/arrondissement/1e07b989-b3ff-43be-bfe6-05e9c9ba19d7' + type: 'Arrondissement' + dateCreation: '2017-01-01' + intituleSansArticle: 'Dinan' + typeArticle: '0' + chefLieu: '22050' + intitule: 'Dinan' + - code: '222' + uri: 'http://id.insee.fr/geo/arrondissement/87fdca9c-f9ed-41e5-93d9-f44534ffd725' + type: 'Arrondissement' + dateCreation: '2017-01-01' + intituleSansArticle: 'Guingamp' + typeArticle: '0' + chefLieu: '22070' + intitule: 'Guingamp' + DepartementsListe: + value: + - code: '01' + uri: 'http://id.insee.fr/geo/departement/84680e6f-2e99-44c9-a9ba-2e96a2ae48b7' + type: 'Departement' + dateCreation: '1967-12-31' + intituleSansArticle: 'Ain' + typeArticle: '5' + chefLieu: '01053' + intitule: 'Ain' + - code: '02' + uri: 'http://id.insee.fr/geo/departement/8b195d1f-8676-4c06-873c-ee5b6d66a23f' + type: 'Departement' + dateCreation: '2016-12-31' + intituleSansArticle: 'Aisne' + typeArticle: '5' + chefLieu: '02408' + intitule: 'Aisne' + DepartementListePrecedents: + value: + - code: '22' + uri: 'http://id.insee.fr/geo/departement/95af7065-d100-4c4f-afd5-764edfe9ae9b' + type: 'Departement' + dateCreation: '1943-01-01' + dateSuppression: '1990-03-08' + intituleSansArticle: 'Côtes-du-Nord' + typeArticle: '4' + chefLieu: '22278' + intitule: 'Côtes-du-Nord' + DepartementListeProjetes: + value: + - code: '22' + uri: 'http://id.insee.fr/geo/departement/95af7065-d100-4c4f-afd5-764edfe9ae9b' + type: 'Departement' + dateCreation: '1943-01-01' + dateSuppression: '1990-03-08' + intituleSansArticle: 'Côtes-du-Nord' + typeArticle: '4' + chefLieu: '22278' + intitule: 'Côtes-du-Nord' + DepartementListeSuivants: + value: + - code: '22' + uri: 'http://id.insee.fr/geo/departement/f07f6a49-9dce-4f2d-a99e-5d61eedf2827' + type: 'Departement' + dateCreation: '1990-03-08' + intituleSansArticle: 'Côtes-d''Armor' + typeArticle': '4' + chefLieu: '22278' + intitule: 'Côtes-d''Armor' + + DistrictListeAscendants: + value: + - code: '984' + uri: 'http://id.insee.fr/geo/collectiviteDOutreMer/f6496613-8f78-4184-80ab-81a077db6b37' + type: 'CollectiviteDOutreMer' + dateCreation: '2008-01-01' + intituleSansArticle: 'Terres australes et antarctiques françaises' + typeArticle: '4' + intitule: 'Terres australes et antarctiques françaises' + District: + value: + code: '98411' + uri: 'http://id.insee.fr/geo/district/d028b78a-9c4d-4e22-9b60-efffd7085eb0' + type: 'District' + dateCreation: '2008-01-01' + intituleSansArticle: 'Îles Saint-Paul et Amsterdam' + typeArticle: '4' + intitule: 'Îles Saint-Paul et Amsterdam' + + Intercommunalite: + value: + code: '240100883' + uri: 'http://id.insee.fr/geo/intercommunalite/5a238840-5cbd-469f-80c8-43713bf8e4a8' + type: 'Intercommunalite' + dateCreation: '2017-01-01' + intituleSansArticle: 'Plaine de l''Ain' + typeArticle: '3' + intituleComplet: 'Communauté de communes de La Plaine de l''Ain' + categorieJuridique: 'Communauté de communes' + intitule: 'La Plaine de l''Ain' + IntercommunaliteListeDescendants: + value: + - code: '01002' + uri: 'http://id.insee.fr/geo/commune/43018c68-c278-433a-b285-3531e8d5347e' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Abergement-de-Varey' + typeArticle: '5' + intitule: 'Abergement-de-Varey' + ListeIntercommunalites: + value: + - code: '240100883' + uri: 'http://id.insee.fr/geo/intercommunalite/5a238840-5cbd-469f-80c8-43713bf8e4a8' + type: 'Intercommunalite' + dateCreation: '2017-01-01' + intituleSansArticle: 'Plaine de l''Ain' + typeArticle: '3' + intituleComplet: 'Communauté de communes de La Plaine de l''Ain' + categorieJuridique: 'Communauté de communes' + intitule: 'La Plaine de l''Ain' + + + Iris: + value: + code: '010040101' + uri: 'http://id.insee.fr/geo/iris/b8c772de-9551-4f13-81c5-eca5bb0f2f7d' + type': 'Iris' + dateCreation: '2008-01-01' + typeDIris: 'H' + intitule: 'Les Pérouses-Triangle d''Activités' + intituleSansArticle: 'Pérouses-Triangle d''Activités' + typeArticle: '4' + + Pays: + value: + code: '99132' + uri: 'http://id.insee.fr/geo/pays/7c3380f3-897b-4470-a12f-2ae3b61fe4d0' + type: 'Pays' + dateCreation: '1943-01-01' + intituleSansArticle: 'Royaume-Uni' + intituleComplet: "Royaume-Uni de Grande-Bretagne et d’Irlande du Nord" + iso3166alpha2: "GB" + iso3166alpha3: "GBR" + iso3166num: "826" + PaysListeDescendants: + value: + - code: '99133' + uri: 'ttp://id.insee.fr/geo/territoire/1af281f6-f58a-4197-a40c-3c1514ebd9c5' + type: 'Territoire' + dateCreation: '1964-09-21' + intitule: 'Territoires britanniques en Méditerranée' + intituleComplet: "Gibraltar, Akrotiri et Dhekelia" + PaysListe: + value: + - code: '99100' + uri: 'http://id.insee.fr/geo/pays/b7e3f0c9-b653-4a3e-904a-de63b80e108b' + type: 'Pays' + dateCreation: '1943-01-01' + intituleSansArticle: 'France' + intituleComplet: "République française" + iso3166alpha2: "FR" + iso3166alpha3: "FRA" + iso3166num: "250" + + + + Region: + value: + code: '06' + uri: 'http://id.insee.fr/geo/region/0e9f9adc-742d-4ab7-90bd-30e5aaf7b2ab' + type: 'Region' + dateCreation: '2011-03-31' + intituleSansArticle: 'Mayotte' + typeArticle: '0' + chefLieu: '97611' + intitule: 'Mayotte' + RegionListeDescendants: + value: + - code: '97601' + uri: 'http://id.insee.fr/geo/commune/cc6df496-5a62-4c71-88f8-22fca3a411d7' + type: 'Commune' + dateCreation: '2011-03-31' + intituleSansArticle: 'Acoua' + typeArticle: '1' + intitule: 'Acoua' + ListeRegions: + value: + - code: '01' + uri: 'http://id.insee.fr/geo/region/598b3ed6-a7ea-44f8-a130-7a42e3630a8a' + type: 'Region' + dateCreation: '2007-07-15' + intituleSansArticle: 'Guadeloupe' + typeArticle: '3' + chefLieu: '97105' + intitule: 'Guadeloupe' + + UniteUrbaine2020: + value: + code: '01121' + uri: 'http://id.insee.fr/geo/uniteUrbaine2020/57a37c9b-e426-430e-b8c1-ac0fd640e345' + type: 'UniteUrbaine2020' + dateCreation: '2020-10-01' + intituleSansArticle: 'Jujurieux' + typeArticle: '0' + intitule: 'Jujurieux' + UniteUrbaineListeDescendants: + value: + - code: '01199' + uri: 'http://id.insee.fr/geo/commune/0d69a92e-70d3-4ebf-aa3b-db76e6bedf7e' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Jujurieux' + typeArticle: '0' + intitule: 'Jujurieux' + ListeUnitesUrbaines: + value: + - code: '00151' + uri: 'http://id.insee.fr/geo/uniteUrbaine2020/a7355a50-7516-4f7b-8919-a03bc28cd12b' + type: 'UniteUrbaine2020' + dateCreation: '2020-10-01' + intituleSansArticle: 'Lécluse' + typeArticle: '0' + intitule: 'Lécluse' + + + ZoneDEmploi2020: + value: + code: '2415' + uri: 'http://id.insee.fr/geo/zoneDEmploi2020/dbab03e7-3d8d-4797-8ab1-0ed36a4db9c1' + type: 'ZoneDEmploi2020' + dateCreation: '2020-01-01' + intituleSansArticle: 'Vierzon' + typeArticle: '0' + intitule: 'Vierzon' + ZoneDEmploiListeDescendants: + value: + - code: '18036' + uri: 'http://id.insee.fr/geo/commune/9d090028-9065-4c75-bb2b-6ea30d430af7' + type: 'Commune' + dateCreation: '1943-01-01' + intituleSansArticle: 'Brinay' + typeArticle: '0' + intitule: 'Brinay' + ListeZonesDEmploi2020: + value: + - code: '0051' + uri: 'http://id.insee.fr/geo/zoneDEmploi2020/e6911283-05f4-4997-916a-cc2b58c1e013' + type: 'ZoneDEmploi2020' + dateCreation: '2025-01-01' + intituleSansArticle: 'Alençon' + typeArticle: '1' + intitule: 'Vierzon' + + responses: + IncorrectRequest: + description: 'La syntaxe de la requête est incorrecte' + NotFound: + description: 'Ressource non trouvée' + NotAcceptable: + description: 'L''en-tête HTTP ''Accept'' contient une valeur non acceptée' + ServerError: + description: 'Erreur interne du serveur' + + AireDAttractionDesVilles200: + description: 'Opération réussie pour l''aire d''attraction' + content: + application/json: + schema: + $ref: '#/components/schemas/AireDAttractionDesVilles2020' + examples: + défaut: + $ref: '#/components/examples/AireDAttractionDesVilles2020' + application/xml: + schema: + $ref: '#/components/schemas/AireDAttractionDesVilles2020' + examples: + défaut: + $ref: '#/components/examples/AireDAttractionDesVilles2020' + AireDAttractionDesVillesListeDescendants200: + description: 'Opération réussie pour les descendants d''une aire d''attraction des villes' + content: + application/json: + schema: + $ref: '#/components/schemas/AireDAttractionDesVillesListeDescendants' + examples: + défaut: + $ref: '#/components/examples/AireDAttractionDesVillesListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/AireDAttractionDesVillesListeDescendants' + examples: + défaut: + $ref: '#/components/examples/AireDAttractionDesVillesListeDescendants' + AiresDAttractionDesVillesListe200: + description: 'Opération réussie pour les aires d''attraction' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeAiresDAttractionDesVilles2020' + examples: + défaut: + $ref: '#/components/examples/ListeAiresDAttractionDesVilles2020' + application/xml: + schema: + $ref: '#/components/schemas/ListeAiresDAttractionDesVilles2020' + examples: + défaut: + $ref: '#/components/examples/ListeAiresDAttractionDesVilles2020' + + ArrondissementListeAscendants200: + description: 'Opération réussie pour les ascendants d''un arrondissement' + content: + application/json: + schema: + $ref: '#/components/schemas/ArrondissementListeAscendants' + examples: + défaut: + $ref: '#/components/examples/ArrondissementListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/ArrondissementListeAscendants' + examples: + défaut: + $ref: '#/components/examples/ArrondissementListeAscendants' + Arrondissement200: + description: 'Opération réussie pour l''arrondissement' + content: + application/json: + schema: + $ref: '#/components/schemas/Arrondissement' + examples: + défaut: + $ref: '#/components/examples/Arrondissement' + application/xml: + schema: + $ref: '#/components/schemas/Arrondissement' + examples: + défaut: + $ref: '#/components/examples/Arrondissement' + ArrondissementListeDescendants200: + description: 'Opération réussie pour les descendants d''un arrondissement' + content: + application/json: + schema: + $ref: '#/components/schemas/ArrondissementListeDescendants' + examples: + défaut: + $ref: '#/components/examples/ArrondissementListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/ArrondissementListeDescendants' + examples: + défaut: + $ref: '#/components/examples/ArrondissementListeDescendants' + ArrondissementsListe200: + description: 'Opération réussie pour la liste des arrondissements' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeArrondissements' + examples: + défaut: + $ref: '#/components/examples/ListeArrondissements' + application/xml: + schema: + $ref: '#/components/schemas/ListeArrondissements' + examples: + défaut: + $ref: '#/components/examples/ListeArrondissements' + + ArrondissementMunicipalListeAscendants200: + description: 'Opération réussie pour les ascendants d''un arrondissement municipal' + content: + application/json: + schema: + $ref: '#/components/schemas/ArrondissementMunicipalListeAscendants' + examples: + défaut: + $ref: '#/components/examples/ArrondissementMunicipalListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/ArrondissementMunicipalListeAscendants' + examples: + défaut: + $ref: '#/components/examples/ArrondissementMunicipalListeAscendants' + ArrondissementMunicipal200: + description: 'Opération réussie pour l''arrondissement municipal' + content: + application/json: + schema: + $ref: '#/components/schemas/ArrondissementMunicipal' + examples: + défaut: + $ref: '#/components/examples/ArrondissementMunicipal' + application/xml: + schema: + $ref: '#/components/schemas/ArrondissementMunicipal' + examples: + défaut: + $ref: '#/components/examples/ArrondissementMunicipal' + ArrondissementsMunicipauxListe200: + description: 'Opération réussie pour les arrondissements municipaux' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeArrondissementsMunicipaux' + examples: + défaut: + $ref: '#/components/examples/ListeArrondissementsMunicipaux' + application/xml: + schema: + $ref: '#/components/schemas/ListeArrondissementsMunicipaux' + examples: + défaut: + $ref: '#/components/examples/ListeArrondissementsMunicipaux' + + + BassinDeVie200: + description: 'Opération réussie pour le bassin de vie' + content: + application/json: + schema: + $ref: '#/components/schemas/BassinDeVie2022' + examples: + défaut: + $ref: '#/components/examples/BassinDeVie2022' + application/xml: + schema: + $ref: '#/components/schemas/BassinDeVie2022' + examples: + défaut: + $ref: '#/components/examples/BassinDeVie2022' + BassinDeVieListeDescendants200: + description: 'Opération réussie pour les descendants d''un bassin de vie' + content: + application/json: + schema: + $ref: '#/components/schemas/BassinDeVieListeDescendants' + examples: + défaut: + $ref: '#/components/examples/BassinDeVieListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/BassinDeVieListeDescendants' + examples: + défaut: + $ref: '#/components/examples/BassinDeVieListeDescendants' + BassinsDeVieListe200: + description: 'Opération réussie pour les bassins de vie' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeBassinsDeVie' + examples: + défaut: + $ref: '#/components/examples/ListeBassinsDeVie' + application/xml: + schema: + $ref: '#/components/schemas/ListeBassinsDeVie' + examples: + défaut: + $ref: '#/components/examples/ListeBassinsDeVie' + + CantonListeAscendants200: + description: 'Opération réussie pour les ascendants d''un canton' + content: + application/json: + schema: + $ref: '#/components/schemas/CantonListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CantonListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/CantonListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CantonListeAscendants' + Canton200: + description: 'Opération réussie pour le canton' + content: + application/json: + schema: + $ref: '#/components/schemas/Canton' + examples: + défaut: + $ref: '#/components/examples/Canton' + application/xml: + schema: + $ref: '#/components/schemas/Canton' + examples: + défaut: + $ref: '#/components/examples/Canton' + CantonsListe200: + description: 'Opération réussie pour les cantons' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeCantons' + examples: + défaut: + $ref: '#/components/examples/ListeCantons' + application/xml: + schema: + $ref: '#/components/schemas/ListeCantons' + examples: + défaut: + $ref: '#/components/examples/ListeCantons' + + CantonOuVilleListeAscendants200: + description: 'Opération réussie pour les ascendants d''un canton-ou-ville' + content: + application/json: + schema: + $ref: '#/components/schemas/CantonOuVilleListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CantonOuVilleListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/CantonOuVilleListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CantonOuVilleListeAscendants' + CantonOuVille200: + description: 'Opération réussie pour le canton-ou-ville' + content: + application/json: + schema: + $ref: '#/components/schemas/CantonOuVille' + examples: + défaut: + $ref: '#/components/examples/CantonOuVille' + application/xml: + schema: + $ref: '#/components/schemas/CantonOuVille' + examples: + défaut: + $ref: '#/components/examples/CantonOuVille' + CantonOuVilleListeDescendants200: + description: 'Opération réussie pour les descendants d''un canton-ou-ville' + content: + application/json: + schema: + $ref: '#/components/schemas/CantonOuVilleListeDescendants' + examples: + défaut: + $ref: '#/components/examples/CantonOuVilleListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/CantonOuVilleListeDescendants' + examples: + défaut: + $ref: '#/components/examples/CantonOuVilleListeDescendants' + CantonsEtVilles200: + description: 'Opération réussie pour les cantons et villes' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeCantonsEtVilles' + examples: + défaut: + $ref: '#/components/examples/ListeCantonsEtVilles' + application/xml: + schema: + $ref: '#/components/schemas/ListeCantonsEtVilles' + examples: + défaut: + $ref: '#/components/examples/ListeCantonsEtVilles' + + CirconscriptionTerritorialeListeAscendants200: + description: 'Opération réussie pour les ascendants d''une circonscription territoriale' + content: + application/json: + schema: + $ref: '#/components/schemas/CirconscriptionTerritorialeListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CirconscriptionTerritorialeListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/CirconscriptionTerritorialeListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CirconscriptionTerritorialeListeAscendants' + + CirconscriptionTerritoriale200: + description: 'Opération réussie pour la circonscription territoriale' + content: + application/json: + schema: + $ref: '#/components/schemas/CirconscriptionTerritoriale' + examples: + défaut: + $ref: '#/components/examples/CirconscriptionTerritoriale' + application/xml: + schema: + $ref: '#/components/schemas/CirconscriptionTerritoriale' + examples: + défaut: + $ref: '#/components/examples/CirconscriptionTerritoriale' + + CollectiviteDOutreMer200: + description: 'Opération réussie pour la collectivité d''outre-mer' + content: + application/json: + schema: + $ref: '#/components/schemas/CollectiviteDOutreMer' + examples: + défaut: + $ref: '#/components/examples/CollectiviteDOutreMer' + application/xml: + schema: + $ref: '#/components/schemas/CollectiviteDOutreMer' + examples: + défaut: + $ref: '#/components/examples/CollectiviteDOutreMer' + CollectivitesDOutreMerListe200: + description: 'Opération réussie pour les collectivités d''outre-mer' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeCollectivitesDOutreMer' + examples: + défaut: + $ref: '#/components/examples/ListeCollectivitesDOutreMer' + application/xml: + schema: + $ref: '#/components/schemas/ListeCollectivitesDOutreMer' + examples: + défaut: + $ref: '#/components/examples/ListeCollectivitesDOutreMer' + + CommunesListe200: + description: 'Opération réussie' + content: + application/json: + schema: + $ref: '#/components/schemas/CommunesListe' + examples: + défaut: + $ref: '#/components/examples/CommunesListe' + application/xml: + schema: + $ref: '#/components/schemas/CommunesListe' + examples: + défaut: + $ref: '#/components/examples/CommunesListe' + Commune200: + description: 'Opération réussie' + content: + application/json: + schema: + $ref: '#/components/schemas/Commune' + examples: + défaut: + $ref: '#/components/examples/Commune' + application/xml: + schema: + $ref: '#/components/schemas/Commune' + examples: + défaut: + $ref: '#/components/examples/Commune' + CommuneListePrecedents200: + description: 'Opération réussie pour les communes précédentes' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneListePrecedents' + examples: + défaut: + $ref: '#/components/examples/CommuneListePrecedents' + application/xml: + schema: + $ref: '#/components/schemas/CommuneListePrecedents' + examples: + défaut: + $ref: '#/components/examples/CommuneListePrecedents' + CommuneListeProjetes200: + description: 'Opération réussie pour les projetés d''une commune' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneListeProjetes' + examples: + défaut: + $ref: '#/components/examples/CommuneListeProjetes' + application/xml: + schema: + $ref: '#/components/schemas/CommuneListeProjetes' + examples: + défaut: + $ref: '#/components/examples/CommuneListeProjetes' + CommuneListeSuivants200: + description: 'Opération réussie pour les successeurs d''une commune' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneListeSuivants' + examples: + défaut: + $ref: '#/components/examples/CommuneListeSuivants' + application/xml: + schema: + $ref: '#/components/schemas/CommuneListeSuivants' + examples: + défaut: + $ref: '#/components/examples/CommuneListeSuivants' + CommuneListeDescendants200: + description: 'Opération réussie pour les descendants d''une commune' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneListeDescendants' + examples: + défaut: + $ref: '#/components/examples/CommuneListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/CommuneListeDescendants' + examples: + défaut: + $ref: '#/components/examples/CommuneListeDescendants' + + CommuneListeAscendants200: + description: 'Opération réussie pour les ascendants d''une commune' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CommuneListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/CommuneListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CommuneListeAscendants' + + CommuneAssocieeListeAscendants200: + description: 'Opération réussie pour les ascendants d''une commune associée' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneAssocieeListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CommuneAssocieeListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/CommuneAssocieeListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CommuneAssocieeListeAscendants' + CommuneAssociee200: + description: 'Opération réussie pour la commune associée' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneAssociee' + examples: + défaut: + $ref: '#/components/examples/CommuneAssociee' + application/xml: + schema: + $ref: '#/components/schemas/CommuneAssociee' + examples: + défaut: + $ref: '#/components/examples/CommuneAssociee' + CommunesAssocieesListe200: + description: 'Opération réussie pour les communes associées' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeCommunesAssociees' + examples: + défaut: + $ref: '#/components/examples/ListeCommunesAssociees' + application/xml: + schema: + $ref: '#/components/schemas/ListeCommunesAssociees' + examples: + défaut: + $ref: '#/components/examples/ListeCommunesAssociees' + + CommuneDelegueeListeAscendants200: + description: 'Opération réussie pour les ascendants d''une commune déléguée' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneDelegueeListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CommuneDelegueeListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/CommuneDelegueeListeAscendants' + examples: + défaut: + $ref: '#/components/examples/CommuneDelegueeListeAscendants' + CommuneDeleguee200: + description: 'Opération réussie pour la commune déléguée' + content: + application/json: + schema: + $ref: '#/components/schemas/CommuneDeleguee' + examples: + défaut: + $ref: '#/components/examples/CommuneDeleguee' + application/xml: + schema: + $ref: '#/components/schemas/CommuneDeleguee' + examples: + défaut: + $ref: '#/components/examples/CommuneDeleguee' + CommunesDelegueesListe200: + description: 'Opération réussie pour les communes déléguées' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeCommunesDeleguees' + examples: + défaut: + $ref: '#/components/examples/ListeCommunesDeleguees' + application/xml: + schema: + $ref: '#/components/schemas/ListeCommunesDeleguees' + examples: + défaut: + $ref: '#/components/examples/ListeCommunesDeleguees' + + DepartementListeSuivants200: + description: 'Opération réussie pour les successeurs d''un département' + content: + application/json: + schema: + $ref: '#/components/schemas/DepartementListeSuivantsAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementListeSuivants' + application/xml: + schema: + $ref: '#/components/schemas/DepartementListeSuivantsAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementListeSuivants' + DepartementListeProjetes200: + description: 'Opération réussie pour les projetés d''un département' + content: + application/json: + schema: + $ref: '#/components/schemas/DepartementListeProjetesAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementListeProjetes' + application/xml: + schema: + $ref: '#/components/schemas/DepartementListeProjetesAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementListeProjetes' + DepartementListePrecedents200: + description: 'Opération réussie pour les départements précédents' + content: + application/json: + schema: + $ref: '#/components/schemas/DepartementListePrecedentsAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementListePrecedents' + application/xml: + schema: + $ref: '#/components/schemas/DepartementListePrecedentsAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementListePrecedents' + DepartementListeDescendants200: + description: 'Opération réussie pour les descendants d''un département' + content: + application/json: + schema: + $ref: '#/components/schemas/DepartementListeDescendants' + examples: + défaut: + $ref: '#/components/examples/DepartementListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/DepartementListeDescendants' + examples: + défaut: + $ref: '#/components/examples/DepartementListeDescendants' + DepartementListeAscendants200: + description: 'Opération réussie pour les ascendants d''un département' + content: + application/json: + schema: + $ref: '#/components/schemas/DepartementListeAscendants' + examples: + défaut: + $ref: '#/components/examples/DepartementListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/DepartementListeAscendants' + examples: + défaut: + $ref: '#/components/examples/DepartementListeAscendants' + DepartementsListe200: + description: 'Opération réussie pour la liste des départements' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeTerritoiresAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementsListe' + application/xml: + schema: + $ref: '#/components/schemas/ListeTerritoiresAvecChefLieu' + examples: + défaut: + $ref: '#/components/examples/DepartementsListe' + Departement200: + description: 'Opération réussie pour le département' + content: + application/json: + schema: + $ref: '#/components/schemas/Departement' + examples: + défaut: + $ref: '#/components/examples/Departement' + application/xml: + schema: + $ref: '#/components/schemas/Departement' + examples: + défaut: + $ref: '#/components/examples/Departement' + + DistrictListeAscendants200: + description: 'Opération réussie pour les ascendants d''un district' + content: + application/json: + schema: + $ref: '#/components/schemas/DistrictListeAscendants' + examples: + défaut: + $ref: '#/components/examples/DistrictListeAscendants' + application/xml: + schema: + $ref: '#/components/schemas/DistrictListeAscendants' + examples: + défaut: + $ref: '#/components/examples/DistrictListeAscendants' + District200: + description: 'Opération réussie pour le district' + content: + application/json: + schema: + $ref: '#/components/schemas/District' + examples: + défaut: + $ref: '#/components/examples/District' + application/xml: + schema: + $ref: '#/components/schemas/District' + examples: + défaut: + $ref: '#/components/examples/District' + + Intercommunalite200: + description: 'Opération réussie pour l''intercommunalité' + content: + application/json: + schema: + $ref: '#/components/schemas/Intercommunalite' + examples: + défaut: + $ref: '#/components/examples/Intercommunalite' + application/xml: + schema: + $ref: '#/components/schemas/Intercommunalite' + examples: + défaut: + $ref: '#/components/examples/Intercommunalite' + IntercommunaliteListeDescendants200: + description: 'Opération réussie pour les descendants d''une intercommunalite' + content: + application/json: + schema: + $ref: '#/components/schemas/IntercommunaliteListeDescendants' + examples: + défaut: + $ref: '#/components/examples/IntercommunaliteListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/IntercommunaliteListeDescendants' + examples: + défaut: + $ref: '#/components/examples/IntercommunaliteListeDescendants' + IntercommunalitesListe200: + description: 'Opération réussie pour les intercommunalités' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeIntercommunalites' + examples: + défaut: + $ref: '#/components/examples/ListeIntercommunalites' + application/xml: + schema: + $ref: '#/components/schemas/ListeIntercommunalites' + examples: + défaut: + $ref: '#/components/examples/ListeIntercommunalites' + + Iris200: + description: 'Opération réussie pour l''Iris' + content: + application/json: + schema: + $ref: '#/components/schemas/Iris' + examples: + défaut: + $ref: '#/components/examples/Iris' + application/xml: + schema: + $ref: '#/components/schemas/Iris' + examples: + défaut: + $ref: '#/components/examples/Iris' + + Pays200: + description: 'Opération réussie pour le pays' + content: + application/json: + schema: + $ref: '#/components/schemas/Pays' + examples: + défaut: + $ref: '#/components/examples/Pays' + application/xml: + schema: + $ref: '#/components/schemas/Pays' + examples: + défaut: + $ref: '#/components/examples/Pays' + PaysListeDescendants200: + description: 'Opération réussie pour les descendants d''un pays' + content: + application/json: + schema: + $ref: '#/components/schemas/PaysListeDescendants' + examples: + défaut: + $ref: '#/components/examples/PaysListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/PaysListeDescendants' + examples: + défaut: + $ref: '#/components/examples/PaysListeDescendants' + + PaysListe200: + description: 'Opération réussie pour la liste des pays' + content: + application/json: + schema: + $ref: '#/components/schemas/PaysListe' + examples: + défaut: + $ref: '#/components/examples/PaysListe' + application/xml: + schema: + $ref: '#/components/schemas/PaysListe' + examples: + défaut: + $ref: '#/components/examples/PaysListe' + + Region200: + description: 'Opération réussie pour la région' + content: + application/json: + schema: + $ref: '#/components/schemas/Region' + examples: + défaut: + $ref: '#/components/examples/Region' + application/xml: + schema: + $ref: '#/components/schemas/Region' + examples: + défaut: + $ref: '#/components/examples/Region' + RegionListeDescendants200: + description: 'Opération réussie pour les descendants d''une région' + content: + application/json: + schema: + $ref: '#/components/schemas/RegionListeDescendants' + examples: + défaut: + $ref: '#/components/examples/RegionListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/RegionListeDescendants' + examples: + défaut: + $ref: '#/components/examples/RegionListeDescendants' + RegionsListe200: + description: 'Opération réussie pour les régions' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeRegions' + examples: + défaut: + $ref: '#/components/examples/ListeRegions' + application/xml: + schema: + $ref: '#/components/schemas/ListeRegions' + examples: + défaut: + $ref: '#/components/examples/ListeRegions' + + UniteUrbaine200: + description: 'Opération réussie pour l''unité urbaine' + content: + application/json: + schema: + $ref: '#/components/schemas/UniteUrbaine2020' + examples: + défaut: + $ref: '#/components/examples/UniteUrbaine2020' + application/xml: + schema: + $ref: '#/components/schemas/UniteUrbaine2020' + examples: + défaut: + $ref: '#/components/examples/UniteUrbaine2020' + UniteUrbaineListeDescendants200: + description: 'Opération réussie pour les descendants d''une unité urbaine' + content: + application/json: + schema: + $ref: '#/components/schemas/UniteUrbaineListeDescendants' + examples: + défaut: + $ref: '#/components/examples/UniteUrbaineListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/UniteUrbaineListeDescendants' + examples: + défaut: + $ref: '#/components/examples/UniteUrbaineListeDescendants' + UnitesUrbainesListe200: + description: 'Opération réussie pour les unités urbaines' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeUnitesUrbaines' + examples: + défaut: + $ref: '#/components/examples/ListeUnitesUrbaines' + application/xml: + schema: + $ref: '#/components/schemas/ListeUnitesUrbaines' + examples: + défaut: + $ref: '#/components/examples/ListeUnitesUrbaines' + + + ZoneDEmploi200: + description: 'Opération réussie pour la zone d''emploi' + content: + application/json: + schema: + $ref: '#/components/schemas/ZoneDEmploi2020' + examples: + défaut: + $ref: '#/components/examples/ZoneDEmploi2020' + application/xml: + schema: + $ref: '#/components/schemas/ZoneDEmploi2020' + examples: + défaut: + $ref: '#/components/examples/ZoneDEmploi2020' + ZoneDEmploiListeDescendants200: + description: 'Opération réussie pour les descendants d''une zone d''emploi' + content: + application/json: + schema: + $ref: '#/components/schemas/ZoneDEmploiListeDescendants' + examples: + défaut: + $ref: '#/components/examples/ZoneDEmploiListeDescendants' + application/xml: + schema: + $ref: '#/components/schemas/ZoneDEmploiListeDescendants' + examples: + défaut: + $ref: '#/components/examples/ZoneDEmploiListeDescendants' + ZonesDEmploiListe200: + description: 'Opération réussie pour les zones d''emploi' + content: + application/json: + schema: + $ref: '#/components/schemas/ListeZonesDEmploi2020' + examples: + défaut: + $ref: '#/components/examples/ListeZonesDEmploi2020' + application/xml: + schema: + $ref: '#/components/schemas/ListeZonesDEmploi2020' + examples: + défaut: + $ref: '#/components/examples/ListeZonesDEmploi2020' + + + schemas: + TypeEnumDescendantsAireDAttractionDesVilles: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - ArrondissementMunicipal + example: 'Commune' + TypeEnumDescendantsArrondissement: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - ArrondissementMunicipal + example: 'CommuneDeleguee' + TypeEnumAscendantsArrondissement: + type: string + xml: + name: 'Type' + enum: + - Region + - Departement + example: 'Region' + TypeEnumAscendantsArrondissementMunicipal: + type: string + xml: + name: 'Type' + enum: + - Region + - Departement + - Arrondissement + - Commune + - AireDAttractionDesVilles2020 + - BassinDeVie2022 + - Canton + - CantonOuVille + - Intercommunalite + - UniteUrbaine2020 + - ZoneDEmploi2020 + example: 'Region' + TypeEnumAscendantsCanton: + type: string + xml: + name: 'Type' + enum: + - Region + - Departement + example: 'Region' + TypeEnumAscendantsCantonOuVille: + type: string + xml: + name: 'Type' + enum: + - Region + - Departement + example: 'Region' + TypeEnumAscendantsCirconscriptionTerritoriale: + type: string + xml: + name: 'Type' + enum: + - CollectiviteDOutreMer + example: 'CollectiviteDOutreMer' + Commune: + xml: + name: Commune + allOf: + - $ref: '#/components/schemas/TerritoireBase' + properties: + code: + $ref: '#/components/schemas/CodeCom' + TypeEnumAscendantsCommuneAssociee: + type: string + xml: + name: 'Type' + enum: + - Region + - Departement + - Arrondissement + - Commune + example: 'Region' + TypeEnumAscendantsCommuneDeleguee: + type: string + xml: + name: 'Type' + enum: + - Region + - Departement + - Arrondissement + - Commune + example: 'Region' + Departement: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Departement + properties: + code: + $ref: '#/components/schemas/CodeDep' + TerritoireBase: + required: + - code + - uri + - type + - dateCreation + - dateSuppression + - intituleSansArticle + - typeArticle + - intitule + xml: + name: TerritoireBase + properties: + code: + type: string + uri: + type: string + pattern: uri + xml: + attribute: true + type: + type: string + $ref: '#/components/schemas/TypeEnum' + dateCreation: + type: string + description: 'Date de création du territoire s''il n''existait pas au premier COG du 1er janvier 1943' + format: date + xml: + name: DateCreation + dateSuppression: + type: string + description: 'Date de suppression du territoire' + format: date + xml: + name: DateSuppression + intituleSansArticle: + xml: + name: IntituleSansArticle + type: string + typeArticle: + xml: + name: TypeArticle + type: string + enum: + - 0: + article: + charniere: 'De' + - 1: + article: + charniere: 'D''' + - 2: + article: 'Le' + charniere: 'Du' + - 3: + article: 'La' + charniere: 'De La' + - 4: + article: 'Les' + charniere: 'Des' + - 5: + article: 'L''' + charniere: 'De L''' + - 6: + article: 'Aux' + charniere: 'Des' + - 7: + article: 'Las' + charniere: 'De Las' + - 8: + article: 'Los' + charniere: 'De Los' + - X: + article: + charniere: + intitule: + type: string + xml: + name: Intitule + TerritoireBase_ChefLieu: + xml: + wrapped: true + name: TerritoireBase_AvecChefLieu + allOf: + - $ref: '#/components/schemas/TerritoireBase' + - type: object + required: + - chefLieu + properties: + chefLieu: + type: string + description: 'Chef-lieu du territoire' + xml: + name: ChefLieu + Territoire_TousAttributs: + xml: + wrapped: true + name: TerritoireBase_AvecTousLesAttributsPossibles + allOf: + - $ref: '#/components/schemas/TerritoireBase' + - type: object + required: + - chefLieu + - typeDIris + - categorieJuridique + - intituleComplet + - inclusion + properties: + chefLieu: + type: string + description: 'Chef-lieu du territoire' + xml: + name: ChefLieu + typeDIris: + type: string + description: 'Type d''iris' + xml: + name: typeDIris + categorieJuridique: + type: string + description: 'Catégorie juridique du territoire' + xml: + name: categorieJuridique + intituleComplet: + type: string + description: 'Intitulé complet du territoire' + xml: + name: intituleComplet + inclusion: + type: string + description: 'Inclusion' + xml: + name: inclusion + + DepartementListeDescendants: + description: 'Liste des descendants d''un département' + type: array + xml: + wrapped: true + name: DescendantsDepartement + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + DepartementListeAscendants: + description: 'Liste des ascendants d''un département' + type: array + xml: + wrapped: true + name: AscendantsDepartement + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + DepartementListeProjetesAvecChefLieu: + description: 'Liste des départements projetés' + type: array + xml: + wrapped: true + name: ListeDepartementsProjetes + items: + $ref: '#/components/schemas/TerritoireBase_ChefLieu' + DepartementListePrecedentsAvecChefLieu: + description: 'Liste des départements précédents' + type: array + xml: + wrapped: true + name: ListeDepartementsPrecedents + items: + $ref: '#/components/schemas/TerritoireBase_ChefLieu' + DepartementListeSuivantsAvecChefLieu: + description: 'Liste des départements qui succèdent au département' + type: array + xml: + wrapped: true + name: ListeDepartementsSuivants + items: + $ref: '#/components/schemas/TerritoireBase_ChefLieu' + + TypeEnumAscendantsDistrict: + type: string + xml: + name: 'Type' + enum: + - CollectiviteDOutreMer + example: 'CollectiviteDOutreMer' + + ListeTerritoiresAvecChefLieu: + description: 'Liste de territoires décrits avec chef-lieu' + type: array + xml: + wrapped: true + name: ListeTerritoiresChefLieu + items: + $ref: '#/components/schemas/TerritoireBase_ChefLieu' + TerritoireRef: + xml: + name: TerritoireRef + type: object + required: + - code + - territoireType + description: 'Références vers un territoire de n''importe quel type' + properties: + code: + type: string + description: 'Code identifiant un teritoire quelqconque' + territoireType: + $ref: '#/components/schemas/TypeEnum' + CodeCom: + pattern: '[0-9][0-9AB][0-9]{3}' + type: 'string' + xml: + attribute: true + example: '14475' + CodeDep: + description: 'Code d''un département' + pattern: '([013-8][0-9])|(2[0-9AB])|(9[0-5])|(97[1-6])' + type: string + xml: + attribute: true + example: '22' + CommunesListe: + description: 'Liste de communes' + type: array + xml: + wrapped: true + name: Communes + items: + $ref: '#/components/schemas/TerritoireBase' + CommuneListeDescendants: + description: 'Liste des descendants d''une commune' + type: array + xml: + wrapped: true + name: DescendantsCommune + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CommuneListeAscendants: + description: 'Liste des ascendants d''une commune' + type: array + xml: + wrapped: true + name: AscendantsCommune + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CommuneListePrecedents: + description: 'Liste des communes précédentes' + type: array + xml: + wrapped: true + name: ListeCommunesPrecedentes + items: + $ref: '#/components/schemas/TerritoireBase' + CommuneListeProjetes: + description: 'Liste des communes projetées' + type: array + xml: + wrapped: true + name: ListeCommunesProjetees + items: + $ref: '#/components/schemas/TerritoireBase' + CommuneListeSuivants: + description: 'Liste des communes qui succèdent à la commune' + type: array + xml: + wrapped: true + name: ListeCommunesSuivants + items: + $ref: '#/components/schemas/TerritoireBase' + Date1950ParDefaut: + description: 'date proposée par défaut' + type: date + xml: + attribute: true + example: '1950-01-01' + Date1945ParDefaut: + description: 'date proposée par défaut' + type: date + xml: + attribute: true + example: '1945-06-26' + TypeEnum: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Canton + - CantonOuVille + - Arrondissement + - ArrondissementMunicipal + - Departement + - Pays + - Region + - Intercommunalite + - District + - AireDAttractionDesVilles2020 + - BassinDeVie2022 + - CollectiviteDOutreMer + - CirconscriptionTerritoriale + - Iris + - ZoneDEmploi2020 + - UniteUrbaine2020 + - Territoire + example: 'Canton' + TypeEnumDescendantsDepartement: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - Arrondissement + - ArrondissementMunicipal + example: 'Arrondissement' + TypeEnumAscendantsDepartement: + type: string + xml: + name: 'Type' + enum: + - Region + example: 'Region' + TypeEnumDescendantsCommune: + type: string + xml: + name: 'Type' + enum: + - CommuneAssociee + - CommuneDeleguee + - Iris + - ArrondissementMunicipal + example: 'Arrondissement' + TypeEnumAscendantsCommune: + type: string + xml: + name: 'Type' + enum: + - Departement + - Region + - Arrondissement + - CollectiviteDOutreMer + - AireDAttractionDesVilles2020 + - BassinDeVie2022 + - Canton + - CantonOuVille + - Intercommunalite + - ZoneDEmploi2020 + example: 'Departement' + + AireDAttractionDesVilles2020: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Aire d'attraction + properties: + code: + $ref: '#/components/schemas/CodeAireDAttractionDesVilles' + CodeAireDAttractionDesVilles: + description: 'Code d''une aire d''attraction' + pattern: '[a-zA-Z0-9]{3}' + type: string + xml: + attribute: true + example: '062' + AireDAttractionDesVillesListeDescendants: + description: 'Liste des descendants d''une aire d''attraction des villes' + type: array + xml: + wrapped: true + name: DescendantsAireDAttractionDesVilles + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ListeAiresDAttractionDesVilles2020: + description: 'Liste des aires d''attraction des villes' + type: array + xml: + wrapped: true + name: ListeAiresDAttractionDesVilles2020 + items: + $ref: '#/components/schemas/AireDAttractionDesVilles2020' + + ArrondissementListeAscendants: + description: 'Liste des ascendants d''un arrondissement' + type: array + xml: + wrapped: true + name: AscendantsArrondissement + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + + Arrondissement: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Arrondissement + properties: + code: + $ref: '#/components/schemas/CodeArrondissement' + CodeArrondissement: + description: 'Code d''un arrondissement' + pattern: '[a-zA-Z0-9]{3,4}' + type: string + xml: + attribute: true + example: '674' + ArrondissementListeDescendants: + description: 'Liste des descendants d''un arrondissement' + type: array + xml: + wrapped: true + name: DescendantsArrondissement + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ListeArrondissements: + description: 'Liste des arrondissements' + type: array + xml: + wrapped: true + name: ListeArrondissements + items: + $ref: '#/components/schemas/Arrondissement' + + ArrondissementMunicipalListeAscendants: + description: 'Liste des ascendants d''un arrondissement municipal' + type: array + xml: + wrapped: true + name: AscendantsArrondissementMunicipal + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ArrondissementMunicipal: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Arrondissement municipal + properties: + code: + $ref: '#/components/schemas/CodeArrondissementMunicipal' + CodeArrondissementMunicipal: + description: 'Code d''un arrondissement municipal' + pattern: '[a-zA-Z0-9]{5}' + type: string + xml: + attribute: true + example: '69385' + ListeArrondissementsMunicipaux: + description: 'Liste des arrondissements municipaux' + type: array + xml: + wrapped: true + name: ListeArrondissementsMunicipaux + items: + $ref: '#/components/schemas/ArrondissementMunicipal' + + CommuneAssocieeListeAscendants: + description: 'Liste des ascendants d''une commune associée' + type: array + xml: + wrapped: true + name: AscendantsCommuneAssociee + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CommuneAssociee: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: CommuneAssociee + properties: + code: + $ref: '#/components/schemas/CodeCommuneAssociee' + ListeCommunesAssociees: + description: 'Liste des communes associées' + type: array + xml: + wrapped: true + name: ListeCommunesAssociees + items: + $ref: '#/components/schemas/CommuneAssociee' + + CommuneDelegueeListeAscendants: + description: 'Liste des ascendants d''une commune déléguée' + type: array + xml: + wrapped: true + name: AscendantsCommuneDeleguee + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CommuneDeleguee: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: CommuneDeleguee + properties: + code: + $ref: '#/components/schemas/CodeCommuneDeleguee' + ListeCommunesDeleguees: + description: 'Liste des communes déléguées' + type: array + xml: + wrapped: true + name: ListeCommunesDeleguees + items: + $ref: '#/components/schemas/CommuneDeleguee' + + CodeCommuneAssociee: + description: 'Code de la commune associée' + pattern: '([0-9]{5})' + type: string + xml: + attribute: true + example: '14463' + + CodeCommuneDeleguee: + description: 'Code de la commune déléguée' + pattern: '([0-9]{5})' + type: string + xml: + attribute: true + example: '46248' + + DistrictListeAscendants: + description: 'Liste des ascendants d''un district' + type: array + xml: + wrapped: true + name: AscendantsDistrict + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + District: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: District + properties: + code: + $ref: '#/components/schemas/CodeDistrict' + CodeDistrict: + description: 'Code du district' + pattern: '([0-9]{5})' + type: string + xml: + attribute: true + example: '98411' + + Intercommunalite: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: Intercommunalite + properties: + code: + $ref: '#/components/schemas/CodeInterco' + CodeInterco: + description: 'Code d''une intercommunalité' + pattern: '([0-9]{9})' + type: string + xml: + attribute: true + example: '240100883' + TypeEnumDescendantsIntercommunalite: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - ArrondissementMunicipal + example: 'Arrondissement' + IntercommunaliteListeDescendants: + description: 'Liste des descendants d''une intercommunalité' + type: array + xml: + wrapped: true + name: DescendantsIntercommunalite + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ListeIntercommunalites: + description: 'Liste des intercommunalités' + type: array + xml: + wrapped: true + name: ListeIntercommunalites + items: + $ref: '#/components/schemas/Intercommunalite' + + CodeIris: + description: 'Code d''une Iris' + pattern: '([0-9]{9})' + type: string + xml: + attribute: true + example: '010040101' + + Iris: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: Iris + properties: + code: + $ref: '#/components/schemas/CodeIris' + + Pays: + xml: + wrapped: true + name: Pays + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + - type: object + required: + - iso3166alpha2 + - iso3166alpha3 + - iso3166num + properties: + iso3166alpha2: + type: string + description: 'Code ISO 3166-1 alpha-2 du pays' + xml: + name: Iso3166alpha2 + iso3166alpha3: + type: string + description: 'Code ISO 3166-1 alpha-3 du pays' + xml: + name: Iso3166alpha3 + iso3166num: + type: string + description: 'Code ISO 3166-1 numérique du pays' + xml: + name: Iso3166num + code: + $ref: '#/components/schemas/CodePays' + CodePays: + description: 'Code d''un pays' + pattern: '^99[0-9]{3}$' + type: string + xml: + attribute: true + example: '99132' + PaysListeDescendants: + description: 'Liste des descendants d''un pays' + type: array + xml: + wrapped: true + name: DescendantsPays + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + PaysListe: + description: 'Liste des pays' + type: array + xml: + wrapped: true + name: ListePays + items: + $ref: '#/components/schemas/Pays' + + Region: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Region + properties: + code: + $ref: '#/components/schemas/CodeReg' + CodeReg: + description: 'Code d''une région' + pattern: '^(01|02|03|04|06|11|24|27|28|32|44|52|53|75|76|84|93|94)$' + type: string + xml: + attribute: true + example: '06' + RegionListeDescendants: + description: 'Liste des descendants d''une région' + type: array + xml: + wrapped: true + name: DescendantsRegion + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ListeRegions: + description: 'Liste des régions' + type: array + xml: + wrapped: true + name: ListeRegions + items: + $ref: '#/components/schemas/Region' + + UniteUrbaine2020: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: UniteUrbaine + properties: + code: + $ref: '#/components/schemas/CodeUniteUrbaine' + CodeUniteUrbaine: + description: 'Code d''une unité urbaine' + pattern: '^([0-9][0-9A-Z][0-9]{3})$' + type: string + xml: + attribute: true + example: '01121' + UniteUrbaineListeDescendants: + description: 'Liste des descendants d''une unité urbaine' + type: array + xml: + wrapped: true + name: DescendantsUniteUrbaine + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + TypeEnumDescendantsUniteUrbaine: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - Arrondissement + - ArrondissementMunicipal + example: 'Commune' + ListeUnitesUrbaines: + description: 'Liste des unités urbaines' + type: array + xml: + wrapped: true + name: ListeUnitesUrbaines + items: + $ref: '#/components/schemas/UniteUrbaine2020' + + BassinDeVie2022: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: Canton + properties: + code: + $ref: '#/components/schemas/CodeBassinDeVie' + CodeBassinDeVie: + description: 'Code d''un bassin de vie' + pattern: '[a-zA-Z0-9]{5}' + type: string + xml: + attribute: true + example: '01004' + TypeEnumDescendantsBassinDeVie: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - ArrondissementMunicipal + example: 'Commune' + BassinDeVieListeDescendants: + description: 'Liste des descendants d''un bassin de vie' + type: array + xml: + wrapped: true + name: DescendantsBassinDeVie + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ListeBassinsDeVie: + description: 'Liste des bassins de vie' + type: array + xml: + wrapped: true + name: ListeBassinsDeVie + items: + $ref: '#/components/schemas/BassinDeVie2022' + + CantonListeAscendants: + description: 'Liste des ascendants d''un canton' + type: array + xml: + wrapped: true + name: AscendantsCanton + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + Canton: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Canton + properties: + code: + $ref: '#/components/schemas/CodeCanton' + CodeCanton: + description: 'Code d''un canton' + pattern: '[0-9]{4}|[0-9]{5}|2[ABab][0-9]{2}' + type: string + xml: + attribute: true + example: '0101' + ListeCantons: + description: 'Liste des cantons' + type: array + xml: + wrapped: true + name: ListeCantons + items: + $ref: '#/components/schemas/Canton' + + CantonOuVilleListeAscendants: + description: 'Liste des ascendants d''un canton-ou-ville' + type: array + xml: + wrapped: true + name: AscendantsCantonOuVille + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CantonOuVilleListeDescendants: + description: 'Liste des descendants d''un canton-ou-ville' + type: array + xml: + wrapped: true + name: DescendantsCantonOuVille + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CantonOuVille: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: Canton + properties: + code: + $ref: '#/components/schemas/CodeCantonOuVille' + CodeCantonOuVille: + description: 'Code d''un canton-ou-ville' + pattern: '[0-9]{4,5}' + type: string + xml: + attribute: true + example: '0101' + TypeEnumDescendantsCantonOuVille: + type: string + xml: + name: 'Type' + enum: + - Commune + - Iris + example: 'Commune' + ListeCantonsEtVilles: + description: 'Liste des cantons et villes' + type: array + xml: + wrapped: true + name: ListeCantonsEtVilles + items: + $ref: '#/components/schemas/CantonOuVille' + + CirconscriptionTerritorialeListeAscendants: + description: 'Liste des ascendants d''une circonscription territoriale' + type: array + xml: + wrapped: true + name: AscendantsCirconscriptionTerritoriale + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + CirconscriptionTerritoriale: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: Circonscription territoriale + properties: + code: + $ref: '#/components/schemas/CodeCirconscriptionTerritoriale' + CodeCirconscriptionTerritoriale: + description: 'Code d''une circonscription territoriale' + pattern: '[a-zA-Z0-9]{5}' + type: string + xml: + attribute: true + example: '98611' + + CollectiviteDOutreMer: + allOf: + - $ref: '#/components/schemas/Territoire_TousAttributs' + xml: + name: CollectiviteDOutreMer + properties: + code: + $ref: '#/components/schemas/CodeCollectiviteDOutreMer' + CodeCollectiviteDOutreMer: + description: 'Code d''une collectivité d''outre-mer' + pattern: '[a-zA-Z0-9]{3}' + type: string + xml: + attribute: true + example: '988' + ListeCollectivitesDOutreMer: + description: 'Liste des collectivités d''outre-mer' + type: array + xml: + wrapped: true + name: ListeCollectivitesDOutreMer + items: + $ref: '#/components/schemas/CollectiviteDOutreMer' + + TypeEnumDescendantsPays: + type: string + xml: + name: 'Type' + enum: + - Territoire + example: 'Territoire' + TypeEnumDescendantsRegion: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - Arrondissement + - ArrondissementMunicipal + - Departement + - Canton + - CantonOuVille + example: 'Commune' + TypeEnumDescendantsZoneDEmploi: + type: string + xml: + name: 'Type' + enum: + - Commune + - CommuneAssociee + - CommuneDeleguee + - Iris + - Arrondissement + - ArrondissementMunicipal + + ZoneDEmploi2020: + allOf: + - $ref: '#/components/schemas/TerritoireBase_ChefLieu' + xml: + name: ZoneDEmploi + properties: + code: + $ref: '#/components/schemas/CodeZoneDEmploi' + CodeZoneDEmploi: + description: 'Code d''une zone d''emploi' + pattern: '[0-9]{4}' + type: string + xml: + attribute: true + example: '2415' + ZoneDEmploiListeDescendants: + description: 'Liste des descendants d''une zone d''emploi' + type: array + xml: + wrapped: true + name: DescendantsZoneDEmploi + items: + $ref: '#/components/schemas/Territoire_TousAttributs' + ListeZonesDEmploi2020: + description: 'Liste des zones d''emploi' + type: array + xml: + wrapped: true + name: ListeZonesDEmploi + items: + $ref: '#/components/schemas/ZoneDEmploi2020' \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2e424e05..a823cb69 100644 --- a/pom.xml +++ b/pom.xml @@ -1,297 +1,298 @@ - 4.0.0 - fr.insee.rmes - metadata-api - war - Implementation of the RMéS metadata API - 3.8.4 - - 17 - ${java.version} - ${java.version} - 4.0.0-M1 - 2.17.2 - 6.1.0 - 2.18.0 - 2.2.22 - 5.10.3 - 5.12.0 - 2.3.32 - 2.10.0 - UTF-8 - UTF-8 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 + + org.springframework.boot + spring-boot-dependencies + 3.4.2 + + fr.insee.rmes + metadata-api-parent + pom + Implementation of the RMéS metadata API + 3.8.4 + + 21 + ${java.version} + ${java.version} + 4.0.0-M1 + 2.17.2 + 6.1.0 + 2.18.0 + 2.2.22 + 5.12.0 + 2.3.34 + 2.10.0 + 7.11.0 + 0.2.6 + 10.0.0 + UTF-8 + UTF-8 - - - src/main/java/fr/insee/rmes/queries/**/*, - src/main/java/fr/insee/rmes/modeles/**/*, - src/main/java/fr/insee/rmes/utils/XmlUtils.java - - ${project.groupId}:${project.artifactId} - Metadata-API - jacoco - jacoco + + src/main/java/fr/insee/rmes/queries/**/*, + src/main/java/fr/insee/rmes/modeles/**/*, + src/main/java/fr/insee/rmes/utils/XmlUtils.java + + ${project.groupId}:${project.artifactId} + Metadata-API + jacoco + jacoco reuseReports java - 3.9.0.2155 - 0.8.7 - -Xms256m -Xmx512m -ea -Dfile.encoding=UTF-8 + 3.9.0.2155 + 0.8.7 + -Xms256m -Xmx512m -ea -Dfile.encoding=UTF-8 + + + + + + + + org.junit + junit-bom + ${junit-jupiter.version} + pom + import + + + jakarta.ws.rs + jakarta.ws.rs-api + 3.1.0 + + + org.glassfish.jersey.core + jersey-server + ${jersey.version} + + + org.glassfish.jersey.containers + jersey-container-servlet + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-moxy + ${jersey.version} + + + org.glassfish.jersey.inject + jersey-hk2 + ${jersey.version} + + + org.glassfish.jersey.media + jersey-media-multipart + ${jersey.version} + + + + + org.apache.logging.log4j + log4j-core + 2.23.1 + + + org.apache.logging.log4j + log4j-jakarta-web + 2.23.1 + + + org.apache.logging.log4j + log4j-slf4j18-impl + ${log.version} + + + + org.junit.jupiter + junit-jupiter-engine + test + + + + org.junit.jupiter + junit-jupiter-params + test + + + org.mockito + mockito-junit-jupiter + ${mockito.version} + test + + + org.mockito + mockito-core + ${mockito.version} + test + + + org.xmlunit + xmlunit-core + ${xmlunit.version} + test + + - - - - - org.glassfish.jersey.core - jersey-server - ${jersey.version} - - - org.glassfish.jersey.containers - jersey-container-servlet - ${jersey.version} - - - org.glassfish.jersey.media - jersey-media-moxy - ${jersey.version} - - - org.glassfish.jersey.inject - jersey-hk2 - ${jersey.version} - - - org.glassfish.jersey.media - jersey-media-multipart - ${jersey.version} - + + + com.fasterxml.jackson.dataformat + jackson-dataformat-csv + ${jackson.version} + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + ${jackson.version} + + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-json-provider + 2.17.2 + - - - org.apache.logging.log4j - log4j-core - 2.23.1 - - - org.apache.logging.log4j - log4j-jakarta-web - 2.23.1 - - - org.apache.logging.log4j - log4j-slf4j18-impl - ${log.version} - - - - org.junit.jupiter - junit-jupiter-engine - ${junit.version} - test - + + com.fasterxml.jackson.jakarta.rs + jackson-jakarta-rs-xml-provider + 2.17.2 + + + jakarta.servlet + jakarta.servlet-api + ${jakarta.version} + + + jakarta.xml.bind + jakarta.xml.bind-api + 4.0.2 + + + org.eclipse.persistence + org.eclipse.persistence.moxy + 4.0.4 + runtime + + + jakarta.validation + jakarta.validation-api + 3.1.0 + + + + jakarta.activation + jakarta.activation-api + 2.1.3 + runtime + + + org.glassfish.jaxb + jaxb-runtime + 4.0.5 + + + + io.swagger.core.v3 + swagger-core-jakarta + ${swagger.version} + + + jersey-container-servlet-core + org.glassfish.jersey.containers + + + + + io.swagger.core.v3 + swagger-jaxrs2-jakarta + ${swagger.version} + + + joda-time + joda-time + 2.12.7 + - - org.junit.jupiter - junit-jupiter-params - ${junit.version} - test - - - org.mockito - mockito-junit-jupiter - ${mockito.version} - test - - - org.mockito - mockito-core - ${mockito.version} - test - - - org.xmlunit - xmlunit-core - ${xmlunit.version} - test - + + + org.freemarker + freemarker + ${freemarker.version} + - - - com.fasterxml.jackson.dataformat - jackson-dataformat-csv - ${jackson.version} - - - - com.fasterxml.jackson.dataformat - jackson-dataformat-xml - ${jackson.version} - - - com.fasterxml.jackson.jakarta.rs - jackson-jakarta-rs-json-provider - 2.17.2 - + + org.apache.commons + commons-text + 1.11.0 + - - com.fasterxml.jackson.jakarta.rs - jackson-jakarta-rs-xml-provider - 2.17.2 - - - jakarta.servlet - jakarta.servlet-api - ${jakarta.version} - - - jakarta.xml.bind - jakarta.xml.bind-api - 4.0.2 - - - org.eclipse.persistence - org.eclipse.persistence.moxy - 4.0.4 - runtime - - - jakarta.validation - jakarta.validation-api - 3.1.0 - - - - jakarta.activation - jakarta.activation-api - 2.1.3 - runtime - - - org.glassfish.jaxb - jaxb-runtime - 4.0.5 - - - - io.swagger.core.v3 - swagger-core-jakarta - ${swagger.version} - - - jersey-container-servlet-core - org.glassfish.jersey.containers - - - - - io.swagger.core.v3 - swagger-jaxrs2-jakarta - ${swagger.version} - - - joda-time - joda-time - 2.12.7 - + + jakarta.platform + jakarta.jakartaee-web-api + ${jakartaee-web-api.version} + + + org.openapitools + jackson-databind-nullable + ${jackson-databind-nullable.version} + + + - - - org.freemarker - freemarker - ${freemarker.version} - - - - org.apache.commons - commons-text - 1.11.0 - - + + + + + org.apache.maven.plugins + maven-war-plugin + 3.3.2 + + + org.sonarsource.scanner.maven + sonar-maven-plugin + ${version.maven-sonar} + + + org.jacoco + jacoco-maven-plugin + ${version.maven-jacoco} + + + + prepare-agent + + + + jacoco-site + test + + report + + + + - - src/main/java - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-war-plugin - 3.3.2 - - - org.sonarsource.scanner.maven - sonar-maven-plugin - ${version.maven-sonar} - - - org.jacoco - jacoco-maven-plugin - ${version.maven-jacoco} - - - - prepare-agent - - - - jacoco-site - test - - report - - - - - - - - - - - - io.openapitools.swagger - swagger-maven-plugin - 2.1.5 - - - fr.insee.rmes.api - - true - target/ - openapi - JSON,YAML - true - fr.insee.rmes.config - UTF-8 - - - - - generate - - - - - - - - - - maven_central - Maven Central - https://repo.maven.apache.org/maven2/ - - + + + + + + maven_central + Maven Central + https://repo.maven.apache.org/maven2/ + + + + oas + interface + impl + diff --git a/src/main/java/fr/insee/rmes/api/AbstractMetadataApi.java b/src/main/java/fr/insee/rmes/api/AbstractMetadataApi.java deleted file mode 100644 index f0bae435..00000000 --- a/src/main/java/fr/insee/rmes/api/AbstractMetadataApi.java +++ /dev/null @@ -1,62 +0,0 @@ -package fr.insee.rmes.api; - -import java.util.Arrays; -import java.util.Optional; -import java.util.stream.Stream; - -import jakarta.ws.rs.core.MediaType; - -import fr.insee.rmes.utils.CSVUtils; -import fr.insee.rmes.utils.ResponseUtils; -import fr.insee.rmes.utils.SparqlUtils; -import io.swagger.v3.oas.annotations.responses.ApiResponse; -import io.swagger.v3.oas.annotations.responses.ApiResponses; - -@ApiResponses(value = { - @ApiResponse(responseCode = "200", description = "Opération réussie"), - @ApiResponse(responseCode = "400", description = "La syntaxe de la requête est incorrecte"), - @ApiResponse(responseCode = "401", description = "Une authentification est nécessaire pour accéder à la ressource"), - @ApiResponse(responseCode = "404", description = "Ressource non trouvée"), - @ApiResponse(responseCode = "406", description = "L'en-tête HTTP 'Accept' contient une valeur non acceptée"), - @ApiResponse(responseCode = "500", description = "Erreur interne du serveur") -}) -public abstract class AbstractMetadataApi { - - protected static final String ARRAY = "array"; - - protected SparqlUtils sparqlUtils; - - protected CSVUtils csvUtils; - - protected ResponseUtils responseUtils; - - protected AbstractMetadataApi() { - - this(new SparqlUtils(), new CSVUtils(), new ResponseUtils()); - } - - protected AbstractMetadataApi(SparqlUtils sparqlUtils, CSVUtils csvUtils, ResponseUtils responseUtils) { - this.sparqlUtils=sparqlUtils; - this.csvUtils=csvUtils; - this.responseUtils=responseUtils; - } - - /** - * @param header from the url contains the list of headers accepted - * @return the first valid header - */ - protected String getFirstValidHeader(String header) { - - Stream stream = Arrays.stream(header.split(",")); - Optional validHeader = - stream.filter(s -> s.equals(MediaType.APPLICATION_JSON) || s.equals(MediaType.APPLICATION_XML)).findFirst(); - - if (validHeader.isPresent()) { - return validHeader.get(); - } - else { - return header; - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/DescribeApi.java b/src/main/java/fr/insee/rmes/api/DescribeApi.java deleted file mode 100644 index a7a997a4..00000000 --- a/src/main/java/fr/insee/rmes/api/DescribeApi.java +++ /dev/null @@ -1,77 +0,0 @@ -package fr.insee.rmes.api; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import org.apache.commons.lang3.StringUtils; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.media.Schema; -import org.apache.commons.text.StringEscapeUtils; - -import java.net.URI; -import java.net.URISyntaxException; - -@Path("/technicalService") -public class DescribeApi extends AbstractMetadataApi { - - @GET - @Path("/describe") - @Produces(MediaType.APPLICATION_JSON) - @Operation(operationId = "describeUri", summary = "Service pour déréférencer une URI") - public Response describeUri( - @Parameter(required = true, description = "Iri à déréférencer", schema = @Schema(type = "string")) @QueryParam("uri") String uri, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String acceptHeader) { - - // Validation de l'URI - if (StringUtils.isEmpty(uri) || !isValidUri(uri)) { - return Response.status(Status.BAD_REQUEST).entity("Invalid URI").build(); - } - - // Exécution de la requête ASK - Boolean result = sparqlUtils.executeAskQuery("ASK WHERE { { <" + escapeSparql(uri) + "> ?p ?o . } UNION { ?s ?p <" + escapeSparql(uri) + "> . }} "); - - if (Boolean.FALSE.equals(result)) { - return Response.status(Status.NOT_FOUND).entity("URI not found").build(); - } else { - // Récupération de la description et encodage du résultat - String queryResult = sparqlUtils.executeSparqlQuery("DESCRIBE <" + escapeSparql(uri) + ">", sanitizeHeader(acceptHeader)); - return Response.ok(encodeForJson(queryResult)).build(); - } - } - - // Méthode pour valider l'URI - private boolean isValidUri(String uri) { - try { - new URI(uri); - return true; - } catch (URISyntaxException e) { - return false; - } - } - - // Échappement des caractères spéciaux dans les requêtes SPARQL - private String escapeSparql(String input) { - return input.replace("\"", "\\\"").replace("<", "\\u003C").replace(">", "\\u003E"); - } - - // Encodage des résultats pour JSON afin de prévenir XSS - private String encodeForJson(String input) { - return StringEscapeUtils.escapeJson(input); - } - - // Sanitize du header - private String sanitizeHeader(String header) { - return header != null ? header.replaceAll("[\n\r]", "") : ""; - } -} - - diff --git a/src/main/java/fr/insee/rmes/api/HealthcheckApi.java b/src/main/java/fr/insee/rmes/api/HealthcheckApi.java deleted file mode 100644 index 120a607d..00000000 --- a/src/main/java/fr/insee/rmes/api/HealthcheckApi.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.insee.rmes.api; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import org.apache.commons.lang3.StringUtils; - -@Path("/healthcheck") -public class HealthcheckApi extends AbstractMetadataApi { - - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - public Response getHealthcheck() { - if (StringUtils.isEmpty(sparqlUtils.executeSparqlQuery("SELECT * { ?s a ?t } LIMIT 1"))) { - return Response.serverError().build(); - } - return Response.ok().build(); - } -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/api/classifications/ClassificationApi.java b/src/main/java/fr/insee/rmes/api/classifications/ClassificationApi.java deleted file mode 100644 index d9b32666..00000000 --- a/src/main/java/fr/insee/rmes/api/classifications/ClassificationApi.java +++ /dev/null @@ -1,113 +0,0 @@ -package fr.insee.rmes.api.classifications; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Function; -import java.util.stream.Collectors; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import io.swagger.v3.oas.annotations.extensions.Extension; -import io.swagger.v3.oas.annotations.extensions.ExtensionProperty; -import org.apache.commons.lang3.StringUtils; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.classification.Poste; -import fr.insee.rmes.modeles.classification.PosteJson; -import fr.insee.rmes.modeles.classification.PosteXml; -import fr.insee.rmes.modeles.classification.Postes; -import fr.insee.rmes.queries.classifications.ClassificationsQueries; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Hidden -@Path("/nomenclature") -@Tag(name = "nomenclatures", description = "Nomenclatures API") -public class ClassificationApi extends AbstractMetadataApi { - - - @GET - @Path("/{code}/postes") - @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) - @Operation(operationId = "getClassificationByCode", summary = "Liste des postes d'une nomenclature (autres que \"catégories juridiques\")", responses = { - @ApiResponse(description = "Liste des postes de la nomenclature", content = { - @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = ARRAY, implementation = PosteJson.class)), - @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(type = ARRAY, implementation = PosteXml.class)) }) }) - public Response getClassificationByCode( - @Parameter(required = true, description = "Identifiant de la nomenclature (hors cj)", example = "nafr2") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam(value = HttpHeaders.ACCEPT) String header) { - - final String csvResult = sparqlUtils.executeSparqlQuery(ClassificationsQueries.getClassification(code)); - final List itemsList = csvUtils.populateMultiPOJO(csvResult, Poste.class); - - if (itemsList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } else if (header.equals(MediaType.APPLICATION_XML)) { - final List itemsListXml = csvUtils.populateMultiPOJO(csvResult, PosteXml.class); - return Response.ok(responseUtils.produceResponse(new Postes(itemsListXml), header)).build(); - } else { - final List itemsListJson = csvUtils.populateMultiPOJO(csvResult, PosteJson.class); - return Response.ok(responseUtils.produceResponse(itemsListJson, header)).build(); - } - } - - @Hidden - @GET - @Path("/{code}/arborescence") - @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) - @Operation(operationId = "getClassificationTreeByCode", summary = "Liste des postes d'une nomenclature (autres que \"catégories juridiques\")", responses = { - @ApiResponse(description = "Liste des postes de la nomenclature", content = { - @Content(mediaType = MediaType.APPLICATION_JSON, schema = @Schema(type = ARRAY, implementation = PosteJson.class)), - @Content(mediaType = MediaType.APPLICATION_XML, schema = @Schema(type = ARRAY, implementation = PosteXml.class)) }) }) - public Response getClassificationTreeByCode( - @Parameter(required = true, description = "Identifiant de la nomenclature (hors cj)", example = "nafr2") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam(value = HttpHeaders.ACCEPT) String header) { - - final String csvResult = sparqlUtils.executeSparqlQuery(ClassificationsQueries.getClassification(code)); - final List itemsList = csvUtils.populateMultiPOJO(csvResult, Poste.class); - - if (itemsList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - - if (header.equals(MediaType.APPLICATION_XML)) { - final List root = this.getTree(csvResult, PosteXml.class); - return Response.ok(responseUtils.produceResponse(new Postes(root), header)).build(); - } else { - final List root = this.getTree(csvResult, PosteJson.class); - return Response.ok(responseUtils.produceResponse(new Postes(root), header)).build(); - } - } - - private

List

getTree(String csvResult, Class

posteClass) { - final List

root = new ArrayList<>(); - final List

liste = csvUtils.populateMultiPOJO(csvResult, posteClass); - final Map postes = liste.stream() - .collect(Collectors.toMap(p -> ((Poste) p).getCode(), Function.identity())); - - for (final P poste : liste) { - if (StringUtils.isNotEmpty(((Poste) poste).getCodeParent())) { - final P posteParent = postes.get(((Poste) poste).getCodeParent()); - ((Poste) posteParent).addPosteEnfant((Poste) poste); - } else { - root.add(poste); - } - } - return root; - } - -} diff --git a/src/main/java/fr/insee/rmes/api/classifications/ClassificationsApi.java b/src/main/java/fr/insee/rmes/api/classifications/ClassificationsApi.java deleted file mode 100644 index 50e7714a..00000000 --- a/src/main/java/fr/insee/rmes/api/classifications/ClassificationsApi.java +++ /dev/null @@ -1,60 +0,0 @@ -package fr.insee.rmes.api.classifications; - -import java.util.List; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.classification.Classification; -import fr.insee.rmes.modeles.classification.Classifications; -import fr.insee.rmes.queries.classifications.ClassificationsQueries; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Hidden -@Path("/nomenclatures") -@Tag(name = "nomenclatures", description = "Nomenclatures API") -public class ClassificationsApi extends AbstractMetadataApi { - - @Hidden - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getAllClassifications", - summary = "Liste des nomenclatures disponibles (autres que \"catégories juridiques\")", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Classification.class)), description="Liste de nomenclatures") - }) - public Response getAllClassifications( - @Parameter(hidden = true) @HeaderParam(value = HttpHeaders.ACCEPT) String header) { - - String csvResult = sparqlUtils.executeSparqlQuery(ClassificationsQueries.getAllClassifications()); - List itemsList = csvUtils.populateMultiPOJO(csvResult, Classification.class); - - if (itemsList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else if (header.equals(MediaType.APPLICATION_XML)) { - return Response.ok(responseUtils.produceResponse(new Classifications(itemsList), header)).build(); - } - else { - return Response.ok(responseUtils.produceResponse(itemsList, header)).build(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/classifications/CodesAPI.java b/src/main/java/fr/insee/rmes/api/classifications/CodesAPI.java deleted file mode 100644 index c334ca21..00000000 --- a/src/main/java/fr/insee/rmes/api/classifications/CodesAPI.java +++ /dev/null @@ -1,331 +0,0 @@ -package fr.insee.rmes.api.classifications; - -import java.util.List; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import fr.insee.rmes.modeles.utils.Date; -import org.joda.time.DateTime; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.classification.Activite; -import fr.insee.rmes.modeles.classification.Activites; -import fr.insee.rmes.modeles.classification.cj.CategorieJuridique; -import fr.insee.rmes.modeles.classification.cj.CategorieJuridiqueNiveauII; -import fr.insee.rmes.modeles.classification.cj.CategorieJuridiqueNiveauIII; -import fr.insee.rmes.modeles.classification.cj.CategoriesJuridiques; -import fr.insee.rmes.modeles.classification.na1973.GroupeNA1973; -import fr.insee.rmes.modeles.classification.naf1993.ClasseNAF1993; -import fr.insee.rmes.modeles.classification.naf2003.ClasseNAF2003; -import fr.insee.rmes.modeles.classification.naf2008.ClasseNAF2008; -import fr.insee.rmes.modeles.classification.naf2008.SousClasseNAF2008; -import fr.insee.rmes.queries.classifications.ActivitesQueries; -import fr.insee.rmes.queries.classifications.CJQueries; -import fr.insee.rmes.queries.classifications.Na1973Queries; -import fr.insee.rmes.queries.classifications.Naf1993Queries; -import fr.insee.rmes.queries.classifications.Naf2003Queries; -import fr.insee.rmes.queries.classifications.Naf2008Queries; -import fr.insee.rmes.utils.DateUtils; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path("/codes") -@Tag(name = "nomenclatures", description = "Nomenclatures API") -public class CodesAPI extends AbstractMetadataApi { - - - @Path("/cj/n2/{code: [0-9]{2}}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = "getcjn2", summary = "Informations sur une catégorie juridique de niveau 2", responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = CategorieJuridiqueNiveauII.class)), description="Catégorie juridique de niveau 2") - }) - public Response getCategorieJuridiqueNiveauII( - @Parameter( - required = true, - description = "Identifiant de la catégorie juridique de niveau 2 (deux chiffres)", example="10") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - CategorieJuridiqueNiveauII cjNiveau2 = new CategorieJuridiqueNiveauII(code); - String csvResult = sparqlUtils.executeSparqlQuery(CJQueries.getCategorieJuridiqueNiveauII(code)); - cjNiveau2 = (CategorieJuridiqueNiveauII) csvUtils.populatePOJO(csvResult, cjNiveau2); - - if (cjNiveau2.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(cjNiveau2, header)).build(); - } - - @Path("/cj/n3/{code: [0-9]{4}}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = "getcjn3", summary = "Informations sur une catégorie juridique de niveau 3", responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = CategorieJuridiqueNiveauIII.class)), description="Catégorie juridique de niveau 3") - }) - public Response getCategorieJuridiqueNiveauIII( - @Parameter( - required = true, - description = "Identifiant de la catégorie juridique de niveau 3 (quatre chiffres)", example="7112") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - - CategorieJuridiqueNiveauIII cjNiveau3 = new CategorieJuridiqueNiveauIII(code); - String csvResult = sparqlUtils.executeSparqlQuery(CJQueries.getCategorieJuridiqueNiveauIII(code)); - cjNiveau3 = (CategorieJuridiqueNiveauIII) csvUtils.populatePOJO(csvResult, cjNiveau3); - - if (cjNiveau3.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(cjNiveau3, header)).build(); - } - - @Hidden - @Path("/cj") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getcj", - summary = "Informations sur une catégorie juridique identifiée par son code et une date", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = CategoriesJuridiques.class)), description="Catégorie juridique") - }) - public Response getCategoriesJuridiques( - @Parameter(required = true, description = "Code de la catégorie juridique", example="5307") @QueryParam("code") String code, - @Parameter( - description = "Date à laquelle la catégorie juridique est valide (Format : 'AAAA-MM-JJ' ; '*' pour obtenir tout l'historique ; paramètre absent pour la date du jour)", example="2020-05-11") @QueryParam("date") Date date, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - String csvResult = ""; - if (date == null) { - csvResult = sparqlUtils.executeSparqlQuery(CJQueries.getCJByCode(code)); - } - else if ("*".equals(date.getString())) { - csvResult = sparqlUtils.executeSparqlQuery(CJQueries.getCJ(code)); - } - else { - if ( ! DateUtils.isValidDate(date.getString())) { - return Response.status(Status.BAD_REQUEST).entity("").build(); - } - DateTime dt = DateUtils.getDateTimeFromDateString(date.getString()); - csvResult = sparqlUtils.executeSparqlQuery(CJQueries.getCJByCodeAndDate(code, dt)); - } - - List cjList = csvUtils.populateMultiPOJO(csvResult, CategorieJuridique.class); - - // sub query return ,,,, result. So check list size and first element is not empty - if (cjList.isEmpty() || cjList.get(0).getCode().equals("")) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else if (header.equals(MediaType.APPLICATION_XML)) { - return Response.ok(responseUtils.produceResponse(new CategoriesJuridiques(cjList), header)).build(); - } - else { - return Response.ok(responseUtils.produceResponse(cjList, header)).build(); - } - } - - @Path("/nafr2/sousClasse/{code: [0-9]{2}\\.[0-9]{2}[A-Z]}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getnafr2n5", - summary = "Informations sur une sous-classe de la NAF rév.2 identifiée par son code", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = SousClasseNAF2008.class)), description="Sous-classe de la NAF") - }) - public Response getSousClasseNAF2008( - @Parameter( - required = true, - description = "Code de la sous-classe (deux chiffres, un point, deux chiffres et une lettre majuscule)", example="33.16Z") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - SousClasseNAF2008 sousClasse = new SousClasseNAF2008(code); - String csvResult = sparqlUtils.executeSparqlQuery(Naf2008Queries.getSousClasseNAF2008(code)); - sousClasse = (SousClasseNAF2008) csvUtils.populatePOJO(csvResult, sousClasse); - - if (sousClasse.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(sousClasse, header)).build(); - } - - @Path("/nafr2/classe/{code: [0-9]{2}\\.[0-9]{2}}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getnafr2n4", - summary = "Informations sur une classe de la NAF rév.2 identifiée par son code", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = ClasseNAF2008.class)), description="Classe de la NAF") - }) - public Response getClasseNAF2008( - @Parameter( - required = true, - description = "Code de la classe (deux chiffres, un point, deux chiffres)", example = "46.66") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - ClasseNAF2008 classe = new ClasseNAF2008(code); - String csvResult = sparqlUtils.executeSparqlQuery(Naf2008Queries.getClasseNAF2008(code)); - classe = (ClasseNAF2008) csvUtils.populatePOJO(csvResult, classe); - - if (classe.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(classe, header)).build(); - } - - @Hidden - @Path("/nafr1/classe/{code: [0-9]{2}\\.[0-9][A-Z]}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getnafr1n5", - summary = "Informations sur une classe de la NAF rév.1 identifiée par son code", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = ClasseNAF2003.class)), description="Classe de la NAF") - }) - public Response getClasseNAF2003( - @Parameter( - required = true, - description = "Code de la classe (deux chiffres, un point, un chiffre, une lettre majuscule)", example = "28.1C") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - ClasseNAF2003 classe = new ClasseNAF2003(code); - String csvResult = sparqlUtils.executeSparqlQuery(Naf2003Queries.getClasseNAF2003(code)); - classe = (ClasseNAF2003) csvUtils.populatePOJO(csvResult, classe); - - if (classe.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(classe, header)).build(); - } - - @Hidden - @Path("/naf/classe/{code: [0-9]{2}\\.[0-9][A-Z]}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getnafn5", - summary = "Informations sur une classe de la NAF identifiée par son code", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = ClasseNAF1993.class)), description="Classe de la NAF") - }) - public Response getClasseNAF1993( - @Parameter( - required = true, - description = "Code de la classe (deux chiffres, un point, un chiffre, une lettre majuscule)", example = "28.1C") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - ClasseNAF1993 classe = new ClasseNAF1993(code); - String csvResult = sparqlUtils.executeSparqlQuery(Naf1993Queries.getClasseNAF1993(code)); - classe = (ClasseNAF1993) csvUtils.populatePOJO(csvResult, classe); - - if (classe.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(classe, header)).build(); - } - - @Hidden - @Path("/na73/groupe/{code: [0-9]{2}\\.[0-9]{2}}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getna73n2", - summary = "Informations sur un groupe de la NA 1973 identifié par son code", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = GroupeNA1973.class)), description="Groupe de la NA") - }) - public Response getGroupeNA1973( - @Parameter( - required = true, - description = "Code du groupe (deux chiffres, un point, deux chiffres)", example="45.23") @PathParam("code") String code, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - GroupeNA1973 groupe = new GroupeNA1973(code); - String csvResult = sparqlUtils.executeSparqlQuery(Na1973Queries.getGroupeNA1973(code)); - groupe = (GroupeNA1973) csvUtils.populatePOJO(csvResult, groupe); - - if (groupe.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(groupe, header)).build(); - } - - @Hidden - @Path("/activites") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getactivities", - summary = "Informations sur une activité identifiée par son code et une date", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = Activites.class)), description="Activités") - }) - public Response getActivities( - @Parameter(required = true, description = "Code de l'activité", example="25.2") @QueryParam("code") String code, - @Parameter( - description = "Date à laquelle l'activité est valide (Format : 'AAAA-MM-JJ' ; '*' pour obtenir tout l'historique ; paramètre absent pour la date du jour)") @QueryParam("date") Date date, - @Parameter(hidden = true) @HeaderParam("Accept") String header) { - - String csvResult = ""; - - if (date == null) { - csvResult = sparqlUtils.executeSparqlQuery(ActivitesQueries.getActiviteByCode(code)); - } - else if ("*".equals(date.getString())) { - csvResult = sparqlUtils.executeSparqlQuery(ActivitesQueries.getActivites(code)); - } - else { - if ( ! DateUtils.isValidDate(date.getString())) { - return Response.status(Status.BAD_REQUEST).entity("").build(); - } - DateTime dt = DateUtils.getDateTimeFromDateString(date.getString()); - csvResult = sparqlUtils.executeSparqlQuery(ActivitesQueries.getActiviteByCodeAndDate(code, dt)); - } - - List activityList = csvUtils.populateMultiPOJO(csvResult, Activite.class); - - if (activityList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else if (header.equals(MediaType.APPLICATION_XML)) { - return Response.ok(responseUtils.produceResponse(new Activites(activityList), header)).build(); - } - else { - return Response.ok(responseUtils.produceResponse(activityList, header)).build(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/classifications/CorrespondenceApi.java b/src/main/java/fr/insee/rmes/api/classifications/CorrespondenceApi.java deleted file mode 100644 index 910d289e..00000000 --- a/src/main/java/fr/insee/rmes/api/classifications/CorrespondenceApi.java +++ /dev/null @@ -1,119 +0,0 @@ -package fr.insee.rmes.api.classifications; - -import java.util.List; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.classification.correspondence.Association; -import fr.insee.rmes.modeles.classification.correspondence.Associations; -import fr.insee.rmes.modeles.classification.correspondence.RawCorrespondence; -import fr.insee.rmes.queries.classifications.CorrespondencesQueries; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Hidden -@Path("/correspondance") -@Tag(name = "nomenclatures", description = "Nomenclatures API") -public class CorrespondenceApi extends AbstractMetadataApi { - - @Hidden - @GET - @Path("/{idCorrespondance}") - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getCorrespondenceByCode", - summary = "Correspondance entre deux nomenclatures", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Association.class)), - description = "Correspondances entre deux nomenclatures") - }) - public Response getCorrespondencesById( - @Parameter( - required = true, - description = "Identifiant de la correspondance", - example = "nafr2-cpfr21") @PathParam("idCorrespondance") String idCorrespondance, - @Parameter(hidden = true) @HeaderParam(value = HttpHeaders.ACCEPT) String header) { - - String csvResult = - sparqlUtils - .executeSparqlQuery(CorrespondencesQueries.getCorrespondenceById(idCorrespondance.toLowerCase())); - - /* RawCorrespondence direct mapping from sparql request */ - List rawItemsList = csvUtils.populateMultiPOJO(csvResult, RawCorrespondence.class); - - if (rawItemsList != null && ! rawItemsList.isEmpty()) { - /* raw sparql result fields order must be got in shape 1 source -> many targets */ - Associations itemsList = CorrespondencesUtils.getCorrespondenceByCorrespondenceId(rawItemsList); - return Response.ok(responseUtils.produceResponse(itemsList, header)).build(); - } - else { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - } - - @Hidden - @GET - @Path("/{idNomenclatureSource}/{idNomenclatureCible}") - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getCorrespondenceByClassificationCodes", - summary = " Liste des associations de correspondance entre deux nomenclatures", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Association.class)), - description = "Correspondances entre deux nomenclatures") - }) - public Response getCorrespondenceByIds( - @Parameter( - required = true, - description = "Identifiant de la nomenclature source", - example = "nafr2") @PathParam("idNomenclatureSource") String codeClassification, - @Parameter( - required = true, - description = "Identifiant de la nomenclature cible", - example = "cpfr21") @PathParam("idNomenclatureCible") String targetCodeClassification, - @Parameter(hidden = true) @HeaderParam(value = HttpHeaders.ACCEPT) String header) { - - String csvResult = - sparqlUtils - .executeSparqlQuery( - CorrespondencesQueries - .getCorrespondenceByIds( - codeClassification.toLowerCase(), - targetCodeClassification.toLowerCase())); - - /* RawCorrespondence direct mapping from sparql request - correspondences are not symetrical in RDF model */ - List rawItemsList = csvUtils.populateMultiPOJO(csvResult, RawCorrespondence.class); - - if (rawItemsList != null && ! rawItemsList.isEmpty()) { - /* raw sparql result fields order must be handled according to source / target classifications */ - Associations itemsList = - CorrespondencesUtils.getCorrespondenceByclassificationIds(targetCodeClassification, rawItemsList); - return Response.ok(responseUtils.produceResponse(itemsList, header)).build(); - } - - else { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/classifications/CorrespondencesApi.java b/src/main/java/fr/insee/rmes/api/classifications/CorrespondencesApi.java deleted file mode 100644 index 95a9e45d..00000000 --- a/src/main/java/fr/insee/rmes/api/classifications/CorrespondencesApi.java +++ /dev/null @@ -1,60 +0,0 @@ -package fr.insee.rmes.api.classifications; - -import java.util.List; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.classification.correspondence.Correspondence; -import fr.insee.rmes.modeles.classification.correspondence.Correspondences; -import fr.insee.rmes.queries.classifications.CorrespondencesQueries; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Hidden -@Path("/correspondances") -@Tag(name = "nomenclatures", description = "Nomenclatures API") -public class CorrespondencesApi extends AbstractMetadataApi { - - @Hidden - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getAllCorrespondances", - summary = "Liste des correspondances entre deux nomenclatures", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = Correspondences.class)), description="Correspondances entre deux nomenclatures") - }) - public Response getAllCorrespondences( - @Parameter(hidden = true) @HeaderParam(value = HttpHeaders.ACCEPT) String header) { - - String csvResult = sparqlUtils.executeSparqlQuery(CorrespondencesQueries.getAllCorrespondences()); - - List itemsList = csvUtils.populateMultiPOJO(csvResult, Correspondence.class); - - if (itemsList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else if (header.equals(MediaType.APPLICATION_XML)) { - return Response.ok(responseUtils.produceResponse(new Correspondences(itemsList), header)).build(); - } - else { - return Response.ok(responseUtils.produceResponse(itemsList, header)).build(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/classifications/CorrespondencesUtils.java b/src/main/java/fr/insee/rmes/api/classifications/CorrespondencesUtils.java deleted file mode 100644 index 6f93c5a7..00000000 --- a/src/main/java/fr/insee/rmes/api/classifications/CorrespondencesUtils.java +++ /dev/null @@ -1,145 +0,0 @@ -package fr.insee.rmes.api.classifications; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -import fr.insee.rmes.modeles.classification.correspondence.Association; -import fr.insee.rmes.modeles.classification.correspondence.Associations; -import fr.insee.rmes.modeles.classification.correspondence.PosteCorrespondence; -import fr.insee.rmes.modeles.classification.correspondence.RawCorrespondence; - -public class CorrespondencesUtils { - - private CorrespondencesUtils() { - // No-args constructor needed for JAXB - } - - /** - * get in shape rawlist in tree map - * 1 source (map id) -> many target - */ - /* when id correspondence */ - public static Associations getCorrespondenceByCorrespondenceId(List rawItemsList) { - - Map> mapSourceTargetItems = getTreeMapTargetItemsBySourceByCorrespondenceId(rawItemsList); - return organizeItemTreeMap(mapSourceTargetItems); - } - - private static Associations organizeItemTreeMap(Map> mapSourceTargetItems) { - Associations associations = new Associations(); - mapSourceTargetItems.forEach((k, v) -> { - - Association assoc = new Association(k, v); - associations.getAssociations().add(assoc); - - }); - - return associations; - } - - /** - * This method transforms sparql query "table" result - * for mapping 1 source item from source classification to to many many target item in target classification - * @param idCorrespondence - * @param rawItemsList - * @return - */ - public static Map> getTreeMapTargetItemsBySourceByCorrespondenceId( - List rawItemsList) { - /* TreeMap for ordering map keys */ - Map> groupedListItems = new TreeMap<>(); - for (RawCorrespondence curRawCorrespondence : rawItemsList) { - PosteCorrespondence posteSource = newPoste1(curRawCorrespondence); - if ( ! groupedListItems.containsKey(posteSource)) { // initialize map if new item source - groupedListItems.put(posteSource, new ArrayList<>()); - } - // add targetItem - PosteCorrespondence targetPoste = newPoste2(curRawCorrespondence); - groupedListItems.get(posteSource).add(targetPoste); - } - return groupedListItems; - } - - /* when id1 + id2 classifications */ - public static Associations getCorrespondenceByclassificationIds( - String codeClassification, - List rawItemsList) { - - Map> mapSourceTargetItems = - getTreeMapTargetItemsBySourceByClassificationsIds(codeClassification, rawItemsList); - return organizeItemTreeMap(mapSourceTargetItems); - } - - /** - * for handling asymetrical correspondencies in RDF data - */ - public static Map> getTreeMapTargetItemsBySourceByClassificationsIds( - String codeClassificationSource, - List rawItemsList) { - - /* TreeMap for ordering map keys */ - Map> groupedListItems = new TreeMap<>(); - - /* - * Classification correspondences are not symetrical in database => answering question : what is source / target - * must in raw correspondances ? - */ - /* if false => first fields of csv result are for source classification item */ - /* if true => second part of fields */ - boolean poste1IsSource = isPoste1Source(codeClassificationSource, rawItemsList); - - for (RawCorrespondence curRawCorrespondence : rawItemsList) { - PosteCorrespondence posteSource = mapRawObjectToItemCorrespondence(curRawCorrespondence, poste1IsSource); - if ( ! groupedListItems.containsKey(posteSource)) {// initialize map - groupedListItems.put(posteSource, new ArrayList<>()); - } - // add targetItem - groupedListItems - .get(posteSource) - .add(mapRawObjectToItemCorrespondence(curRawCorrespondence, ! poste1IsSource)); - } - - return groupedListItems; - - } - - /** - * Correspondance beetween 2 classifications is not symetrical. - * the order for giving clasification must change results mappings - * this method verify is swapping source <-> target items i necessary - * to get the right correspondence - * @param codeClassificationSource - * @param rawItemsList - * @return - */ - private static Boolean isPoste1Source(String codeClassificationSource, List rawItemsList) { - // using the first correspondence ( rawItemsList.get(0) ) - // => which csv result, first or second uri field (uriPoste1/2) does contain classification source id ? - String uriPoste1FromRaw = rawItemsList.get(0).getUriPoste1(); - String classifSource = "/codes/" + codeClassificationSource + "/"; - return ! uriPoste1FromRaw.contains(classifSource); - } - - private static PosteCorrespondence mapRawObjectToItemCorrespondence(RawCorrespondence corresp, boolean poste1IsSource) { - return (poste1IsSource ? newPoste2(corresp) : newPoste1(corresp)); - } - - private static PosteCorrespondence newPoste1(RawCorrespondence corresp) { - return new PosteCorrespondence( - corresp.getCodePoste1(), - corresp.getUriPoste1(), - corresp.getIntituleFrPoste1(), - corresp.getIntituleEnPoste1()); - } - - private static PosteCorrespondence newPoste2(RawCorrespondence corresp) { - return new PosteCorrespondence( - corresp.getCodePoste2(), - corresp.getUriPoste2(), - corresp.getIntituleFrPoste2(), - corresp.getIntituleEnPoste2()); - } - -} diff --git a/src/main/java/fr/insee/rmes/api/concepts/ConceptsAPI.java b/src/main/java/fr/insee/rmes/api/concepts/ConceptsAPI.java deleted file mode 100644 index e21098ea..00000000 --- a/src/main/java/fr/insee/rmes/api/concepts/ConceptsAPI.java +++ /dev/null @@ -1,95 +0,0 @@ -package fr.insee.rmes.api.concepts; - -import java.util.List; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import org.apache.commons.lang3.StringUtils; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.concepts.Concept; -import fr.insee.rmes.modeles.concepts.ConceptLink; -import fr.insee.rmes.modeles.concepts.Definition; -import fr.insee.rmes.modeles.concepts.Definitions; -import fr.insee.rmes.queries.concepts.ConceptsQueries; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path("/concepts") -@Tag(name = "concepts", description = "Concepts API") -public class ConceptsAPI extends AbstractMetadataApi { - - @Path("/definitions") - @GET - @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) - @Operation(operationId = "getConcepts", summary = "Informations sur les définitions des concepts statistiques de l'Insee", responses = { - @ApiResponse(content = { - @Content(schema = @Schema(type = "array", implementation = Definitions.class), mediaType = MediaType.APPLICATION_XML), - @Content(schema = @Schema(type = "array", implementation = Definition.class), mediaType = MediaType.APPLICATION_JSON) }, description = "Concepts") }) - public Response getConcepts( - @Parameter(description = "Recherche dans les libellés", schema = @Schema(type = "string"), example = "élect") @QueryParam("libelle") String libelle, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header) { - - String label = StringUtils.isEmpty(libelle) ? "" : libelle; - - String csvResult = sparqlUtils.executeSparqlQuery(ConceptsQueries.getConceptsByLabel(label)); - List conceptList = csvUtils.populateMultiPOJO(csvResult, Definition.class); - - conceptList.forEach(concept -> { - if (Boolean.TRUE.equals(concept.getHasLink())) { - String csvLinks = sparqlUtils.executeSparqlQuery(ConceptsQueries.getConceptLinks(concept.getId())); - List links = csvUtils.populateMultiPOJO(csvLinks, ConceptLink.class); - concept.setLinks(links); - } - }); - - if (conceptList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } else if (StringUtils.equalsAnyIgnoreCase(header, MediaType.APPLICATION_XML)) { - return Response.ok(responseUtils.produceResponse(new Definitions(conceptList), header)).build(); - } else if (StringUtils.equalsAnyIgnoreCase(header, MediaType.APPLICATION_JSON)) { - return Response.ok(responseUtils.produceResponse(conceptList, header)).build(); - } else { - return Response.status(Status.NOT_ACCEPTABLE).entity("").build(); - } - - } - - @Path("/definition/{id : c[0-9]{4}}") - @GET - @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) - @Operation(operationId = "getconcept", summary = "Informations sur la définition d'un concept statistique de l'Insee", responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = Concept.class)), description = "Concept") }) - public Response getConceptById( - @Parameter(required = true, description = "Identifiant du concept (format : c[0-9]{4})", schema = @Schema(pattern = "c[0-9]{4}", type = "string"), example = "c2066") @PathParam("id") String id, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header) { - - Concept concept = new Concept(id); - String csvResult = sparqlUtils.executeSparqlQuery(ConceptsQueries.getConceptById(id)); - concept = (Concept) csvUtils.populatePOJO(csvResult, concept); - if (Boolean.TRUE.equals(concept.getHasLink())) { - String csvLinks = sparqlUtils.executeSparqlQuery(ConceptsQueries.getConceptLinks(id)); - List links = csvUtils.populateMultiPOJO(csvLinks, ConceptLink.class); - concept.setLinks(links); - } - - if (concept.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } else { - return Response.ok(responseUtils.produceResponse(concept, header)).build(); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/AbstractGeoApi.java b/src/main/java/fr/insee/rmes/api/geo/AbstractGeoApi.java deleted file mode 100644 index e5b3d6c5..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/AbstractGeoApi.java +++ /dev/null @@ -1,155 +0,0 @@ -package fr.insee.rmes.api.geo; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.territoire.Projection; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.queries.geo.CsvGeoUtils; -import fr.insee.rmes.utils.*; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public abstract class AbstractGeoApi extends AbstractMetadataApi { - - protected static final String LITTERAL_PARAMETER_DATE_WITH_HISTORY = ". Le paramètre '*' permet de renvoyer tout l'historique."; - - protected CsvGeoUtils csvGeoUtils = new CsvGeoUtils(); - - private static final Logger logger = LogManager.getLogger(AbstractGeoApi.class); - - protected AbstractGeoApi(){} - - protected AbstractGeoApi(SparqlUtils sparqlUtils, CSVUtils csvUtils, ResponseUtils responseUtils) { - super(sparqlUtils, csvUtils, responseUtils); - } - - // Method to find a territoire object - protected Response generateResponseATerritoireByCode(String csvResult, String header, Territoire territoire) { - - territoire = (Territoire) csvUtils.populatePOJO(csvResult, territoire); - return this - .generateStatusResponse( - ! StringUtils.isEmpty(territoire.getUri()), - territoire, - this.getFirstValidHeader(header)); - } - - // Method to find a list of territoires - protected Response generateResponseListOfTerritoire( - String csvResult, - String header, - Class rootClass, - Class classObject) { - List listeTerritoires = csvUtils.populateMultiPOJO(csvResult, classObject); - return this.generateListStatusResponse(rootClass, listeTerritoires, this.getFirstValidHeader(header)); - } - - protected boolean verifyParametersTypeAndDateAreValid(String typeTerritoire, String date) { - return (this.verifyParameterTypeTerritoireIsRight(typeTerritoire)) && (this.verifyParameterDateIsRightWithoutHistory(date)); - } - - protected boolean verifyParameterTypeTerritoireIsRight(String typeTerritoire) { - return (typeTerritoire == null) - || (EnumTypeGeographie - .streamValuesTypeGeo() - .anyMatch(s -> s.getTypeObjetGeo().equalsIgnoreCase(typeTerritoire))); - } - - protected String formatValidParametertypeTerritoireIfIsNull(String typeTerritoire) { - return (typeTerritoire != null) ? EnumTypeGeographie.getTypeObjetGeoIgnoreCase(typeTerritoire) : Constants.NONE; - } - - private boolean verifyParameterDateIsRight(String date, boolean withHistory) { - return (date == null) || (DateUtils.isValidDate(date)) || (withHistory && date.equals("*")); - } - - protected boolean verifyParameterDateIsRightWithoutHistory(String date) { - return this.verifyParameterDateIsRight(date, false); - } - - protected boolean verifyParameterDateIsRightWithHistory(String date) { - return this.verifyParameterDateIsRight(date, true); - } - - protected String formatValidParameterDateIfIsNull(String date) { - return (date != null) ? date : DateUtils.getDateTodayStringFormat(); - } - - protected String formatValidParameterFiltreIfIsNull(String filtreNom) { - return (filtreNom != null) ? filtreNom : "*"; - } - - protected Boolean formatValidParameterBooleanIfIsNull(Boolean bool) { - return (bool != null) && bool; - } - - - - protected Response generateStatusResponse(boolean objectIsFound, Object o, String header) { - if (objectIsFound) { - return Response.ok(responseUtils.produceResponse(o, header)).build(); - } - else { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - } - - /** - * @param listObject : for XML, pojo containing a list - * @param o : for JSON, list of pojo - * @param header - * @return - */ - protected Response generateListStatusResponse(Class listObject, List o, String header) { - if (o.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else if (StringUtils.equalsAnyIgnoreCase(header, MediaType.APPLICATION_XML)) { - Constructor constructor; - Object sampleObject = null; - try { - constructor = listObject.getConstructor(List.class); - sampleObject = constructor.newInstance(o); - } - catch (NoSuchMethodException | SecurityException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { - logger.error(e.getMessage()); - return Response.status(Status.INTERNAL_SERVER_ERROR).entity("").build(); - } - return Response.ok(responseUtils.produceResponse(sampleObject, header)).build(); - } - else if (StringUtils.equalsAnyIgnoreCase(header, MediaType.APPLICATION_JSON)) { - return Response.ok(responseUtils.produceResponse(o, header)).build(); - } - else { - return Response.status(Status.NOT_ACCEPTABLE).entity("").build(); - } - } - - protected Response generateBadRequestResponse() { - return generateBadRequestResponse(""); - } - - protected Response generateBadRequestResponse(String erreurMessage) { - return Response.status(Status.BAD_REQUEST).entity(erreurMessage).build(); - } - - // Method to find a list of projections - protected Response generateResponseListOfProjection(String csvResult, String header) { - List listProj = csvGeoUtils.populateProjections(csvResult); - return this.generateListStatusResponse(Projections.class, listProj, this.getFirstValidHeader(header)); - } - - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/ConstGeoApi.java b/src/main/java/fr/insee/rmes/api/geo/ConstGeoApi.java deleted file mode 100644 index f44f0ba1..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/ConstGeoApi.java +++ /dev/null @@ -1,110 +0,0 @@ -package fr.insee.rmes.api.geo; - -public class ConstGeoApi { - - public static final String PATH_SEPARATOR = "/"; - - public static final String PATH_GEO = PATH_SEPARATOR + "geo"; - public static final String TAG_NAME = "geographie"; - public static final String TAG_DESCRIPTION = "Geographie API"; - - public static final String PATH_CIRCO_TER = PATH_SEPARATOR + "circonscriptionTerritoriale"; - public static final String PATH_CANTON = PATH_SEPARATOR + "canton"; - public static final String PATH_IRIS=PATH_SEPARATOR + "iris"; - public static final String PATH_COMMUNE = PATH_SEPARATOR + "commune"; - public static final String PATH_CANTON_OU_VILLE = PATH_SEPARATOR + "cantonOuVille"; - public static final String PATH_PAYS = PATH_SEPARATOR + "pays"; - public static final String PATH_REGION = PATH_SEPARATOR + "region"; - public static final String PATH_DEPARTEMENT = PATH_SEPARATOR + "departement"; - public static final String PATH_ZONE_EMPLOI = PATH_SEPARATOR + "zoneDEmploi2020"; - public static final String PATH_AIRE_ATTRACTION = PATH_SEPARATOR + "aireDAttractionDesVilles2020"; - public static final String PATH_UNITE_URBAINE = PATH_SEPARATOR + "uniteUrbaine2020"; - public static final String PATH_ARRONDISSEMENT = PATH_SEPARATOR + "arrondissement"; - public static final String PATH_COMMUNE_ASSOCIEE = PATH_SEPARATOR + "communeAssociee"; - public static final String PATH_COMMUNE_DELEGUEE = PATH_SEPARATOR + "communeDeleguee"; - public static final String PATH_ARRONDISSEMENT_MUNICIPAL = PATH_SEPARATOR + "arrondissementMunicipal"; - public static final String PATH_COM= PATH_SEPARATOR + "collectiviteDOutreMer"; - public static final String PATH_DISTRICT= PATH_SEPARATOR + "district"; - public static final String PATH_LISTE_COM= PATH_SEPARATOR +"collectivitesDOutreMer"; - public static final String PATH_LISTE_CANTON_OU_VILLE= PATH_SEPARATOR +"cantonsEtVilles"; - public static final String PATH_INTERCO= PATH_SEPARATOR + "intercommunalite"; - public static final String PATH_BASSINDEVIE= PATH_SEPARATOR + "bassinDeVie2022"; - public static final String PATH_LISTE_IRIS = PATH_SEPARATOR + "iris"; - public static final String PATH_LISTE_COMMUNE = PATH_SEPARATOR + "communes"; - public static final String PATH_LISTE_PAYS = PATH_SEPARATOR + "pays"; - public static final String PATH_LISTE_CANTON = PATH_SEPARATOR + "cantons"; - public static final String PATH_LISTE_REGION = PATH_SEPARATOR + "regions"; - public static final String PATH_LISTE_DEPARTEMENT = PATH_SEPARATOR + "departements"; - public static final String PATH_LISTE_ARRONDISSEMENT = PATH_SEPARATOR + "arrondissements"; - public static final String PATH_LISTE_COMMUNE_ASSOCIEE = PATH_SEPARATOR + "communesAssociees"; - public static final String PATH_LISTE_COMMUNE_DELEGUEE = PATH_SEPARATOR + "communesDeleguees"; - public static final String PATH_LISTE_ARRONDISSEMENT_MUNICIPAL = PATH_SEPARATOR + "arrondissementsMunicipaux"; - public static final String PATH_LISTE_ZONE_EMPLOI = PATH_SEPARATOR + "zonesDEmploi2020"; - public static final String PATH_LISTE_AIRE_ATTRACTION = PATH_SEPARATOR + "airesDAttractionDesVilles2020"; - public static final String PATH_LISTE_UNITE_URBAINE = PATH_SEPARATOR + "unitesUrbaines2020"; - public static final String PATH_LISTE_DISTRICT = PATH_SEPARATOR + "districts"; - public static final String PATH_LISTE_INTERCO = PATH_SEPARATOR + "intercommunalites"; - public static final String PATH_LISTE_BASSINDEVIE= PATH_SEPARATOR + "bassinsDeVie2022"; - - public static final String PATH_ASCENDANT = PATH_SEPARATOR + "ascendants"; - public static final String PATH_DESCENDANT = PATH_SEPARATOR + "descendants"; - public static final String PATH_SUIVANT = PATH_SEPARATOR + "suivants"; - public static final String PATH_PRECEDENT = PATH_SEPARATOR + "precedents"; - public static final String PATH_PROJECTION = PATH_SEPARATOR + "projetes"; - - - public static final String PATTERN_COMMUNE = "[0-9][0-9AB][0-9]{3}"; - public static final String PATTERN_CIRCO_TER = "986[1-3]{2}"; - public static final String PATTERN_CANTON_OU_VILLE = "(([0-9]{2})|(2[0-9AB])|(97[1-6]))([0-9]{2})"; - public static final String PATTERN_COM ="9[78][1-9]"; - public static final String PATTERN_DISTRICT ="9[78][1-9]{3}"; - public static final String PATTERN_INTERCO ="[0-9]{9}"; - public static final String PATTERN_CANTON = "(([0-9]{2})|(2[0-9AB])|(97[1-6]))([0-9]{2})"; - - public static final String PATTERN_IRIS="[0-9][0-9AB][0-9]{7}"; - public static final String PATTERN_IRIS_DESCRIPTION= "Code Insee de l’Iris (9 caractères)"; - public static final String PATTERN_PAYS = "99[0-9]{3}"; - public static final String PATTERN_REGION = "[0-9]{2}"; - public static final String PATTERN_ZONE_EMPLOI = "[0-9]{4}"; - public static final String PATTERN_UNITE_URBAINE = "[0-9][a-zA-Z0-9][0-9]{3}"; - public static final String PATTERN_AIRE_ATTRACTION = "[a-zA-Z0-9]{3}"; - public static final String PATTERN_DEPARTEMENT = "([013-8][0-9])|(2[0-9AB])|(9[0-5])|(97[1-6])"; - public static final String PATTERN_ARRONDISSEMENT = "(([013-8][0-9])|(2[0-9AB])|(9[0-5])|(97[1-6]))[0-9]"; - public static final String PATTERN_ARRONDISSEMENT_MUNICIPAL = ""; - public static final String PATTERN_BASSINDEVIE = "[0-9][0-9AB][0-9]{3}"; - public static final String PATTERN_BASSINDEVIE_DESCRIPTION = "Code du bassin de vie (cinq caractères)"; - public static final String PATTERN_CANTON_OU_VILLE_DESCRIPTION = "Code d'un canton-ou-ville' (quatre ou cinq caractères pour les DOM ex: 97602)"; - public static final String PATTERN_CIRCO_TER_DESCRIPTION = "Code de la circonscription territoriale (cinq caractères)"; - public static final String PATTERN_COMMUNE_DESCRIPTION = "Code de la commune (cinq caractères)"; - public static final String PATTERN_COM_DESCRIPTION= "Code de la collectivité d'outre-mer (trois caractères)"; - public static final String PATTERN_COMMUNE_ASSOCIEE_DESCRIPTION = "Code de la commune associée (cinq caractères)"; - public static final String PATTERN_COMMUNE_DELEGUEE_DESCRIPTION = "Code de la commune déléguée (cinq caractères)"; - public static final String PATTERN_DISTRICT_DESCRIPTION = "Code du district (cinq caractères)"; - public static final String PATTERN_INTERCO_DESCRIPTION = "Code de l'intercommunalité (neuf caractères)"; - public static final String PATTERN_ZONE_EMPLOI_DESCRIPTION = "Code de la zone d'emploi (quatre chiffres)"; - public static final String PATTERN_UNITE_URBAINE_DESCRIPTION = "Code de l'unité urbaine (cinq chiffres)"; - public static final String PATTERN_AIRE_ATTRACTION_DESCRIPTION = "Code de l'aire d'attraction (trois chiffres)"; - public static final String PATTERN_PAYS_DESCRIPTION = "Code du pays (cinq chiffres, débutant par 99)"; - public static final String PATTERN_REGION_DESCRIPTION = "Code de la région (deux chiffres)"; - public static final String PATTERN_CANTON_DESCRIPTION = "Code du canton (quatre chiffres pour la Métropole ou cinq chiffres pour les DOM ou 2A/2B plus 2 chiffres pour la Corse)" ; - public static final String PATTERN_DEPARTEMENT_DESCRIPTION = - "Code du département (deux ou trois caractères)"; - public static final String PATTERN_ARRONDISSEMENT_DESCRIPTION = - "Code de l'arrondissement (trois ou quatre caractères)"; - public static final String PATTERN_ARRONDISSEMENT_MUNICIPAL_DESCRIPTION = - "Code de l'arrondissement municipal (cinq caractères)"; - - public static final String ID_OPERATION_ASCENDANTS = "asc"; - public static final String ID_OPERATION_DESCENDANTS = "desc"; - public static final String ID_OPERATION_LISTE = "liste"; - public static final String ID_OPERATION_PRECEDENT = "prec"; - public static final String ID_OPERATION_SUIVANT = "suiv"; - public static final String ID_OPERATION_PROJECTION = "proj"; - public static final String ID_OPERATION_COMMUNES = "communes"; - public static final String ID_OPERATION_PROJECTIONS = "allpro"; - - public static final String ERREUR_PATTERN= "Le code saisi ne respecte pas le format attendu"; - - private ConstGeoApi() {} - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/PaysApi.java b/src/main/java/fr/insee/rmes/api/geo/PaysApi.java deleted file mode 100644 index 1d99e650..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/PaysApi.java +++ /dev/null @@ -1,272 +0,0 @@ -package fr.insee.rmes.api.geo; - -import fr.insee.rmes.modeles.geo.territoires.PaysS; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import jakarta.ws.rs.*; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import fr.insee.rmes.modeles.geo.territoire.Pays; -import fr.insee.rmes.modeles.utils.Header; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class PaysApi extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_PAYS + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogpays"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un pays identifié par son code (cinq chiffres, les deux premiers étant 99)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Pays"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_DATE_EXAMPLE = "2000-01-01"; - private static final String LITTERAL_CODE_HISTORY_EXAMPLE = "44"; - - - - @Path(ConstGeoApi.PATH_PAYS + CODE_PATTERN) - @GET - @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Pays.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_PAYS_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_PAYS, - type = Constants.TYPE_STRING, example = "99217")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) Header header) { - if (!isValidCode(code)) { - return Response.status(Status.BAD_REQUEST).entity("Invalid code").build(); - } - - Pays pays = new Pays(code); - String sanitizedCode = escapeSparql(code); - String csvResult = sparqlUtils.executeSparqlQuery(GeoQueries.getPays(sanitizedCode)); - pays = (Pays) csvUtils.populatePOJO(csvResult, pays); - - if (pays.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } else { - String acceptHeader = sanitizeAndValidateHeader(header.getString()); - - if (acceptHeader == null) { - return Response.status(Status.BAD_REQUEST).entity("Invalid Accept header").build(); - } - return Response.ok(responseUtils.produceResponse(pays, acceptHeader)).build(); - } - } - - @Path(ConstGeoApi.PATH_PAYS) - @GET - @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = PaysS.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les pays actifs à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListPays(this.formatValidParameterDateIfIsNull(dateString))), - header, - PaysS.class, - Pays.class); - } - } - - @Path(ConstGeoApi.PATH_PAYS + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans le pays", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_PAYS_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_PAYS, - type = Constants.TYPE_STRING, example="002")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans le pays actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="ArrondissementMunicipal")) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsPays( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_PAYS + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les pays qui succèdent au pays", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Pays.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_PAYS_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_PAYS, - type = Constants.TYPE_STRING, example="41")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le pays de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextPays(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - PaysS.class, - Pays.class); - } - } - - - @Path(ConstGeoApi.PATH_PAYS + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les pays qui précèdent le pays", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Pays.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_PAYS_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_PAYS, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le pays de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousPays(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - PaysS.class, - Pays.class); - } - } - - private boolean isValidCode(String code) { - return code != null && code.matches(ConstGeoApi.PATTERN_PAYS); - } - - private String escapeSparql(String input) { - return input.replace("\"", "\\\"").replace("<", "\\u003C").replace(">", "\\u003E"); - } - private String sanitizeAndValidateHeader(String header) { - if (header == null || header.isEmpty()) { - return null; - } - if (header.equals(MediaType.APPLICATION_JSON) || header.equals(MediaType.APPLICATION_XML)) { - return header; - } - - return null; - } -} - diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/AireAttractionApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/AireAttractionApi.java deleted file mode 100644 index 05550336..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/AireAttractionApi.java +++ /dev/null @@ -1,184 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.AireDAttractionDesVilles2020; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.AiresDAttractionDesVilles2020; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class AireAttractionApi extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_AIRE_ATTRACTION + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogaav"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une aire d'attraction française identifiée par son code (trois caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Aire d'attraction"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer l'aire d'attraction active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_CODE_EXAMPLE = "062"; - - - @Path(ConstGeoApi.PATH_AIRE_ATTRACTION + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = AireDAttractionDesVilles2020.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_AIRE_ATTRACTION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_AIRE_ATTRACTION, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getAireAttractionByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new AireDAttractionDesVilles2020(code)); - } - } - - @Path(ConstGeoApi.PATH_AIRE_ATTRACTION + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans l'aire d'attraction", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_AIRE_ATTRACTION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_AIRE_ATTRACTION, - type = Constants.TYPE_STRING, example="002")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans l'aire d'attraction active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="ArrondissementMunicipal")) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsAireAttraction( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - - @Path(ConstGeoApi.PATH_LISTE_AIRE_ATTRACTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les aires d'attractions actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = AireDAttractionDesVilles2020.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les aire d'attractions actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListAiresAttraction(this.formatValidParameterDateIfIsNull(dateString))), - header, - AiresDAttractionDesVilles2020.class, - AireDAttractionDesVilles2020.class); - } - } - - -} - diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/ArrondissementApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/ArrondissementApi.java deleted file mode 100644 index f99da30b..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/ArrondissementApi.java +++ /dev/null @@ -1,439 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Arrondissement; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Arrondissements; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class ArrondissementApi extends AbstractGeoApi { - - private static final String LITTERAL_DATE_PROJECTION_DESCRIPTION = "Date vers laquelle est projetée l'arrondissement. Paramètre obligatoire (erreur 400 si absent, Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION = "Filtre pour préciser l'arrondissement de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')"; - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_ARRONDISSEMENT + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogarr"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un arrondissement français identifié par son code (trois ou quatre caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Arrondissement"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer l'arrondissement actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_CODE_EXAMPLE = "674"; - private static final String LITTERAL_CODE_EXAMPLE_SUIVANT = "042"; - private static final String LITTERAL_DATE_EXAMPLE = "2016-01-01"; - - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Arrondissement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getArrondissementByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new Arrondissement(code)); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent l'arrondissement", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant l'arrondissement actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsArrondissement( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans l'arrondissement", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans l'arrondissement actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING), example="CommuneDeleguee") @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsArrondissement( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_LISTE_ARRONDISSEMENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur tous les arrondissements actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Arrondissement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les arrondissements actifs à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getListArrondissements(this.formatValidParameterDateIfIsNull(dateString))), - header, - Arrondissements.class, - Arrondissement.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les arrondissements qui succèdent à l'arrondissement", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Arrondissement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE_SUIVANT)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextArrondissement(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Arrondissements.class, - Arrondissement.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les arrondissements qui précèdent l'arrondissement", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Arrondissement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousArrondissement(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Arrondissements.class, - Arrondissement.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les arrondissements qui résultent de la projection de l'arrondissement à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Arrondissement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_DATE_PROJECTION_DESCRIPTION, - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE), example="1994-07-30") @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date !=null) { - dateString = date.getString(); - } - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionArrondissement( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header, - Arrondissements.class, - Arrondissement.class); - } - } - - @Hidden - @Path(ConstGeoApi.PATH_LISTE_ARRONDISSEMENT + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTIONS, - summary = "Récupérer la projection des arrondissements vers la date passée en paramètre.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Projections.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAllProjections( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser les arrondissements de départ. Par défaut, c’est la date courante qui est utilisée.", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle sont projetées les arrondissements. Paramètre obligatoire (erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date !=null) { - dateString = date.getString(); - } - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfProjection( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAllProjectionArrondissement( - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/ArrondissementMunicipalApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/ArrondissementMunicipalApi.java deleted file mode 100644 index fff5c8ca..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/ArrondissementMunicipalApi.java +++ /dev/null @@ -1,390 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.ArrondissementMunicipal; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.ArrondissementsMunicipaux; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class ArrondissementMunicipalApi extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogarrmun"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un arrondissement municipal identifié par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Arrondissement municipal"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la arrondissement municipal actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_DATE_PROJECTION_DESCRIPTION = "Date vers laquelle est projetée l'arrondissement municipal. Paramètre obligatoire (erreur 400 si absent, Format : 'AAAA-MM-JJ'))"; - private static final String LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION = "Filtre pour préciser l'arrondissement municipal de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')"; - - private static final String LITTERAL_CODE_EXAMPLE = "69385"; - private static final String LITTERAL_DATE_PROJETE_EXAMPLE = "2011-12-31"; - private static final String LITTERAL_DATE_EXAMPLE = "1960-01-01"; - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT_MUNICIPAL + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = ArrondissementMunicipal.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString =null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getArrondissementmunicipalByCodeAndDate( - code, - this.formatValidParameterDateIfIsNull(dateString))), - header, - new ArrondissementMunicipal(code)); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT_MUNICIPAL + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent l'arrondissement municipal", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL, - type = Constants.TYPE_STRING)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant l'arrondissement municipal actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString =null; - if (date != null){ - dateString = date.getString(); - } - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsArrondissementMunicipal( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_LISTE_ARRONDISSEMENT_MUNICIPAL) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur tous les arrondissements municipaux actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = ArrondissementMunicipal.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString =null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getListArrondissementsMunicipaux(this.formatValidParameterDateIfIsNull(dateString))), - header, - ArrondissementsMunicipaux.class, - ArrondissementMunicipal.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT_MUNICIPAL + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les arrondissements municipaux qui succèdent à l'arrondissement municipal", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = ArrondissementMunicipal.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL, - type = Constants.TYPE_STRING), - example=LITTERAL_CODE_EXAMPLE) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION, - required = false, - example=LITTERAL_DATE_EXAMPLE, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString =null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getNextArrondissementMunicipal(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - ArrondissementsMunicipaux.class, - ArrondissementMunicipal.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT_MUNICIPAL + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les arrondissement municipaux qui précèdent l'arrondissement municipal", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = ArrondissementMunicipal.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL_DESCRIPTION, - required = true, - example=LITTERAL_CODE_EXAMPLE, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL, - type = Constants.TYPE_STRING)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString =null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getPreviousArrondissementMunicipal(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - ArrondissementsMunicipaux.class, - ArrondissementMunicipal.class); - } - } - - @Path(ConstGeoApi.PATH_ARRONDISSEMENT_MUNICIPAL + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les arrondissements municipaux qui résultent de la projection de l'arrondissement municipal à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = ArrondissementMunicipal.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ARRONDISSEMENT_MUNICIPAL, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_DATE_ORIGINE_PROJ_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_DATE_PROJECTION_DESCRIPTION, - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_PROJETE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateprojectionString = null; - if (date != null){ - dateString = date.getString(); - } - if (dateProjection != null){ - dateprojectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateprojectionString) || dateprojectionString == null) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionArrondissementMunicipal( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateprojectionString)), - header, - ArrondissementsMunicipaux.class, - ArrondissementMunicipal.class); - } - } - - @Hidden - @Path(ConstGeoApi.PATH_LISTE_ARRONDISSEMENT_MUNICIPAL + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTIONS, - summary = "Récupérer la projection des arrondissements municipaux vers la date passée en paramètre.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Projections.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAllProjections( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser les arrondissements municipaux de départ. Par défaut, c’est la date courante qui est utilisée.", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle sont projetées les arrondissements municipaux. Paramètre obligatoire (erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateprojectionString = null; - if (date != null){ - dateString = date.getString(); - } - if (dateProjection != null){ - dateprojectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateprojectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfProjection( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAllProjectionArrondissementMunicipal( - this.formatValidParameterDateIfIsNull(dateString), - dateprojectionString)), - header); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/BassinDeVie2022Api.java b/src/main/java/fr/insee/rmes/api/geo/territoire/BassinDeVie2022Api.java deleted file mode 100644 index 2c4cc4be..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/BassinDeVie2022Api.java +++ /dev/null @@ -1,211 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.BassinDeVie2022; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.BassinsDeVie2022; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class BassinDeVie2022Api extends AbstractGeoApi { - - private static final String CODE_PATTERN_BASSINDEVIE = "/{code: " + ConstGeoApi.PATTERN_BASSINDEVIE + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogBassinDevie2022"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un bassin de vie identifiée par son code (neuf caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "bassin de vie 2022"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer le bassin de vie active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_CODE_EXAMPLE = "01004"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom de l'intercommunalité" ; - - - - @Path(ConstGeoApi.PATH_BASSINDEVIE + CODE_PATTERN_BASSINDEVIE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = BassinDeVie2022.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_BASSINDEVIE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_BASSINDEVIE, - type = Constants.TYPE_STRING, example="01004")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - - // Gérer la nullité de la date - String dateString = (date != null) ? date.getString() : null; - - // Si la date est invalide ou nulle, retourner une réponse BAD_REQUEST - if (dateString != null && !this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - - // Requête SPARQL avec la date correcte ou null - return this.generateResponseATerritoireByCode( - sparqlUtils.executeSparqlQuery( - GeoQueries.getBassinDeVie2022ByCodeAndDate( - code, this.formatValidParameterDateIfIsNull(dateString) - ) - ), - header, - new BassinDeVie2022(code) - ); - } - - @Path(ConstGeoApi.PATH_LISTE_BASSINDEVIE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur tous les bassins de vie actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = BassinDeVie2022.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les bassins de vie à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="Ambérieu-en-Bugey")) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) - { - // Gérer la nullité de la date - String dateString = (date != null) ? date.getString() : null; - - // Validation de la date si elle est fournie - if (dateString != null && !this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - - // Validation et encodage du filtreNom - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - - // Exécution de la requête SPARQL avec les paramètres validés - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getListBassinsDeVie( - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParameterFiltreIfIsNull(filtreNomString) - ) - ), - header, - BassinsDeVie2022.class, - BassinDeVie2022.class - ); - } - - - // Méthode pour encoder et valider le filtreNom - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - //on peut ajouter d'autres contrôles - return filtreNom.replaceAll("[<>\"]", ""); - } - - @Path(ConstGeoApi.PATH_BASSINDEVIE + CODE_PATTERN_BASSINDEVIE + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans le bassin de vie", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_BASSINDEVIE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_BASSINDEVIE, - type = Constants.TYPE_STRING, example="35176")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans le bassin de vie actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="Commune")) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - - // Gérer la nullité de la date - String dateString = (date != null) ? date.getString() : null; - - // Validation de la date et du type de territoire - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - - // Exécution de la requête SPARQL - return this - .generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getDescendantsBassinDeVie( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire) - ) - ), - header, - Territoires.class, - Territoire.class - ); - } - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CantonAPI.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CantonAPI.java deleted file mode 100644 index 1cc73c43..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CantonAPI.java +++ /dev/null @@ -1,422 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Canton; -import fr.insee.rmes.modeles.geo.territoire.Commune; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Cantons; -import fr.insee.rmes.modeles.geo.territoires.Communes; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -import jakarta.ws.rs.*; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class CantonAPI extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code:[0-9]{4}}"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom des communes renvoyées" ; - - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Canton"; - private static final String LITTERAL_ID_OPERATION = "getcogcanton"; - private static final String LITTERAL_CODE_EXAMPLE = "0101"; - - private static final String LITTERAL_CODE_HISTORY_EXAMPLE = "0103"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la region active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un canton identifié par son code (quatre chiffres pour la métropole ou cinq pour les DOM ou 2A/2B plus deux chiffres pour la Corse)"; - - private static final String LITTERAL_DATE_EXAMPLE = "2020-01-01"; - - - - @Path(ConstGeoApi.PATH_CANTON + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Canton.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getCantonByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new Canton(code)); - } - } - - - - - - @Path(ConstGeoApi.PATH_LISTE_CANTON) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les cantons actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Canton.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les cantons actifs à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListCantons(this.formatValidParameterDateIfIsNull(dateString))), - header, - Cantons.class, - Canton.class); - } - } - - @Path(ConstGeoApi.PATH_CANTON +CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les cantons qui succèdent au canton", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Canton.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON, - type = Constants.TYPE_STRING, example="0103")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le canton de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextCanton(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Cantons.class, - Canton.class); - } - } - - - @Path(ConstGeoApi.PATH_CANTON + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les cantons qui précèdent le canton", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Canton.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le canton de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) ) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousCanton(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Cantons.class, - Canton.class); - } - } - - @Path(ConstGeoApi.PATH_CANTON + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les cantons qui résultent de la projection du canton à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Canton.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le canton de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle est projetée le canton. Paramètre obligatoire (Format : 'AAAA-MM-JJ', erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - String dateProjectionString = null; - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString) ) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionCanton( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header, - Cantons.class, - Canton.class); - } - } - - @Path(ConstGeoApi.PATH_CANTON + CODE_PATTERN + "/communes") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_COMMUNES, - summary = "Récupérer les informations concernant les communes qui ont un territoire commun avec le canton {code}\n", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Canton.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getCommunes( @Parameter( - description = ConstGeoApi.PATTERN_CANTON_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "La requête renvoie les communes actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date){ - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - - if (!code.matches(ConstGeoApi.PATTERN_CANTON)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getCommunesCanton( - code, - this.formatValidParameterDateIfIsNull(dateString))), - header, - Communes.class, - Commune.class); - } - - } - - - - @Path(ConstGeoApi.PATH_CANTON + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent le canton", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant le canton actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsCanton( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CantonOuVilleApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CantonOuVilleApi.java deleted file mode 100644 index 04e5ac57..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CantonOuVilleApi.java +++ /dev/null @@ -1,445 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.CantonOuVille; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.CantonsEtVilles; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.CSVUtils; -import fr.insee.rmes.utils.Constants; -import fr.insee.rmes.utils.ResponseUtils; -import fr.insee.rmes.utils.SparqlUtils; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -import jakarta.ws.rs.*; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class CantonOuVilleApi extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code}"; - private static final String LITTERAL_ID_OPERATION = "getcogcantonouville"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un canton-ou-ville identifié par son code (quatre chiffres pour la métropole ou cinq pour les DOM)"; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom des territoires renvoyés" ; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_RESPONSE_DESCRIPTION = "CantonOuVille"; - private static final String LITTERAL_CODE_EXAMPLE = "0101"; - private static final String LITTERAL_CODE_HISTORY_EXAMPLE = "0104"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer le canton-ou-ville actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_DATE_EXAMPLE = "2016-01-01"; - - protected CantonOuVilleApi(SparqlUtils sparqlUtils, CSVUtils csvUtils, ResponseUtils responseUtils) { - super(sparqlUtils, csvUtils, responseUtils); - } - - public CantonOuVilleApi() { - // Constructeur par défaut - } - - @Path(ConstGeoApi.PATH_CANTON_OU_VILLE + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CantonOuVille.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_OU_VILLE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON_OU_VILLE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON_OU_VILLE)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getCantonOuVilleByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new CantonOuVille(code)); - } - } - - @Path(ConstGeoApi.PATH_LISTE_CANTON_OU_VILLE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les cantons-et-villes actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = CantonOuVille.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les cantons-ou-villes actifs à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListCantonsOuVilles(this.formatValidParameterDateIfIsNull(dateString))), - header, - CantonsEtVilles.class, - CantonOuVille.class); - } - } - - @Path(ConstGeoApi.PATH_CANTON_OU_VILLE + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans le canton-ou-ville", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_OU_VILLE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON_OU_VILLE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans le canton-ou-ville actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire, - @Parameter( - description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - if (!code.matches(ConstGeoApi.PATTERN_CANTON_OU_VILLE)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsCantonOuVille( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire), this.formatValidParameterFiltreIfIsNull(filtreNomString))), - header, - Territoires.class, - Territoire.class); - } - } - - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - return filtreNom.replaceAll("[<>\"']", ""); - } - - @Path(ConstGeoApi.PATH_CANTON_OU_VILLE + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent le canton-ou-ville", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_OU_VILLE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON_OU_VILLE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant le canton-ou-ville actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON_OU_VILLE)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsCantonOuVille( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } -} - - @Path(ConstGeoApi.PATH_CANTON_OU_VILLE + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les cantons-ou-villes qui précèdent le canton-ou-ville", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CantonOuVille.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_OU_VILLE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON_OU_VILLE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le canton-ou-ville de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON_OU_VILLE)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousCantonOuVille(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - CantonsEtVilles.class, - CantonOuVille.class); - } - } - - @Path(ConstGeoApi.PATH_CANTON_OU_VILLE + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les régions qui succèdent à la région", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CantonOuVille.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_OU_VILLE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON_OU_VILLE, - type = Constants.TYPE_STRING, example="0103")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le canton-ou-ville de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON_OU_VILLE)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextCantonOuVille(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - CantonsEtVilles.class, - CantonOuVille.class); - } - } - - @Path(ConstGeoApi.PATH_CANTON_OU_VILLE + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les cantons-ou-villes qui résultent de la projection de la région à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CantonOuVille.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_CANTON_OU_VILLE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CANTON_OU_VILLE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le canton-ou-ville de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle est projetée le canton-ou-ville. Paramètre obligatoire (Format : 'AAAA-MM-JJ', erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date !=null) { - dateString = date.getString(); - } - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if (!code.matches(ConstGeoApi.PATTERN_CANTON_OU_VILLE)) { - String errorMessage = ConstGeoApi.ERREUR_PATTERN; - return Response.status(Response.Status.BAD_REQUEST) - .entity(errorMessage) - .type(MediaType.TEXT_PLAIN) - .build(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionCantonOuVille( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header, - CantonsEtVilles.class, - CantonOuVille.class); - } - } - - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CirconscriptionTerritorialeApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CirconscriptionTerritorialeApi.java deleted file mode 100644 index 7f07f7e5..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CirconscriptionTerritorialeApi.java +++ /dev/null @@ -1,144 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.CirconscriptionTerritoriale; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - - - @Path(ConstGeoApi.PATH_GEO) - @Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) - -public class CirconscriptionTerritorialeApi extends AbstractGeoApi { - - private static final String CODE_PATTERNCIRCO_TER = "/{code: " + ConstGeoApi.PATTERN_CIRCO_TER + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogdistrict"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une circonscription territoriale identifiée par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "circonscription territoriale d'une collectivité d'outre-mer"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la circonscription territoriale active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_CODE_EXAMPLE = "98611"; - - - @Path(ConstGeoApi.PATH_CIRCO_TER + CODE_PATTERNCIRCO_TER) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CirconscriptionTerritoriale.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_CIRCO_TER_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CIRCO_TER, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getCirconscriptionTerritorialeByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new CirconscriptionTerritoriale(code)); - } - } - - @Path(ConstGeoApi.PATH_CIRCO_TER + CODE_PATTERNCIRCO_TER + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent la circonscription territoriale", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_CIRCO_TER_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_CIRCO_TER, - type = Constants.TYPE_STRING, example="98611")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant la circonscription territoriale actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsCirconscriptionTerritoriale( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CollectivitesDOutreMerAPI.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CollectivitesDOutreMerAPI.java deleted file mode 100644 index 11dc1874..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CollectivitesDOutreMerAPI.java +++ /dev/null @@ -1,221 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.CollectiviteDOutreMer; -import fr.insee.rmes.modeles.geo.territoire.Commune; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.CollectivitesDOutreMer; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - - - @Path(ConstGeoApi.PATH_GEO) - @Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) - - public class CollectivitesDOutreMerAPI extends AbstractGeoApi { - - private static final String CODE_PATTERNCOM = "/{code: " + ConstGeoApi.PATTERN_COM + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogcom"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une collectivité d'outre-mer identifiée par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "collectivité d'outre-mer"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la collectivite d'outre-mer active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_CODE_EXAMPLE = "988"; - - - - @Path(ConstGeoApi.PATH_LISTE_COM) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les collectivités d'outre-mer actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les collectivités d'outre-mer actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) - { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery(GeoQueries.getListCollectivitesDOutreMer(this.formatValidParameterDateIfIsNull(dateString))), - header, - CollectivitesDOutreMer.class, - CollectiviteDOutreMer.class ); - } - } - - - @Path(ConstGeoApi.PATH_COM + CODE_PATTERNCOM) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CollectiviteDOutreMer.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_COM_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COM, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getCollectiviteDOutreMerByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new CollectiviteDOutreMer(code)); - } - } - - - @Path(ConstGeoApi.PATH_COM + CODE_PATTERNCOM + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans la collectivite d'outre-mer", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) -/* public Response getDescendants( - @Parameter( - description = "code de la collectivité d'outre-mer (3 caractères)", - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COM, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description ="Filtre pour renvoyer les territoires inclus dans la collectivité d'outre-mer active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION+ "(Commune ou District)", - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire, - @Parameter( - description = "Filtre sur le nom du ou des territoires renvoyés", - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery(GeoQueries.getDescendantsCollectiviteDOutreMer(code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire), - this.formatValidParameterFiltreIfIsNull(filtreNom.getString()))), - header, Territoires.class, Territoire.class); - } - }*/ - public Response getDescendants( - @PathParam(Constants.CODE) String code, - @HeaderParam(HttpHeaders.ACCEPT) String header, - @QueryParam(value = Constants.PARAMETER_DATE) Date date, - @QueryParam(value = Constants.PARAMETER_TYPE) String typeTerritoire, - @QueryParam(value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) { - - String dateString = null; - if (date != null) { - dateString = date.getString(); - } - - // Vérification que le paramètre filtreNom n'est pas null avant d'appeler getString() - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery(GeoQueries.getDescendantsCollectiviteDOutreMer(code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire), - this.formatValidParameterFiltreIfIsNull(filtreNomString))), - header, Territoires.class, Territoire.class); - } - } - - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - return filtreNom.replaceAll("[<>\"']", ""); - } - - } diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneApi.java deleted file mode 100644 index 22258a04..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneApi.java +++ /dev/null @@ -1,556 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Canton; -import fr.insee.rmes.modeles.geo.territoire.Commune; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Cantons; -import fr.insee.rmes.modeles.geo.territoires.Communes; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class CommuneApi extends AbstractGeoApi { - - private static final String LITTERAL_DATE_EXAMPLE = "1945-06-26"; - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_COMMUNE + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogcom"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une commune française identifiée par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Commune"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la commune active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom de la commune" ; - private static final String LITTERAL_CODE_EXAMPLE = "14475"; - private static final String LITTERAL_PARAMETER_COM_DESCRIPTION="Sélectionner \"true\" pour inclure les collectivités d’outre-mer"; - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getCommuneByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new Commune(code)); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent la commune", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example="73035")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant la commune active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsCommune( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans la commune", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example="13055")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans la commune active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="ArrondissementMunicipal")) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsCommune( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - /* @Path(ConstGeoApi.PATH_LISTE_COMMUNE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les communes actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les communes actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="Bonnay")) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom, - @Parameter(description = LITTERAL_PARAMETER_COM_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_BOOLEAN, allowableValues = {"true","false"},example="false", defaultValue = "false")) - @QueryParam( - value = Constants.PARAMETER_STRING) Boolean com - ) - { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListCommunes(this.formatValidParameterDateIfIsNull(dateString), this.formatValidParameterFiltreIfIsNull(filtreNom.getString()),this.formatValidParameterBooleanIfIsNull(com))), - header, - Communes.class, - Commune.class); - } - }*/ - @Path(ConstGeoApi.PATH_LISTE_COMMUNE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les communes actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les communes actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="Bonnay")) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom, - @Parameter(description = LITTERAL_PARAMETER_COM_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_BOOLEAN, allowableValues = {"true","false"}, example="false", defaultValue = "false")) - @QueryParam( - value = Constants.PARAMETER_STRING) Boolean com - ) - { - String dateString = null; - if (date != null) { - dateString = date.getString(); - } - - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - - - if (!this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery(GeoQueries.getListCommunes( - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParameterFiltreIfIsNull(filtreNomString), - this.formatValidParameterBooleanIfIsNull(com))), - header, - Communes.class, - Commune.class - ); - } - } - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - return filtreNom.replaceAll("[<>\"']", ""); - } - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les communes qui succèdent à la commune", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser la commune de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextCommune(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Communes.class, - Commune.class); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les communes qui précèdent la commune", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser la commune de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousCommune(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Communes.class, - Commune.class); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les communes qui résultent de la projection de la commune à la date passée en paramètre.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser la commune de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle est projetée la commune. Paramètre obligatoire (Format : 'AAAA-MM-JJ', erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date !=null) { - dateString = date.getString(); - } - if (dateProjection !=null) { - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString) || dateProjectionString== null) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionCommune( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header, - Communes.class, - Commune.class); - } - } - - @Hidden - @Path(ConstGeoApi.PATH_LISTE_COMMUNE + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTIONS, - summary = "Récupérer la projection des communes vers la date passée en paramètre.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Projections.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAllProjections( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser les communes de départ. Par défaut, c’est la date courante qui est utilisée.", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle sont projetées les communes. Paramètre obligatoire (erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date !=null) { - dateString = date.getString(); - } - if (dateProjection !=null) { - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfProjection( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAllProjectionCommune(this.formatValidParameterDateIfIsNull(dateString), dateProjectionString)), - header); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE + CODE_PATTERN +"/cantons") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getComCanton", - summary = "information sur le(s) canton(s) associé(s) à la commune identifiée par son code (cinq caractères)", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Canton.class)), - description = "Cantons dont fait partie la commune") - }) - public Response getCantonForCommune( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example="01053")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date !=null) { - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getCantonCommunes( - - code, - this.formatValidParameterDateIfIsNull(dateString))), - header, - Cantons.class, - Canton.class); } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneAssocieeApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneAssocieeApi.java deleted file mode 100644 index a9bd30cb..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneAssocieeApi.java +++ /dev/null @@ -1,185 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Commune; -import fr.insee.rmes.modeles.geo.territoire.CommuneAssociee; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.CommunesAssociees; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class CommuneAssocieeApi extends AbstractGeoApi { - - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_COMMUNE + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogcomass"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une commune associée identifiée par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Commune associée"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la commune associée active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_CODE_EXAMPLE = "14463"; - - - @Path(ConstGeoApi.PATH_COMMUNE_ASSOCIEE + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CommuneAssociee.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_ASSOCIEE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getCommuneAssocieeByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new CommuneAssociee(code)); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE_ASSOCIEE + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent la commune associée", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_ASSOCIEE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant la commune associée active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsCommuneAssociee( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_LISTE_COMMUNE_ASSOCIEE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les communes associées actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les communes associées actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getListCommunesAssociees(this.formatValidParameterDateIfIsNull(dateString))), - header, - CommunesAssociees.class, - CommuneAssociee.class); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneDelegueeApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneDelegueeApi.java deleted file mode 100644 index 8a9e94fc..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/CommuneDelegueeApi.java +++ /dev/null @@ -1,183 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Commune; -import fr.insee.rmes.modeles.geo.territoire.CommuneDeleguee; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.CommunesDeleguees; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class CommuneDelegueeApi extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_COMMUNE + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogcomdel"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une commune déléguée identifiée par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Commune déléguée"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la commune déléguée active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_CODE_EXAMPLE = "46248"; - - @Path(ConstGeoApi.PATH_COMMUNE_DELEGUEE + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = CommuneDeleguee.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DELEGUEE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getCommuneDelegueeByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new CommuneDeleguee(code)); - } - } - - @Path(ConstGeoApi.PATH_COMMUNE_DELEGUEE + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent la commune déléguée", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_COMMUNE_DELEGUEE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_COMMUNE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant la commune déléguée active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsCommuneDeleguee( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_LISTE_COMMUNE_DELEGUEE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les communes déléguées actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Commune.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les communes déléguées actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getListCommunesDeleguees(this.formatValidParameterDateIfIsNull(dateString))), - header, - CommunesDeleguees.class, - CommuneDeleguee.class); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/DepartementApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/DepartementApi.java deleted file mode 100644 index dcd8e980..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/DepartementApi.java +++ /dev/null @@ -1,440 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Departement; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Departements; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class DepartementApi extends AbstractGeoApi { - - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_DEPARTEMENT + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogdep"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un departement identifié par son code (deux ou trois caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Departement"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom des territoires renvoyés" ; - private static final String LITTERAL_CODE_EXAMPLE = "22"; - private static final String LITTERAL_DATE_EXAMPLE = "1950-01-01"; - - - @Path(ConstGeoApi.PATH_DEPARTEMENT + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Departement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_DEPARTEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DEPARTEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer la département actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getDepartementByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new Departement(code)); - } - } - - @Path(ConstGeoApi.PATH_DEPARTEMENT + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent le département", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_DEPARTEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DEPARTEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant le département actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsDepartement( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_DEPARTEMENT + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans le departement", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_DEPARTEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DEPARTEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans le département actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire, - @Parameter( - description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsDepartement( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire),this.formatValidParameterFiltreIfIsNull(filtreNomString))), - header, - Territoires.class, - Territoire.class); - } - } - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - return filtreNom.replaceAll("[<>\"']", ""); - } - - @Path(ConstGeoApi.PATH_LISTE_DEPARTEMENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur tous les départements actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Departement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer le département actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery(GeoQueries.getListDepartements(this.formatValidParameterDateIfIsNull(dateString))), - header, - Departements.class, - Departement.class); - } - } - - @Path(ConstGeoApi.PATH_DEPARTEMENT + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les départements qui succèdent au département", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Departement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_DEPARTEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DEPARTEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le departement de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextDepartement(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Departements.class, - Departement.class); - } - } - - @Path(ConstGeoApi.PATH_DEPARTEMENT + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les departements qui précèdent le departement", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Departement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_DEPARTEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DEPARTEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le departement de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousDepartement(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Departements.class, - Departement.class); - } - } - - @Path(ConstGeoApi.PATH_DEPARTEMENT + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les départements qui résultent de la projection du département à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Departement.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_DEPARTEMENT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DEPARTEMENT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser le departement de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle est projetée le departement. Paramètre obligatoire (Format : 'AAAA-MM-JJ', erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjection.getString())) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionDepartement( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateProjection.getString())), - header, - Departements.class, - Departement.class); - } - } - - @Hidden - @Path(ConstGeoApi.PATH_LISTE_DEPARTEMENT + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTIONS, - summary = "Récupérer la projection des departements vers la date passée en paramètre.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Projections.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAllProjections( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser les departements de départ. Par défaut, c’est la date courante qui est utilisée.", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle sont projetées les departements. Paramètre obligatoire (erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date != null){ - dateString = date.getString(); - } - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfProjection( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAllProjectionDepartement( - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/DistrictApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/DistrictApi.java deleted file mode 100644 index 7caaa74f..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/DistrictApi.java +++ /dev/null @@ -1,143 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.District; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - - - @Path(ConstGeoApi.PATH_GEO) - @Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) - - - -public class DistrictApi extends AbstractGeoApi { - - private static final String CODE_PATTERNDISTRICT = "/{code: " + ConstGeoApi.PATTERN_DISTRICT + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogdistrict"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un district identifiée par son code (cinq caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "district d'une collectivité d'outre-mer"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer le district actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_CODE_EXAMPLE = "98411"; - - @Path(ConstGeoApi.PATH_DISTRICT + CODE_PATTERNDISTRICT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = District.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_DISTRICT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DISTRICT, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getDistrictByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new District(code)); - } - } - - @Path(ConstGeoApi.PATH_DISTRICT + CODE_PATTERNDISTRICT + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent le district", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_DISTRICT_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_DISTRICT, - type = Constants.TYPE_STRING, example="98411")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant le district actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsDistrict( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/IntercommunaliteAPI.java b/src/main/java/fr/insee/rmes/api/geo/territoire/IntercommunaliteAPI.java deleted file mode 100644 index f6002cde..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/IntercommunaliteAPI.java +++ /dev/null @@ -1,308 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Intercommunalite; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Intercommunalites; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - - - @Path(ConstGeoApi.PATH_GEO) - @Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) - -public class IntercommunaliteAPI extends AbstractGeoApi { - - private static final String CODE_PATTERN_INTERCO = "/{code: " + ConstGeoApi.PATTERN_INTERCO + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogInterco"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une intercommunalité identifiée par son code (neuf caractères)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "intercommunalité"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer l'intercommunalité active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_CODE_EXAMPLE = "240100883"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom de l'intercommunalité" ; - private static final String LITTERAL_DATE_EXAMPLE = "2014-01-01"; - - @Path(ConstGeoApi.PATH_INTERCO + CODE_PATTERN_INTERCO) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Intercommunalite.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION, - required = true, - schema = @Schema(pattern = ConstGeoApi.PATTERN_INTERCO, - type = Constants.TYPE_STRING, example = LITTERAL_CODE_EXAMPLE)) - @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter(description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) - @QueryParam(value = Constants.PARAMETER_DATE) Date date) { - - String dateString = (date != null) ? date.getString() : null; - - if (!this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseATerritoireByCode( - sparqlUtils.executeSparqlQuery( - GeoQueries.getIntercommunaliteByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new Intercommunalite(code)); - } - } - - @Path(ConstGeoApi.PATH_LISTE_INTERCO) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les intercommunalités actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Intercommunalite.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter(description = "Filtre pour renvoyer les intercommunalités à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) - @QueryParam(value = Constants.PARAMETER_DATE) Date date, - @Parameter(description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example = "Plaine de l'Ain")) - @QueryParam(value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) { - - String dateString = (date != null) ? date.getString() : null; - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - - if (!this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getListIntercommunalites(this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParameterFiltreIfIsNull(filtreNomString))), - header, - Intercommunalites.class, - Intercommunalite.class); - } - } - - - // Méthode pour encoder et valider le filtreNom - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - //on peut ajouter d'autres contrôles - return filtreNom.replaceAll("[<>\"]", ""); - } - - @Path(ConstGeoApi.PATH_INTERCO + CODE_PATTERN_INTERCO + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les intercommunalités qui précèdent l’intercommunalité", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION, - required = true, - schema = @Schema(pattern = ConstGeoApi.PATTERN_INTERCO, - type = Constants.TYPE_STRING, example = "200046977")) - @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter(description = "Filtre pour renvoyer les informations concernant les intercommunalités qui précèdent l’intercommunalité à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) - @QueryParam(value = Constants.PARAMETER_DATE) Date date) { - - String dateString = (date != null) ? date.getString() : null; - - if (!this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getPreviousIntercommunalite(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Intercommunalites.class, - Intercommunalite.class); - } - } - - - @Path(ConstGeoApi.PATH_INTERCO + CODE_PATTERN_INTERCO + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans l'intercommunalite", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION, - required = true, - schema = @Schema(pattern = ConstGeoApi.PATTERN_INTERCO, - type = Constants.TYPE_STRING, example = "200000438")) - @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter(description = "Filtre pour renvoyer les territoires inclus dans l'intercommunalité active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) - @QueryParam(value = Constants.PARAMETER_DATE) Date date, - @Parameter(description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example = "Commune")) - @QueryParam(value = Constants.PARAMETER_TYPE) String typeTerritoire) { - - String dateString = (date != null) ? date.getString() : null; - - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getDescendantsIntercommunalite( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - - @Path(ConstGeoApi.PATH_INTERCO + CODE_PATTERN_INTERCO + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les intercommunalités qui succèdent à l'intercommunalite", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Intercommunalite.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION, - required = true, - schema = @Schema(pattern = ConstGeoApi.PATTERN_INTERCO, - type = Constants.TYPE_STRING, example = "246900245")) - @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter(description = "Filtre pour préciser l'intercommunalité de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example = LITTERAL_DATE_EXAMPLE)) - @QueryParam(value = Constants.PARAMETER_DATE) Date date) { - - String dateString = (date != null) ? date.getString() : null; - - if (!this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getNextIntercommunalite(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Intercommunalites.class, - Intercommunalite.class); - } - } - - - - @Path(ConstGeoApi.PATH_INTERCO + CODE_PATTERN_INTERCO + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les intercommunalites qui résultent de la projection de l'intercommunalité à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Intercommunalite.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION, - required = true, - schema = @Schema(pattern = ConstGeoApi.PATTERN_INTERCO, - type = Constants.TYPE_STRING, example = "200046977")) - @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter(description = "Filtre pour préciser l'intercommunalité de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) - @QueryParam(value = Constants.PARAMETER_DATE) Date date, - @Parameter(description = "Date vers laquelle est projetée l'intercommunalité. Paramètre obligatoire (Format : 'AAAA-MM-JJ', erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example = "2013-01-01")) - @QueryParam(value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - - String dateString = (date != null) ? date.getString() : null; - String dateProjectionString = (dateProjection != null) ? dateProjection.getString() : null; - - if (!this.verifyParameterDateIsRightWithoutHistory(dateString) || !this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } else { - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getProjectionIntercommunalite(code, this.formatValidParameterDateIfIsNull(dateString), dateProjectionString)), - header, - Intercommunalites.class, - Intercommunalite.class); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/IrisApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/IrisApi.java deleted file mode 100644 index 65d9bf3a..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/IrisApi.java +++ /dev/null @@ -1,228 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.CodeIris; -import fr.insee.rmes.modeles.geo.territoire.Iris; -import fr.insee.rmes.modeles.geo.territoire.PseudoIris; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.*; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -import jakarta.ws.rs.*; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class IrisApi extends AbstractGeoApi { - private static final String CODE_PATTERN = "/{code:}"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Iris"; - private static final String LITTERAL_ID_OPERATION = "getcogiris"; - private static final String LITTERAL_CODE_EXAMPLE = "010040101"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer l'Iris active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur un Iris identifié par son code (neuf chiffres pour la métropole ou 2A/2B plus 7 chiffres pour la Corse)"; - - - private final IrisUtils irisUtils; - - public IrisApi() { - // Constructeur par défaut - this.irisUtils = new IrisUtils(); - } - - protected IrisApi(SparqlUtils sparqlUtils, CSVUtils csvUtils, ResponseUtils responseUtils, IrisUtils irisUtils) { - super(sparqlUtils, csvUtils, responseUtils); - this.irisUtils = irisUtils; - } - - @Path(ConstGeoApi.PATH_IRIS + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Iris.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_IRIS_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_IRIS, - type = Constants.TYPE_STRING, example = LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - var codeIris = CodeIris.of(code); - if (codeIris.isInvalid()) { - return generateBadRequestResponse(ConstGeoApi.ERREUR_PATTERN); - } - if (!this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - - return getResponseForIrisOrPseudoIris(codeIris, header, date); - } - - private Response getResponseForIrisOrPseudoIris(CodeIris codeIris, String header, Date date) { - if (irisUtils.hasIrisDescendant(codeIris.codeCommune())) { - return getResponseForIris(codeIris, header, date); - } else { - return getResponseForPseudoIris(codeIris, header, date); - } - - } - - private Response getResponseForPseudoIris(CodeIris codeIris, String header, Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if (codeIris.isPseudoIrisCode()) { - return this.generateResponseATerritoireByCode( - sparqlUtils.executeSparqlQuery( - GeoQueries.getIrisByCodeAndDate(codeIris.code(), this.formatValidParameterDateIfIsNull(dateString))), - header, - new PseudoIris(codeIris.code())); - } else { - return Response.status(Response.Status.NOT_FOUND).entity("").build(); - } - } - - private Response getResponseForIris(CodeIris codeIris, String header, Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if (codeIris.isPseudoIrisCode()) { - return Response.status(Response.Status.NOT_FOUND).entity("").build(); - } else { - Territoire territoire = new Iris(codeIris.code()); - return this.generateResponseATerritoireByCode( - sparqlUtils.executeSparqlQuery( - GeoQueries.getIrisByCodeAndDate(codeIris.code(), this.formatValidParameterDateIfIsNull(dateString))), - header, - territoire); - } - } - - - @Path(ConstGeoApi.PATH_LISTE_IRIS) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les iris actifs à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les Iris ou faux-Iris à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter(description = "les Iris (et pseudo-iris) des collectivités d'outre-mer", - required = true, - schema = @Schema(type = Constants.TYPE_BOOLEAN, allowableValues = {"true", "false"}, example = "false", defaultValue = "false")) - @QueryParam( - value = Constants.PARAMETER_STRING) Boolean com - ) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if (!this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListIris(this.formatValidParameterDateIfIsNull(dateString), this.formatValidParameterBooleanIfIsNull(com))), - header, - Territoires.class, - Territoire.class); - } - } - - - @Path(ConstGeoApi.PATH_IRIS + CODE_PATTERN + ConstGeoApi.PATH_ASCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_ASCENDANTS, - summary = "Informations concernant les territoires qui contiennent l'Iris", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAscendants( - @Parameter( - description = ConstGeoApi.PATTERN_IRIS_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_IRIS, - type = Constants.TYPE_STRING, example = LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires contenant l'iris actif à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAscendantsIris( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/RegionApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/RegionApi.java deleted file mode 100644 index 85611e62..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/RegionApi.java +++ /dev/null @@ -1,395 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Region; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.modeles.geo.territoires.Regions; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.modeles.utils.FiltreNom; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Hidden; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class RegionApi extends AbstractGeoApi { - - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_REGION + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogreg"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une région identifiée par son code (deux chiffres)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Region"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la region active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - private static final String LITTERAL_PARAMETER_NAME_DESCRIPTION = "Filtre sur le nom des territoires renvoyés" ; - private static final String LITTERAL_CODE_EXAMPLE = "06"; - private static final String LITTERAL_CODE_HISTORY_EXAMPLE = "44"; - - private static final String LITTERAL_DATE_EXAMPLE = "2000-01-01"; - - @Path(ConstGeoApi.PATH_REGION + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = LITTERAL_ID_OPERATION, summary = LITTERAL_OPERATION_SUMMARY, responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Region.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_REGION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_REGION, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getRegionByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new Region(code)); - } - } - - @Path(ConstGeoApi.PATH_REGION + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans la région", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_REGION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_REGION, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans la région active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire, - @Parameter( - description = LITTERAL_PARAMETER_NAME_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING)) @QueryParam( - value = Constants.PARAMETER_FILTRE) FiltreNom filtreNom) { - - String dateString = (date != null) ? date.getString() : null; - - // Valider et nettoyer le filtreNom - String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null; - - if (!this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - - return this.generateResponseListOfTerritoire( - sparqlUtils.executeSparqlQuery( - GeoQueries.getDescendantsRegion( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire), - this.formatValidParameterFiltreIfIsNull(filtreNomString) - )), - header, - Territoires.class, - Territoire.class - ); - } - - // Méthode pour nettoyer et valider filtreNom - private String sanitizeFiltreNom(String filtreNom) { - if (filtreNom == null || filtreNom.isEmpty()) { - return null; - } - return filtreNom.replaceAll("[<>\"']", ""); - } - - @Path(ConstGeoApi.PATH_LISTE_REGION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les régions actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Region.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les régions actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListRegions(this.formatValidParameterDateIfIsNull(dateString))), - header, - Regions.class, - Region.class); - } - } - - @Path(ConstGeoApi.PATH_REGION + CODE_PATTERN + ConstGeoApi.PATH_SUIVANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_SUIVANT, - summary = "Informations concernant les régions qui succèdent à la région", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Region.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getSuivant( - @Parameter( - description = ConstGeoApi.PATTERN_REGION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_REGION, - type = Constants.TYPE_STRING, example="41")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser la region de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getNextRegion(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Regions.class, - Region.class); - } - } - - @Path(ConstGeoApi.PATH_REGION + CODE_PATTERN + ConstGeoApi.PATH_PRECEDENT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PRECEDENT, - summary = "Informations concernant les régions qui précèdent la région", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Region.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getPrecedent( - @Parameter( - description = ConstGeoApi.PATTERN_REGION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_REGION, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser la region de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getPreviousRegion(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - Regions.class, - Region.class); - } - } - - @Path(ConstGeoApi.PATH_REGION + CODE_PATTERN + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTION, - summary = "Informations concernant les regions qui résultent de la projection de la région à la date passée en paramètre. ", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Region.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getProjection( - @Parameter( - description = ConstGeoApi.PATTERN_REGION_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_REGION, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_HISTORY_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser la region de départ. Par défaut, c’est la date courante qui est utilisée. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle est projetée la region. Paramètre obligatoire (Format : 'AAAA-MM-JJ', erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE, example=LITTERAL_DATE_EXAMPLE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date != null){ - dateString = date.getString(); - } - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString) ) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getProjectionRegion( - code, - this.formatValidParameterDateIfIsNull(dateString), - dateProjectionString)), - header, - Regions.class, - Region.class); - } - } - - @Hidden - @Path(ConstGeoApi.PATH_LISTE_REGION + ConstGeoApi.PATH_PROJECTION) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_PROJECTIONS, - summary = "Récupérer la projection des régions vers la date passée en paramètre.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = Projections.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getAllProjections( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour préciser les régions de départ. Par défaut, c’est la date courante qui est utilisée.", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = "Date vers laquelle sont projetées les régions. Paramètre obligatoire (erreur 400 si absent)", - required = true, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE_PROJECTION) Date dateProjection) { - String dateString = null; - String dateProjectionString = null; - if (date != null){ - dateString = date.getString(); - } - if (dateProjection != null){ - dateProjectionString = dateProjection.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString) || ! this.verifyParameterDateIsRightWithoutHistory(dateProjectionString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfProjection( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getAllProjectionRegion(this.formatValidParameterDateIfIsNull(dateString), dateProjectionString)), - header); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/UniteUrbaineApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/UniteUrbaineApi.java deleted file mode 100644 index 42e919c3..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/UniteUrbaineApi.java +++ /dev/null @@ -1,184 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoire.UniteUrbaine2020; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.geo.territoires.UnitesUrbaines2020; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class UniteUrbaineApi extends AbstractGeoApi { - - - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_UNITE_URBAINE + "}"; - private static final String LITTERAL_ID_OPERATION = "getcoguu"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une unité urbaine française identifiée par son code (cinq chiffres ou 1 chiffre, 1 lettre et 3 chiffres)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Unité urbaine"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer l'unité urbaine active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_CODE_EXAMPLE = "01121"; - - - @Path(ConstGeoApi.PATH_UNITE_URBAINE + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = UniteUrbaine2020.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_UNITE_URBAINE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_UNITE_URBAINE, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getUniteUrbaineByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new UniteUrbaine2020(code)); - } - } - - @Path(ConstGeoApi.PATH_UNITE_URBAINE + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans l'unité urbaine", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_UNITE_URBAINE_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_UNITE_URBAINE, - type = Constants.TYPE_STRING, example="01121")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans l'unité urbaine active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="ArrondissementMunicipal")) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsUniteUrbaine( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_LISTE_UNITE_URBAINE) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les unités urbaines actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = UniteUrbaine2020.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les unités urbaines actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListUnitesUrbaines(this.formatValidParameterDateIfIsNull(dateString))), - header, - UnitesUrbaines2020.class, - UniteUrbaine2020.class); - } - } - -} - diff --git a/src/main/java/fr/insee/rmes/api/geo/territoire/ZoneEmploiApi.java b/src/main/java/fr/insee/rmes/api/geo/territoire/ZoneEmploiApi.java deleted file mode 100644 index ccd3fc86..00000000 --- a/src/main/java/fr/insee/rmes/api/geo/territoire/ZoneEmploiApi.java +++ /dev/null @@ -1,181 +0,0 @@ -package fr.insee.rmes.api.geo.territoire; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; - -import fr.insee.rmes.api.geo.AbstractGeoApi; -import fr.insee.rmes.api.geo.ConstGeoApi; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoire.ZoneDEmploi2020; -import fr.insee.rmes.modeles.geo.territoires.Territoires; -import fr.insee.rmes.modeles.geo.territoires.ZonesDEmploi2020; -import fr.insee.rmes.modeles.utils.Date; -import fr.insee.rmes.queries.geo.GeoQueries; -import fr.insee.rmes.utils.Constants; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - -@Path(ConstGeoApi.PATH_GEO) -@Tag(name = ConstGeoApi.TAG_NAME, description = ConstGeoApi.TAG_DESCRIPTION) -public class ZoneEmploiApi extends AbstractGeoApi { - - private static final String CODE_PATTERN = "/{code: " + ConstGeoApi.PATTERN_ZONE_EMPLOI + "}"; - private static final String LITTERAL_ID_OPERATION = "getcogze"; - private static final String LITTERAL_OPERATION_SUMMARY = - "Informations sur une zone d'emploi française identifiée par son code (quatre chiffres)"; - private static final String LITTERAL_RESPONSE_DESCRIPTION = "Zone d'emploi"; - private static final String LITTERAL_PARAMETER_DATE_DESCRIPTION = - "Filtre pour renvoyer la zone d'emploi active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')"; - private static final String LITTERAL_PARAMETER_TYPE_DESCRIPTION = "Filtre sur le type de territoire renvoyé."; - - private static final String LITTERAL_CODE_EXAMPLE = "2415"; - - - @Path(ConstGeoApi.PATH_ZONE_EMPLOI + CODE_PATTERN) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION, - summary = LITTERAL_OPERATION_SUMMARY, - responses = { - @ApiResponse( - content = @Content(schema = @Schema(implementation = ZoneDEmploi2020.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getByCode( - @Parameter( - description = ConstGeoApi.PATTERN_ZONE_EMPLOI_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ZONE_EMPLOI, - type = Constants.TYPE_STRING, example=LITTERAL_CODE_EXAMPLE)) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = LITTERAL_PARAMETER_DATE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithoutHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseATerritoireByCode( - sparqlUtils - .executeSparqlQuery( - GeoQueries.getZoneEmploiByCodeAndDate(code, this.formatValidParameterDateIfIsNull(dateString))), - header, - new ZoneDEmploi2020(code)); - } - } - - @Path(ConstGeoApi.PATH_ZONE_EMPLOI + CODE_PATTERN + ConstGeoApi.PATH_DESCENDANT) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_DESCENDANTS, - summary = "Informations concernant les territoires inclus dans la zone d'emploi", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getDescendants( - @Parameter( - description = ConstGeoApi.PATTERN_ZONE_EMPLOI_DESCRIPTION, - required = true, - schema = @Schema( - pattern = ConstGeoApi.PATTERN_ZONE_EMPLOI, - type = Constants.TYPE_STRING, example="2415")) @PathParam(Constants.CODE) String code, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les territoires inclus dans la zone d'emploi active à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')", - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date, - @Parameter( - description = LITTERAL_PARAMETER_TYPE_DESCRIPTION, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, example="ArrondissementMunicipal")) @QueryParam( - value = Constants.PARAMETER_TYPE) String typeTerritoire) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery( - GeoQueries - .getDescendantsZoneEmploi( - code, - this.formatValidParameterDateIfIsNull(dateString), - this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire))), - header, - Territoires.class, - Territoire.class); - } - } - - @Path(ConstGeoApi.PATH_LISTE_ZONE_EMPLOI) - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = LITTERAL_ID_OPERATION + ConstGeoApi.ID_OPERATION_LISTE, - summary = "Informations sur toutes les zones d'emploi actives à la date donnée. Par défaut, c’est la date courante.", - responses = { - @ApiResponse( - content = @Content(schema = @Schema(type = ARRAY, implementation = ZoneDEmploi2020.class)), - description = LITTERAL_RESPONSE_DESCRIPTION) - }) - public Response getListe( - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header, - @Parameter( - description = "Filtre pour renvoyer les zones d'emploi actives à la date donnée. Par défaut, c’est la date courante. (Format : 'AAAA-MM-JJ')" + LITTERAL_PARAMETER_DATE_WITH_HISTORY, - required = false, - schema = @Schema(type = Constants.TYPE_STRING, format = Constants.FORMAT_DATE)) @QueryParam( - value = Constants.PARAMETER_DATE) Date date) { - String dateString = null; - if (date != null){ - dateString = date.getString(); - } - if ( ! this.verifyParameterDateIsRightWithHistory(dateString)) { - return this.generateBadRequestResponse(); - } - else { - return this - .generateResponseListOfTerritoire( - sparqlUtils - .executeSparqlQuery(GeoQueries.getListZonesEmploi(this.formatValidParameterDateIfIsNull(dateString))), - header, - ZonesDEmploi2020.class, - ZoneDEmploi2020.class); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/operations/OperationsAPI.java b/src/main/java/fr/insee/rmes/api/operations/OperationsAPI.java deleted file mode 100644 index 49a94655..00000000 --- a/src/main/java/fr/insee/rmes/api/operations/OperationsAPI.java +++ /dev/null @@ -1,181 +0,0 @@ -package fr.insee.rmes.api.operations; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import jakarta.ws.rs.GET; -import jakarta.ws.rs.HeaderParam; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.PathParam; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.HttpHeaders; -import jakarta.ws.rs.core.MediaType; -import jakarta.ws.rs.core.Response; -import jakarta.ws.rs.core.Response.Status; - -import org.apache.commons.lang3.StringUtils; - -import fr.insee.rmes.api.AbstractMetadataApi; -import fr.insee.rmes.modeles.operations.CsvFamily; -import fr.insee.rmes.modeles.operations.CsvIndicateur; -import fr.insee.rmes.modeles.operations.CsvSerie; -import fr.insee.rmes.modeles.operations.Famille; -import fr.insee.rmes.modeles.operations.Familles; -import fr.insee.rmes.modeles.operations.Indicateur; -import fr.insee.rmes.modeles.operations.Serie; -import fr.insee.rmes.modeles.operations.documentations.DocumentationSims; -import fr.insee.rmes.queries.operations.OperationsQueries; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -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.tags.Tag; - - -@Path("/operations") -@Tag(name = "operations", description = "Operations API") -public class OperationsAPI extends AbstractMetadataApi { - - private OperationsApiService operationsApiService = new OperationsApiService(); - - - @Path("/arborescence") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getSeries", - summary = "Liste des opérations disponibles dans leur arborescence", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = Familles.class)), description="Familles") - }) - public Response getOperationsTree( - @Parameter( - description = "Le diffuseur des données (permet de filtrer les opérations retournées)", - schema = @Schema(nullable = true, allowableValues = { - "insee.fr" - }, type = "string")) @QueryParam("diffuseur") String diffuseur, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header) { - - String csvResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getFamilies()); - List familyList = csvUtils.populateMultiPOJO(csvResult, CsvFamily.class); - - if (familyList.isEmpty()) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else { - Map> exclusions = new HashMap<>(); - if (StringUtils.equals(diffuseur, "insee.fr")) { - exclusions = operationsApiService.readExclusions(); - } - Map familyMap = operationsApiService.getListeFamilyToOperation(familyList,exclusions); - - if (header.equals(MediaType.APPLICATION_XML)) { - Familles familles = new Familles(new ArrayList<>(familyMap.values())); - return Response.ok(responseUtils.produceResponse(familles, header)).build(); - } - else { - return Response.ok(responseUtils.produceResponse(familyMap.values(), header)).build(); - } - } - - } - - - @Path("/rapportQualite/{id: [0-9]{4}}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation( - operationId = "getDocumentation", - summary = "Documentation d'une opération, d'un indicateur ou d'une série", - responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = DocumentationSims.class)), description="Documentation SIMS") - }) - public Response getDocumentation( - @Parameter( - description = "Identifiant de la documentation (format : [0-9]{4})", - required = true, - schema = @Schema(pattern = "[0-9]{4}", type = "string"), - example = "1979") @PathParam("id") String id, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header) { - String csvResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getDocumentationTitle(id)); - DocumentationSims sims = new DocumentationSims(); - sims = (DocumentationSims) csvUtils.populatePOJO(csvResult, sims); - - if (sims.getUri() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else { - sims.setRubriques(operationsApiService.getListRubriques(id)); - return Response.ok(responseUtils.produceResponse(sims, header)).build(); - } - } - - - @Path("/serie/{idSeries}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = "getSeries", summary = "Informations sur une série statistique de l'Insee", responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = Serie.class)), description="Séries") - }) - public Response getSeries( - @Parameter( - description = "Identifiant de la série(format : s[0-9]{4})", - required = true, - schema = @Schema(pattern = "s[0-9]{4}", type = "string"), - example = "s1223") @PathParam("idSeries") String idSeries, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header) { - String csvResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getSeries(idSeries)); - CsvSerie csvSerie = new CsvSerie(); - csvSerie = (CsvSerie) csvUtils.populatePOJO(csvResult, csvSerie); - - if (csvSerie.getSeriesId() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else { - return Response - .ok(responseUtils.produceResponse(operationsApiService.getSerie(csvSerie, idSeries), header)) - .build(); - } - } - - - @Path("/indicateur/{idIndicateur}") - @GET - @Produces({ - MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML - }) - @Operation(operationId = "getIndicateur", summary = "Informations sur un indicateur de l'Insee", responses = { - @ApiResponse(content = @Content(schema = @Schema(implementation = Indicateur.class)), description="Indicateur") - }) - public Response getIndicateur( - @Parameter( - description = "Identifiant de l'indicateur (format : p[0-9]{4})", - required = true, - schema = @Schema(pattern = "p[0-9]{4}", type = "string"), - example ="p1670") @PathParam("idIndicateur") String idIndicateur, - @Parameter(hidden = true) @HeaderParam(HttpHeaders.ACCEPT) String header) { - String csvResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getIndicator(idIndicateur)); - CsvIndicateur csvIndic = new CsvIndicateur(); - csvIndic = (CsvIndicateur) csvUtils.populatePOJO(csvResult, csvIndic); - - if (csvIndic.getId() == null) { - return Response.status(Status.NOT_FOUND).entity("").build(); - } - else { - return Response - .ok(responseUtils.produceResponse(operationsApiService.getIndicateur(csvIndic, idIndicateur), header)) - .build(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/api/operations/OperationsApiService.java b/src/main/java/fr/insee/rmes/api/operations/OperationsApiService.java deleted file mode 100644 index efd8b7b5..00000000 --- a/src/main/java/fr/insee/rmes/api/operations/OperationsApiService.java +++ /dev/null @@ -1,402 +0,0 @@ -package fr.insee.rmes.api.operations; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import fr.insee.rmes.config.Configuration; -import fr.insee.rmes.modeles.operations.CsvFamily; -import fr.insee.rmes.modeles.operations.CsvIndicateur; -import fr.insee.rmes.modeles.operations.CsvOperation; -import fr.insee.rmes.modeles.operations.CsvSerie; -import fr.insee.rmes.modeles.operations.Famille; -import fr.insee.rmes.modeles.operations.Indicateur; -import fr.insee.rmes.modeles.operations.IndicateurPrecedent; -import fr.insee.rmes.modeles.operations.IndicateurSuivant; -import fr.insee.rmes.modeles.operations.ObjectWithSimsId; -import fr.insee.rmes.modeles.operations.Operation; -import fr.insee.rmes.modeles.operations.Serie; -import fr.insee.rmes.modeles.operations.SeriePrecedente; -import fr.insee.rmes.modeles.operations.SerieSuivante; -import fr.insee.rmes.modeles.operations.SimpleObject; -import fr.insee.rmes.modeles.operations.documentations.CsvRubrique; -import fr.insee.rmes.modeles.operations.documentations.Document; -import fr.insee.rmes.modeles.operations.documentations.Rubrique; -import fr.insee.rmes.modeles.operations.documentations.RubriqueRichText; -import fr.insee.rmes.queries.operations.OperationsQueries; -import fr.insee.rmes.utils.CSVUtils; -import fr.insee.rmes.utils.FileUtils; -import fr.insee.rmes.utils.Lang; -import fr.insee.rmes.utils.SparqlUtils; - -public class OperationsApiService { - - private static Logger logger = LogManager.getLogger(OperationsApiService.class); - - private SparqlUtils sparqlUtils; - private CSVUtils csvUtils; - - public OperationsApiService() { - super(); - sparqlUtils = new SparqlUtils(); - csvUtils = new CSVUtils(); - } - - public Map getListeFamilyToOperation(List familiesList, Map> listObjToRemove) { - //put families in a map - Map familyMap = familiesList.stream() - .collect(Collectors.toMap(CsvFamily::getId, family -> new Famille(family))); - - - //get all series and put in a map - String csvSeriesResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getSeries()); - List seriesList = csvUtils.populateMultiPOJO(csvSeriesResult, CsvSerie.class); - - Map serieMap = seriesList.stream() - .collect(Collectors.toMap(CsvSerie::getSeriesId, serie -> new Serie(serie))); - - - - //get all operations - String csvOpResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getOperations()); - List opList = csvUtils.populateMultiPOJO(csvOpResult, CsvOperation.class); - for (CsvOperation csvOperation : opList) { - if (!listObjToRemove.containsKey("operation") || !listObjToRemove.get("operation").contains(csvOperation.getId())){ - Operation o = new Operation( - csvOperation.getUri(), - csvOperation.getId(), - csvOperation.getLabelLg1(), - csvOperation.getLabelLg2(), - csvOperation.getSimsId()); - o.setAltLabel(csvOperation.getAltlabelLg1(), csvOperation.getAltlabelLg2()); - if (csvOperation.getSeriesId() == null || serieMap.get(csvOperation.getSeriesId()) == null) { - logger.error("No series find for operation {}, or series {} not in the tree", csvOperation.getId(), csvOperation.getSeriesId()); - }else { - serieMap.get(csvOperation.getSeriesId()).addOperation(o); - } - } - } - - //get all indicators - String csvIndicResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getIndicators()); - List indicList = csvUtils.populateMultiPOJO(csvIndicResult, CsvIndicateur.class); - - for (CsvIndicateur csvIndic : indicList) { - if (!listObjToRemove.containsKey("indicateur") || !listObjToRemove.get("indicateur").contains(csvIndic.getId())){ - - Indicateur i = new Indicateur( - csvIndic.getIndic(), - csvIndic.getId(), - csvIndic.getLabelLg1(), - csvIndic.getLabelLg2(), - csvIndic.getSimsId()); - i.setAltLabel(csvIndic.getAltLabelLg1(), csvIndic.getAltLabelLg2()); - - //Get series - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getWasGeneratedByByIndic(i.getId())); - List liste = csvUtils.populateMultiPOJO(csv, Serie.class); - i.setWasGeneratedBy(liste); - for (Serie s : liste) { - serieMap.get(s.getId()).addIndicateur(i); - } - } - } - - for (CsvSerie csvSerie : seriesList) { - if (!listObjToRemove.containsKey("serie") || !listObjToRemove.get("serie").contains(csvSerie.getSeriesId())){ - familyMap.get(csvSerie.getFamilyId()).addSerie(serieMap.get(csvSerie.getSeriesId())); - } - } - - if (listObjToRemove.containsKey("famille")){ - for (String idFamilyToRemove : listObjToRemove.get("famille")) { - familyMap.remove(idFamilyToRemove); - } - } - - - return familyMap; - } - - public Map> readExclusions() { - Map> exclusions = new HashMap<>(); - String path = String.format("%s/storage/%s", Configuration.getFileStorageLocation(), "exclusionsInseeFr.txt"); - List> fileContent = FileUtils.readFile(path, ";"); - if (fileContent == null || fileContent.isEmpty()) { - logger.warn("Exclusion file empty"); - return exclusions; - } - for (List line : fileContent) { - String type = line.get(0).trim(); - String idToRemove = line.get(1).trim(); - if (exclusions.containsKey(type)) { - List newList = exclusions.get(type); - newList.add(idToRemove); - exclusions.put(type, newList); - }else { - List newList = new ArrayList<>(); - newList.add(idToRemove); - exclusions.put(type, newList); - } - } - return exclusions; - } - - public List getListRubriques(String id) { - String csvResult = sparqlUtils.executeSparqlQuery(OperationsQueries.getDocumentationRubrics(id)); - List csvRubriques = csvUtils.populateMultiPOJO(csvResult, CsvRubrique.class); - Map rubriquesById = new HashMap<>(); - for (CsvRubrique cr : csvRubriques) { - addCsvRubricToRubricMap(id, rubriquesById, cr); - } - return rubriquesById.values().stream().collect(Collectors.toList()); - - } - - private void addCsvRubricToRubricMap(String id, Map rubriquesById, CsvRubrique cr) { - Rubrique r = new Rubrique(cr.getId(), cr.getUri(), cr.getType()); - r.setTitre(cr.getTitreLg1(), cr.getTitreLg2()); - r.setIdParent(cr.getIdParent()); - switch (cr.getType()) { - case "DATE": - r.setValeurSimple(cr.getValeurSimple()); - break; - case "CODE_LIST": - SimpleObject codeListElement = new SimpleObject( - cr.getValeurSimple(), - cr.getCodeUri(), - cr.getLabelObjLg1(), - cr.getLabelObjLg2()); - - if (cr.getMaxOccurs() != null && rubriquesById.containsKey(cr.getId())) { - r = rubriquesById.get(cr.getId()); - r.addValeurCode(codeListElement); - rubriquesById.remove(cr.getId()); - }else { - r.setValeurCode(Stream.of(codeListElement).collect(Collectors.toList())); - } - break; - case "ORGANIZATION": - SimpleObject valeurOrg = - new SimpleObject( - cr.getValeurSimple(), - cr.getOrganisationUri(), - cr.getLabelObjLg1(), - cr.getLabelObjLg2()); - r.setValeurOrganisation(valeurOrg); - break; - case "RICH_TEXT": - RubriqueRichText richTextLg1 = new RubriqueRichText(cr.getLabelLg1(), Lang.FR); - if (Boolean.TRUE.equals(cr.isHasDocLg1())) { - String csvDocs = sparqlUtils.executeSparqlQuery(OperationsQueries.getDocuments(id, r.getId(), Lang.FR)); - List docs = csvUtils.populateMultiPOJO(csvDocs, Document.class); - richTextLg1.setDocuments(docs); - } - r.addRichTexts(richTextLg1); - if (StringUtils.isNotEmpty(cr.getLabelLg2()) || Boolean.TRUE.equals(cr.isHasDocLg2())) { - RubriqueRichText richTextLg2 = new RubriqueRichText(cr.getLabelLg2(), Lang.EN); - if (Boolean.TRUE.equals(cr.isHasDocLg2())) { - String csvDocs = sparqlUtils.executeSparqlQuery(OperationsQueries.getDocuments(id, r.getId(), Lang.EN)); - List docs = csvUtils.populateMultiPOJO(csvDocs, Document.class); - richTextLg2.setDocuments(docs); - } - r.addRichTexts(richTextLg2); - } - break; - case "TEXT": - r.setLabelLg1(cr.getLabelLg1()); - r.setLabelLg2(cr.getLabelLg2()); - break; - case "GEOGRAPHY": - SimpleObject valeurGeo = - new SimpleObject( - cr.getValeurSimple(), - cr.getGeoUri(), - cr.getLabelObjLg1(), - cr.getLabelObjLg2()); - r.setValeurGeographie(valeurGeo); - break; - default: - break; - } - rubriquesById.putIfAbsent(r.getId(), r); - } - - /** - * Transform csvSeries in Serie - * @param csvSerie - * @param idSeries - * @return - */ - public Serie getSerie(CsvSerie csvSerie, String idSeries) { - Serie s = - new Serie( - csvSerie.getSeries(), - csvSerie.getSeriesId(), - csvSerie.getSeriesLabelLg1(), - csvSerie.getSeriesLabelLg2()); - s.setSimsId(csvSerie.getSimsId()); - // create family - SimpleObject fam = - new SimpleObject( - csvSerie.getFamilyId(), - csvSerie.getFamily(), - csvSerie.getFamilyLabelLg1(), - csvSerie.getFamilyLabelLg2()); - s.setFamily(fam); - - if (StringUtils.isNotEmpty(csvSerie.getSeriesAbstractLg1())) { - s.setAbstractLg1(csvSerie.getSeriesAbstractLg1()); - s.setAbstractLg2(csvSerie.getSeriesAbstractLg2()); - } - if (StringUtils.isNotEmpty(csvSerie.getSeriesHistoryNoteLg1())) { - s.setHistoryNoteLg1(csvSerie.getSeriesHistoryNoteLg1()); - s.setHistoryNoteLg2(csvSerie.getSeriesHistoryNoteLg2()); - } - if (StringUtils.isNotEmpty(csvSerie.getType())) { - SimpleObject type = - new SimpleObject( - csvSerie.getTypeId(), - csvSerie.getType(), - csvSerie.getTypeLabelLg1(), - csvSerie.getTypeLabelLg2()); - s.setType(type); - } - if (StringUtils.isNotEmpty(csvSerie.getPeriodicity())) { - SimpleObject periodicity = - new SimpleObject( - csvSerie.getPeriodicityId(), - csvSerie.getPeriodicity(), - csvSerie.getPeriodicityLabelLg1(), - csvSerie.getPeriodicityLabelLg2()); - s.setAccrualPeriodicity(periodicity); - } - if (StringUtils.isNotEmpty(csvSerie.getSeriesAltLabelLg1()) - || StringUtils.isNotEmpty(csvSerie.getSeriesAltLabelLg2())) { - s.setAltLabel(csvSerie.getSeriesAltLabelLg1(), csvSerie.getSeriesAltLabelLg2()); - } - - if (Boolean.TRUE.equals(csvSerie.isHasOperation())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getOperationBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, Operation.class); - s.setOperations(liste); - } - - if (Boolean.TRUE.equals(csvSerie.isHasIndic())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getIndicBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, Indicateur.class); - s.setIndicateurs(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasSeeAlso())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getSeeAlsoBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, ObjectWithSimsId.class); - s.setSeeAlso(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasIsReplacedBy())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getIsReplacedByBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, SerieSuivante.class); - s.setIsReplacedBy(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasReplaces())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getReplacesBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, SeriePrecedente.class); - s.setReplaces(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasPublisher())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getPublishersBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, SimpleObject.class); - s.setPublishers(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasContributor())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getContributorsBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, SimpleObject.class); - s.setContributors(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasDataCollector())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getDataCollectorsBySeries(idSeries)); - List liste = csvUtils.populateMultiPOJO(csv, SimpleObject.class); - s.setDataCollectors(liste); - } - if (Boolean.TRUE.equals(csvSerie.isHasCreator())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getCreatorsBySeries(idSeries)); - List liste = sparqlUtils.getResponseAsList(csv); - s.setCreators(liste); - } - return s; - } - - public Indicateur getIndicateur(CsvIndicateur csvIndic, String idIndicateur) { - Indicateur i = - new Indicateur( - csvIndic.getIndic(), - csvIndic.getId(), - csvIndic.getLabelLg1(), - csvIndic.getLabelLg2(), - csvIndic.getSimsId()); - - if (StringUtils.isNotEmpty(csvIndic.getAltLabelLg1()) || StringUtils.isNotEmpty(csvIndic.getAltLabelLg2())) { - i.setAltLabel(csvIndic.getAltLabelLg1(), csvIndic.getAltLabelLg2()); - } - if (StringUtils.isNotEmpty(csvIndic.getAbstractLg1())) { - i.setAbstractLg1(csvIndic.getAbstractLg1()); - i.setAbstractLg2(csvIndic.getAbstractLg2()); - } - if (StringUtils.isNotEmpty(csvIndic.getHistoryNoteLg1())) { - i.setHistoryNoteLg1(csvIndic.getHistoryNoteLg1()); - i.setHistoryNoteLg2(csvIndic.getHistoryNoteLg2()); - } - if (Boolean.TRUE.equals(csvIndic.isHasPublisher())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getPublishersByIndic(idIndicateur)); - List liste = csvUtils.populateMultiPOJO(csv, SimpleObject.class); - i.setPublishers(liste); - } - if (Boolean.TRUE.equals(csvIndic.isHasCreator())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getCreatorsByIndic(idIndicateur)); - List liste = sparqlUtils.getResponseAsList(csv); - i.setCreators(liste); - } - if (Boolean.TRUE.equals(csvIndic.isHasContributor())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getContributorsByIndic(idIndicateur)); - List liste = csvUtils.populateMultiPOJO(csv, SimpleObject.class); - i.setContributors(liste); - } - if (Boolean.TRUE.equals(csvIndic.isHasReplaces())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getReplacesByIndic(idIndicateur)); - List liste = csvUtils.populateMultiPOJO(csv, IndicateurPrecedent.class); - i.setReplaces(liste); - } - if (Boolean.TRUE.equals(csvIndic.isHasIsReplacedBy())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getIsReplacedByByIndic(idIndicateur)); - List liste = csvUtils.populateMultiPOJO(csv, IndicateurSuivant.class); - i.setIsReplacedBy(liste); - } - if (Boolean.TRUE.equals(csvIndic.isHasSeeAlso())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getSeeAlsoByIndic(idIndicateur)); - List liste = csvUtils.populateMultiPOJO(csv, ObjectWithSimsId.class); - i.setSeeAlso(liste); - } - if (Boolean.TRUE.equals(csvIndic.isHasWasGeneratedBy())) { - String csv = sparqlUtils.executeSparqlQuery(OperationsQueries.getWasGeneratedByByIndic(idIndicateur)); - List liste = csvUtils.populateMultiPOJO(csv, Serie.class); - i.setWasGeneratedBy(liste); - } - if (StringUtils.isNotEmpty(csvIndic.getPeriodicity())) { - SimpleObject periodicity = - new SimpleObject( - csvIndic.getPeriodicityId(), - csvIndic.getPeriodicity(), - csvIndic.getPeriodicityLabelLg1(), - csvIndic.getPeriodicityLabelLg2()); - i.setAccrualPeriodicity(periodicity); - } - return i; - } - -} diff --git a/src/main/java/fr/insee/rmes/config/Configuration.java b/src/main/java/fr/insee/rmes/config/Configuration.java deleted file mode 100644 index 52fa214b..00000000 --- a/src/main/java/fr/insee/rmes/config/Configuration.java +++ /dev/null @@ -1,168 +0,0 @@ -package fr.insee.rmes.config; - -import java.io.IOException; -import java.util.Properties; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class Configuration { - private static Logger logger = LogManager.getLogger(Configuration.class); - private PropertiesLoading propertiesLoading = new PropertiesLoading(); - - private static String sparqlEndPoint = ""; - - // Base for all uri in our database - private static String baseHost = ""; - - // folder where documents are stored - private static String fileStorage = ""; - // Server where documents are stored - private static String fileStorageLocation = ""; - - // API Server - private static String swaggerHost = ""; - // API name - private static String swaggerBasepath = ""; - // Build with host and basepath - private static String swaggerUrl = ""; - // Https or Http - private static Boolean requiresSsl = false; - - private static String version = ""; - private static String title = ""; - private static String description = ""; - - public Configuration() { - Properties props = null; - try { - props = propertiesLoading.getProperties(); - setConfig(props); - } - catch (IOException e) { - logger.error("Configuration error, can't read properties", e); - } - - } - - private static void setConfig(Properties props) { - - version = props.getProperty("fr.insee.rmes.api.version"); - title = props.getProperty("fr.insee.rmes.api.title"); - description = props.getProperty("fr.insee.rmes.api.description"); - - sparqlEndPoint = props.getProperty("fr.insee.rmes.api.sparqlEndpoint"); - baseHost = props.getProperty("fr.insee.rmes.api.baseHost"); - fileStorage = props.getProperty("fr.insee.rmes.api.fileStorage"); - fileStorageLocation = props.getProperty("fr.insee.rmes.api.storage.document"); - - swaggerHost = props.getProperty("fr.insee.rmes.api.host"); - swaggerBasepath = props.getProperty("fr.insee.rmes.api.basepath"); - requiresSsl = Boolean.valueOf(props.getProperty("fr.insee.rmes.api.force.ssl")); - swaggerUrl = - (Boolean.TRUE.equals(requiresSsl) ? "https" : "http") + "://" + swaggerHost + "/" + swaggerBasepath; - - printMajorConfig(); - - } - - public static void printMajorConfig() { - logger.info("*********************** CONFIG USED ***********************************"); - - logger.info("SERVEUR RDF : {}",sparqlEndPoint); - - logger.info("DOCUMENT STORAGE : {}", fileStorageLocation); - - logger.info("SWAGGER URL : {}", swaggerUrl); - - logger.info("*********************** END CONFIG USED ***********************************"); - - - } - - - public static String getSparqlEndPoint() { - return sparqlEndPoint; - } - - public static void setSparqlEndPoint(String sparqlEndPoint) { - Configuration.sparqlEndPoint = sparqlEndPoint; - } - - public static String getBaseHost() { - return baseHost; - } - - public static String getFileStorage() { - return fileStorage; - } - - public static void setFileStorage(String fileStorage) { - Configuration.fileStorage = fileStorage; - } - - public static String getFileStorageLocation() { - return fileStorageLocation; - } - - public static void setFileStorageLocation(String fileStorageLocation) { - Configuration.fileStorageLocation = fileStorageLocation; - } - - public static String getSwaggerHost() { - return swaggerHost; - } - - public static void setSwaggerHost(String swaggerHost) { - Configuration.swaggerHost = swaggerHost; - } - - public static String getSwaggerBasepath() { - return swaggerBasepath; - } - - public static void setSwaggerBasepath(String swaggerBasepath) { - Configuration.swaggerBasepath = swaggerBasepath; - } - - public static String getSwaggerUrl() { - return swaggerUrl; - } - - public static void setSwaggerUrl(String swaggerUrl) { - Configuration.swaggerUrl = swaggerUrl; - } - - public static Boolean getRequiresSsl() { - return requiresSsl; - } - - public static void setRequiresSsl(Boolean requiresSsl) { - Configuration.requiresSsl = requiresSsl; - } - - public static String getVersion() { - return version; - } - - public static void setVersion(String version) { - Configuration.version = version; - } - - public static String getTitle() { - return title; - } - - public static void setTitle(String title) { - Configuration.title = title; - } - - public static String getDescription() { - return description; - } - - public static void setDescription(String description) { - Configuration.description = description; - } - -} diff --git a/src/main/java/fr/insee/rmes/config/FreemarkerConfig.java b/src/main/java/fr/insee/rmes/config/FreemarkerConfig.java deleted file mode 100644 index d20e853a..00000000 --- a/src/main/java/fr/insee/rmes/config/FreemarkerConfig.java +++ /dev/null @@ -1,81 +0,0 @@ -package fr.insee.rmes.config; - -import java.io.File; -import java.io.IOException; -import java.net.URISyntaxException; -import java.util.Locale; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import freemarker.cache.FileTemplateLoader; -import freemarker.cache.MultiTemplateLoader; -import freemarker.cache.TemplateLoader; -import freemarker.template.Configuration; -import freemarker.template.TemplateExceptionHandler; - -public class FreemarkerConfig { - - private FreemarkerConfig() { - super(); - } - - static final Logger logger = LogManager.getLogger(FreemarkerConfig.class); - - static Configuration cfg; - - public static void init() { - // Create your Configuration instance, and specify if up to what FreeMarker - // version (here 2.3.27) do you want to apply the fixes that are not 100% - // backward-compatible. See the Configuration JavaDoc for details. - cfg = new Configuration(Configuration.VERSION_2_3_31); - - // Specify the source where the template files come from. Here I set a - // plain directory for it, but non-file-system sources are possible too: - - try { - - FileTemplateLoader ftl1 = - new FileTemplateLoader( - new File(FreemarkerConfig.class.getClassLoader().getResource("request").toURI())); - - MultiTemplateLoader mtl = new MultiTemplateLoader(new TemplateLoader[] { - ftl1 - }); - - logger - .info( - "Init freemarker templateloader {}", - FreemarkerConfig.class.getClassLoader().getResource("request")); - cfg.setTemplateLoader(mtl); - - } - catch (IOException | URISyntaxException e) { - logger.error(e.getMessage()); - } - - // Set the preferred charset template files are stored in. UTF-8 is - // a good choice in most applications: - cfg.setDefaultEncoding("UTF-8"); - cfg.setLocale(Locale.FRANCE); - - // Sets how errors will appear. - // During web page *development* TemplateExceptionHandler.HTML_DEBUG_HANDLER is better. - cfg.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); - - // Don't log exceptions inside FreeMarker that it will thrown at you anyway: - cfg.setLogTemplateExceptions(false); - - // Wrap unchecked exceptions thrown during template processing into TemplateException-s. - cfg.setWrapUncheckedExceptions(true); - - } - - public static Configuration getCfg() { - if (cfg == null) { - init(); - } - return cfg; - } - -} diff --git a/src/main/java/fr/insee/rmes/config/Log4jInseeServletContainerInitializer.java b/src/main/java/fr/insee/rmes/config/Log4jInseeServletContainerInitializer.java deleted file mode 100644 index d7d53f0f..00000000 --- a/src/main/java/fr/insee/rmes/config/Log4jInseeServletContainerInitializer.java +++ /dev/null @@ -1,57 +0,0 @@ -package fr.insee.rmes.config; - -import java.net.URISyntaxException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Objects; -import java.util.Optional; -import java.util.Set; -import java.util.stream.Stream; - -import jakarta.servlet.ServletContext; -import jakarta.servlet.ServletException; -import org.apache.logging.log4j.web.Log4jServletContainerInitializer; -import org.apache.logging.log4j.web.Log4jWebSupport; -import fr.insee.rmes.utils.PropertiesUtils; - - -public class Log4jInseeServletContainerInitializer extends Log4jServletContainerInitializer { - - private static final String WEBAPPS = "%s/webapps/%s"; - - private static final String CATALINA_BASE = "catalina.base"; - - @Override - public void onStartup(final Set> classes, final ServletContext servletContext) throws ServletException { - servletContext.setInitParameter(Log4jWebSupport.LOG4J_CONFIG_LOCATION, findLog4jConfFile()); - super.onStartup(classes, servletContext); - switchOffLog4jServletContainerInitializer(servletContext); - } - - private boolean switchOffLog4jServletContainerInitializer(ServletContext servletContext) { - return servletContext.setInitParameter(Log4jWebSupport.IS_LOG4J_AUTO_INITIALIZATION_DISABLED, "true"); - } - - private String findLog4jConfFile() { - - Path devPropsInClassPath; - try { - devPropsInClassPath = Paths.get(getClass().getClassLoader().getResource("rmes-api.properties").toURI()); - } catch (URISyntaxException e) { - devPropsInClassPath = null; - } - - return Stream.of(Paths.get(String.format(WEBAPPS, System.getProperty(CATALINA_BASE), "production.properties")), - Paths.get(String.format(WEBAPPS, System.getProperty(CATALINA_BASE), "rmes-api.properties")), - Paths.get(String.format(WEBAPPS, System.getProperty(CATALINA_BASE), "rmeswnci.properties")), - Paths.get(String.format(WEBAPPS, System.getProperty(CATALINA_BASE), "rmeswncz.properties")), - Paths.get(String.format(WEBAPPS, System.getProperty(CATALINA_BASE), "rmeswncd.properties")), - devPropsInClassPath) - .filter(Objects::nonNull) - .map(p -> PropertiesUtils.readPropertyFromPath("fr.insee.rmes.api.log.configuration", p)) - .filter(Optional::isPresent) - .map(Optional::get) - .findFirst() - .orElse("log4j2.xml"); - } -} diff --git a/src/main/java/fr/insee/rmes/config/LogRequestFilter.java b/src/main/java/fr/insee/rmes/config/LogRequestFilter.java deleted file mode 100644 index d3cb1233..00000000 --- a/src/main/java/fr/insee/rmes/config/LogRequestFilter.java +++ /dev/null @@ -1,47 +0,0 @@ -package fr.insee.rmes.config; - -import java.io.IOException; - -import jakarta.ws.rs.container.ContainerRequestContext; -import jakarta.ws.rs.container.ContainerRequestFilter; -import jakarta.ws.rs.container.ContainerResponseContext; -import jakarta.ws.rs.container.ContainerResponseFilter; -import jakarta.ws.rs.ext.Provider; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - - -@Provider -public class LogRequestFilter implements ContainerRequestFilter, ContainerResponseFilter { - - private static final Logger log = LoggerFactory.getLogger(LogRequestFilter.class); - - @Override - public void filter(ContainerRequestContext requestContext) throws IOException { - StringBuilder sb = logRequest(requestContext); - sb.append(", Params : ").append(requestContext.getUriInfo().getQueryParameters()); - String toLog = sb.toString(); - toLog = toLog.replaceAll("[\n\r]", "_"); - log.info("START {}", toLog); - } - - - @Override - public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext) throws IOException { - StringBuilder sb = logRequest(requestContext); - sb.append(" with code : ").append(responseContext.getStatus()); - String toLog = sb.toString(); - toLog = toLog.replaceAll("[\n\r]", "_"); - log.info("END {}", toLog); - } - - - private StringBuilder logRequest(ContainerRequestContext requestContext) { - StringBuilder sb = new StringBuilder(); - sb.append(requestContext.getMethod()).append(" ").append(requestContext.getUriInfo().getPath()); - sb.append(", User: ").append(requestContext.getSecurityContext().getUserPrincipal() == null ? "unknown" - : requestContext.getSecurityContext().getUserPrincipal()); - return sb; - } -} diff --git a/src/main/java/fr/insee/rmes/config/MetadataApiConfig.java b/src/main/java/fr/insee/rmes/config/MetadataApiConfig.java deleted file mode 100644 index 315c409a..00000000 --- a/src/main/java/fr/insee/rmes/config/MetadataApiConfig.java +++ /dev/null @@ -1,78 +0,0 @@ -package fr.insee.rmes.config; - -import java.nio.ByteBuffer; -import java.nio.charset.StandardCharsets; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -import jakarta.servlet.ServletConfig; -import jakarta.ws.rs.ApplicationPath; -import jakarta.ws.rs.core.Context; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.glassfish.jersey.media.multipart.MultiPartFeature; -import org.glassfish.jersey.server.ResourceConfig; - -import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource; -import io.swagger.v3.oas.integration.SwaggerConfiguration; -import io.swagger.v3.oas.models.OpenAPI; -import io.swagger.v3.oas.models.info.Info; -import io.swagger.v3.oas.models.servers.Server; - -@ApplicationPath("/") -public class MetadataApiConfig extends ResourceConfig { - - private static final Logger logger = LogManager.getLogger(MetadataApiConfig.class); - - public MetadataApiConfig(@Context ServletConfig servletConfig) { - super(); - - //Swagger - OpenApiResource openApiResource = initializeSwagger(servletConfig); - this.register(openApiResource); - this.register(MultiPartFeature.class); - - //Logs - this.register(LogRequestFilter.class); - - } - - private OpenApiResource initializeSwagger(ServletConfig servletConfig) { - OpenAPI openApi = new OpenAPI(); - - logger.info("ServletConfig : {}", - (servletConfig != null ? servletConfig.getServletContext() : "ServletConfig is null")); - - // describe API - Info info = new Info().title(Configuration.getTitle()).version(convertInUtf8(Configuration.getVersion())).description(convertInUtf8(Configuration.getDescription())); - openApi.info(info); - - // set Server API - Server server = new Server(); - server.url(Configuration.getSwaggerUrl()); - openApi.addServersItem(server); - - // define where API are described (with annotations) - SwaggerConfiguration oasConfig = - new SwaggerConfiguration() - .openAPI(openApi) - .resourcePackages(Stream.of("fr.insee.rmes.api").collect(Collectors.toSet())) - .prettyPrint(true); - - logger.info("SWAGGER : {}", (oasConfig != null ? oasConfig.getOpenAPI() : "SwaggerConfiguration is null")); - - OpenApiResource openApiResource = new OpenApiResource(); - openApiResource.setOpenApiConfiguration(oasConfig); - return openApiResource; - } - - private String convertInUtf8(String strToEncode) { - ByteBuffer buffer = StandardCharsets.UTF_8.encode(strToEncode); - return StandardCharsets.UTF_8.decode(buffer).toString(); - } - - - - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/config/PropertiesLoading.java b/src/main/java/fr/insee/rmes/config/PropertiesLoading.java deleted file mode 100644 index ee73e867..00000000 --- a/src/main/java/fr/insee/rmes/config/PropertiesLoading.java +++ /dev/null @@ -1,43 +0,0 @@ -package fr.insee.rmes.config; - -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.Properties; - -public class PropertiesLoading { - - public Properties getProperties() throws IOException { - Properties props = new Properties(); - props.load(this.getClass().getClassLoader().getResourceAsStream("api-stable.properties")); - props.load(this.getClass().getClassLoader().getResourceAsStream("rmes-api.properties")); - this.loadFromCatalinaIfExists(props, "rmes-api.properties"); - this.loadFromCatalinaIfExists(props, "rmeswnci.properties"); - this.loadFromCatalinaIfExists(props, "rmeswncz.properties"); - this.loadFromCatalinaIfExists(props, "rmeswncd.properties"); - this.loadFromCatalinaIfExists(props, "production.properties"); - this.loadFromFileIfExist(props, "/conf/rmes-api.properties"); - return props; - } - - /* - * load properties on catalina base - */ - private Properties loadFromCatalinaIfExists (Properties props, String filename) throws IOException { - return loadFromFileIfExist(props, String.format("%s/webapps/%s", System.getProperty("catalina.base"), filename)); - } - - /* - * Load properties from ConfigMap mounted path and return the modified properties - */ - private Properties loadFromFileIfExist(Properties props, String absolutePathToFile) throws IOException { - File file = new File(absolutePathToFile); - if (file.exists() && !file.isDirectory()) { - try (FileReader reader = new FileReader(file)) { - props.load(reader); - } - } - return props; - } - -} diff --git a/src/main/java/fr/insee/rmes/config/StaticFilter.java b/src/main/java/fr/insee/rmes/config/StaticFilter.java deleted file mode 100644 index 09ea2051..00000000 --- a/src/main/java/fr/insee/rmes/config/StaticFilter.java +++ /dev/null @@ -1,53 +0,0 @@ -package fr.insee.rmes.config; - -import java.io.IOException; - -import jakarta.servlet.FilterChain; -import jakarta.servlet.FilterConfig; -import jakarta.servlet.RequestDispatcher; -import jakarta.servlet.ServletException; -import jakarta.servlet.ServletRequest; -import jakarta.servlet.ServletResponse; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class StaticFilter implements jakarta.servlet.Filter { - private RequestDispatcher defaultRequestDispatcher; - private static Logger logger = LogManager.getLogger(StaticFilter.class); - - @Override - public void destroy() { - logger.warn("StaticFilter is destroyed"); - } - - @Override - public void doFilter( - ServletRequest request, - ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse resp = (HttpServletResponse) response; - HttpServletRequest req = (HttpServletRequest) request; - if (req.getRequestURI().endsWith("/swagger-ui")) { - resp.sendRedirect(req.getRequestURI() + "/index.html"); - } - else if (req.getRequestURI().endsWith("/swagger-ui/")) { - resp.sendRedirect(req.getRequestURI() + "index.html"); - } - else if (req.getRequestURI().endsWith("/")) { - resp.sendRedirect(req.getRequestURI() + "swagger-ui/index.html"); - } - else { - defaultRequestDispatcher.forward(request, response); - } - } - - @Override - public void init(FilterConfig filterConfig) throws ServletException { - this.defaultRequestDispatcher = filterConfig.getServletContext().getNamedDispatcher("default"); - new Configuration(); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/StringWithLang.java b/src/main/java/fr/insee/rmes/modeles/StringWithLang.java deleted file mode 100644 index 34ef16e0..00000000 --- a/src/main/java/fr/insee/rmes/modeles/StringWithLang.java +++ /dev/null @@ -1,65 +0,0 @@ -package fr.insee.rmes.modeles; - -import java.nio.charset.StandardCharsets; -import java.util.Objects; - -import jakarta.xml.bind.annotation.XmlAttribute; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; -@Schema(name = "TexteMultiLangue", description = "TexteMultiLangue") -public class StringWithLang { - @Schema(example = "Texte en français") - @JsonProperty("contenu") - private String string = null; - - @Schema(example = "fr") - @JsonProperty("langue") - @XmlAttribute - @JacksonXmlProperty(isAttribute = true, localName = "xmllang") - private Lang lang = null; - - public String getString() { - if (string == null) return null; - else return new String(string.getBytes(), StandardCharsets.UTF_8); - } - - public StringWithLang(String string, Lang lang) { - super(); - this.string = string; - this.lang = lang; - } - - public void setString(String string) { - this.string = string; - } - - public String getLang() { - return lang.getLang(); - } - - public void setLang(Lang lang) { - this.lang = lang; - } - - @Override - public int hashCode() { - return Objects.hash(lang, string); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - StringWithLang other = (StringWithLang) obj; - return lang == other.lang && Objects.equals(string, other.string); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/StringXmlMixIn.java b/src/main/java/fr/insee/rmes/modeles/StringXmlMixIn.java deleted file mode 100644 index ec31b808..00000000 --- a/src/main/java/fr/insee/rmes/modeles/StringXmlMixIn.java +++ /dev/null @@ -1,25 +0,0 @@ -package fr.insee.rmes.modeles; - -import jakarta.xml.bind.annotation.XmlValue; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; - -public abstract class StringXmlMixIn { - - @JsonCreator - public StringXmlMixIn(String string, String lang) {} - - //@JsonProperty("contenu") - //@JsonRawValue - @JacksonXmlText - @XmlValue - abstract String getString(); - - @JacksonXmlProperty(isAttribute = true) - @JsonProperty("xmllang") - abstract String getLang(); - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/Activite.java b/src/main/java/fr/insee/rmes/modeles/classification/Activite.java deleted file mode 100644 index 90347e03..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/Activite.java +++ /dev/null @@ -1,97 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.utils.DateUtils; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "Activite") -@JacksonXmlRootElement(localName = "Activite") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une activité") -public class Activite { - @XmlAttribute - @Schema(example = "01.1A") - private String code = null; - @XmlAttribute - @Schema(example = "http://id.insee.fr/codes/nafr1/classe/01.1A") - private String uri = null; - - @XmlElement(name = "Intitule") - @Schema(example = "Culture de céréales ; cultures industrielles") - private String intitule = null; - - @XmlElement(name = "DateDebutValidite") - @Schema(example = "2003-01-01", format="date") - private String issued = null; - - @XmlElement(name = "DateFinValidite") - @Schema( example = "2007-12-31", format="date") - private String valid = null; - - public Activite() {} // No-args constructor needed for JAXB - - public Activite(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - @JacksonXmlProperty(localName = "DateDebutValidite") - @JsonProperty(value = "dateDebutValidite") - @JsonInclude(Include.NON_EMPTY) - public String getIssued() { - return issued; - } - - public void setIssued(String issued) { - this.issued = DateUtils.getDateStringFromDateTimeString(issued); - } - - @JacksonXmlProperty(localName = "DateFinValidite") - @JsonProperty(value = "dateFinValidite") - @JsonInclude(Include.NON_EMPTY) - public String getValid() { - return valid; - } - - public void setValid(String valid) { - this.valid = DateUtils.getDateStringFromDateTimeString(valid); - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/Activites.java b/src/main/java/fr/insee/rmes/modeles/classification/Activites.java deleted file mode 100644 index 74873fb9..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/Activites.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Activites") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Tableau représentant des activités") -public class Activites { - - private List activitesList = null; - - public Activites() {} // No-args constructor needed for JAXB - - public Activites(List activites) { - this.activitesList = activites; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Activite") - @JacksonXmlElementWrapper(useWrapping = false) - public List getActivites() { - return activitesList; - } - - public void setActivites(List activites) { - this.activitesList = activites; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/Classification.java b/src/main/java/fr/insee/rmes/modeles/classification/Classification.java deleted file mode 100644 index 7e2d24be..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/Classification.java +++ /dev/null @@ -1,53 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Nomenclature") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Nomenclature", description = "Objet représentant une nomenclature") -public class Classification { - @Schema(example = "nafr2") - String code; - @Schema(example = "http://id.insee.fr/codes/nafr2/naf") - String uri; - @Schema(example = "Nomenclature d'activités française - NAF rév. 2") - String intitule; - - public Classification() { - super(); - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/Classifications.java b/src/main/java/fr/insee/rmes/modeles/classification/Classifications.java deleted file mode 100644 index 21f961d6..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/Classifications.java +++ /dev/null @@ -1,34 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Nomenclatures") -@Schema(name = "Nomenclatures", description = "Tableau représentant la liste des nomenclatures") -public class Classifications { - - private List listDescriptions = new ArrayList<>(); - - public Classifications() {} - - public Classifications(List listDescriptions) { - this.listDescriptions = listDescriptions; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Nomenclature") - @JacksonXmlElementWrapper(useWrapping = false) - public List getlistDescriptions() { - return this.listDescriptions; - } - - public void setListItems(List listDescriptions) { - this.listDescriptions = listDescriptions; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/Poste.java b/src/main/java/fr/insee/rmes/modeles/classification/Poste.java deleted file mode 100644 index 6e66e545..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/Poste.java +++ /dev/null @@ -1,157 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Poste") -@XmlAccessorType(XmlAccessType.FIELD) -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@Schema(description = "Objet représentant un poste d'une nomenclature", oneOf = { PosteJson.class, PosteXml.class }) -public class Poste { - @Schema(description = "URI du poste de la nomenclature",example = "http://id.insee.fr/codes/nafr2/sousClasse/23.99Z") - String uri; - @Schema(example = "23.99Z") - String code; - @Schema(example = "http://id.insee.fr/codes/nafr2/classe/23.99") - String uriParent; - @Schema(example = "23.99") - String codeParent; - @Schema(example = "Fabrication d'autres produits minéraux non métalliques n.c.a.") - String intituleFr; - @Schema(example = "Manufacture of other non-metallic mineral products n.e.c.") - String intituleEn; - String contenuLimite; - String contenuCentral; - String contenuExclu; - String noteGenerale; - - - List postesEnfants; - - public Poste() { - // No-args constructor needed for JAXB - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUriParent() { - return uriParent; - } - - public void setUriParent(String uriParent) { - this.uriParent = uriParent; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCodeParent() { - return codeParent; - } - - public void setCodeParent(String codeParent) { - this.codeParent = codeParent; - } - - @JacksonXmlProperty(localName = "IntituleFr") - public String getIntituleFr() { - return intituleFr; - } - - public void setIntituleFr(String intituleFr) { - this.intituleFr = intituleFr; - } - - @JacksonXmlProperty(localName = "IntituleEn") - public String getIntituleEn() { - return intituleEn; - } - - public void setIntituleEn(String intituleEn) { - this.intituleEn = intituleEn; - } - - public void setContenuLimite(String contenuLimite) { - this.contenuLimite = contenuLimite; - } - - public void setContenuCentral(String contenuCentral) { - this.contenuCentral = contenuCentral; - } - - public void setContenuExclu(String contenuExclu) { - this.contenuExclu = contenuExclu; - } - - public void setNoteGenerale(String noteGenerale) { - this.noteGenerale = noteGenerale; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Poste") - @JacksonXmlElementWrapper(useWrapping = false) - @JsonInclude(Include.NON_NULL) - @Schema(implementation=Poste.class, example="") - public List getPostesEnfants() { - return postesEnfants; - } - - public void setPostesEnfants(List postesEnfants) { - this.postesEnfants = postesEnfants; - } - - public void addPosteEnfant(Poste posteEnfant) { - if (postesEnfants == null) { - postesEnfants = new ArrayList<>(); - } - postesEnfants.add(posteEnfant); - } - -// @Schema(example = "exemple de contenu limite", name = "ContenuLimite") -// @JacksonXmlProperty(localName = "ContenuLimite") - public String getContenuLimite() { - return contenuLimite; - } - -// @Schema(example = "exemple de contenu central", name="ContenuCentral") -// @JacksonXmlProperty(localName = "ContenuCentral") - public String getContenuCentral() { - return contenuCentral; - } - - //@Schema(example = "exemple d'exclusions", name="ContenuExclu") - //@JacksonXmlProperty(localName = "ContenuExclu") - public String getContenuExclu() { - return contenuExclu; - } - - public String getNoteGenerale() { - return noteGenerale; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/PosteJson.java b/src/main/java/fr/insee/rmes/modeles/classification/PosteJson.java deleted file mode 100644 index d8399d47..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/PosteJson.java +++ /dev/null @@ -1,52 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Poste") -public class PosteJson extends Poste { - - @JacksonXmlProperty(localName = "contenuLimite") - @Schema(example = "exemple de contenu limite", name = "contenuLimite") - @Override - public String getContenuLimite() { - return contenuLimite; - } - - @JacksonXmlProperty(localName = "contenuCentral") - @Schema(example = "exemple de contenu central", name="contenuCentral") - @Override - public String getContenuCentral() { - return contenuCentral; - } - - @JacksonXmlProperty(localName = "contenuExclu") - @Schema(example = "exemple d'exclusions", name="contenuExclu") - @Override - public String getContenuExclu() { - return contenuExclu; - } - - @JacksonXmlProperty(localName = "noteGenerale") - @Schema(example = "exemple de contenu général", name = "noteGenerale" ) - @Override - public String getNoteGenerale() { - return noteGenerale; - } - - @JacksonXmlElementWrapper(useWrapping = false) - @JsonInclude(Include.NON_NULL) - @Schema(implementation=PosteJson.class,name = "Poste") - @Override - public List getPostesEnfants() { - return postesEnfants; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/PosteXml.java b/src/main/java/fr/insee/rmes/modeles/classification/PosteXml.java deleted file mode 100644 index a1cb7096..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/PosteXml.java +++ /dev/null @@ -1,76 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonRawValue; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Poste") -public class PosteXml extends Poste { - - @JsonRawValue // don't encode XML - @JacksonXmlProperty(localName = "ContenuLimite")//change name - @Schema(example = "exemple de contenu limite", name = "ContenuLimite") // add example - @Override - public String getContenuLimite() { - if (StringUtils.isNotEmpty(contenuLimite)) { - return contenuLimite; - } - else - return null; - } - - @JsonRawValue - @JacksonXmlProperty(localName = "ContenuCentral") - @Schema(example = "exemple de contenu central", name="ContenuCentral") - @Override - public String getContenuCentral() { - if (StringUtils.isNotEmpty(contenuCentral)) { - return contenuCentral; - } - else - return null; - } - - @JsonRawValue - @JacksonXmlProperty(localName = "ContenuExclu") - @Schema(example = "exemple d'exclusions", name="ContenuExclu") - @Override - public String getContenuExclu() { - if (StringUtils.isNotEmpty(contenuExclu)) { - return contenuExclu; - } - else - return null; - } - - @JsonRawValue - @JacksonXmlProperty(localName = "NoteGenerale") - @Schema(example = "exemple de contenu général", name = "NoteGenerale" ) - @Override - public String getNoteGenerale() { - if (StringUtils.isNotEmpty(noteGenerale)) { - return noteGenerale ; - } - else - return null; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Poste") - @JacksonXmlElementWrapper(useWrapping = false) - @JsonInclude(Include.NON_NULL) - @Schema(implementation=PosteXml.class, name="Poste") - @Override - public List getPostesEnfants() { - return postesEnfants; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/Postes.java b/src/main/java/fr/insee/rmes/modeles/classification/Postes.java deleted file mode 100644 index 69d94974..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/Postes.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.classification; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Postes") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Tableau représentant les postes d'une nomenclature") -public class Postes { - - private List listItems = null; - - public Postes() {} - - public Postes(List itemsListXml) { - this.listItems = itemsListXml; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Poste") - @JacksonXmlElementWrapper(useWrapping = false) - public List getListItems() { - return listItems; - } - - public void setListItems(List listItems) { - this.listItems = listItems; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridique.java b/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridique.java deleted file mode 100644 index 3ebcd0d3..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridique.java +++ /dev/null @@ -1,85 +0,0 @@ -package fr.insee.rmes.modeles.classification.cj; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.utils.DateUtils; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "CategorieJuridique") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une catégorie juridique") -public class CategorieJuridique { - @Schema(example = "1100") - private String code = null; - @Schema(example = "http://id.insee.fr/codes/cj/niveauIII/1100/197") - private String uri = null; - @Schema(example = "Entrepreneur individuel") - private String intitule = null; - @Schema(name = "DateDebutValidite", example = "1973-01-01") - private String issued = null; - @Schema(name = "dateFinValidite", example = "2018-06-30") - private String valid = null; - - public CategorieJuridique() {} // No-args constructor needed for JAXB - - public CategorieJuridique(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - @JacksonXmlProperty(localName = "DateDebutValidite") - @JsonProperty(value = "dateDebutValidite") - @JsonInclude(Include.NON_EMPTY) - public String getIssued() { - return issued; - } - - public void setIssued(String issued) { - this.issued = DateUtils.getDateStringFromDateTimeString(issued); - } - - @JacksonXmlProperty(localName = "DateFinValidite") - @JsonProperty(value = "dateFinValidite") - @JsonInclude(Include.NON_EMPTY) - public String getValid() { - return valid; - } - - public void setValid(String valid) { - this.valid = DateUtils.getDateStringFromDateTimeString(valid); - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridiqueNiveauII.java b/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridiqueNiveauII.java deleted file mode 100644 index 7ca05f32..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridiqueNiveauII.java +++ /dev/null @@ -1,63 +0,0 @@ -package fr.insee.rmes.modeles.classification.cj; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "CategorieJuridiqueNiveauII") -@JacksonXmlRootElement(localName = "CategorieJuridiqueNiveauII") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une catégorie juridique (niveau 2)") -public class CategorieJuridiqueNiveauII { - @XmlAttribute - @Schema(example = "10") - private String code; - @XmlAttribute - @Schema(example = "http://id.insee.fr/codes/cj/n2/10") - private String uri; - @XmlElement(name = "Intitule") - @Schema(example = "Entrepreneur individuel") - private String intitule; - - public CategorieJuridiqueNiveauII() {} // No-args constructor needed for JAXB - - public CategorieJuridiqueNiveauII(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridiqueNiveauIII.java b/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridiqueNiveauIII.java deleted file mode 100644 index 13cd95c0..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategorieJuridiqueNiveauIII.java +++ /dev/null @@ -1,63 +0,0 @@ -package fr.insee.rmes.modeles.classification.cj; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "CategorieJuridiqueNiveauIII") -@JacksonXmlRootElement(localName = "CategorieJuridiqueNiveauIII") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une catégorie juridique détaillée (niveau 3)") -public class CategorieJuridiqueNiveauIII { - @Schema(example = "7112") - @XmlAttribute - private String code; - @Schema(example = "http://id.insee.fr/codes/cj/n3/7112") - @XmlAttribute - private String uri; - @XmlElement(name = "Intitule") - @Schema(example = "Autorité administrative ou publique indépendante") - private String intitule; - - public CategorieJuridiqueNiveauIII() {} // No-args constructor needed for JAXB - - public CategorieJuridiqueNiveauIII(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategoriesJuridiques.java b/src/main/java/fr/insee/rmes/modeles/classification/cj/CategoriesJuridiques.java deleted file mode 100644 index 7269ab8c..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/cj/CategoriesJuridiques.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.classification.cj; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "CategoriesJuridiques") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Tableau représentant des catégories juridiques") -public class CategoriesJuridiques { - - private List categoriesJuridiques = null; - - public CategoriesJuridiques() {} // No-args constructor needed for JAXB - - public CategoriesJuridiques(List categoriesJuridiques) { - this.categoriesJuridiques = categoriesJuridiques; - } - - @JacksonXmlProperty(isAttribute = true, localName = "CategorieJuridique") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCategoriesJuridiques() { - return categoriesJuridiques; - } - - public void setCategoriesJuridiques(List categoriesJuridiques) { - this.categoriesJuridiques = categoriesJuridiques; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Association.java b/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Association.java deleted file mode 100644 index e66e67de..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Association.java +++ /dev/null @@ -1,59 +0,0 @@ -package fr.insee.rmes.modeles.classification.correspondence; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Association") -@XmlAccessorType(XmlAccessType.FIELD) -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@Schema(description = "Objet représentant une Association") -public class Association { - - @JacksonXmlProperty(localName = "Source") - @JsonProperty("source") - private PosteCorrespondence itemSource; - - @JacksonXmlProperty(localName = "Cible") - @JacksonXmlElementWrapper(useWrapping = false) - @JsonProperty("cibles") - @Schema(description = "Liste des postes cibles") - private List itemTargets; - - public Association() { - - } - - public Association(PosteCorrespondence k, List v) { - - this.itemSource = k; - this.itemTargets = v; - - } - - public PosteCorrespondence getItemSource() { - return itemSource; - } - - public void setItemSource(PosteCorrespondence itemSource) { - this.itemSource = itemSource; - } - - public List getItemTargets() { - return itemTargets; - } - - public void setItemTargets(List itemTargets) { - this.itemTargets = itemTargets; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Associations.java b/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Associations.java deleted file mode 100644 index 49bd8053..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Associations.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.insee.rmes.modeles.classification.correspondence; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Associations") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Tableau représentant la liste des associations entre deux nomenclatures") -public class Associations { - - @JsonProperty("associations") - @JacksonXmlProperty(localName = "Association") - @JacksonXmlElementWrapper(useWrapping = false) - private List associations = new ArrayList<>(); - - public Associations() { - // No-args constructor needed for JAXB - } - - public List getAssociations() { - return associations; - } - - public void setAssociations(List associations) { - this.associations = associations; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Correspondence.java b/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Correspondence.java deleted file mode 100644 index 1a0d2b40..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Correspondence.java +++ /dev/null @@ -1,107 +0,0 @@ -package fr.insee.rmes.modeles.classification.correspondence; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JsonInclude(JsonInclude.Include.NON_EMPTY) -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Correspondance", description = "Objet représentant une correspondance entre deux nomenclatures") -public class Correspondence { - - @Schema(example = "nafr2-cpfr21") - String id; - @Schema(example = "nafr2") - String idSource; - @Schema(example = "cpfr21") - String idCible; - @Schema(example = "http://rdf.insee.fr/codes/nafr2-cpfr21") - String uri; - @Schema(example = "Correspondance Naf rév. 2 / Cpf rév. 2.1") - String intituleFr; - @Schema(example = "Naf2/Cpf2.1 correspondence") - String intituleEn; - String descriptionFr; - String descriptionEn; - - public Correspondence() { - // No-args constructor needed for JAXB - } - - @JacksonXmlProperty(isAttribute = true) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true) - public String getIdSource() { - return idSource; - } - - public void setIdSource(String idSource) { - this.idSource = idSource; - } - - @JacksonXmlProperty(isAttribute = true) - public String getIdCible() { - return idCible; - } - - public void setIdCible(String idCible) { - this.idCible = idCible; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "IntituleFr") - public String getIntituleFr() { - return intituleFr; - } - - public void setIntituleFr(String intituleFr) { - this.intituleFr = intituleFr; - } - - @JacksonXmlProperty(localName = "IntituleEn") - public String getIntituleEn() { - return intituleEn; - } - - public void setIntituleEn(String intituleEn) { - this.intituleEn = intituleEn; - } - - @JacksonXmlProperty(localName = "DescriptionFr") - public String getDescriptionFr() { - return descriptionFr; - } - - public void setDescriptionFr(String descriptionFr) { - this.descriptionFr = descriptionFr; - } - - @JacksonXmlProperty(localName = "DescriptionEn") - public String getDescriptionEn() { - return descriptionEn; - } - - public void setDescriptionEn(String descriptionEn) { - this.descriptionEn = descriptionEn; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Correspondences.java b/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Correspondences.java deleted file mode 100644 index de558a96..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/Correspondences.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.modeles.classification.correspondence; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema( - name = "Correspondances", - description = "Objet représentant la liste des correspondances entre deux nomenclatures") -@JacksonXmlRootElement(localName = "Correspondances") -public class Correspondences { - - private List itemsList = new ArrayList<>(); - - public Correspondences() { - - } - - public Correspondences(List itemsList) { - - this.itemsList = itemsList; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Correspondance") - @JacksonXmlElementWrapper(useWrapping = false) - public List getItemsList() { - return itemsList; - } - - public void setItemsList(List itemsList) { - this.itemsList = itemsList; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/PosteCorrespondence.java b/src/main/java/fr/insee/rmes/modeles/classification/correspondence/PosteCorrespondence.java deleted file mode 100644 index 81c0e709..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/PosteCorrespondence.java +++ /dev/null @@ -1,98 +0,0 @@ -package fr.insee.rmes.modeles.classification.correspondence; - -import java.util.Objects; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -@JacksonXmlRootElement(localName = "Correspondance") -@XmlAccessorType(XmlAccessType.FIELD) -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class PosteCorrespondence implements Comparable { - - String code; - String uri; - String intituleFr; - String intituleEn; - - public PosteCorrespondence(String code, String uri, String intituleFr, String intituleEn) { - super(); - this.code = code; - this.uri = uri; - this.intituleFr = intituleFr; - this.intituleEn = intituleEn; - } - - public PosteCorrespondence() { - // No-args constructor needed for JAXB - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "IntituleFr") - public String getIntituleFr() { - return intituleFr; - } - - public void setIntituleFr(String intituleFr) { - this.intituleFr = intituleFr; - } - - @JacksonXmlProperty(localName = "IntituleEn") - public String getIntituleEn() { - return intituleEn; - } - - public void setIntituleEnPosteSource(String intituleEn) { - this.intituleEn = intituleEn; - } - - @Override - public int compareTo(Object p) { - PosteCorrespondence posteToCompare = (PosteCorrespondence) p; - String posteToCompareUri = posteToCompare.getUri(); - if (this.uri.equals(posteToCompareUri)) { - return 0; - } - return 1; - } - - @Override - public int hashCode() { - return Objects.hash(code, intituleEn, intituleFr, uri); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - PosteCorrespondence other = (PosteCorrespondence) obj; - return Objects.equals(code, other.code) && Objects.equals(intituleEn, other.intituleEn) - && Objects.equals(intituleFr, other.intituleFr) && Objects.equals(uri, other.uri); - } - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/RawCorrespondence.java b/src/main/java/fr/insee/rmes/modeles/classification/correspondence/RawCorrespondence.java deleted file mode 100644 index ec8fc2f4..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/correspondence/RawCorrespondence.java +++ /dev/null @@ -1,81 +0,0 @@ -package fr.insee.rmes.modeles.classification.correspondence; - -/** - * object for mapping raw complete correspondences data before computing - */ -public class RawCorrespondence { - - private String codePoste1; - private String uriPoste1; - private String intituleFrPoste1; - private String intituleEnPoste1; - private String codePoste2; - private String uriPoste2; - private String intituleFrPoste2; - private String intituleEnPoste2; - - public String getCodePoste1() { - return codePoste1; - } - - public void setCodePoste1(String codePoste1) { - this.codePoste1 = codePoste1; - } - - public String getUriPoste1() { - return uriPoste1; - } - - public void setUriPoste1(String uriPoste1) { - this.uriPoste1 = uriPoste1; - } - - public String getIntituleFrPoste1() { - return intituleFrPoste1; - } - - public void setIntituleFrPoste1(String intituleFrPoste1) { - this.intituleFrPoste1 = intituleFrPoste1; - } - - public String getIntituleEnPoste1() { - return intituleEnPoste1; - } - - public void setIntituleEnPoste1(String intituleEnPoste1) { - this.intituleEnPoste1 = intituleEnPoste1; - } - - public String getCodePoste2() { - return codePoste2; - } - - public void setCodePoste2(String codePoste2) { - this.codePoste2 = codePoste2; - } - - public String getUriPoste2() { - return uriPoste2; - } - - public void setUriPoste2(String uriPoste2) { - this.uriPoste2 = uriPoste2; - } - - public String getIntituleFrPoste2() { - return intituleFrPoste2; - } - - public void setIntituleFrPoste2(String intituleFrPoste2) { - this.intituleFrPoste2 = intituleFrPoste2; - } - - public String getIntituleEnPoste2() { - return intituleEnPoste2; - } - - public void setIntituleEnPoste2(String intituleEnPoste2) { - this.intituleEnPoste2 = intituleEnPoste2; - } - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/classification/na1973/GroupeNA1973.java b/src/main/java/fr/insee/rmes/modeles/classification/na1973/GroupeNA1973.java deleted file mode 100644 index 7a9fc963..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/na1973/GroupeNA1973.java +++ /dev/null @@ -1,56 +0,0 @@ -package fr.insee.rmes.modeles.classification.na1973; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "GroupeNA1973") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un groupe de la NA 1973") -public class GroupeNA1973 { - @Schema(example = "45.23") - private String code = null; - @Schema(example = "http://id.insee.fr/codes/na73/groupe/45.23") - private String uri = null; - @Schema(example = "Fabrication d'articles divers en cuir et similaires") - private String intitule = null; - - public GroupeNA1973() {} // No-args constructor needed for JAXB - - public GroupeNA1973(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/naf1993/ClasseNAF1993.java b/src/main/java/fr/insee/rmes/modeles/classification/naf1993/ClasseNAF1993.java deleted file mode 100644 index 3d3bc3ac..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/naf1993/ClasseNAF1993.java +++ /dev/null @@ -1,56 +0,0 @@ -package fr.insee.rmes.modeles.classification.naf1993; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "ClasseNAF1993") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une classe de la NAF 1993") -public class ClasseNAF1993 { - @Schema(example = "01.1A") - private String code = null; - @Schema(example = "http://id.insee.fr/codes/naf/classe/01.1A") - private String uri = null; - @Schema(example = "Culture de céréales ; cultures industrielles") - private String intitule = null; - - public ClasseNAF1993() {} // No-args constructor needed for JAXB - - public ClasseNAF1993(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/naf2003/ClasseNAF2003.java b/src/main/java/fr/insee/rmes/modeles/classification/naf2003/ClasseNAF2003.java deleted file mode 100644 index fd4dd998..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/naf2003/ClasseNAF2003.java +++ /dev/null @@ -1,51 +0,0 @@ -package fr.insee.rmes.modeles.classification.naf2003; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -@JacksonXmlRootElement(localName = "ClasseNAF2003") -@XmlAccessorType(XmlAccessType.FIELD) -public class ClasseNAF2003 { - - private String code = null; - private String uri = null; - private String intitule = null; - - public ClasseNAF2003() {} // No-args constructor needed for JAXB - - public ClasseNAF2003(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/naf2008/ClasseNAF2008.java b/src/main/java/fr/insee/rmes/modeles/classification/naf2008/ClasseNAF2008.java deleted file mode 100644 index 5dc9beae..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/naf2008/ClasseNAF2008.java +++ /dev/null @@ -1,63 +0,0 @@ -package fr.insee.rmes.modeles.classification.naf2008; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "ClasseNAF2008") -@JacksonXmlRootElement(localName = "ClasseNAF2008") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une classe de la NAF 2008 (rév. 2)") -public class ClasseNAF2008 { - @XmlAttribute - @Schema(example = "46.66") - private String code = null; - @XmlAttribute - @Schema(example = "http://id.insee.fr/codes/nafr2/classe/46.66") - private String uri = null; - @XmlElement(name = "Intitule") - @Schema(example = "Commerce de gros d\'autres machines et équipements de bureau") - private String intitule = null; - - public ClasseNAF2008() {} // No-args constructor needed for JAXB - - public ClasseNAF2008(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/classification/naf2008/SousClasseNAF2008.java b/src/main/java/fr/insee/rmes/modeles/classification/naf2008/SousClasseNAF2008.java deleted file mode 100644 index d0a908ab..00000000 --- a/src/main/java/fr/insee/rmes/modeles/classification/naf2008/SousClasseNAF2008.java +++ /dev/null @@ -1,63 +0,0 @@ -package fr.insee.rmes.modeles.classification.naf2008; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "SousClasseNAF2008") -@JacksonXmlRootElement(localName = "SousClasseNAF2008") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une sous-classe de la NAF 2008 (rév. 2)") -public class SousClasseNAF2008 { - @XmlAttribute - @Schema(example = "27.40Z") - private String code; - @XmlAttribute - @Schema(example = "http://id.insee.fr/codes/nafr2/sousClasse/27.40Z") - private String uri; - @XmlElement(name = "Intitule") - @Schema(example = "Fabrication d'appareils d'éclairage électrique") - private String intitule; - - public SousClasseNAF2008() {} // No-args constructor needed for JAXB - - public SousClasseNAF2008(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/Concept.java b/src/main/java/fr/insee/rmes/modeles/concepts/Concept.java deleted file mode 100644 index 18fc662d..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/Concept.java +++ /dev/null @@ -1,240 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "Definition") -@JacksonXmlRootElement(localName = "Definition") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Definition", description = "Objet représentant la définition d'un concept statistique de l'Insee") -public class Concept { - - @XmlAttribute - @Schema(example = "c2066") - private String id = null; - - @XmlAttribute - @Schema(example = "http://id.insee.fr/concepts/definition/c2066") - private String uri = null; - - @XmlElement(name = "Intitule") - @JsonInclude(Include.NON_EMPTY) - private List intitule = new ArrayList<>(); - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name = "Definition") - @JacksonXmlElementWrapper(useWrapping = false) - private List definition= new ArrayList<>(); - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name="NoteEditoriale") - @JacksonXmlElementWrapper(useWrapping = false) - private List noteEditoriale= new ArrayList<>(); - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name = "DefinitionCourte") - @JacksonXmlElementWrapper(useWrapping = false) - private List scopeNote= new ArrayList<>(); - - - private Boolean hasLink; - - private List remplace = new ArrayList<>(); - - private List estRemplacePar = new ArrayList<>(); - - - @Schema(example = "2020-11-10", pattern = "AAAA-MM-JJ") - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name = "DateMiseAJour") - private String dateMiseAJour = null; - - public Concept() {} - - public Concept(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - - @JacksonXmlProperty(localName = "Intitule") - @JacksonXmlElementWrapper(useWrapping = false) - public List getIntitule() { - return intitule; - } - - public void setIntitule(List intitule) { - this.intitule = intitule; - } - - public void setIntituleFr(String intituleFr) { - if (!intituleFr.equals("")) { - intitule.add(new StringWithLangConcept(intituleFr, Lang.FR)); - } - } - - public void setIntituleEn(String intituleEn) { - if (!intituleEn.equals("")) { - intitule.add(new StringWithLangConcept(intituleEn, Lang.EN)); - } - } - - - @JacksonXmlProperty(localName = "Definition") - @JacksonXmlElementWrapper(useWrapping = false) - public List getDefinition() { - return definition; - } - - public void setDefinition(List definition) { - this.definition = definition; - } - - - @JsonProperty(value = "definitionFr") - public void setDefinitionFr(String definitionFr) { - if (!definitionFr.equals("")) { - definition.add(new StringWithLangConcept(definitionFr, Lang.FR)); - } - } - - public void setDefinitionEn(String definitionEn) { - if (!definitionEn.equals("")) { - definition.add(new StringWithLangConcept(definitionEn, Lang.EN)); - } - } - - - @JacksonXmlProperty(localName = "DefinitionCourte") - @JsonProperty(value="definitionCourte") - @JacksonXmlElementWrapper(useWrapping = false) - public List getScopeNote() { - return scopeNote; - } - - public void setScopeNote(List scopeNote) { - this.scopeNote = scopeNote; - } - - public void setScopeNoteFr(String scopeNoteFr) { - if (!scopeNoteFr.equals("")) { - scopeNote.add(new StringWithLangConcept(scopeNoteFr, Lang.FR)); - } - } - - public void setScopeNoteEn(String scopeNoteEn) { - if (!scopeNoteEn.equals("")) { - scopeNote.add(new StringWithLangConcept(scopeNoteEn, Lang.EN)); - } - } - - @JacksonXmlProperty(localName = "NoteEditoriale") - @JacksonXmlElementWrapper(useWrapping = false) - public List getNoteEditoriale() { - return noteEditoriale; - } - - public void setNoteEditoriale(List editorialNote) { - this.noteEditoriale = editorialNote; - } - - public void setEditorialNoteFr(String editorialNoteFr) { - if (!editorialNoteFr.equals("")) { - noteEditoriale.add(new StringWithLangConcept(editorialNoteFr, Lang.FR)); - } - } - - public void setEditorialNoteEn(String editorialNoteEn) { - if (!editorialNoteEn.equals("")) { - noteEditoriale.add(new StringWithLangConcept(editorialNoteEn, Lang.EN)); - } - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("conceptsPrecedents") - @XmlElementWrapper(name = "ConceptsPrecedents") - @JacksonXmlElementWrapper(localName = "ConceptsPrecedents") - @JacksonXmlProperty(localName = "ConceptPrecedent") - public List getRemplace() { - return remplace; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("conceptsSuivants") //json example - @XmlElementWrapper(name = "ConceptsSuivants") //xml example list - @JacksonXmlElementWrapper(localName = "ConceptsSuivants") //xml response - @JacksonXmlProperty(localName = "ConceptSuivant") //xml response - public List getEstRemplacePar() { - return estRemplacePar; - } - - public String getDateMiseAJour() { - return dateMiseAJour.substring(0,10); - } - - @JacksonXmlProperty(localName = "DateMiseAJour") - public void setDateMiseAJour(String dateMiseAJour) { - this.dateMiseAJour = dateMiseAJour; - } - - @JsonIgnore - public Boolean getHasLink() { - return hasLink; - } - - @JsonProperty(value = "hasLink") - public void setHasLink(Boolean hasLink) { - this.hasLink = hasLink; - } - - public void setLinks(List links) { - links.forEach(link -> { - - if (StringUtils.equals("replaces",link.getTypeOfLink())) { - ConceptPrecedent so = new ConceptPrecedent(link.getId(), link.getUri()); - remplace.add(so); - }else if (StringUtils.equals("isReplacedBy",link.getTypeOfLink())) { - ConceptSuivant so = new ConceptSuivant(link.getId(), link.getUri()); - estRemplacePar.add(so); - } - }); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/ConceptLink.java b/src/main/java/fr/insee/rmes/modeles/concepts/ConceptLink.java deleted file mode 100644 index ddca11d0..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/ConceptLink.java +++ /dev/null @@ -1,28 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -public class ConceptLink { - - private String id; - private String uri; - private String typeOfLink; - - public String getId() { - return id; - } - public void setId(String id) { - this.id = id; - } - public String getUri() { - return uri; - } - public void setUri(String uri) { - this.uri = uri; - } - public String getTypeOfLink() { - return typeOfLink; - } - public void setTypeOfLink(String typeOfLink) { - this.typeOfLink = typeOfLink; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/ConceptPrecedent.java b/src/main/java/fr/insee/rmes/modeles/concepts/ConceptPrecedent.java deleted file mode 100644 index 7ffe9e2a..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/ConceptPrecedent.java +++ /dev/null @@ -1,61 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import java.util.Objects; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name="ConceptPrecedent") -@Schema(name = "ConceptPrecedent", description = "concept lié") -public class ConceptPrecedent { - @Schema(example = "c1501") - protected String id = null; - @Schema(example = "http://id.insee.fr/concepts/definition/c1501") - protected String uri = null; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ConceptPrecedent(String id, String uri) { - this.id = id; - this.uri = uri; - } - - public ConceptPrecedent() { - super(); - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - - @Override - public int hashCode() { - return Objects.hash(id, uri); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ConceptPrecedent other = (ConceptPrecedent) obj; - return Objects.equals(id, other.id) && Objects.equals(uri, other.uri); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/ConceptSuivant.java b/src/main/java/fr/insee/rmes/modeles/concepts/ConceptSuivant.java deleted file mode 100644 index 7284db08..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/ConceptSuivant.java +++ /dev/null @@ -1,61 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import java.util.Objects; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name="ConceptSuivant") -@Schema(name = "ConceptSuivant", description = "concept lié") -public class ConceptSuivant { - @Schema(example = "c1500") - protected String id = null; - @Schema(example = "http://id.insee.fr/concepts/definition/c1500") - protected String uri = null; - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public ConceptSuivant(String id, String uri) { - this.id = id; - this.uri = uri; - } - - public ConceptSuivant() { - super(); - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - - @Override - public int hashCode() { - return Objects.hash(id, uri); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - ConceptSuivant other = (ConceptSuivant) obj; - return Objects.equals(id, other.id) && Objects.equals(uri, other.uri); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/Definition.java b/src/main/java/fr/insee/rmes/modeles/concepts/Definition.java deleted file mode 100644 index ae5c6514..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/Definition.java +++ /dev/null @@ -1,127 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import java.util.ArrayList; -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlElementWrapper; -import jakarta.xml.bind.annotation.XmlRootElement; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "Definition")//for openapi example -@JacksonXmlRootElement(localName = "IntituleDefinition") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "IntituleDefinition", description = "Objet représentant la définition d'un concept statistique de l'Insee") -public class Definition { - - @XmlAttribute - @Schema(example = "c2066") - private String id = null; - - @XmlAttribute - @Schema(example = "http://id.insee.fr/concepts/definition/c2066") - private String uri = null; - - @XmlElement(name = "Intitule") - @Schema(example = "Intitulé du concept à définir") - private String intitule = null; - - @JsonInclude(Include.NON_EMPTY) - private List remplace = new ArrayList<>(); - - @JsonInclude(Include.NON_EMPTY) - private List estRemplacePar = new ArrayList<>(); - - private Boolean hasLink; - - - public Definition() {} - - public Definition(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true) - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("conceptsPrecedents") - @XmlElementWrapper(name = "ConceptsPrecedents") - @JacksonXmlElementWrapper(localName = "ConceptsPrecedents") - @JacksonXmlProperty(localName = "ConceptPrecedent") - public List getRemplace() { - return remplace; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("conceptsSuivants") //json example - @XmlElementWrapper(name = "ConceptsSuivants") //xml example list - @JacksonXmlElementWrapper(localName = "ConceptsSuivants") //xml response - @JacksonXmlProperty(localName = "ConceptSuivant") //xml response - public List getEstRemplacePar() { - return estRemplacePar; - } - - @JsonIgnore - public Boolean getHasLink() { - return hasLink; - } - - @JsonProperty(value = "hasLink") - public void setHasLink(Boolean hasLink) { - this.hasLink = hasLink; - } - - public void setLinks(List links) { - links.forEach(link -> { - - if (StringUtils.equals("replaces",link.getTypeOfLink())) { - ConceptPrecedent so = new ConceptPrecedent(link.getId(), link.getUri()); - remplace.add(so); - }else if (StringUtils.equals("isReplacedBy",link.getTypeOfLink())) { - ConceptSuivant so = new ConceptSuivant(link.getId(), link.getUri()); - estRemplacePar.add(so); - } - }); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/Definitions.java b/src/main/java/fr/insee/rmes/modeles/concepts/Definitions.java deleted file mode 100644 index b4aef031..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/Definitions.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Definitions") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Definitions", description = "Tableau représentant des définitions de concepts statistiques de l'Insee") -public class Definitions { - - private List definitions = null; - - public Definitions() {} - - public Definitions(List definitions) { - this.definitions = definitions; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Definition") - @JacksonXmlElementWrapper(useWrapping = false, localName = "Definition") - public List getConcepts() { - return definitions; - } - - public void setConcepts(List definitions) { - this.definitions = definitions; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/StringWithLangConcept.java b/src/main/java/fr/insee/rmes/modeles/concepts/StringWithLangConcept.java deleted file mode 100644 index af1df8d4..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/StringWithLangConcept.java +++ /dev/null @@ -1,65 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import java.nio.charset.StandardCharsets; -import java.util.Objects; - -import jakarta.xml.bind.annotation.XmlAttribute; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; -@Schema(name = "TexteMultiLangue", description = "TexteMultiLangue") -public class StringWithLangConcept { - @Schema(example = "Texte en français") - @JsonProperty("contenu") - private String string = null; - - @Schema(example = "fr") - @JsonProperty("langue") - @XmlAttribute - @JacksonXmlProperty(isAttribute = true, localName = "langue") - private Lang lang = null; - - public String getString() { - if (string == null) return null; - else return new String(string.getBytes(), StandardCharsets.UTF_8); - } - - public StringWithLangConcept(String string, Lang lang) { - super(); - this.string = string; - this.lang = lang; - } - - public void setString(String string) { - this.string = string; - } - - public String getLang() { - return lang.getLang(); - } - - public void setLang(Lang lang) { - this.lang = lang; - } - - @Override - public int hashCode() { - return Objects.hash(lang, string); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - StringWithLangConcept other = (StringWithLangConcept) obj; - return lang == other.lang && Objects.equals(string, other.string); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/concepts/StringXmlMixInConcept.java b/src/main/java/fr/insee/rmes/modeles/concepts/StringXmlMixInConcept.java deleted file mode 100644 index 1a8e3379..00000000 --- a/src/main/java/fr/insee/rmes/modeles/concepts/StringXmlMixInConcept.java +++ /dev/null @@ -1,21 +0,0 @@ -package fr.insee.rmes.modeles.concepts; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonRawValue; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -public abstract class StringXmlMixInConcept { - - @JsonCreator - public StringXmlMixInConcept(String string, String lang) {} - - @JsonProperty("contenu") - @JsonRawValue - abstract String getString(); - - @JacksonXmlProperty(isAttribute = true) - @JsonProperty("langue") - abstract String getLang(); - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/EnumTypeGeographie.java b/src/main/java/fr/insee/rmes/modeles/geo/EnumTypeGeographie.java deleted file mode 100644 index ed1d3e66..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/EnumTypeGeographie.java +++ /dev/null @@ -1,94 +0,0 @@ -package fr.insee.rmes.modeles.geo; - -import fr.insee.rmes.modeles.geo.territoire.*; -import fr.insee.rmes.modeles.geo.territoires.*; -import fr.insee.rmes.utils.Constants; - -import java.util.Optional; -import java.util.stream.Stream; - -public enum EnumTypeGeographie { - - COMMUNE("Commune", Commune.class,Communes.class, Constants.NONE), - REGION("Region", Region.class,Regions.class, "prefectureDeRegion"), - DEPARTEMENT("Departement", Departement.class,Departements.class, "prefecture"), - ARRONDISSEMENT("Arrondissement", Arrondissement.class,Arrondissements.class, "sousPrefecture"), - CANTON("Canton", Canton.class,Cantons.class,"bureauCentralisateur"), - CANTON_OU_VILLE("CantonOuVille", CantonOuVille.class, CantonsEtVilles.class, Constants.NONE), - COLLECTIVITE_D_OUTRE_MER("CollectiviteDOutreMer", CollectiviteDOutreMer.class,CollectivitesDOutreMer.class, Constants.NONE), - COMMUNE_DELEGUEE("CommuneDeleguee", CommuneDeleguee.class,CommunesDeleguees.class,Constants.NONE), - COMMUNE_ASSOCIEE("CommuneAssociee", CommuneAssociee.class,CommunesAssociees.class,Constants.NONE), - ARRONDISSEMENT_MUNICIPAL("ArrondissementMunicipal",ArrondissementMunicipal.class,ArrondissementsMunicipaux.class, Constants.NONE), - ZONE_EMPLOI("ZoneDEmploi2020", ZoneDEmploi2020.class,ZonesDEmploi2020.class,Constants.NONE), - AIRE_ATTRACTION("AireDAttractionDesVilles2020",AireDAttractionDesVilles2020.class,AiresDAttractionDesVilles2020.class,Constants.NONE), - UNITE_URBAINE("UniteUrbaine2020", UniteUrbaine2020.class,UnitesUrbaines2020.class,Constants.NONE), - DISTRICT("District",District.class,Districts.class,Constants.NONE), - CIRCONSCRIPTION_TERRITORIALE("CirconscriptionTerritoriale",CirconscriptionTerritoriale.class,CirconscriptionsTerritoriales.class,Constants.NONE), - INTERCOMMUNALITE("Intercommunalite",Intercommunalite.class,Intercommunalites.class,Constants.NONE), - BASSINDEVIE("BassinDeVie2022",BassinDeVie2022.class,BassinsDeVie2022.class,Constants.NONE), - IRIS("Iris", Iris.class,Iriss.class,Constants.NONE), - PAYS("Pays", Pays.class, PaysS.class,Constants.NONE); - - private String typeObjetGeo; - private Class classNameOfGeoType; - private Class classPluralGeoType; - private String chefLieuPredicate; - - private EnumTypeGeographie( - String typeObjetGeo, - Class classNameOfGeoType, - Class classPluralGeoType, - String chefLieuPredicate) { - this.typeObjetGeo = typeObjetGeo; - this.classNameOfGeoType = classNameOfGeoType; - this.classPluralGeoType = classPluralGeoType; - this.chefLieuPredicate = chefLieuPredicate; - } - - - - public String getTypeObjetGeo() { - return typeObjetGeo; - } - - public Class getClassNameOfGeoType() { - return classNameOfGeoType; - } - - - public Class getClassPluralGeoType() { - return classPluralGeoType; - } - - public static Stream streamValuesTypeGeo() { - return Stream.of(EnumTypeGeographie.values()); - } - - public static Class getClassByType(String type) { - Optional optionalClass = getOptionalEnumType(type); - return optionalClass.isPresent() ? optionalClass.get().getClassNameOfGeoType() : null; - } - - public static Class getPluralClassByType(String type) { - Optional optionalClass = getOptionalEnumType(type); - return optionalClass.isPresent() ? optionalClass.get().getClassPluralGeoType() : null; - } - - private static Optional getOptionalEnumType(String type) { - return streamValuesTypeGeo().filter(s -> s.getTypeObjetGeo().equalsIgnoreCase(type)).findAny(); - } - - public static String getTypeObjetGeoIgnoreCase(String typeObjetGeo) { - Optional enumTypeGeographie = - EnumTypeGeographie - .streamValuesTypeGeo() - .filter(s -> s.getTypeObjetGeo().equalsIgnoreCase(typeObjetGeo)) - .findFirst(); - return enumTypeGeographie.isPresent() ? enumTypeGeographie.get().getTypeObjetGeo() : null; - } - - public String getChefLieuPredicate() { - return chefLieuPredicate; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/IntituleSansArticle.java b/src/main/java/fr/insee/rmes/modeles/geo/IntituleSansArticle.java deleted file mode 100644 index 3a0bb42c..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/IntituleSansArticle.java +++ /dev/null @@ -1,51 +0,0 @@ -package fr.insee.rmes.modeles.geo; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlText; -import io.swagger.v3.oas.annotations.media.Schema; - -import jakarta.xml.bind.annotation.*; - -@Schema(description="Intitulé sans son article et article associé") -@XmlAccessorType(XmlAccessType.PROPERTY) -@JsonPropertyOrder({"intituleSansArticle", "typeArticle"}) -@XmlRootElement(name = "IntituleSansArticle") -@JacksonXmlRootElement(localName = "IntituleSansArticle") -public class IntituleSansArticle { - - @Schema(example = "Aigle") - //@XmlValue - private String label = null; - - @Schema(example = "5") - private String typeArticle = null; - - - @JacksonXmlText - @JsonProperty("intituleSansArticle") - @JacksonXmlProperty(localName="IntituleSansArticle") - @Schema(example = "Aigle") - @XmlValue - public String getIntituleSansArticle() { - return label; - } - - public void setIntituleSansArticle(String intituleSansArticle) { - this.label = intituleSansArticle; - } - - @JacksonXmlProperty(isAttribute = true) - @JsonProperty("typeArticle") - @XmlAttribute - public String getTypeArticle() { - return typeArticle; - } - - public void setTypeArticle(String typeArticle) { - this.typeArticle = typeArticle; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/TerritoireJsonMixIn.java b/src/main/java/fr/insee/rmes/modeles/geo/TerritoireJsonMixIn.java deleted file mode 100644 index d080763e..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/TerritoireJsonMixIn.java +++ /dev/null @@ -1,28 +0,0 @@ -package fr.insee.rmes.modeles.geo; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonUnwrapped; - -public abstract class TerritoireJsonMixIn { - - @JsonCreator - public TerritoireJsonMixIn( - String code, - String uri, - String intitule, - EnumTypeGeographie type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { } - - @JsonUnwrapped - abstract String getIntituleSansArticle(); - - @JsonInclude(Include.NON_EMPTY) - abstract String getChefLieu(); - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/AireDAttractionDesVilles2020.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/AireDAttractionDesVilles2020.java deleted file mode 100644 index ef844543..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/AireDAttractionDesVilles2020.java +++ /dev/null @@ -1,93 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "AireDAttractionDesVilles2020") -@JacksonXmlRootElement(namespace = "AireDAttractionDesVilles2020") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une aire d'attraction") -public class AireDAttractionDesVilles2020 extends Territoire { - - // No-args constructor needed for JAXB - - public AireDAttractionDesVilles2020() { - this.type = EnumTypeGeographie.AIRE_ATTRACTION.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public AireDAttractionDesVilles2020(String code) { - this.type = EnumTypeGeographie.AIRE_ATTRACTION.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public AireDAttractionDesVilles2020( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String typeArticle) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle); - this.setTypeArticle(typeArticle); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "062") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/aireDAttractionDesVilles2020/062") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Angoulême") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Aire d'attraction") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de l'aire d'attraction si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de l'aire d'attraction si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Arrondissement.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Arrondissement.java deleted file mode 100644 index f01c9a4e..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Arrondissement.java +++ /dev/null @@ -1,96 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "Arrondissement") -@JacksonXmlRootElement(localName = "Arrondissement") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un arrondissement") -public class Arrondissement extends Territoire { - - // No-args constructor needed for JAXB - public Arrondissement() { - super(); - this.type = EnumTypeGeographie.ARRONDISSEMENT.getTypeObjetGeo(); - } - - public Arrondissement(String code) { - super(); - this.type = EnumTypeGeographie.ARRONDISSEMENT.getTypeObjetGeo(); - } - - public Arrondissement( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle, chefLieu); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "191") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/arrondissement/c38af455-45e1-4f44-9d58-165e1626441a") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Brive-la-Gaillarde") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Arrondissement") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de l'arrondissement s'il n’existait pas au premier COG du 1er janvier 1943", - example = "1993-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de l'arrondissement s'il a été supprimé. ", example = "2017-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - @Override - @JacksonXmlProperty(localName = "ChefLieu") - @Schema(description = "Code Insee de la commune sous-préfecture de l’arrondissement.", example="19031") - public String getChefLieu() { - return chefLieu; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/ArrondissementMunicipal.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/ArrondissementMunicipal.java deleted file mode 100644 index 02bb2676..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/ArrondissementMunicipal.java +++ /dev/null @@ -1,84 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "ArrondissementMunicipal") -public class ArrondissementMunicipal extends Territoire { - // No-args constructor needed for JAXB - public ArrondissementMunicipal() { - this.type = EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public ArrondissementMunicipal(String code) { - this.type = EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public ArrondissementMunicipal( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle, chefLieu); - } - - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "69388") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/arrondissementMunicipal/0b5aef6b-ee47-4cd0-ad4a-7a745dd62b3f") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Lyon 8e Arrondissement") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "ArrondissementMunicipal") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de l'arrondissement municipal s'il n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de l'arrondissement municipal s'il a été supprimé. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/BassinDeVie2022.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/BassinDeVie2022.java deleted file mode 100644 index 7a298cf5..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/BassinDeVie2022.java +++ /dev/null @@ -1,44 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "BassinDeVie2022") -@JacksonXmlRootElement(localName = "BassinDeVie2022") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un bassin de vie") -public class BassinDeVie2022 extends Territoire { - - // No-args constructor needed for JAXB - public BassinDeVie2022() { - this.type = EnumTypeGeographie.BASSINDEVIE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public BassinDeVie2022(String code) { - this.type = EnumTypeGeographie.BASSINDEVIE.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public BassinDeVie2022( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle, chefLieu); - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Canton.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Canton.java deleted file mode 100644 index d8dc6064..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Canton.java +++ /dev/null @@ -1,97 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "Canton") -@JacksonXmlRootElement(localName = "Canton") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un canton") -public class Canton extends Territoire { - public Canton() { - this.type = EnumTypeGeographie.CANTON.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public Canton(String code) { - this.type = EnumTypeGeographie.CANTON.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "0101") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(description = "URI du canton",example = "http://id.insee.fr/geo/canton/f96a2438-478f-4ebb-b659-434305dff18f") - - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(description = "Nom du canton (avec article)",example = "Ambérieu-en-Bugey") - - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "IntituleSansArticle") - @JsonProperty(value = "intituleSansArticle") - @Schema(description = "Nom du canton sans article",example = "Ambérieu-en-Bugey") - public IntituleSansArticle getIntituleSansArticle() { - return intituleSansArticle; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Canton") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création du canton si il n’existait pas au premier COG du 1er janvier 2016", - example = "2016-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression du canton si il a été supprimé. ", example = "2019-01-01") - - public String getDateSuppression() { - return dateSuppression; - } - - @Override - - @JacksonXmlProperty(localName = "ChefLieu") - @Schema(description = "Code Insee de la commune bureau centralisateur du canton. \n", example="19031") - - public String getChefLieu() { - return chefLieu; - } - -} - diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CantonOuVille.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CantonOuVille.java deleted file mode 100644 index c018026b..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CantonOuVille.java +++ /dev/null @@ -1,84 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "CantonOuVille") -@JacksonXmlRootElement(localName = "CantonOuVille") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un cantonOuVille") -public class CantonOuVille extends Territoire { - - public CantonOuVille(String code) { - this.type = EnumTypeGeographie.CANTON_OU_VILLE.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CantonOuVille() { - this.type = EnumTypeGeographie.CANTON_OU_VILLE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "0101") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/cantonOuVille/0101") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Ambérieu-en-Bugey") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "CantonOuVille") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création du canton si elle n’existait pas au premier COG du 1er janvier 1943", - example = "2016-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression du canton si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "01004") - public String getChefLieu() { - return chefLieu; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CirconscriptionTerritoriale.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CirconscriptionTerritoriale.java deleted file mode 100644 index a6894d3c..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CirconscriptionTerritoriale.java +++ /dev/null @@ -1,46 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "CirconscriptionTerritoriale") -@JacksonXmlRootElement(localName = "CirconscriptionTerritoriale") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une circonscription territoriale") - -public class CirconscriptionTerritoriale extends Territoire { - - public CirconscriptionTerritoriale() { - this.type = EnumTypeGeographie.CIRCONSCRIPTION_TERRITORIALE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CirconscriptionTerritoriale(String code) { - this.type = EnumTypeGeographie.CIRCONSCRIPTION_TERRITORIALE.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CirconscriptionTerritoriale( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String typeArticle) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle); - this.setTypeArticle(typeArticle); - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CodeIris.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CodeIris.java deleted file mode 100644 index cb7e2edb..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CodeIris.java +++ /dev/null @@ -1,41 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import java.util.regex.Pattern; - -import static fr.insee.rmes.api.geo.ConstGeoApi.PATTERN_IRIS; - -public final class CodeIris { - - private static final Pattern IRIS_CODE_PATTERN = Pattern.compile(PATTERN_IRIS); - public static final String PSEUDO_IRIS_SUFFIX = "0000"; - private final String code; - private final boolean isInvalid; - - private CodeIris(String code) { - this.code = code; - isInvalid = ! IRIS_CODE_PATTERN.matcher(code).matches(); - } - - public static CodeIris of(String code) { - return new CodeIris(code); - } - - public boolean isInvalid() { - return this.isInvalid; - } - - public String code() { - if (isInvalid){ - throw new IllegalStateException("Cannot get an invalid code (which does not match "+PATTERN_IRIS+") from CodeIris"); - } - return code; - } - - public boolean isPseudoIrisCode() { - return code().endsWith(PSEUDO_IRIS_SUFFIX); - } - - public String codeCommune() { - return code().substring(0, 5); - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CollectiviteDOutreMer.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CollectiviteDOutreMer.java deleted file mode 100644 index 9c989a94..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CollectiviteDOutreMer.java +++ /dev/null @@ -1,93 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "CollectiviteDOutreMER") -@JacksonXmlRootElement(localName = "CollectiviteDOutreMer") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une collectivite d'outre-mer") - -public class CollectiviteDOutreMer extends Territoire { - - // No-args constructor needed for JAXB - public CollectiviteDOutreMer() { - this.type = EnumTypeGeographie.COLLECTIVITE_D_OUTRE_MER.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CollectiviteDOutreMer(String code) { - this.type = EnumTypeGeographie.COLLECTIVITE_D_OUTRE_MER.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CollectiviteDOutreMer( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle, chefLieu); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "98735") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/commune/98735") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Papeete") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Commune") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de la commune/district si il/elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de la commune/district si il/elle a été supprimé(e). ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Commune.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Commune.java deleted file mode 100644 index db205c39..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Commune.java +++ /dev/null @@ -1,94 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -import jakarta.validation.constraints.NotNull; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "Commune") -@JacksonXmlRootElement(localName = "Commune") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une commune") -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class Commune extends Territoire { - - private final Inclusion inclusion; - - // No-args constructor needed for JAXB - public Commune() { - this.type = EnumTypeGeographie.COMMUNE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - this.inclusion=null; - } - - - public Commune(String code) { - this(); - this.code = code; - } - - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "55323") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/commune/55323") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "L'Aigle") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Commune") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de la commune si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de la commune si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - - @JacksonXmlProperty(localName = "Inclusion") - @NotNull - @Schema(description = "inclusion totale ou partielle dans un canton", example = "totale") - public Inclusion getInclusion() { - return inclusion; - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CommuneAssociee.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CommuneAssociee.java deleted file mode 100644 index 15f1c0f5..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CommuneAssociee.java +++ /dev/null @@ -1,83 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "CommuneAssociee") -@JacksonXmlRootElement(localName = "CommuneAssociee") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une commune associee") -public class CommuneAssociee extends Territoire { - - // No-args constructor needed for JAXB - public CommuneAssociee() { - this.type = EnumTypeGeographie.COMMUNE_ASSOCIEE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CommuneAssociee(String code) { - this.type = EnumTypeGeographie.COMMUNE_ASSOCIEE.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "14463") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/communeAssociee/14463") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Neuilly-le-Malherbe") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Commune Associee") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de la commune si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de la commune si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - @Override - @JacksonXmlProperty(localName = "IntituleSansArticle") - public IntituleSansArticle getIntituleSansArticle() { - return intituleSansArticle; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CommuneDeleguee.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CommuneDeleguee.java deleted file mode 100644 index 6b5c43f7..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CommuneDeleguee.java +++ /dev/null @@ -1,83 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "CommuneDeleguee") -@JacksonXmlRootElement(localName = "CommuneDeleguee") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une commune deleguee") -public class CommuneDeleguee extends Territoire { - - // No-args constructor needed for JAXB - public CommuneDeleguee() { - this.type = EnumTypeGeographie.COMMUNE_DELEGUEE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public CommuneDeleguee(String code) { - this.type = EnumTypeGeographie.COMMUNE_DELEGUEE.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "46248") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/communeDeleguee/46248") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "L'Aigle") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Commune Deleguee") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de la commune si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de la commune si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - @Override - @JacksonXmlProperty(localName = "IntituleSansArticle") - public IntituleSansArticle getIntituleSansArticle() { - return intituleSansArticle; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CsvProjection.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/CsvProjection.java deleted file mode 100644 index ba8b4ee7..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/CsvProjection.java +++ /dev/null @@ -1,180 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; - -public class CsvProjection { - - private static Logger logger = LogManager.getLogger(CsvProjection.class); - - - protected String type; - - protected String codeOrigine = null; - protected String origine = null; - protected String intituleOrigine = null; - protected String dateCreationOrigine = null; - protected String dateSuppressionOrigine = null; - protected IntituleSansArticle intituleSansArticleOrigine; - protected String chefLieuOrigine = null; - - protected String code = null; - protected String uri = null; - protected String intitule = null; - protected String dateCreation = null; - protected String dateSuppression = null; - protected IntituleSansArticle intituleSansArticle; - protected String chefLieu = null; - protected String intituleComplet = null; - - public CsvProjection() { - this.intituleSansArticle = new IntituleSansArticle(); - this.intituleSansArticleOrigine = new IntituleSansArticle(); - } - - public String getOrigine() { - return origine; - } - - public Territoire getTerritoireOrigine() { - Class territoireClass = EnumTypeGeographie.getClassByType(type); - Territoire t = null; - try { - t = - territoireClass - .getDeclaredConstructor( - String.class, - String.class, - String.class, - String.class, - String.class, - String.class, - IntituleSansArticle.class, - String.class) - .newInstance( - codeOrigine, - origine, - intituleOrigine, - type, - dateCreationOrigine, - dateSuppressionOrigine, - intituleSansArticleOrigine, - chefLieuOrigine); - } - catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { - logger.error("Error in getTerritoireOrigine - {}",e.getMessage()); - } - return t; - } - - public Territoire getTerritoireProjete() { - Class territoireClass = EnumTypeGeographie.getClassByType(type); - Territoire t = null; - try { - t = - territoireClass - .getDeclaredConstructor( - String.class, - String.class, - String.class, - String.class, - String.class, - String.class, - IntituleSansArticle.class, - String.class) - .newInstance( - code, - uri, - intitule, - type, - dateCreation, - dateSuppression, - intituleSansArticle, - chefLieu); - } - catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { - logger.error("Error in getTerritoireProjete - {}",e.getMessage()); - } - return t; - } - - public void setCodeOrigine(String codeOrigine) { - this.codeOrigine = codeOrigine; - } - - public void setOrigine(String origine) { - this.origine = origine; - } - - public void setIntituleOrigine(String intituleOrigine) { - this.intituleOrigine = intituleOrigine; - } - - public void setDateCreationOrigine(String dateCreationOrigine) { - this.dateCreationOrigine = dateCreationOrigine; - } - - public void setDateSuppressionOrigine(String dateSuppressionOrigine) { - this.dateSuppressionOrigine = dateSuppressionOrigine; - } - - public void setIntituleSansArticleOrigine(String intituleSansArticleOrigine) { - this.intituleSansArticleOrigine.setIntituleSansArticle(intituleSansArticleOrigine); - } - - public void setTypeArticleOrigine(String typeArticleOrigine) { - this.intituleSansArticleOrigine.setTypeArticle(typeArticleOrigine); - } - - public void setChefLieuOrigine(String chefLieuOrigine) { - this.chefLieuOrigine = chefLieuOrigine; - } - - public void setCode(String code) { - this.code = code; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - public void setType(String type) { - this.type = type; - } - - public void setDateCreation(String dateCreation) { - this.dateCreation = dateCreation; - } - - public void setDateSuppression(String dateSuppression) { - this.dateSuppression = dateSuppression; - } - - public void setIntituleSansArticle(String intituleSansArticle) { - this.intituleSansArticle.setIntituleSansArticle(intituleSansArticle); - } - - public void setTypeArticle(String typeArticle) { - this.intituleSansArticle.setTypeArticle(typeArticle); - } - - public void setChefLieu(String chefLieu) { - this.chefLieu = chefLieu; - } - - public void setIntituleComplet(String intituleComplet) { - this.intituleComplet = intituleComplet; - } - public String getIntituleComplet() { - return intituleComplet; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Departement.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Departement.java deleted file mode 100644 index 4ec46915..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Departement.java +++ /dev/null @@ -1,96 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "Departement") -@JacksonXmlRootElement(localName = "Departement") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un departement") -public class Departement extends Territoire { - - // No-args constructor needed for JAXB - public Departement() { - super(); - this.type = EnumTypeGeographie.DEPARTEMENT.getTypeObjetGeo(); - } - - public Departement(String code) { - super(); - this.type = EnumTypeGeographie.DEPARTEMENT.getTypeObjetGeo(); - } - - public Departement( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle, chefLieu); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "22") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/departement/22") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Côtes-du-Nord") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Departement") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création du département si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression du département si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - @Override - @JacksonXmlProperty(localName = "ChefLieu") - @Schema(description = "Code Insee de la commune préfecture du département.", example="22278") - public String getChefLieu() { - return chefLieu; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/District.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/District.java deleted file mode 100644 index 52a4a72e..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/District.java +++ /dev/null @@ -1,93 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "District") -@JacksonXmlRootElement(localName = "District") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un district") -public class District extends Territoire { - - // No-args constructor needed for JAXB - public District() { - this.type = EnumTypeGeographie.DISTRICT.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public District(String code) { - this.type = EnumTypeGeographie.DISTRICT.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public District( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String typeArticle) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle); - this.setTypeArticle(typeArticle); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "98412") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/district/78c18c16-2d63-486d-9ff0-e36e76a95718") /*to do changer adresse */ - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Archipel des Kerguelen") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "District") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création du district s'il n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression du district s'il a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Inclusion.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Inclusion.java deleted file mode 100644 index 901fedfc..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Inclusion.java +++ /dev/null @@ -1,19 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonValue; - -import jakarta.xml.bind.annotation.XmlValue; - -@JsonFormat(shape = JsonFormat.Shape.STRING) -public enum Inclusion { - PARTIELLE, TOTALE; - - @JsonValue - @XmlValue - @Override - public String toString(){ - return name().toLowerCase(); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Intercommunalite.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Intercommunalite.java deleted file mode 100644 index 730ca359..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Intercommunalite.java +++ /dev/null @@ -1,48 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - - -@XmlRootElement(name = "Intercommunalite") -@JacksonXmlRootElement(localName = "Intercommunalite") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une intercommunalite") - -public class Intercommunalite extends Territoire { - - @JsonInclude(JsonInclude.Include.NON_EMPTY) - @XmlElement(name="IntituleComplet") - private String intituleComplet = null; - - public Intercommunalite(String code) { - this(); - this.code = code; - - } - - public Intercommunalite() { - this.type = EnumTypeGeographie.INTERCOMMUNALITE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - @JacksonXmlProperty(localName = "IntituleComplet") - public String getIntituleComplet() { - return intituleComplet; - } - - public void setIntituleComplet(String intituleComplet) { - this.intituleComplet = intituleComplet; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Iris.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Iris.java deleted file mode 100644 index 370cfcdc..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Iris.java +++ /dev/null @@ -1,107 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -import jakarta.validation.constraints.NotNull; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "Iris") -@JacksonXmlRootElement(localName = "Iris") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un Iris") -public class Iris extends Territoire { - - private final TypeDIris typeDIris; - - public Iris( - TypeDIris typeDIris, - String code, - String uri, - String intitule, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle) { - super(code, uri, intitule, EnumTypeGeographie.IRIS.getTypeObjetGeo(), dateCreation, dateSuppression, intituleSansArticle); - this.typeDIris=typeDIris; - } - - public Iris() { - this(null); - } - - public Iris(String code) { - this(null, code, null, null, null, null, new IntituleSansArticle()); - } - - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "http://rdf.insee.fr/def/geo#Iris") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "010040101") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(description = "URI de l'Iris ", example = "http://id.insee.fr/geo/iris/b8c772de-9551-4f13-81c5-eca5bb0f2f7d") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(description = "Nom de l'Iris (avec article)", example = "Les Pérouses-Triangle d'Activités") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "IntituleSansArticle") - @JsonProperty(value = "intituleSansArticle") - @Schema(description = "Nom de l'Iris sans article", example = "Pérouses-Triangle d'Activité") - public IntituleSansArticle getIntituleSansArticle() { - return intituleSansArticle; - } - - - @JacksonXmlProperty(localName = "TypeDIris") - @NotNull - @Schema(description = "Type d'Iris (H , A ou D)", example = "H") - public TypeDIris getTypeDIris() { - return typeDIris; - } - - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de l'Iris si il n’existait pas au premier COG du 1er janvier 2016", - example = "2016-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de l'Iris si il a été supprimé. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - // getters and setters -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Pays.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Pays.java deleted file mode 100644 index 0848faa5..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Pays.java +++ /dev/null @@ -1,77 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "Pays") -@JacksonXmlRootElement(localName = "Pays") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant un pays") -public class Pays extends Territoire { - - @Schema(example = "99254") - private String code = null; - @Schema(example = "http://id.insee.fr/geo/pays/99254") - private String uri = null; - @Schema(example = "CHYPRE") - private String intitule = null; - @Schema(example = "RÉPUBLIQUE DE CHYPRE") - private String intituleEntier = null; - - public Pays() {} // No-args constructor needed for JAXB - - public Pays(String code) { - this.code = code; - } - - @XmlAttribute - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @XmlAttribute - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @XmlElement(name = "Intitule") - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - @XmlElement(name = "IntituleEntier") - @JacksonXmlProperty(localName = "IntituleEntier") - @JsonProperty(value = "intituleEntier") - public String getIntituleEntier() { - return intituleEntier; - } - - public void setIntituleEntier(String intituleEntier) { - this.intituleEntier = intituleEntier; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Projection.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Projection.java deleted file mode 100644 index 56d490d3..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Projection.java +++ /dev/null @@ -1,79 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.territoires.Territoires; - -public class Projection { - - private static Logger logger = LogManager.getLogger(Projection.class); - - @JacksonXmlElementWrapper(useWrapping = false) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) - Territoire origine; - - @JsonIgnore - List projetes = new ArrayList<>(); - - @JacksonXmlElementWrapper(useWrapping = false) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) - Territoires listeProj; - - public Projection() {} - - public Projection(Territoire origine, Territoire t) { - this.origine = origine; - this.addProjete(t); - } - - public Territoire getOrigine() { - return origine; - } - - public void setOrigine(Territoire origine) { - this.origine = origine; - } - - public List getProjetes() { - return projetes; - } - - public void setProjetes(List projetes) { - this.projetes = projetes; - } - - @JsonIgnore - public String getIdentifiant() { - return origine.getUri(); - } - - public void addProjete(Territoire t) { - projetes.add(t); - } - - public Territoires getListeProj() { - Class classeTerritoire = EnumTypeGeographie.getPluralClassByType(origine.getType()); - try { - return classeTerritoire.getDeclaredConstructor(List.class).newInstance(projetes); - } - catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) { - logger.error(e.getMessage()); - return null; - } - } - - public void setListeProj(Territoires listeProj) { - this.listeProj = listeProj; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/PseudoIris.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/PseudoIris.java deleted file mode 100644 index 9a355299..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/PseudoIris.java +++ /dev/null @@ -1,104 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; - -import jakarta.xml.bind.annotation.*; - -@XmlRootElement(name = "Commune") -@JacksonXmlRootElement(localName = "Commune") -@XmlAccessorType(XmlAccessType.FIELD) -@JsonInclude(JsonInclude.Include.NON_EMPTY) -public class PseudoIris extends Territoire{ - - public PseudoIris( - String code, - String uri, - String intitule, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle) { - super(code, uri, intitule, EnumTypeGeographie.COMMUNE.getTypeObjetGeo(), dateCreation, dateSuppression, intituleSansArticle); - } - - public PseudoIris() { - this(null); - } - - public PseudoIris(String code) { - this(code, null, null, null, null, new IntituleSansArticle()); - } - - - - public String getCode() { - return code; - } - - public void setCode(String code) { - if (this.code==null) { - this.code=code; - } - } - - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - - public String getDateCreation() { - return dateCreation; - } - - public void setDateCreation(String dateCreation) { - this.dateCreation = dateCreation; - } - - - public String getDateSuppression() { - return dateSuppression; - } - - public void setDateSuppression(String dateSuppression) { - this.dateSuppression = dateSuppression; - } - - @Override - public String toString() { - return "PseudoIris{" + - "code='" + code + '\'' + - ", uri='" + uri + '\'' + - ", intitule='" + intitule + '\'' + - ", type='" + type + '\'' + - ", dateCreation='" + dateCreation + '\'' + - ", dateSuppression='" + dateSuppression + '\'' + - ", intituleSansArticle=" + intituleSansArticle + - '}'; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Region.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Region.java deleted file mode 100644 index e2ecc1b4..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Region.java +++ /dev/null @@ -1,97 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Region") -@XmlRootElement(name = "Region") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une région") -public class Region extends Territoire { - - // No-args constructor needed for JAXB - public Region() { - this.type = EnumTypeGeographie.REGION.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public Region(String code) { - this.type = EnumTypeGeographie.REGION.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public Region( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle, chefLieu); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "27") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/region/27") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Bourgogne-Franche-Comté") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Region") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de la région si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de la région si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - @Override - @JacksonXmlProperty(localName = "ChefLieu") - @Schema(description = "Code Insee de la commune préfecture de la région") - public String getChefLieu() { - return chefLieu; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Territoire.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/Territoire.java deleted file mode 100644 index d6c58f09..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/Territoire.java +++ /dev/null @@ -1,197 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -import jakarta.xml.bind.annotation.XmlAttribute; -import jakarta.xml.bind.annotation.XmlElement; -import jakarta.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name="Territoire") -public abstract class Territoire { - - @XmlAttribute - protected String code = null; - - @XmlAttribute - protected String uri = null; - - @XmlElement(name="Intitule") - protected String intitule = null; - - @XmlElement(name="Type") - protected String type; - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name="DateCreation") - @Schema(example ="1992-09-09") - protected String dateCreation = null; - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name="DateSuppression") - @Schema(example ="2015-10-10") - protected String dateSuppression = null; - - protected IntituleSansArticle intituleSansArticle; - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name="ChefLieu") - protected String chefLieu = null; - - @JsonInclude(Include.NON_EMPTY) - @XmlElement(name="CategorieJuridique") - protected String categorieJuridique = null; - - @JacksonXmlProperty(isAttribute = true) - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - @JacksonXmlProperty(isAttribute = true) - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public Territoire( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String chefLieu) { - - this(code, uri, intitule, type, dateCreation, dateSuppression, null, intituleSansArticle); - this.chefLieu = chefLieu; - } - - public Territoire( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle) { - - this(code, uri, intitule, type, dateCreation, dateSuppression, null, intituleSansArticle); - } - - public Territoire( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - String categorieJuridique, - IntituleSansArticle intituleSansArticle - ) { - - this.code = code; - this.uri = uri; - this.intitule = intitule; - this.type = type; - this.dateCreation = dateCreation; - this.dateSuppression = dateSuppression; - this.intituleSansArticle = intituleSansArticle; - this.categorieJuridique= categorieJuridique; - } - - public Territoire() { - this(null); - } - - public Territoire(String code) { - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - public String getIntitule() { - return intitule; - } - - public void setIntitule(String intitule) { - this.intitule = intitule; - } - - @JacksonXmlProperty(localName = "Type") - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - - @JacksonXmlProperty(localName = "DateCreation") - public String getDateCreation() { - return dateCreation; - } - - public void setDateCreation(String dateCreation) { - this.dateCreation = dateCreation; - } - - @JacksonXmlProperty(localName = "DateSuppression") - public String getDateSuppression() { - return dateSuppression; - } - - public void setDateSuppression(String dateSuppression) { - this.dateSuppression = dateSuppression; - } - @JacksonXmlProperty(localName = "IntituleSansArticle") - public IntituleSansArticle getIntituleSansArticle() { - return intituleSansArticle; - } - - public void setIntituleSansArticle(IntituleSansArticle intituleSansArticle) { - this.intituleSansArticle = intituleSansArticle; - } - - public void setIntituleSansArticle(String intituleSansArticle) { - this.intituleSansArticle.setIntituleSansArticle(intituleSansArticle); - } - - public void setTypeArticle(String typeArticle) { - this.intituleSansArticle.setTypeArticle(typeArticle); - } - - @JacksonXmlProperty(localName = "ChefLieu") - public String getChefLieu() { - return chefLieu; - } - - public void setChefLieu(String chefLieu) { - this.chefLieu = chefLieu; - } - - - @JacksonXmlProperty(localName = "CategorieJuridique") - public String getCategorieJuridique() { - return categorieJuridique; - } - - public void setCategorieJuridique(String categorieJuridique) { - this.categorieJuridique = categorieJuridique; - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/TypeDIris.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/TypeDIris.java deleted file mode 100644 index ac12f909..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/TypeDIris.java +++ /dev/null @@ -1,19 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import com.fasterxml.jackson.annotation.JsonFormat; -import com.fasterxml.jackson.annotation.JsonValue; - -import jakarta.xml.bind.annotation.XmlValue; - -@JsonFormat(shape = JsonFormat.Shape.STRING) -public enum TypeDIris { - H, A, D; - - @JsonValue - @XmlValue - @Override - public String toString(){ - return name(); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/UniteUrbaine2020.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/UniteUrbaine2020.java deleted file mode 100644 index 1b5827de..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/UniteUrbaine2020.java +++ /dev/null @@ -1,92 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "UniteUrbaine2020") -@JacksonXmlRootElement(localName = "UniteUrbaine2020") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une unité urbaine") -public class UniteUrbaine2020 extends Territoire { - - // No-args constructor needed for JAXB - public UniteUrbaine2020() { - this.type = EnumTypeGeographie.UNITE_URBAINE.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public UniteUrbaine2020(String code) { - this.type = EnumTypeGeographie.UNITE_URBAINE.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public UniteUrbaine2020( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String typeArticle) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle); - this.setTypeArticle(typeArticle); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "01121") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/uniteUrbaine2020/01121") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Jujurieux") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Unité urbaine") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de l'unité urbaine si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de l'unité urbaine si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoire/ZoneDEmploi2020.java b/src/main/java/fr/insee/rmes/modeles/geo/territoire/ZoneDEmploi2020.java deleted file mode 100644 index 51f7ad89..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoire/ZoneDEmploi2020.java +++ /dev/null @@ -1,92 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoire; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.IntituleSansArticle; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "ZoneDEmploi2020") -@JacksonXmlRootElement(localName = "ZoneDEmploi2020") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant une zone d'emploi") -public class ZoneDEmploi2020 extends Territoire { - - // No-args constructor needed for JAXB - public ZoneDEmploi2020() { - this.type = EnumTypeGeographie.ZONE_EMPLOI.getTypeObjetGeo(); - this.intituleSansArticle = new IntituleSansArticle(); - } - - public ZoneDEmploi2020(String code) { - this.type = EnumTypeGeographie.ZONE_EMPLOI.getTypeObjetGeo(); - this.code = code; - this.intituleSansArticle = new IntituleSansArticle(); - } - - public ZoneDEmploi2020( - String code, - String uri, - String intitule, - String type, - String dateCreation, - String dateSuppression, - IntituleSansArticle intituleSansArticle, - String typeArticle) { - super(code, uri, intitule, type, dateCreation, dateSuppression, intituleSansArticle); - this.setTypeArticle(typeArticle); - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "2415") - public String getCode() { - return code; - } - - @Override - @JacksonXmlProperty(isAttribute = true) - @Schema(example = "http://id.insee.fr/geo/ZoneDEmploi2020/2415") - public String getUri() { - return uri; - } - - @Override - @JacksonXmlProperty(localName = "Intitule") - @JsonProperty(value = "intitule") - @Schema(example = "Vierzon") - public String getIntitule() { - return intitule; - } - - @Override - @JacksonXmlProperty(localName = "Type") - @Schema(example = "Zone d'emploi") - public String getType() { - return type; - } - - @Override - @JacksonXmlProperty(localName = "DateCreation") - @Schema( - description = "Date de création de la zone d'emploi si elle n’existait pas au premier COG du 1er janvier 1943", - example = "1943-01-01") - public String getDateCreation() { - return dateCreation; - } - - @Override - @JacksonXmlProperty(localName = "DateSuppression") - @Schema(description = "Date de suppression de la zone d'emploi si elle a été supprimée. ", example = "2019-01-01") - public String getDateSuppression() { - return dateSuppression; - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/AiresDAttractionDesVilles2020.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/AiresDAttractionDesVilles2020.java deleted file mode 100644 index bb6df756..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/AiresDAttractionDesVilles2020.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.AireDAttractionDesVilles2020; -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name = "AireDAttractionDesVilles2020") -@JacksonXmlRootElement(localName = "AiresDAttractionDesVilles2020") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Aires d'attraction", description = "Tableau représentant les aires d'attraction") -public class AiresDAttractionDesVilles2020 extends Territoires { - - private List airesDAttractionDesVilles2020 = null; - - public AiresDAttractionDesVilles2020() {} - - public AiresDAttractionDesVilles2020(List airesDAttractionDesVilles2020) { - this.airesDAttractionDesVilles2020 = airesDAttractionDesVilles2020; - } - - @JacksonXmlProperty(isAttribute = true, localName = "AireDAttractionDesVilles2020") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAiresAttraction() { - return airesDAttractionDesVilles2020; - } - - public void setAiresAttraction(List airesDAttractionDesVilles2020) { - this.airesDAttractionDesVilles2020 = airesDAttractionDesVilles2020; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Arrondissements.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Arrondissements.java deleted file mode 100644 index a768fe78..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Arrondissements.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.Arrondissement; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Arrondissements") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Arrondissements", description = "Tableau représentant les arrondissements") -public class Arrondissements extends Territoires{ - - private List arrondissements = null; - - public Arrondissements() { - // No-args constructor needed for JAXB - } - - public Arrondissements(List arrondissements) { - this.arrondissements = arrondissements; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Arrondissement") - @JacksonXmlElementWrapper(useWrapping = false) - public List getArrondissements() { - return arrondissements; - } - - public void setArrondissements(List arrondissements) { - this.arrondissements = arrondissements; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/ArrondissementsMunicipaux.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/ArrondissementsMunicipaux.java deleted file mode 100644 index 1c392dfd..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/ArrondissementsMunicipaux.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.ArrondissementMunicipal; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "ArrondissementsMunicipaux") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "ArrondissementsMunicipaux", description = "Tableau représentant les arrondissementsMunicipaux") -public class ArrondissementsMunicipaux extends Territoires{ - - private List arrondissementsMunicipaux = null; - - public ArrondissementsMunicipaux() {} - - public ArrondissementsMunicipaux(List arrondissementsMunicipaux) { - this.arrondissementsMunicipaux = arrondissementsMunicipaux; - } - - @JacksonXmlProperty(isAttribute = true, localName = "ArrondissementMunicipal") - @JacksonXmlElementWrapper(useWrapping = false) - public List getArrondissementsMunicipaux() { - return arrondissementsMunicipaux; - } - - public void setArrondissementsMunicipaux(List arrondissementsMunicipaux) { - this.arrondissementsMunicipaux = arrondissementsMunicipaux; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/BassinsDeVie2022.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/BassinsDeVie2022.java deleted file mode 100644 index b84cc365..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/BassinsDeVie2022.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.BassinDeVie2022; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "BassinsDeVie2022") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "BassinsDeVie2022", description = "Tableau représentant les bassins de vie") - -public class BassinsDeVie2022 extends Territoires { - - private List bassinsDeVie2022 = null; - - public BassinsDeVie2022() {} - - public BassinsDeVie2022(List bassinsDeVie2022) { - this.bassinsDeVie2022 = bassinsDeVie2022; - } - - @JacksonXmlProperty(isAttribute = true, localName = "BassinDeVie2022") - @JacksonXmlElementWrapper(useWrapping = false) - public List getBassinsDeVie2022() { - return bassinsDeVie2022; - } - - public void setBassinsDeVie2022(List bassinsDeVie2022) { - this.bassinsDeVie2022 = bassinsDeVie2022; - } - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Cantons.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Cantons.java deleted file mode 100644 index b40e26e9..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Cantons.java +++ /dev/null @@ -1,36 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.territoire.Canton; -import fr.insee.rmes.modeles.geo.territoire.Commune; -import io.swagger.v3.oas.annotations.media.Schema; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import java.util.List; - -@JacksonXmlRootElement(localName = "Cantons") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Cantons", description = "Tableau représentant les cantons") -public class Cantons extends Territoires{ - private List cantons = null; - - public Cantons() {} - - public Cantons(List cantons) { - this.cantons = cantons; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Canton") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCantons() { - return cantons; - } - - public void setCantons(List cantons) { - this.cantons = cantons; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CantonsEtVilles.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/CantonsEtVilles.java deleted file mode 100644 index 53b7bd5b..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CantonsEtVilles.java +++ /dev/null @@ -1,34 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.territoire.CantonOuVille; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import java.util.List; - -@JacksonXmlRootElement(localName = "CantonsEtVilles") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "CantonsEtVilles", description = "Tableau représentant les cantonsEtVilles") -public class CantonsEtVilles extends Territoires{ - private List cantonsEtVilles = null; - - public CantonsEtVilles() {} - - public CantonsEtVilles(List cantonsEtVilles) { - this.cantonsEtVilles = cantonsEtVilles; - } - - @JacksonXmlProperty(isAttribute = true, localName = "CantonOuVille") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCantonsEtVilles() { - return cantonsEtVilles; - } - - public void setCantons(List cantonsEtVilles) { - this.cantonsEtVilles = cantonsEtVilles; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CirconscriptionsTerritoriales.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/CirconscriptionsTerritoriales.java deleted file mode 100644 index 71be22ef..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CirconscriptionsTerritoriales.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.CirconscriptionTerritoriale; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "CirconscriptionsTerritoriales") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "CirconscriptionsTerritoriales", description = "Tableau représentant les circonscriptions territoriales") - -public class CirconscriptionsTerritoriales extends Territoires { - - private List circonscriptionsTerritoriales = null; - - public CirconscriptionsTerritoriales() {} - - public CirconscriptionsTerritoriales(List circonscriptionsTerritoriales) { - this.circonscriptionsTerritoriales = circonscriptionsTerritoriales; - } - - @JacksonXmlProperty(isAttribute = true, localName = "CirconscriptionTerritoriale") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCirconscriptionsTerritoriales() { - return circonscriptionsTerritoriales; - } - - public void setCirconscriptionsTerritoriales(List circonscriptionsTerritoriales) { - this.circonscriptionsTerritoriales = circonscriptionsTerritoriales; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CollectivitesDOutreMer.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/CollectivitesDOutreMer.java deleted file mode 100644 index 0fd680a9..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CollectivitesDOutreMer.java +++ /dev/null @@ -1,45 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.CollectiviteDOutreMer; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "CollectivitesDOutreMer") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "CollectivitesDOutreMer", description = "Tableau représentant les collectivites d'outre-mer") - -public class CollectivitesDOutreMer extends Territoires{ - - private List collectivitesDOutreMer = null; - - public CollectivitesDOutreMer() {} - - public CollectivitesDOutreMer(List collectivitesDOutreMer) { - this.collectivitesDOutreMer = collectivitesDOutreMer; - } - - @JacksonXmlProperty(isAttribute = true, localName = "collectiviteDOutreMer") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCollectivitesDOutreMer() { - return collectivitesDOutreMer; - } - - public void setCollectivitesDOutreMer(List collectivitesDOutreMer) { - this.collectivitesDOutreMer = collectivitesDOutreMer; - } - -} - - - - - diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Communes.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Communes.java deleted file mode 100644 index 2d366f0a..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Communes.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.Commune; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Communes") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Communes", description = "Tableau représentant les communes") -public class Communes extends Territoires{ - - private List communes = null; - - public Communes() {} - - public Communes(List communes) { - this.communes = communes; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Commune") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCommunes() { - return communes; - } - - public void setCommunes(List communes) { - this.communes = communes; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CommunesAssociees.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/CommunesAssociees.java deleted file mode 100644 index 3d72e8d2..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CommunesAssociees.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.CommuneAssociee; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "CommunesAssociees") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "CommunesAssociees", description = "Tableau représentant les communes associées") -public class CommunesAssociees extends Territoires{ - - private List communesAssociees = null; - - public CommunesAssociees() {} - - public CommunesAssociees(List communesAssociees) { - this.communesAssociees = communesAssociees; - } - - @JacksonXmlProperty(isAttribute = true, localName = "CommuneAssociee") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCommunesAssociees() { - return communesAssociees; - } - - public void setCommunesAssociees(List communesAssociees) { - this.communesAssociees = communesAssociees; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CommunesDeleguees.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/CommunesDeleguees.java deleted file mode 100644 index 204c9fd6..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/CommunesDeleguees.java +++ /dev/null @@ -1,38 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.CommuneDeleguee; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "CommunesDeleguees") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "CommunesDeleguees", description = "Tableau représentant les communes déléguées") -public class CommunesDeleguees extends Territoires{ - - private List communesDeleguees = null; - - public CommunesDeleguees() {} - - public CommunesDeleguees(List communesDeleguees) { - this.communesDeleguees = communesDeleguees; - } - - @JacksonXmlProperty(isAttribute = true, localName = "CommuneDeleguee") - @JacksonXmlElementWrapper(useWrapping = false) - public List getCommunesDeleguees() { - return communesDeleguees; - } - - public void setCommunesDeleguees(List communesDeleguees) { - this.communesDeleguees = communesDeleguees; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Departements.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Departements.java deleted file mode 100644 index c23158cd..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Departements.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.Departement; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Departements") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Departements", description = "Tableau représentant les départements") -public class Departements extends Territoires { - - private List departements = null; - - public Departements() {} - - public Departements(List departements) { - this.departements = departements; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Departement") - @JacksonXmlElementWrapper(useWrapping = false) - public List getDepartements() { - return departements; - } - - public void setDepartementss(List departements) { - this.departements = departements; - } -} - - - diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Districts.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Districts.java deleted file mode 100644 index e4251ed1..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Districts.java +++ /dev/null @@ -1,40 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.District; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Districts") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Districts", description = "Tableau représentant les districts") - -public class Districts extends Territoires { - - private List districts = null; - - public Districts() {} - - public Districts(List districts) { - this.districts = districts; - } - - @JacksonXmlProperty(isAttribute = true, localName = "District") - @JacksonXmlElementWrapper(useWrapping = false) - public List getDistricts() { - return districts; - } - - public void setDistricts(List districts) { - this.districts = districts; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Intercommunalites.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Intercommunalites.java deleted file mode 100644 index 135f16d0..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Intercommunalites.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.Intercommunalite; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Intercommunalites") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Intercommunalites", description = "Tableau représentant les intercommunalités") - -public class Intercommunalites extends Territoires { - - private List intercommunalites = null; - - public Intercommunalites() {} - - public Intercommunalites(List intercommunalites) { - this.intercommunalites = intercommunalites; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Intercommunalite") - @JacksonXmlElementWrapper(useWrapping = false) - public List getIntercommunalites() { - return intercommunalites; - } - - public void setIntercommunalites(List intercommunalites) { - this.intercommunalites = intercommunalites; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Iriss.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Iriss.java deleted file mode 100644 index 65f9f9df..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Iriss.java +++ /dev/null @@ -1,32 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.territoire.Iris; -import io.swagger.v3.oas.annotations.media.Schema; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import java.util.List; -@JacksonXmlRootElement(localName = "Iriss") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Iriss", description = "Tableau représentant les Iriss") -public class Iriss extends Territoires{ - private List iriss = null; - - public Iriss() {} - - public Iriss(List iriss) { - this.iriss = iriss; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Iris") - @JacksonXmlElementWrapper(useWrapping = false) - public List getIriss() { - return iriss; - } - - public void setIriss(List cantons) { - this.iriss = iriss; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/PaysS.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/PaysS.java deleted file mode 100644 index 1efe0ffe..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/PaysS.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; -import fr.insee.rmes.modeles.geo.territoire.Pays; -import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; -import jakarta.xml.bind.annotation.XmlRootElement; - -import java.util.List; - -@XmlRootElement(name = "Countries") -@JacksonXmlRootElement(localName = "Countries") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Liste des pays", description = "Tableau représentant la liste des pays") -public class PaysS extends Territoires { - - private List listePays = null; - - public PaysS() {} - - public PaysS(List listePays) { - this.listePays = listePays; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Liste des pays") - @JacksonXmlElementWrapper(useWrapping = false) - public List getListePays() { - return listePays; - } - - public void setListePays(List listePays) { - this.listePays = listePays; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Projections.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Projections.java deleted file mode 100644 index 308b3749..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Projections.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.Projection; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Projections") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Projections", description = "Tableau représentant les projections") -public class Projections extends Territoires { - - private List projection = null; - - public Projections() { - - } - - public Projections(List projection) { - this.projection = projection; - } - - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Projection") - public List getProjection() { - return projection; - } - - public void setProjection(List projection) { - this.projection = projection; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Regions.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Regions.java deleted file mode 100644 index 4b2d2e57..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Regions.java +++ /dev/null @@ -1,41 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.Region; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Regions") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Regions", description = "Tableau représentant les régions") -public class Regions extends Territoires{ - - private List region = null; - - public Regions() { - - } - - public Regions(List region) { - this.region = region; - } - - @JsonUnwrapped - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Region") - public List getRegion() { - return region; - } - - public void setRegion(List region) { - this.region = region; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Territoires.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/Territoires.java deleted file mode 100644 index 900b2b8e..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/Territoires.java +++ /dev/null @@ -1,34 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; - -import fr.insee.rmes.modeles.geo.territoire.Territoire; - -public class Territoires { - - @JsonUnwrapped - @JacksonXmlElementWrapper(useWrapping = false) - @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.WRAPPER_OBJECT) - private List listeTerritoires = null; - - public Territoires() {} - - public Territoires(List territoires) { - this.listeTerritoires = territoires; - } - - @JsonIgnore - public List getTerritoires() { - return listeTerritoires; - } - - public void setTerritoires(List territoires) { - this.listeTerritoires = territoires; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/UnitesUrbaines2020.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/UnitesUrbaines2020.java deleted file mode 100644 index a7f4ad5a..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/UnitesUrbaines2020.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.UniteUrbaine2020; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "UnitesUrbaines2020") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Unités urbaines", description = "Tableau représentant les unités urbaines") -public class UnitesUrbaines2020 extends Territoires { - - private List unitesUrbaines2020 = null; - - public UnitesUrbaines2020() {} - - public UnitesUrbaines2020(List unitesUrbaines2020) { - this.unitesUrbaines2020 = unitesUrbaines2020; - } - - @JacksonXmlProperty(isAttribute = true, localName = "UniteUrbaine2020") - @JacksonXmlElementWrapper(useWrapping = false) - public List getUnitesUrbaines() { - return unitesUrbaines2020; - } - - public void setUnitesUrbaines(List unitesUrbaines2020) { - this.unitesUrbaines2020 = unitesUrbaines2020; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/geo/territoires/ZonesDEmploi2020.java b/src/main/java/fr/insee/rmes/modeles/geo/territoires/ZonesDEmploi2020.java deleted file mode 100644 index 24f8e169..00000000 --- a/src/main/java/fr/insee/rmes/modeles/geo/territoires/ZonesDEmploi2020.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.geo.territoires; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.geo.territoire.ZoneDEmploi2020; -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "ZonesDEmploi2020") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(name = "Zones d'emploi", description = "Tableau représentant les zones d'emploi") -public class ZonesDEmploi2020 extends Territoires { - - private List zonesDEmploi2020 = null; - - public ZonesDEmploi2020() {} - - public ZonesDEmploi2020(List zonesDEmploi2020) { - this.zonesDEmploi2020 = zonesDEmploi2020; - } - - @JacksonXmlProperty(isAttribute = true, localName = "ZoneDEmploi2020") - @JacksonXmlElementWrapper(useWrapping = false) - public List getZonesEmploi() { - return zonesDEmploi2020; - } - - public void setZonesEmploi(List zonesDEmploi2020) { - this.zonesDEmploi2020 = zonesDEmploi2020; - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/CsvFamily.java b/src/main/java/fr/insee/rmes/modeles/operations/CsvFamily.java deleted file mode 100644 index 3dfa210a..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/CsvFamily.java +++ /dev/null @@ -1,65 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -public class CsvFamily { - - private String id = null; - private String labelLg1 = null; - private String labelLg2 = null; - private String altlabelLg1 = null; - private String altlabelLg2 = null; - private String uri = null; - - public CsvFamily() {// No-args constructor needed for JAXB - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getLabelLg1() { - return labelLg1; - } - - public void setLabelLg1(String labelLg1) { - this.labelLg1 = labelLg1; - } - - public String getLabelLg2() { - return labelLg2; - } - - public void setLabelLg2(String labelLg2) { - this.labelLg2 = labelLg2; - } - - public String getAltlabelLg1() { - return altlabelLg1; - } - - public void setAltlabelLg1(String altlabelLg1) { - this.altlabelLg1 = altlabelLg1; - } - - public String getAltlabelLg2() { - return altlabelLg2; - } - - public void setAltlabelLg2(String altlabelLg2) { - this.altlabelLg2 = altlabelLg2; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/CsvIndicateur.java b/src/main/java/fr/insee/rmes/modeles/operations/CsvIndicateur.java deleted file mode 100644 index eeaab4c3..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/CsvIndicateur.java +++ /dev/null @@ -1,221 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import org.apache.commons.lang3.StringUtils; - -public class CsvIndicateur { - - private String id; - private String indic;// uri - private String labelLg1; - private String labelLg2; - private String altLabelLg1; - private String altLabelLg2; - - private String abstractLg1; - private String abstractLg2; - private String historyNoteLg1; - private String historyNoteLg2; - - private Boolean hasReplaces; - private Boolean hasIsReplacedBy; - private Boolean hasSeeAlso; - private Boolean hasWasGeneratedBy; - - private String periodicity; - private String periodicityLabelLg1; - private String periodicityLabelLg2; - private String periodicityId; - - private Boolean hasContributor ; - private Boolean hasPublisher ; - private Boolean hasCreator ; - - - private String simsId = null; - - public CsvIndicateur() { - // No-args constructor needed for JAXB - - } - - public String getLabelLg1() { - return labelLg1; - } - - public void setLabelLg1(String labelLg1) { - this.labelLg1 = labelLg1; - } - - public String getLabelLg2() { - return labelLg2; - } - - public void setLabelLg2(String labelLg2) { - this.labelLg2 = labelLg2; - } - - public String getAltLabelLg1() { - return altLabelLg1; - } - - public void setAltLabelLg1(String altLabelLg1) { - this.altLabelLg1 = altLabelLg1; - } - - public String getAltLabelLg2() { - return altLabelLg2; - } - - public void setAltLabelLg2(String altLabelLg2) { - this.altLabelLg2 = altLabelLg2; - } - - public String getAbstractLg1() { - return abstractLg1; - } - - public void setAbstractLg1(String abstractLg1) { - this.abstractLg1 = abstractLg1; - } - - public String getAbstractLg2() { - return abstractLg2; - } - - public void setAbstractLg2(String abstractLg2) { - this.abstractLg2 = abstractLg2; - } - - public String getHistoryNoteLg1() { - return historyNoteLg1; - } - - public void setHistoryNoteLg1(String historyNoteLg1) { - this.historyNoteLg1 = historyNoteLg1; - } - - public String getHistoryNoteLg2() { - return historyNoteLg2; - } - - public void setHistoryNoteLg2(String historyNoteLg2) { - this.historyNoteLg2 = historyNoteLg2; - } - - public Boolean isHasContributor() { - return hasContributor; - } - - public void setHasContributor(Boolean hasContributor) { - this.hasContributor = hasContributor; - } - - public Boolean isHasReplaces() { - return hasReplaces; - } - - public void setHasReplaces(Boolean hasReplaces) { - this.hasReplaces = hasReplaces; - } - - public Boolean isHasIsReplacedBy() { - return hasIsReplacedBy; - } - - public void setHasIsReplacedBy(Boolean hasIsReplacedBy) { - this.hasIsReplacedBy = hasIsReplacedBy; - } - - public Boolean isHasSeeAlso() { - return hasSeeAlso; - } - - public void setHasSeeAlso(Boolean hasSeeAlso) { - this.hasSeeAlso = hasSeeAlso; - } - - public Boolean isHasWasGeneratedBy() { - return hasWasGeneratedBy; - } - - public void setHasWasGeneratedBy(Boolean hasWasGeneratedBy) { - this.hasWasGeneratedBy = hasWasGeneratedBy; - } - - public String getSimsId() { - return simsId; - } - - public void setSimsId(String simsId) { - this.simsId = simsId; - } - - public String getPeriodicity() { - return periodicity; - } - - public void setPeriodicity(String periodicity) { - this.periodicity = periodicity; - } - - public String getPeriodicityLabelLg1() { - return periodicityLabelLg1; - } - - public void setPeriodicityLabelLg1(String periodicityLabelLg1) { - this.periodicityLabelLg1 = periodicityLabelLg1; - } - - public String getPeriodicityLabelLg2() { - return periodicityLabelLg2; - } - - public void setPeriodicityLabelLg2(String periodicityLabelLg2) { - this.periodicityLabelLg2 = periodicityLabelLg2; - } - - public String getPeriodicityId() { - return periodicityId; - } - - public void setPeriodicityId(String periodicityId) { - this.periodicityId = periodicityId; - } - - public String getId() { - if (!StringUtils.isEmpty(id) || indic == null) {return id ;} - if (indic.contains("\\")) return StringUtils.substringAfterLast(indic, "\\"); - return StringUtils.substringAfterLast(indic, "/"); - } - - public void setId(String id) { - this.id = id; - } - - public String getIndic() { - return indic; - } - - public void setIndic(String indic) { - this.indic = indic; - } - - public Boolean isHasPublisher() { - return hasPublisher; - } - - public void setHasPublisher(Boolean hasPublisher) { - this.hasPublisher = hasPublisher; - } - - - public Boolean isHasCreator() { - return hasCreator; - } - - - public void setHasCreator(Boolean hasCreator) { - this.hasCreator = hasCreator; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/CsvOperation.java b/src/main/java/fr/insee/rmes/modeles/operations/CsvOperation.java deleted file mode 100644 index 313d541a..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/CsvOperation.java +++ /dev/null @@ -1,94 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import org.apache.commons.lang3.StringUtils; - -public class CsvOperation { - - private String id = null; - private String labelLg1 = null; - private String labelLg2 = null; - private String altlabelLg1 = null; - private String altlabelLg2 = null; - private String uri = null; - private String simsId = null; - private String series = null; - - public CsvOperation() {// No-args constructor needed for JAXB - } - - public String getSeriesId() { - if (StringUtils.isEmpty(series)) {return null ;} - if (series.contains("\\")) return StringUtils.substringAfterLast(series, "\\"); - return StringUtils.substringAfterLast(series, "/"); - } - - - - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getLabelLg1() { - return labelLg1; - } - - public void setLabelLg1(String labelLg1) { - this.labelLg1 = labelLg1; - } - - public String getLabelLg2() { - return labelLg2; - } - - public void setLabelLg2(String labelLg2) { - this.labelLg2 = labelLg2; - } - - public String getAltlabelLg1() { - return altlabelLg1; - } - - public void setAltlabelLg1(String altlabelLg1) { - this.altlabelLg1 = altlabelLg1; - } - - public String getAltlabelLg2() { - return altlabelLg2; - } - - public void setAltlabelLg2(String altlabelLg2) { - this.altlabelLg2 = altlabelLg2; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getSimsId() { - return simsId; - } - - public void setSimsId(String simsId) { - this.simsId = simsId; - } - - public String getSeries() { - return series; - } - - public void setSeries(String series) { - this.series = series; - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/CsvSerie.java b/src/main/java/fr/insee/rmes/modeles/operations/CsvSerie.java deleted file mode 100644 index 9df3728b..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/CsvSerie.java +++ /dev/null @@ -1,315 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import org.apache.commons.lang3.StringUtils; - -public class CsvSerie { - - private String familyId = null; - private String familyLabelLg1 = null; - private String familyLabelLg2 = null; - private String family = null; - - private String seriesId = null; - private String seriesLabelLg1 = null; - private String seriesLabelLg2 = null; - private String series = null; - - private String seriesAbstractLg1 = null; - private String seriesAbstractLg2 = null; - private String seriesHistoryNoteLg1 = null; - private String seriesHistoryNoteLg2 = null; - private String seriesAltLabelLg1 = null; - private String seriesAltLabelLg2 = null; - - private Boolean hasSeeAlso = null; - private Boolean hasReplaces = null; - private Boolean hasIsReplacedBy = null; - - private String periodicity = null; - private String periodicityLabelLg1 = null; - private String periodicityLabelLg2 = null; - private String periodicityId = null; - - private String type = null; - private String typeLabelLg1 = null; - private String typeLabelLg2 = null; - private String typeId = null; - - private Boolean hasOperation = null; - private Boolean hasIndic = null; - - private Boolean hasContributor = null; - private Boolean hasDataCollector = null; - - private Boolean hasPublisher = null; - private Boolean hasCreator = null; - - private String simsId = null; - - public CsvSerie() {// No-args constructor needed for JAXB - } - - - public String getFamilyId() { - if (familyId != null) return familyId; - if (StringUtils.isEmpty(family)) {return null ;} - if (family.contains("\\")) return StringUtils.substringAfterLast(family, "\\"); - return StringUtils.substringAfterLast(family, "/"); - - } - - public void setFamilyId(String familyId) { - this.familyId = familyId; - } - - public String getFamilyLabelLg1() { - return familyLabelLg1; - } - - public void setFamilyLabelLg1(String familyLabelLg1) { - this.familyLabelLg1 = familyLabelLg1; - } - - public String getSeriesLabelLg1() { - return seriesLabelLg1; - } - - public void setSeriesLabelLg1(String seriesLabelLg1) { - this.seriesLabelLg1 = seriesLabelLg1; - } - - public String getSeriesId() { - return seriesId; - } - - public void setSeriesId(String seriesId) { - this.seriesId = seriesId; - } - - public String getFamilyLabelLg2() { - return familyLabelLg2; - } - - public void setFamilyLabelLg2(String familyLabelLg2) { - this.familyLabelLg2 = familyLabelLg2; - } - - public String getSeriesLabelLg2() { - return seriesLabelLg2; - } - - public void setSeriesLabelLg2(String seriesLabelLg2) { - this.seriesLabelLg2 = seriesLabelLg2; - } - - public String getSeriesAbstractLg1() { - return seriesAbstractLg1; - } - - public void setSeriesAbstractLg1(String seriesAbstractLg1) { - this.seriesAbstractLg1 = seriesAbstractLg1; - } - - public String getSeriesAbstractLg2() { - return seriesAbstractLg2; - } - - public void setSeriesAbstractLg2(String seriesAbstractLg2) { - this.seriesAbstractLg2 = seriesAbstractLg2; - } - - public String getSeriesHistoryNoteLg1() { - return seriesHistoryNoteLg1; - } - - public void setSeriesHistoryNoteLg1(String seriesHistoryNoteLg1) { - this.seriesHistoryNoteLg1 = seriesHistoryNoteLg1; - } - - public String getSeriesHistoryNoteLg2() { - return seriesHistoryNoteLg2; - } - - public void setSeriesHistoryNoteLg2(String seriesHistoryNoteLg2) { - this.seriesHistoryNoteLg2 = seriesHistoryNoteLg2; - } - - public String getPeriodicity() { - return periodicity; - } - - public void setPeriodicity(String periodicity) { - this.periodicity = periodicity; - } - - public String getPeriodicityLabelLg1() { - return periodicityLabelLg1; - } - - public void setPeriodicityLabelLg1(String periodicityLabelLg1) { - this.periodicityLabelLg1 = periodicityLabelLg1; - } - - public String getPeriodicityLabelLg2() { - return periodicityLabelLg2; - } - - public void setPeriodicityLabelLg2(String periodicityLabelLg2) { - this.periodicityLabelLg2 = periodicityLabelLg2; - } - - public String getPeriodicityId() { - return periodicityId; - } - - public void setPeriodicityId(String periodicityId) { - this.periodicityId = periodicityId; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getTypeLabelLg1() { - return typeLabelLg1; - } - - public void setTypeLabelLg1(String typeLabelLg1) { - this.typeLabelLg1 = typeLabelLg1; - } - - public String getTypeLabelLg2() { - return typeLabelLg2; - } - - public void setTypeLabelLg2(String typeLabelLg2) { - this.typeLabelLg2 = typeLabelLg2; - } - - public String getTypeId() { - return typeId; - } - - public void setTypeId(String typeId) { - this.typeId = typeId; - } - - public String getSimsId() { - return simsId; - } - - public void setSimsId(String simsId) { - this.simsId = simsId; - } - - public String getFamily() { - return family; - } - - public void setFamily(String family) { - this.family = family; - } - - public String getSeries() { - return series; - } - - public void setSeries(String series) { - this.series = series; - } - - public Boolean isHasSeeAlso() { - return hasSeeAlso; - } - - public void setHasSeeAlso(Boolean hasSeeAlso) { - this.hasSeeAlso = hasSeeAlso; - } - - public Boolean isHasReplaces() { - return hasReplaces; - } - - public void setHasReplaces(Boolean hasReplaces) { - this.hasReplaces = hasReplaces; - } - - public Boolean isHasIsReplacedBy() { - return hasIsReplacedBy; - } - - public void setHasIsReplacedBy(Boolean hasIsReplacedBy) { - this.hasIsReplacedBy = hasIsReplacedBy; - } - - public Boolean isHasOperation() { - return hasOperation; - } - - public void setHasOperation(Boolean hasOperation) { - this.hasOperation = hasOperation; - } - - public Boolean isHasIndic() { - return hasIndic; - } - - public void setHasIndic(Boolean hasIndic) { - this.hasIndic = hasIndic; - } - - public Boolean isHasContributor() { - return hasContributor; - } - - public void setHasContributor(Boolean hasContributor) { - this.hasContributor = hasContributor; - } - - public Boolean isHasDataCollector() { - return hasDataCollector; - } - - public void setHasDataCollector(Boolean hasDataCollector) { - this.hasDataCollector = hasDataCollector; - } - - public String getSeriesAltLabelLg1() { - return seriesAltLabelLg1; - } - - public void setSeriesAltLabelLg1(String seriesAltLabelLg1) { - this.seriesAltLabelLg1 = seriesAltLabelLg1; - } - - public String getSeriesAltLabelLg2() { - return seriesAltLabelLg2; - } - - public void setSeriesAltLabelLg2(String seriesAltLabelLg2) { - this.seriesAltLabelLg2 = seriesAltLabelLg2; - } - - public Boolean isHasPublisher() { - return hasPublisher; - } - - public void setHasPublisher(Boolean hasPublisher) { - this.hasPublisher = hasPublisher; - } - - - public Boolean isHasCreator() { - return hasCreator; - } - - - public void setHasCreator(Boolean hasCreator) { - this.hasCreator = hasCreator; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/Famille.java b/src/main/java/fr/insee/rmes/modeles/operations/Famille.java deleted file mode 100644 index 7db2266d..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/Famille.java +++ /dev/null @@ -1,127 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import java.util.ArrayList; -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(description = "Objet représentant une famille d'opérations statistiques") -public class Famille { - - @Schema(example = "s23") - private String id = null; - private List label = new ArrayList<>(); - - @Schema(example = "http://id.insee.fr/operations/famille/s23") - private String uri = null; - - @JsonInclude(Include.NON_NULL) - private List series; - - @JsonInclude(Include.NON_NULL) - private List altLabel; - - public Famille(String uri, String id, String labelLg1, String labelLg2, Serie serie) { - if (serie != null) { - this.setSeries(new ArrayList<>()); - series.add(serie); - } - this.id = id; - label.add(new StringWithLang(labelLg1, Lang.FR)); - if (!labelLg2.equals("")) { - label.add(new StringWithLang(labelLg2, Lang.EN)); - } - this.uri = uri; - } - - public Famille(CsvFamily csv) { - this.id = csv.getId(); - label.add(new StringWithLang(csv.getLabelLg1(), Lang.FR)); - if (!csv.getLabelLg2().equals("")) { - label.add(new StringWithLang(csv.getLabelLg2(), Lang.EN)); - } - this.uri = csv.getUri(); - if (!csv.getAltlabelLg1().equals("")) { - altLabel = new ArrayList<>(); - altLabel.add(new StringWithLang(csv.getAltlabelLg1(), Lang.FR)); - } - if (!csv.getAltlabelLg2().equals("")) { - if (altLabel == null) {altLabel = new ArrayList<>(); } - label.add(new StringWithLang(csv.getAltlabelLg2(), Lang.EN)); - } - } - - @JacksonXmlProperty(isAttribute = true, localName = "Serie") - @JacksonXmlElementWrapper(useWrapping = false) - public List getSeries() { - return series; - } - - public void setSeries(List series) { - this.series = series; - } - - public void addSerie(Serie serie) { - if (series == null) { - this.setSeries(new ArrayList<>()); - } - this.series.add(serie); - } - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabel(List label) { - this.label = label; - } - - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "AltLabel") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAltLabel() { - return altLabel; - } - - public void setAltLabel(String altLabelLg1, String altLabelLg2) { - if (!altLabelLg1.equals("")) { - if (altLabel == null) { - altLabel = new ArrayList<>(); - } - label.add(new StringWithLang(altLabelLg1, Lang.FR)); - } - if (!altLabelLg2.equals("")) { - if (altLabel == null) { - altLabel = new ArrayList<>(); - } - label.add(new StringWithLang(altLabelLg2, Lang.EN)); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/Familles.java b/src/main/java/fr/insee/rmes/modeles/operations/Familles.java deleted file mode 100644 index aaf18452..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/Familles.java +++ /dev/null @@ -1,37 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import java.util.List; - -import jakarta.xml.bind.annotation.XmlAccessType; -import jakarta.xml.bind.annotation.XmlAccessorType; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@JacksonXmlRootElement(localName = "Familles") -@XmlAccessorType(XmlAccessType.FIELD) -@Schema(description = "Objet représentant l'arborescence des opérations statistiques") -public class Familles { - - List families = null; - - public Familles() {} - - public Familles(List families) { - this.families = families; - } - - @JacksonXmlProperty(isAttribute = true, localName = "Famille") - @JacksonXmlElementWrapper(useWrapping = false) - public List getFamilies() { - return families; - } - - public void setFamilies(List families) { - this.families = families; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/Indicateur.java b/src/main/java/fr/insee/rmes/modeles/operations/Indicateur.java deleted file mode 100644 index 46506eb5..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/Indicateur.java +++ /dev/null @@ -1,332 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -public class Indicateur { - - @Schema(example = "p1647") - private String id = null; - @Schema(example = "http://id.insee.fr/produits/indicateur/p1647") - private String uri = null; - private List label = new ArrayList<>(); - @JsonInclude(Include.NON_NULL) - private List altLabel; - - @JsonInclude(Include.NON_NULL) - private List abstractIndic = null; - @JsonInclude(Include.NON_NULL) - private List historyNote; - - @JsonInclude(Include.NON_NULL) - private List replaces; - @JsonInclude(Include.NON_NULL) - private List isReplacedBy; - @JsonInclude(Include.NON_NULL) - private List seeAlso; - @JsonInclude(Include.NON_NULL) - private List wasGeneratedBy; - - @JsonInclude(Include.NON_NULL) - private List publishers; - @JsonInclude(Include.NON_NULL) - private List contributors; - @JsonInclude(Include.NON_EMPTY) - private List creators; - - @JsonInclude(Include.NON_NULL) - private SimpleObject accrualPeriodicity = null; - - @JsonInclude(Include.NON_NULL) - @Schema(example = "1011") - private String simsId = null; - - public Indicateur(String uri, String id, String labelLg1, String labelLg2, String simsId) { - super(); - this.id = id; - label.add(new StringWithLang(labelLg1, Lang.FR)); - if ( ! labelLg2.equals("")) { - label.add(new StringWithLang(labelLg2, Lang.EN)); - } - if ( ! simsId.equals("")) { - this.simsId = simsId; - } - this.uri = uri; - } - - public Indicateur() { - super(); - } - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabel(List label) { - this.label = label; - } - - @JsonProperty(value = "idRapportQualite") - @JacksonXmlProperty(localName = "IdRapportQualite") - public String getSimsId() { - return simsId; - } - - @JsonProperty(value = "simsId") - public void setSimsId(String simsId) { - if (StringUtils.isNotEmpty(simsId)) { - this.simsId = simsId; - } - } - - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public void setLabelFr(String labelFr) { - this.setLabel(labelFr, Lang.FR); - } - - public void setLabelEn(String labelEn) { - this.setLabel(labelEn, Lang.EN); - } - - private void setLabel(String newlabel, Lang lang) { - if (StringUtils.isNotEmpty(newlabel)) { - label.add(new StringWithLang(newlabel, lang)); - } - } - - @JacksonXmlProperty(localName = "AltLabel") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAltLabel() { - return altLabel; - } - - public void setAltLabel(List altLabel) { - this.altLabel = altLabel; - } - - public void setAltLabel(String altLabelLg1, String altLabelLg2) { - if ( ! altLabelLg1.equals("")) { - this.initAltLabel(); - altLabel.add(new StringWithLang(altLabelLg1, Lang.FR)); - } - if ( ! altLabelLg2.equals("")) { - this.initAltLabel(); - altLabel.add(new StringWithLang(altLabelLg2, Lang.EN)); - } - } - - private void initAltLabel() { - if (altLabel == null) { - altLabel = new ArrayList<>(); - } - } - - public void addSeeAlso(ObjectWithSimsId sa) { - if (seeAlso == null) { - this.setSeeAlso(new ArrayList<>()); - } - this.seeAlso.add(sa); - } - - public void addReplaces(IndicateurPrecedent rep) { - if (replaces == null) { - this.setReplaces(new ArrayList<>()); - } - this.replaces.add(rep); - } - - public void addIsReplacedBy(IndicateurSuivant irb) { - if (isReplacedBy == null) { - this.setIsReplacedBy(new ArrayList<>()); - } - this.isReplacedBy.add(irb); - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("indicateursPrecedents") //json example -// @XmlElementWrapper(name = "IndicateursPrecedents") //xml example list -// @JacksonXmlElementWrapper(localName = "IndicateursPrecedents") //xml response - @JacksonXmlProperty(localName = "IndicateurPrecedent") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getReplaces() { - return replaces; - } - - public void setReplaces(List replaces) { - this.replaces = replaces; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("indicateursSuivants") //json example -// @XmlElementWrapper(name = "IndicateursSuivants") //xml example list -// @JacksonXmlElementWrapper(localName = "IndicateursSuivants") //xml response - @JacksonXmlProperty(localName = "IndicateurSuivant") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getIsReplacedBy() { - return isReplacedBy; - } - - public void setIsReplacedBy(List isReplacedBy) { - this.isReplacedBy = isReplacedBy; - } - - @JsonProperty("references") - @JacksonXmlProperty(isAttribute = true, localName = "Reference") - @JacksonXmlElementWrapper(useWrapping = false) - public List getSeeAlso() { - return seeAlso; - } - - public void setSeeAlso(List seeAlso) { - this.seeAlso = seeAlso; - } - - @JsonProperty("seriesContributrices") - @JacksonXmlProperty(isAttribute = true, localName = "SerieContributrice") - @JacksonXmlElementWrapper(useWrapping = false) - public List getWasGeneratedBy() { - return wasGeneratedBy; - } - - public void setWasGeneratedBy(List wasGeneratedBy) { - this.wasGeneratedBy = wasGeneratedBy; - } - - @JsonProperty("frequenceDiffusion") - @JacksonXmlProperty(isAttribute = true, localName = "FrequenceDiffusion") - @JacksonXmlElementWrapper(useWrapping = false) - public SimpleObject getAccrualPeriodicity() { - return accrualPeriodicity; - } - - public void setAccrualPeriodicity(SimpleObject accrualPeriodicity) { - this.accrualPeriodicity = accrualPeriodicity; - } - - @JsonProperty("resume") - @JacksonXmlProperty(localName = "Resume") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAbstractIndic() { - return abstractIndic; - } - - public void setAbstractLg1(String abstractLg1) { - this.setAbstract(abstractLg1, Lang.FR); - } - - public void setAbstractLg2(String abstractLg2) { - this.setAbstract(abstractLg2, Lang.EN); - } - - private void setAbstract(String abstr, Lang lang) { - if (StringUtils.isNotEmpty(abstr)) { - if (abstractIndic == null) { - abstractIndic = new ArrayList<>(); - } - abstractIndic.add(new StringWithLang(abstr, lang)); - } - } - - @JsonProperty("noteHistorique") - @JacksonXmlProperty(localName = "NoteHistorique") - @JacksonXmlElementWrapper(useWrapping = false) - public List getHistoryNote() { - return historyNote; - } - - public void setHistoryNoteLg1(String str) { - if (StringUtils.isNotEmpty(str)) { - if (historyNote == null) { - historyNote = new ArrayList<>(); - } - historyNote.add(new StringWithLang(str, Lang.FR)); - } - } - - public void setHistoryNoteLg2(String str) { - if (StringUtils.isNotEmpty(str)) { - if (historyNote == null) { - historyNote = new ArrayList<>(); - } - historyNote.add(new StringWithLang(str, Lang.EN)); - } - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("organismesResponsables") //json example -// @XmlElementWrapper(name = "OrganismesResponsables") //xml example list -// @JacksonXmlElementWrapper(localName = "OrganismesResponsables") //xml response - @JacksonXmlProperty(localName = "OrganismeResponsable") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getPublishers() { - return publishers; - } - - public void setPublishers(List publishers) { - this.publishers = publishers; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("partenaires") //json example -// @XmlElementWrapper(name = "Partenaires") //xml example list -// @JacksonXmlElementWrapper(localName = "Partenaires") //xml response - @JacksonXmlProperty(localName = "Partenaire") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getContributors() { - return contributors; - } - - public void setContributors(List contributors) { - this.contributors = contributors; - } - - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("proprietaires") //json example -// @XmlElementWrapper(name = "Proprietaires") //xml example list -// @JacksonXmlElementWrapper(localName = "Proprietaires") //xml response - @JacksonXmlProperty(localName = "Proprietaire") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getCreators() { - return creators; - } - - public void setCreators(List creators) { - this.creators = creators; - } - - - - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/operations/IndicateurPrecedent.java b/src/main/java/fr/insee/rmes/modeles/operations/IndicateurPrecedent.java deleted file mode 100644 index e508a610..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/IndicateurPrecedent.java +++ /dev/null @@ -1,12 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name="IndicateurPrecedent") -@Schema(name = "IndicateurPrecedent", description = "Indicateur précédent") -public class IndicateurPrecedent extends Indicateur{ - - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/operations/IndicateurSuivant.java b/src/main/java/fr/insee/rmes/modeles/operations/IndicateurSuivant.java deleted file mode 100644 index ac61df88..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/IndicateurSuivant.java +++ /dev/null @@ -1,12 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name="IndicateurSuivant") -@Schema(name = "IndicateurSuivant", description = "Indicateur suivant") -public class IndicateurSuivant extends Indicateur{ - - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/operations/ObjectWithSimsId.java b/src/main/java/fr/insee/rmes/modeles/operations/ObjectWithSimsId.java deleted file mode 100644 index 7cf05c22..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/ObjectWithSimsId.java +++ /dev/null @@ -1,48 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(name = "ObjetSimpleAvecSims", description = "Objet simple avec documentation SIMS") -public class ObjectWithSimsId extends SimpleObject { - - private String simsId = null; - - public ObjectWithSimsId(String id, String uri, String labelFr, String labelEn, String simsId) { - this.id = id; - this.uri = uri; - if (StringUtils.isNotEmpty(labelFr)) { - label.add(new StringWithLang(labelFr, Lang.FR)); - } - if (StringUtils.isNotEmpty(labelEn)) { - label.add(new StringWithLang(labelEn, Lang.EN)); - } - this.simsId=simsId; - } - - public ObjectWithSimsId() { - super(); - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty(value = "idRapportQualite") - @JacksonXmlProperty(localName = "IdRapportQualite") - public String getSimsId() { - return simsId; - } - - @JsonProperty(value="simsId") - public void setSimsId(String simsId) { - this.simsId = simsId; - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/Operation.java b/src/main/java/fr/insee/rmes/modeles/operations/Operation.java deleted file mode 100644 index 7e6315d7..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/Operation.java +++ /dev/null @@ -1,128 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(description = "Objet représentant une opération statistique") -public class Operation { - - @Schema(example = "s1459") - private String id = null; - - private List label = new ArrayList<>(); - - @Schema(example = "http://id.insee.fr/operations/operation/s1459") - private String uri = null; - - @Schema(example = "1011") - @JsonInclude(Include.NON_EMPTY) - private String simsId = null; - - @JsonInclude(Include.NON_NULL) - private List altLabel; - - public Operation(String uri, String id, String labelFr, String labelEn, String simsId) { - super(); - this.id = id; - label.add(new StringWithLang(labelFr, Lang.FR)); - if ( ! labelEn.equals("")) { - label.add(new StringWithLang(labelEn, Lang.EN)); - } - if ( ! simsId.equals("")) { - this.simsId = simsId; - } - this.uri = uri; - } - - public Operation() { - super(); - } - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty(value = "idRapportQualite") - @JacksonXmlProperty(localName = "IdRapportQualite") - public String getSimsId() { - return simsId; - } - - @JsonProperty(value="simsId") - public void setSimsId(String simsId) { - if (StringUtils.isNotEmpty(simsId)) { - this.simsId = simsId; - } - } - - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabel(List label) { - this.label = label; - } - - public void setLabelFr(String labelFr) { - if (StringUtils.isNotEmpty(labelFr)) { - label.add(new StringWithLang(labelFr, Lang.FR)); - } - } - - public void setLabelEn(String labelEn) { - if (StringUtils.isNotEmpty(labelEn)) { - label.add(new StringWithLang(labelEn, Lang.EN)); - } - } - - @JacksonXmlProperty(localName = "AltLabel") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAltLabel() { - return altLabel; - } - - public void setAltLabel(String altLabelLg1, String altLabelLg2) { - if ( ! altLabelLg1.equals("")) { - if (altLabel == null) { - altLabel = new ArrayList<>(); - } - altLabel.add(new StringWithLang(altLabelLg1, Lang.FR)); - } - if ( ! altLabelLg2.equals("")) { - if (altLabel == null) { - altLabel = new ArrayList<>(); - } - altLabel.add(new StringWithLang(altLabelLg2, Lang.EN)); - } - } - -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/modeles/operations/Serie.java b/src/main/java/fr/insee/rmes/modeles/operations/Serie.java deleted file mode 100644 index fea82b4a..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/Serie.java +++ /dev/null @@ -1,394 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(description = "Objet représentant une série d'opérations statistiques") -public class Serie { - - @Schema(example = "s1234") - private String id = null; - private List label = new ArrayList<>(); - - @Schema(example = "http://id.insee.fr/operations/serie/s1234") - private String uri = null; - - @JsonInclude(Include.NON_NULL) - private SimpleObject family = null; - - @JsonInclude(Include.NON_NULL) - private List abstractSerie; - - @JsonInclude(Include.NON_NULL) - private List historyNote; - - @JsonInclude(Include.NON_NULL) - private List altLabel; - - @JsonInclude(Include.NON_NULL) - private SimpleObject type = null; - @JsonInclude(Include.NON_NULL) - private SimpleObject accrualPeriodicity = null; - - @Schema(example = "1011") - @JsonInclude(Include.NON_EMPTY) - private String simsId = null; - - @JsonInclude(Include.NON_NULL) - private List operations; - @JsonInclude(Include.NON_NULL) - private List indicateurs; - - @JsonInclude(Include.NON_NULL) - private List replaces; - @JsonInclude(Include.NON_NULL) - private List isReplacedBy; - @JsonInclude(Include.NON_NULL) - private List seeAlso; - @JsonInclude(Include.NON_NULL) - private List publishers; - @JsonInclude(Include.NON_NULL) - private List contributors; - @JsonInclude(Include.NON_NULL) - private List dataCollectors; - @JsonInclude(Include.NON_EMPTY) - private List creators; - - public Serie(String uri, String id, String labelLg1, String labelLg2) { - this.id = id; - label.add(new StringWithLang(labelLg1, Lang.FR)); - if ( ! labelLg2.equals("")) { - label.add(new StringWithLang(labelLg2, Lang.EN)); - } - this.uri = uri; - } - - public Serie(CsvSerie csv) { - this.id = csv.getSeriesId(); - label.add(new StringWithLang(csv.getSeriesLabelLg1(), Lang.FR)); - if ( ! csv.getSeriesLabelLg2().equals("")) { - label.add(new StringWithLang(csv.getSeriesLabelLg2(), Lang.EN)); - } - this.uri = csv.getSeries(); - if (!csv.getSeriesAltLabelLg1().equals("")) { - altLabel = new ArrayList<>(); - altLabel.add(new StringWithLang(csv.getSeriesAltLabelLg1(), Lang.FR)); - } - if (!csv.getSeriesAltLabelLg2().equals("")) { - if (altLabel == null) {altLabel = new ArrayList<>(); } - altLabel.add(new StringWithLang(csv.getSeriesAltLabelLg2(), Lang.EN)); - } - this.simsId = csv.getSimsId(); - } - - public Serie() { - super(); - } - - public void addOperation(Operation op) { - if (operations == null) { - this.setOperations(new ArrayList<>()); - } - this.operations.add(op); - } - - public void addIndicateur(Indicateur indic) { - if (indicateurs == null) { - this.setIndicateurs(new ArrayList<>()); - } - this.indicateurs.add(indic); - } - - public void addSeeAlso(ObjectWithSimsId sa) { - if (seeAlso == null) { - this.setSeeAlso(new ArrayList<>()); - } - this.seeAlso.add(sa); - } - - public void addReplaces(SeriePrecedente rep) { - if (replaces == null) { - this.setReplaces(new ArrayList<>()); - } - this.replaces.add(rep); - } - - public void addIsReplacedBy(SerieSuivante irb) { - if (isReplacedBy == null) { - this.setIsReplacedBy(new ArrayList<>()); - } - this.isReplacedBy.add(irb); - } - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty(value = "idRapportQualite") - @JacksonXmlProperty(localName = "IdRapportQualite") - public String getSimsId() { - return simsId; - } - @JsonProperty(value="simsId") - public void setSimsId(String simsId) { - if ( ! simsId.equals("")) { - this.simsId = simsId; - } - } - - @JacksonXmlProperty(localName = "Operation") - @JacksonXmlElementWrapper(useWrapping = false) - public List getOperations() { - return operations; - } - - public void setOperations(List operations) { - this.operations = operations; - } - - @JacksonXmlProperty( localName = "Indicateur") - @JacksonXmlElementWrapper(useWrapping = false) - public List getIndicateurs() { - return indicateurs; - } - - public void setIndicateurs(List indicateurs) { - this.indicateurs = indicateurs; - } - - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public void setFamily(SimpleObject f) { - this.family = f; - } - - @JsonProperty("famille") - @JacksonXmlProperty(localName = "Famille") - @JacksonXmlElementWrapper(useWrapping = false) - public SimpleObject getFamily() { - return family; - } - - @JacksonXmlProperty(localName = "Type") - public SimpleObject getType() { - return type; - } - - public void setType(SimpleObject type) { - this.type = type; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("seriesPrecedentes") - @JacksonXmlProperty(localName = "SeriePrecedente") - @JacksonXmlElementWrapper(useWrapping = false) - public List getReplaces() { - return replaces; - } - - public void setReplaces(List replaces) { - this.replaces = replaces; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("seriesSuivantes") //json example - @JacksonXmlProperty(localName = "SerieSuivante") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getIsReplacedBy() { - return isReplacedBy; - } - - public void setIsReplacedBy(List isReplacedBy) { - this.isReplacedBy = isReplacedBy; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("references") - @JacksonXmlProperty( localName = "Reference") - @JacksonXmlElementWrapper(useWrapping = false) - public List getSeeAlso() { - return seeAlso; - } - - public void setSeeAlso(List seeAlso) { - this.seeAlso = seeAlso; - } - - @JsonProperty("frequenceCollecte") - @JacksonXmlProperty( localName = "FrequenceCollecte") - @JacksonXmlElementWrapper(useWrapping = false) - public SimpleObject getAccrualPeriodicity() { - return accrualPeriodicity; - } - - public void setAccrualPeriodicity(SimpleObject accrualPeriodicity) { - this.accrualPeriodicity = accrualPeriodicity; - } - - @JsonProperty("resume") - @JacksonXmlProperty(localName = "Resume") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAbstractSerie() { - return abstractSerie; - } - - public void setAbstractLg1(String abstractLg1) { - setAbstract(abstractLg1, Lang.FR); - } - - public void setAbstractLg2(String abstractLg2) { - setAbstract(abstractLg2, Lang.EN); - } - - private void setAbstract(String abstr, Lang lang) { - if (StringUtils.isNotEmpty(abstr)) { - if (abstractSerie == null) { - abstractSerie = new ArrayList<>(); - } - abstractSerie.add(new StringWithLang(abstr, lang)); - } - } - - @JsonProperty("noteHistorique") - @JacksonXmlProperty(localName = "NoteHistorique") - @JacksonXmlElementWrapper(useWrapping = false) - public List getHistoryNote() { - return historyNote; - } - - public void setHistoryNoteLg1(String str) { - setHistoryNote(str, Lang.FR); - } - - public void setHistoryNoteLg2(String str) { - setHistoryNote(str, Lang.EN); - } - - private void setHistoryNote(String str, Lang lang) { - if (StringUtils.isNotEmpty(str)) { - if (historyNote == null) { - historyNote = new ArrayList<>(); - } - historyNote.add(new StringWithLang(str, lang)); - } - } - - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("organismesResponsables") //json example - @JacksonXmlProperty(localName = "OrganismeResponsable") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getPublishers() { - return publishers; - } - - public void setPublishers(List publishers) { - this.publishers = publishers; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("partenaires") //json example - @JacksonXmlProperty(localName = "Partenaire") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getContributors() { - return contributors; - } - - public void setDataCollectors(List dataCollectors) { - this.dataCollectors = dataCollectors; - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("servicesCollecteurs") //json example - @JacksonXmlProperty(localName = "ServiceCollecteur") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getDataCollectors() { - return dataCollectors; - } - - public void setContributors(List contributors) { - this.contributors = contributors; - } - - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("proprietaires") //json example - @JacksonXmlProperty(localName = "Proprietaire") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public List getCreators() { - return creators; - } - - public void setCreators(List creators) { - this.creators = creators; - } - - public void setLabelFr(String labelFr) { - setLabel(labelFr, Lang.FR); - } - - public void setLabelEn(String labelEn) { - setLabel(labelEn, Lang.EN); - } - - private void setLabel(String newlabel, Lang lang) { - if (StringUtils.isNotEmpty(newlabel)) { - label.add(new StringWithLang(newlabel, lang)); - } - } - - @JacksonXmlProperty(localName = "AltLabel") - @JacksonXmlElementWrapper(useWrapping = false) - public List getAltLabel() { - return altLabel; - } - - public void setAltLabel(String altLabelLg1, String altLabelLg2) { - if ( ! altLabelLg1.equals("")) { - initAltLabel(); - altLabel.add(new StringWithLang(altLabelLg1, Lang.FR)); - } - if ( ! altLabelLg2.equals("")) { - initAltLabel(); - altLabel.add(new StringWithLang(altLabelLg2, Lang.EN)); - } - } - - private void initAltLabel() { - if (altLabel == null) { - altLabel = new ArrayList<>(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/SeriePrecedente.java b/src/main/java/fr/insee/rmes/modeles/operations/SeriePrecedente.java deleted file mode 100644 index 572613b9..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/SeriePrecedente.java +++ /dev/null @@ -1,11 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name="SeriePrecedente") -@Schema(name = "SeriePrecedente", description = "Série liée") -public class SeriePrecedente extends Serie { - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/SerieSuivante.java b/src/main/java/fr/insee/rmes/modeles/operations/SerieSuivante.java deleted file mode 100644 index f8c872e9..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/SerieSuivante.java +++ /dev/null @@ -1,11 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import jakarta.xml.bind.annotation.XmlRootElement; - -import io.swagger.v3.oas.annotations.media.Schema; - -@XmlRootElement(name="SerieSuivante") -@Schema(name = "SerieSuivante", description = "Série liée") -public class SerieSuivante extends Serie { - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/SimpleObject.java b/src/main/java/fr/insee/rmes/modeles/operations/SimpleObject.java deleted file mode 100644 index 0b54b8aa..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/SimpleObject.java +++ /dev/null @@ -1,99 +0,0 @@ -package fr.insee.rmes.modeles.operations; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@Schema(name = "ObjetSimple", description = "Objet simple") -public class SimpleObject { - - protected String id = null; - @Schema(example = "http://id.insee.fr/...") - protected String uri = null; - - protected List label = new ArrayList<>(); - - - - public SimpleObject(String id, String uri, String labelFr, String labelEn) { - this.id = id; - this.uri = uri; - if (StringUtils.isNotEmpty(labelFr)) { - label.add(new StringWithLang(labelFr, Lang.FR)); - } - if (StringUtils.isNotEmpty(labelEn)) { - label.add(new StringWithLang(labelEn, Lang.EN)); - } - } - - public SimpleObject() { - super(); - } - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabel(List label) { - this.label = label; - } - - public void setLabelFr(String labelFr) { - if (StringUtils.isNotEmpty(labelFr)) { - label.add(new StringWithLang(labelFr, Lang.FR)); - } - } - - public void setLabelEn(String labelEn) { - if (StringUtils.isNotEmpty(labelEn)) { - label.add(new StringWithLang(labelEn, Lang.EN)); - } - } - - @Override - public int hashCode() { - return Objects.hash(id, label, uri); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - SimpleObject other = (SimpleObject) obj; - return Objects.equals(id, other.id) && Objects.equals(label, other.label) && Objects.equals(uri, other.uri); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/documentations/CsvRubrique.java b/src/main/java/fr/insee/rmes/modeles/operations/documentations/CsvRubrique.java deleted file mode 100644 index 404f0c3b..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/documentations/CsvRubrique.java +++ /dev/null @@ -1,165 +0,0 @@ -package fr.insee.rmes.modeles.operations.documentations; - -public class CsvRubrique { - - private String id = null; - private String uri = null; - private String idParent = null; - private String titreLg1; - private String titreLg2; - private String type; - - private String valeurSimple = null; - private String labelLg1; - private String labelLg2; - private String codeUri; - private String organisationUri; - - private String labelObjLg1; - private String labelObjLg2; - - private Boolean hasDocLg1; - private Boolean hasDocLg2; - - - private String maxOccurs; - - private String geoUri; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getIdParent() { - return idParent; - } - - public void setIdParent(String idParent) { - this.idParent = idParent; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getValeurSimple() { - return valeurSimple; - } - - public void setValeurSimple(String valeurSimple) { - this.valeurSimple = valeurSimple; - } - - public String getLabelLg1() { - return labelLg1; - } - - public void setLabelLg1(String labelLg1) { - this.labelLg1 = labelLg1; - } - - public String getLabelLg2() { - return labelLg2; - } - - public void setLabelLg2(String labelLg2) { - this.labelLg2 = labelLg2; - } - - public String getCodeUri() { - return codeUri; - } - - public void setCodeUri(String codeUri) { - this.codeUri = codeUri; - } - - public String getOrganisationUri() { - return organisationUri; - } - - public void setOrganisationUri(String organisationUri) { - this.organisationUri = organisationUri; - } - - public Boolean isHasDocLg1() { - return hasDocLg1; - } - - public void setHasDocLg1(Boolean hasDocLg1) { - this.hasDocLg1 = hasDocLg1; - } - - public Boolean isHasDocLg2() { - return hasDocLg2; - } - - public void setHasDocLg2(Boolean hasDocLg2) { - this.hasDocLg2 = hasDocLg2; - } - - public String getLabelObjLg1() { - return labelObjLg1; - } - - public void setLabelObjLg1(String labelObjLg1) { - this.labelObjLg1 = labelObjLg1; - } - - public String getLabelObjLg2() { - return labelObjLg2; - } - - public void setLabelObjLg2(String labelObjLg2) { - this.labelObjLg2 = labelObjLg2; - } - - public String getTitreLg1() { - return titreLg1; - } - - public void setTitreLg1(String titreLg1) { - this.titreLg1 = titreLg1; - } - - public String getTitreLg2() { - return titreLg2; - } - - public void setTitreLg2(String titreLg2) { - this.titreLg2 = titreLg2; - } - - public String getMaxOccurs() { - return maxOccurs; - } - - public void setMaxOccurs(String maxOccurs) { - this.maxOccurs = maxOccurs; - } - - public String getGeoUri() { - return geoUri; - } - - public void setGeoUri(String geoUri) { - this.geoUri = geoUri; - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/documentations/Document.java b/src/main/java/fr/insee/rmes/modeles/operations/documentations/Document.java deleted file mode 100644 index 3fa78950..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/documentations/Document.java +++ /dev/null @@ -1,92 +0,0 @@ -package fr.insee.rmes.modeles.operations.documentations; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonClassDescription; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.config.Configuration; -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.utils.Lang; - -@JsonClassDescription("Objet représentant un document ou un lien vers une page internet") -public class Document { - private List label = new ArrayList<>(); - private String dateMiseAJour; - private String langue; - private String url; - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabelLg1(String labelLg1) { - label.add(new StringWithLang(labelLg1, Lang.FR)); - } - - public void setLabelLg2(String labelLg2) { - if (StringUtils.isNotEmpty(labelLg2)) { - label.add(new StringWithLang(labelLg2, Lang.EN)); - } - } - - @JsonInclude(Include.NON_NULL) - @JacksonXmlProperty(localName = "DateMiseAJour") - public String getDateMiseAJour() { - return dateMiseAJour; - } - - public void setDateMiseAJour(String dateMiseAJour) { - this.dateMiseAJour = dateMiseAJour; - } - - @JacksonXmlProperty(localName = "Langue") - public String getLangue() { - return langue; - } - - public void setLangue(String langue) { - this.langue = langue; - } - - @JacksonXmlProperty(localName = "Url") - public String getUrl() { - if (url != null && url.contains(Configuration.getFileStorage())) { - String[] temp = url.split(Configuration.getFileStorage()); - return temp[temp.length - 1]; - } - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - @Override - public int hashCode() { - return Objects.hash(dateMiseAJour, label, langue, url); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Document other = (Document) obj; - return Objects.equals(dateMiseAJour, other.dateMiseAJour) && Objects.equals(label, other.label) - && Objects.equals(langue, other.langue) && Objects.equals(url, other.url); - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/documentations/DocumentationSims.java b/src/main/java/fr/insee/rmes/modeles/operations/documentations/DocumentationSims.java deleted file mode 100644 index cca4c7e8..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/documentations/DocumentationSims.java +++ /dev/null @@ -1,118 +0,0 @@ -package fr.insee.rmes.modeles.operations.documentations; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonClassDescription; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.modeles.operations.SimpleObject; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@JsonClassDescription("Objet représentant un rapport qualité (documentation SIMS)") -@JacksonXmlRootElement(localName = "RapportQualite") -public class DocumentationSims { - - private String id = null; - @Schema(example = "http://id.insee.fr/qualite/attribut/1907/I.18.11") - private String uri = null; - private List label = new ArrayList<>(); - - @JsonInclude(Include.NON_NULL) - private SimpleObject cible; - - private List rubriques = new ArrayList<>(); - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabelLg1(String labelLg1) { - label.add(new StringWithLang(labelLg1, Lang.FR)); - } - - public void setLabelLg2(String labelLg2) { - label.add(new StringWithLang(labelLg2, Lang.EN)); - } - - @JacksonXmlProperty(localName = "Rubrique") - @JacksonXmlElementWrapper(localName = "Rubriques", useWrapping = true) - public List getRubriques() { - return rubriques; - } - - public void setRubriques(List rubriques) { - this.rubriques = rubriques; - } - - public SimpleObject getCible() { - return cible; - } - - public void setIdCible(String idCible) { - if (StringUtils.isNotEmpty(idCible)) { - this.checkCibleExists(); - cible.setId(idCible); - } - } - - public void setCible(String cibleUri) { - if (StringUtils.isNotEmpty(cibleUri)) { - this.checkCibleExists(); - cible.setUri(cibleUri); - } - } - - public void setLabelCibleLg1(String labelCibleLg1) { - if (StringUtils.isNotEmpty(labelCibleLg1)) { - this.checkCibleExists(); - List temp = cible.getLabel(); - temp.add(new StringWithLang(labelCibleLg1, Lang.FR)); - cible.setLabel(temp); - } - } - - public void setLabelCibleLg2(String labelCibleLg2) { - if (StringUtils.isNotEmpty(labelCibleLg2)) { - this.checkCibleExists(); - List temp = cible.getLabel(); - temp.add(new StringWithLang(labelCibleLg2, Lang.EN)); - cible.setLabel(temp); - } - } - - private void checkCibleExists() { - if (cible == null) { - cible = new SimpleObject(); - } - } - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/documentations/Rubrique.java b/src/main/java/fr/insee/rmes/modeles/operations/documentations/Rubrique.java deleted file mode 100644 index 17c40839..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/documentations/Rubrique.java +++ /dev/null @@ -1,233 +0,0 @@ -package fr.insee.rmes.modeles.operations.documentations; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -import org.apache.commons.lang3.StringUtils; - -import com.fasterxml.jackson.annotation.JsonClassDescription; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.modeles.operations.SimpleObject; -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@JsonClassDescription("Objet représentant une rubrique d'une documentation SIMS") -public class Rubrique { - - private String id = null; - @Schema(example = "http://id.insee.fr/qualite/attribut/1907/I.18.11") - private String uri = null; - @Schema(description = "Titre de la rubrique") - private List titre = new ArrayList<>(); - private String idParent = null; - private String type; - - /* CODE_LIST */ - @JsonInclude(Include.NON_NULL) - private List valeurCode; - - /* DATE */ - @JsonInclude(Include.NON_NULL) - private String valeurSimple = null; - - /* ORGANISATION */ - @JsonInclude(Include.NON_NULL) - private SimpleObject valeurOrganisation; - - /* GEOGRAPHY */ - @JsonInclude(Include.NON_NULL) - private SimpleObject valeurGeographie; - - /* TEXT - RICH_TEXT */ - @JsonInclude(Include.NON_NULL) - private List label; - - /* RICH_TEXT */ - @JsonInclude(Include.NON_NULL) - private List richTexts; - - public Rubrique(String id, String uri, String type) { - this.id = id; - this.uri = uri; - this.type = type; - } - - @JacksonXmlProperty(isAttribute = true, localName = "id") - public String getId() { - return id; - } - @JacksonXmlProperty(isAttribute = true, localName = "uri") - public String getUri() { - return uri; - } - - @JsonProperty("titre") - @JacksonXmlProperty(localName = "Titre") - @JacksonXmlElementWrapper(useWrapping = false) - public List getTitre() { - return titre; - } - - public void setTitre(List titre) { - this.titre = titre; - } - - @JsonInclude(Include.NON_EMPTY) - @JacksonXmlProperty(localName = "IdParent") - public String getIdParent() { - return idParent; - } - - public void setIdParent(String idParent) { - this.idParent = idParent; - } - - @JacksonXmlProperty(localName = "Type") - public String getType() { - return type; - } - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("date") //json example - @JacksonXmlProperty(localName = "Date") - public String getValeurSimple() { - return valeurSimple; - } - - public void setValeurSimple(String valeurSimple) { - this.valeurSimple = valeurSimple; - } - - @JacksonXmlProperty(localName = "Label") - @JacksonXmlElementWrapper(useWrapping = false) - public List getLabel() { - return label; - } - - public void setLabelLg1(String labelLg1) { - if (StringUtils.isNotEmpty(labelLg1)) { - if (label == null) { - label = new ArrayList<>(); - } - label.add(new StringWithLang(labelLg1, Lang.FR)); - } - } - - public void setLabelLg2(String labelLg2) { - if (StringUtils.isNotEmpty(labelLg2)) { - if (label == null) { - label = new ArrayList<>(); - } - label.add(new StringWithLang(labelLg2, Lang.EN)); - } - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("organisme") //json example - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Organisme") //xml response - public SimpleObject getValeurOrganisation() { - return valeurOrganisation; - } - - - public void setValeurOrganisation(SimpleObject valeurOrganisation) { - this.valeurOrganisation = valeurOrganisation; - } - - public void setTitre(String titreLg1, String titreLg2) { - if (titre == null) { - titre = new ArrayList<>(); - } - if (StringUtils.isNotEmpty(titreLg1)) { - titre.add(new StringWithLang(titreLg1, Lang.FR)); - } - if (StringUtils.isNotEmpty(titreLg2)) { - titre.add(new StringWithLang(titreLg2, Lang.EN)); - } - } - - @JsonProperty(value = "contenus") - @JacksonXmlProperty(localName = "Contenu") - @JacksonXmlElementWrapper(useWrapping = false) - public List getRichTexts() { - return richTexts; - } - - public void setRichTexts(List richTexts) { - this.richTexts = richTexts; - } - - public void addRichTexts(RubriqueRichText r) { - if (richTexts == null) { - richTexts = new ArrayList<>(); - } - this.richTexts.add(r); - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("codes") //json example -// @XmlElementWrapper(name = "Valeurs") //xml example list -// @JacksonXmlElementWrapper(localName = "Valeurs") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - @JacksonXmlProperty(localName = "Code") //xml response - public List getValeurCode() { - return valeurCode; - } - - public void setValeurCode(List valeurCode) { - this.valeurCode = valeurCode; - } - - public void addValeurCode(SimpleObject so) { - if (valeurCode == null) { - valeurCode = new ArrayList<>(); - } - this.valeurCode.add(so); - } - - @JsonInclude(Include.NON_EMPTY) - @JsonProperty("territoire") //json example - @JacksonXmlProperty(localName = "Territoire") //xml response - @JacksonXmlElementWrapper(useWrapping = false) - public SimpleObject getValeurGeographie() { - return valeurGeographie; - } - - public void setValeurGeographie(SimpleObject valeurGeographie) { - this.valeurGeographie = valeurGeographie; - } - - @Override - public int hashCode() { - return Objects.hash(id, idParent, label, richTexts, titre, type, uri, valeurCode, valeurGeographie, - valeurOrganisation, valeurSimple); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - Rubrique other = (Rubrique) obj; - return Objects.equals(id, other.id) && Objects.equals(idParent, other.idParent) - && Objects.equals(label, other.label) && Objects.equals(richTexts, other.richTexts) - && Objects.equals(titre, other.titre) && Objects.equals(type, other.type) - && Objects.equals(uri, other.uri) && Objects.equals(valeurCode, other.valeurCode) - && Objects.equals(valeurGeographie, other.valeurGeographie) - && Objects.equals(valeurOrganisation, other.valeurOrganisation) - && Objects.equals(valeurSimple, other.valeurSimple); - } - - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/documentations/RubriqueRichText.java b/src/main/java/fr/insee/rmes/modeles/operations/documentations/RubriqueRichText.java deleted file mode 100644 index f84adfba..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/documentations/RubriqueRichText.java +++ /dev/null @@ -1,84 +0,0 @@ -package fr.insee.rmes.modeles.operations.documentations; - -import java.nio.charset.StandardCharsets; -import java.util.List; -import java.util.Objects; - -import com.fasterxml.jackson.annotation.JsonClassDescription; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -import fr.insee.rmes.utils.Lang; -import io.swagger.v3.oas.annotations.media.Schema; - -@JsonClassDescription("Objet représentant une rubrique texte riche d'une documentation SIMS") -public class RubriqueRichText { - - - - private String string = null; - - @Schema(example = "fr") - private Lang lang = null; - - @JsonInclude(Include.NON_NULL) - private List documents; - - - public RubriqueRichText(String string, Lang lang) { - super(); - this.string = string; - this.lang = lang; - } - - @JsonProperty("texte") - public String getString() { - if (string == null) return null; - else return new String(string.getBytes(), StandardCharsets.UTF_8); - } - - public void setString(String string) { - this.string = string; - } - - @JsonProperty("langue") - public String getLang() { - return lang.getLang(); - } - - public void setLang(Lang lang) { - this.lang = lang; - } - - @JacksonXmlProperty(localName = "Document") - @JacksonXmlElementWrapper(useWrapping = false) - public List getDocuments() { - return documents; - } - - public void setDocuments(List documents) { - this.documents = documents; - } - - @Override - public int hashCode() { - return Objects.hash(documents, lang, string); - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - RubriqueRichText other = (RubriqueRichText) obj; - return Objects.equals(documents, other.documents) && lang == other.lang && Objects.equals(string, other.string); - } - - -} diff --git a/src/main/java/fr/insee/rmes/modeles/operations/documentations/RubriqueRichTextXmlMixIn.java b/src/main/java/fr/insee/rmes/modeles/operations/documentations/RubriqueRichTextXmlMixIn.java deleted file mode 100644 index 84c9e7ca..00000000 --- a/src/main/java/fr/insee/rmes/modeles/operations/documentations/RubriqueRichTextXmlMixIn.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.insee.rmes.modeles.operations.documentations; - -import java.util.List; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; - -public abstract class RubriqueRichTextXmlMixIn { - - @JsonCreator - public RubriqueRichTextXmlMixIn(String string, @JsonProperty("xmllang") String lang, List documents) {} - - @JsonProperty("Texte") - abstract String getString(); - - - @JacksonXmlProperty(isAttribute = true, localName = "xmllang") - @JsonProperty("xmllang") - abstract String getLang(); - - abstract List getDocuments(); - -} diff --git a/src/main/java/fr/insee/rmes/modeles/utils/Date.java b/src/main/java/fr/insee/rmes/modeles/utils/Date.java deleted file mode 100644 index 3247cebf..00000000 --- a/src/main/java/fr/insee/rmes/modeles/utils/Date.java +++ /dev/null @@ -1,24 +0,0 @@ -package fr.insee.rmes.modeles.utils; - -public class Date { - - private String date; - - public Date(String date) { - if (date == null){ - this.date = null; - } - else{ - this.date = date; - } - } - - public String getString() { - if (date != null && !date.isEmpty()) { - return date; - } - else{ - return null; //without this it might cause some trouble to test with new Date(null) - } - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/utils/FiltreNom.java b/src/main/java/fr/insee/rmes/modeles/utils/FiltreNom.java deleted file mode 100644 index 4ca76f0c..00000000 --- a/src/main/java/fr/insee/rmes/modeles/utils/FiltreNom.java +++ /dev/null @@ -1,23 +0,0 @@ -package fr.insee.rmes.modeles.utils; - -public class FiltreNom { - private String filtreNom; - - public FiltreNom(String filtreNom) { - if (filtreNom == null){ - this.filtreNom = null; - } - else{ - this.filtreNom = filtreNom; - } - } - - public String getString() { - if (filtreNom != null && !filtreNom.isEmpty()) { - return filtreNom; - } - else{ - return null; //without this it might cause some trouble to test with new FiltreNom(null) - } - } -} diff --git a/src/main/java/fr/insee/rmes/modeles/utils/Header.java b/src/main/java/fr/insee/rmes/modeles/utils/Header.java deleted file mode 100644 index a25f281b..00000000 --- a/src/main/java/fr/insee/rmes/modeles/utils/Header.java +++ /dev/null @@ -1,23 +0,0 @@ -package fr.insee.rmes.modeles.utils; - -public class Header { - private String header; - - public Header(String header) { - if (header == null){ - this.header = null; - } - else{ - this.header = header; - } - } - - public String getString() { - if (header != null && !header.isEmpty()) { - return header; - } - else{ - return null; //without this it might cause some trouble to test with new Header(null) - } - } -} diff --git a/src/main/java/fr/insee/rmes/queries/Queries.java b/src/main/java/fr/insee/rmes/queries/Queries.java deleted file mode 100644 index 4eaaf792..00000000 --- a/src/main/java/fr/insee/rmes/queries/Queries.java +++ /dev/null @@ -1,33 +0,0 @@ -package fr.insee.rmes.queries; - -import java.io.IOException; -import java.io.StringWriter; -import java.io.Writer; -import java.util.Map; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import fr.insee.rmes.config.FreemarkerConfig; -import freemarker.template.Template; -import freemarker.template.TemplateException; - -public abstract class Queries { - - private static Logger logger = LogManager.getLogger(Queries.class); - - public static String buildRequest(String root, String fileName, Map params) { - Template temp; - Writer out = new StringWriter(); - try { - temp = FreemarkerConfig.getCfg().getTemplate(root + fileName); - temp.process(params, out); - } - catch (IOException | TemplateException e) { - logger.error("Can't read query {}", fileName); - } - return out.toString(); - } - - -} diff --git a/src/main/java/fr/insee/rmes/queries/geo/CsvGeoUtils.java b/src/main/java/fr/insee/rmes/queries/geo/CsvGeoUtils.java deleted file mode 100644 index c9680cef..00000000 --- a/src/main/java/fr/insee/rmes/queries/geo/CsvGeoUtils.java +++ /dev/null @@ -1,60 +0,0 @@ -package fr.insee.rmes.queries.geo; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import com.fasterxml.jackson.databind.MappingIterator; -import com.fasterxml.jackson.dataformat.csv.CsvMapper; -import com.fasterxml.jackson.dataformat.csv.CsvSchema; - -import fr.insee.rmes.modeles.geo.territoire.CsvProjection; -import fr.insee.rmes.modeles.geo.territoire.Projection; - -public class CsvGeoUtils { - - private static Logger logger = LogManager.getLogger(CsvGeoUtils.class); - - - /** - * Create complex POJOs (containing list) - * @param csv : result of the request - * @param childClass : POJO class - * @return - */ - public List populateProjections(String csv) { - Map alreadyCreated = new HashMap<>(); - - try { - CsvMapper mapper = CsvMapper.csvBuilder().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .build(); - CsvSchema schema = CsvSchema.emptySchema().withHeader(); - - MappingIterator> it = mapper.readerFor(Map.class).with(schema).readValues(csv); - while (it.hasNext()) { - Map rowAsMap = it.next(); - - CsvProjection pojo = mapper.convertValue(rowAsMap, CsvProjection.class); - if (alreadyCreated.containsKey(pojo.getOrigine())){ - alreadyCreated.get(pojo.getOrigine()).addProjete(pojo.getTerritoireProjete()); - }else { - Projection p = new Projection(pojo.getTerritoireOrigine(), pojo.getTerritoireProjete()); - alreadyCreated.put(pojo.getOrigine(), p); - } - } - } - catch (Exception e) { - logger.error(e.getMessage()); - } - return alreadyCreated.values().stream().collect(Collectors.toList()); - } - - -} diff --git a/src/main/java/fr/insee/rmes/queries/geo/GeoQueries.java b/src/main/java/fr/insee/rmes/queries/geo/GeoQueries.java deleted file mode 100644 index 86f55435..00000000 --- a/src/main/java/fr/insee/rmes/queries/geo/GeoQueries.java +++ /dev/null @@ -1,530 +0,0 @@ -package fr.insee.rmes.queries.geo; - -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.queries.Queries; -import fr.insee.rmes.utils.Constants; - -import java.util.HashMap; -import java.util.Map; - -public class GeoQueries extends Queries { - - private static final String CODE = "code"; - private static final String ASCENDANT = "ascendant"; - private static final String TYPE = "type"; - private static final String DATE_PROJECTION = "dateProjection"; - private static final String DATE = "date"; - private static final String TYPE_ORIGINE = "typeOrigine"; - private static final String PREVIOUS = "previous"; - private static final String QUERIES_FOLDER = "geographie/"; - private static final String FILTRE = "filtreNom"; - private static final String COM = "com"; - - - - /* IDENTIFICATION */ - public static String getZoneEmploiByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.ZONE_EMPLOI); - } - - public static String getUniteUrbaineByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.UNITE_URBAINE); - } - - public static String getAireAttractionByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.AIRE_ATTRACTION); - } - - public static String getCommuneByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.COMMUNE); - } - - public static String getCollectiviteDOutreMerByCodeAndDate(String code,String date) { - return getTerritoireFiltre(code, date,"*", EnumTypeGeographie.COLLECTIVITE_D_OUTRE_MER,true); - } - - public static String getCirconscriptionTerritorialeByCodeAndDate(String code,String date) { - return getTerritoireFiltre(code, date,"*", EnumTypeGeographie.CIRCONSCRIPTION_TERRITORIALE,true); - } - - public static String getDepartementByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.DEPARTEMENT); - } - - public static String getDistrictByCodeAndDate(String code,String date) { - return getTerritoireFiltre(code, date,"*",EnumTypeGeographie.DISTRICT,true); - } - - public static String getIntercommunaliteByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.INTERCOMMUNALITE); - } - - public static String getBassinDeVie2022ByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.BASSINDEVIE); - } - - public static String getRegionByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.REGION); - } - public static String getCantonByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.CANTON); - } - - public static String getIrisByCodeAndDate(String code,String date) { - if (code.endsWith("0000")) { - return getTerritoire(code.substring(0,5), date, EnumTypeGeographie.COMMUNE);} - else { - return getTerritoire(code, date, EnumTypeGeographie.IRIS); - } - } - public static String getCantonOuVilleByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.CANTON_OU_VILLE); - } - - public static String getArrondissementByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.ARRONDISSEMENT); - } - - public static String getCommuneAssocieeByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.COMMUNE_ASSOCIEE); - } - - public static String getCommuneDelegueeByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.COMMUNE_DELEGUEE); - } - - public static String getArrondissementmunicipalByCodeAndDate(String code, String date) { - return getTerritoire(code, date, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL); - } - - /* LIST */ - public static String getListCommunes(String date,String filtreNom,boolean com) { - return getTerritoireFiltre(Constants.NONE, date,filtreNom, EnumTypeGeographie.COMMUNE,com); - } - - public static String getListIntercommunalites(String date,String filtreNom) { - return getTerritoireFiltre(Constants.NONE, date,filtreNom, EnumTypeGeographie.INTERCOMMUNALITE,true); - } - - public static String getListBassinsDeVie(String date,String filtreNom) { - return getTerritoireFiltre(Constants.NONE, date,filtreNom, EnumTypeGeographie.BASSINDEVIE,true); - } - - public static String getListCollectivitesDOutreMer(String date) { - return getTerritoireFiltre(Constants.NONE, date,Constants.ABSENT, EnumTypeGeographie.COLLECTIVITE_D_OUTRE_MER,true); - } - - public static String getListDepartements(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.DEPARTEMENT); - } - - public static String getListRegions(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.REGION); - } - public static String getListCantonsOuVilles(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.CANTON_OU_VILLE); - } - - public static String getListIris(String date,Boolean com) { - return getTerritoireListIris(Constants.NONE, date,EnumTypeGeographie.IRIS,com); - } - public static String getListCantons(String date){ - return getTerritoire(Constants.NONE,date,EnumTypeGeographie.CANTON); - } - - public static String getListAiresAttraction(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.AIRE_ATTRACTION); - } - - public static String getListPays(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.PAYS); - } - - public static String getListUnitesUrbaines(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.UNITE_URBAINE); - } - - public static String getListZonesEmploi(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.ZONE_EMPLOI); - } - - public static String getListArrondissements(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.ARRONDISSEMENT); - } - - public static String getListArrondissementsMunicipaux(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL); - } - - public static String getListCommunesAssociees(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.COMMUNE_ASSOCIEE); - } - - public static String getListCommunesDeleguees(String date) { - return getTerritoire(Constants.NONE, date, EnumTypeGeographie.COMMUNE_DELEGUEE); - } - - /* ASCENDANT */ - public static String getAscendantsCommune(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.COMMUNE,Constants.ABSENT,Constants.NONE, true); - } - - public static String getAscendantsDepartement(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.DEPARTEMENT,Constants.ABSENT,Constants.NONE, true); - } - public static String getAscendantsCanton(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.CANTON,Constants.ABSENT,Constants.NONE, true); - } - public static String getAscendantsIris(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.IRIS,Constants.ABSENT,Constants.NONE, true); - } - public static String getAscendantsDistrict(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.DISTRICT,Constants.ABSENT,Constants.NONE,true); - } - - public static String getAscendantsCirconscriptionTerritoriale(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.CIRCONSCRIPTION_TERRITORIALE,Constants.ABSENT,Constants.NONE,true); - } - - public static String getAscendantsCommuneDeleguee(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.COMMUNE_DELEGUEE,Constants.ABSENT,Constants.NONE, true); - } - - public static String getAscendantsCommuneAssociee(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.COMMUNE_ASSOCIEE,Constants.ABSENT,Constants.NONE, true); - } - - public static String getAscendantsIntercommunalite(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.INTERCOMMUNALITE,Constants.ABSENT,Constants.NONE, true) ; - } - - public static String getAscendantsArrondissementMunicipal(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL,Constants.ABSENT,Constants.NONE, true); - } - - public static String getAscendantsArrondissement(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.ARRONDISSEMENT,Constants.ABSENT,Constants.NONE, true); - } - - public static String getAscendantsCantonOuVille(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.CANTON_OU_VILLE,Constants.ABSENT,Constants.NONE, true); - } - /* DESCENDANT */ - public static String getDescendantsCommune(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.COMMUNE,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsCollectiviteDOutreMer(String code, String date, String type,String filtreNom) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.COLLECTIVITE_D_OUTRE_MER, filtreNom,Constants.NONE,false); - } - - public static String getDescendantsIntercommunalite(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.INTERCOMMUNALITE,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsBassinDeVie(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.BASSINDEVIE,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsZoneEmploi(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.ZONE_EMPLOI,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsAireAttraction(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.AIRE_ATTRACTION,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsPays(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.PAYS,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsUniteUrbaine(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.UNITE_URBAINE,Constants.ABSENT,Constants.NONE, false); - } - - public static String getDescendantsDepartement(String code, String date, String type,String filtreNom) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.DEPARTEMENT,filtreNom,Constants.NONE, false); - } - - public static String getDescendantsRegion(String code, String date, String type,String filtreNom) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.REGION,filtreNom,Constants.NONE, false); - } - public static String getDescendantsCantonOuVille(String code, String date, String type, String filtreNom) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.CANTON_OU_VILLE,filtreNom,Constants.NONE, false); - } - - public static String getDescendantsArrondissement(String code, String date, String type) { - return getAscendantOrDescendantsQuery(code, date, type, EnumTypeGeographie.ARRONDISSEMENT, Constants.ABSENT,Constants.NONE,false); - } - - // NEXT - public static String getNextCommune(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.COMMUNE, false); - } - - public static String getNextIntercommunalite(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.INTERCOMMUNALITE, false); - } - - public static String getNextDepartement(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.DEPARTEMENT, false); - } - - public static String getNextRegion(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.REGION, false); - } - - public static String getNextPays(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.PAYS, false); - } - - public static String getNextCantonOuVille(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.CANTON_OU_VILLE, false); - } - - public static String getNextCanton(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.CANTON, false); - } - - public static String getNextArrondissement(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.ARRONDISSEMENT, false); - } - - public static String getNextArrondissementMunicipal(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL, false); - } - - // PREVIOUS - public static String getPreviousCommune(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.COMMUNE, true); - } - - public static String getPreviousDepartement(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.DEPARTEMENT, true); - } - - public static String getPreviousRegion(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.REGION, true); - } - public static String getPreviousPays(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.PAYS, true); - } - - public static String getPreviousCanton(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.CANTON, true); - } - - public static String getPreviousCantonOuVille(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.CANTON_OU_VILLE, true); - } - - public static String getPreviousArrondissement(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.ARRONDISSEMENT, true); - } - - public static String getPreviousArrondissementMunicipal(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL, true); - } - - public static String getPreviousIntercommunalite(String code, String date) { - return getPreviousOrNextQuery(code, date, EnumTypeGeographie.INTERCOMMUNALITE, true); - } - - // PROJECTION - public static String getProjectionCommune(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.COMMUNE); - } - - public static String getProjectionIntercommunalite(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.INTERCOMMUNALITE); - } - - public static String getProjectionDepartement(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.DEPARTEMENT); - } - - public static String getProjectionRegion(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.REGION); - } - public static String getProjectionCantonOuVille(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.CANTON_OU_VILLE); - } - - - public static String getProjectionCanton(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.CANTON); - } - - public static String getProjectionArrondissement(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.ARRONDISSEMENT); - } - - public static String getProjectionArrondissementMunicipal(String code, String date, String dateProjection) { - return getProjectionQuery(code, date, dateProjection, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL); - } - - // ALL PROJECTIONs - public static String getAllProjectionCommune(String date, String dateProjection) { - return getAllProjectionQuery(date, dateProjection, EnumTypeGeographie.COMMUNE); - } - - public static String getAllProjectionIntercommunalite(String date, String dateProjection) { - return getAllProjectionQuery(date, dateProjection, EnumTypeGeographie.INTERCOMMUNALITE); - } - - public static String getAllProjectionDepartement(String date, String dateProjection) { - return getAllProjectionQuery(date, dateProjection, EnumTypeGeographie.DEPARTEMENT); - } - - public static String getAllProjectionRegion(String date, String dateProjection) { - return getAllProjectionQuery(date, dateProjection, EnumTypeGeographie.REGION); - } - - public static String getAllProjectionArrondissement(String date, String dateProjection) { - return getAllProjectionQuery(date, dateProjection, EnumTypeGeographie.ARRONDISSEMENT); - } - - public static String getAllProjectionArrondissementMunicipal( String date, String dateProjection) { - return getAllProjectionQuery(date, dateProjection, EnumTypeGeographie.ARRONDISSEMENT_MUNICIPAL); - } - - /* UTILS */ - - private static String getProjectionQuery( - String code, - String date, - String dateProjection, - EnumTypeGeographie typeOrigine) { - boolean previous = dateProjection.compareTo(date) <= 0; - Map params = buildCodeAndDateParams(code, date); - params.put(TYPE_ORIGINE, typeOrigine.getTypeObjetGeo()); - params.put(PREVIOUS, String.valueOf(previous)); - params.put(DATE_PROJECTION, String.valueOf(dateProjection)); - return buildRequest(QUERIES_FOLDER, "getProjectionByCodeTypeDate.ftlh", params); - } - - private static String getAllProjectionQuery( - String date, - String dateProjection, - EnumTypeGeographie typeOrigine) { - boolean previous = dateProjection.compareTo(date) <= 0; - Map params = new HashMap<>(); - params.put(DATE, date); - params.put(TYPE_ORIGINE, typeOrigine.getTypeObjetGeo()); - params.put(PREVIOUS, String.valueOf(previous)); - params.put(DATE_PROJECTION, String.valueOf(dateProjection)); - return buildRequest(QUERIES_FOLDER, "getAllProjectionByTypeDate.ftlh", params); - } - - public static String getCommunesCanton(String code, String date) { - Map params = buildCodeAndDateParams(code, date); - params.put(TYPE_ORIGINE, EnumTypeGeographie.COMMUNE); - return buildRequest(QUERIES_FOLDER, "getCommunesByCodeDate.ftlh", params); - } - - public static String getCantonCommunes(String code, String date) { - Map params = buildCodeAndDateParams(code, date); - params.put(TYPE_ORIGINE, EnumTypeGeographie.CANTON); - return buildRequest(QUERIES_FOLDER, "getCommunesCantonsByCodeDate.ftlh", params); - } - - private static String getAscendantOrDescendantsQuery( - String code, - String date, - String type, - EnumTypeGeographie typeOrigine, - String filtreNom, - String com, - boolean ascendant) { - Map params = buildCodeAndDateParams(code, date); - params.put(TYPE, type); - params.put(TYPE_ORIGINE, typeOrigine.getTypeObjetGeo()); - params.put(FILTRE, filtreNom); - params.put(COM,com); - params.put(ASCENDANT, String.valueOf(ascendant)); - if(code.matches("^.{5}0000$") && typeOrigine.getTypeObjetGeo().equals("Iris")) { - return buildRequest(QUERIES_FOLDER, "getAscendantsIrisByCodeTypeDate.ftlh", params); - } else { - return buildRequest(QUERIES_FOLDER, "getAscendantsOrDescendantsByCodeTypeDate.ftlh", params); - } - - } - - private static String getPreviousOrNextQuery( - String code, - String date, - EnumTypeGeographie typeOrigine, - boolean precedent) { - Map params = buildCodeAndDateParams(code, date); - params.put(TYPE_ORIGINE, typeOrigine.getTypeObjetGeo()); - params.put(PREVIOUS, String.valueOf(precedent)); - return buildRequest(QUERIES_FOLDER, "getPreviousOrNextByCodeTypeDate.ftlh", params); - } - - private static String getTerritoire(String code, String date, EnumTypeGeographie typeGeo) { - if (typeGeo == EnumTypeGeographie.IRIS && code !="none") { - return getIris(code, date,typeGeo); - } else{ - return getTerritoireFiltre(code, date, Constants.ABSENT, typeGeo, true); - } - } - - private static String getTerritoireListIris(String code, String date, EnumTypeGeographie typeGeo,Boolean com) { - if (com.booleanValue()==true) { - return getIrisList(code, date,typeGeo,true); - } else { - return getIrisList(code, date, typeGeo, false); - } - } - private static Map buildCodeAndDateParams(String code, String date) { - Map params = new HashMap<>(); - params.put(CODE, code); - params.put(DATE, date); - return params; - } - - private static String getIris(String code, String date, EnumTypeGeographie typeGeo) { - Map params = buildCodeAndDateParams(code, date); - params.put("territoire", typeGeo.getTypeObjetGeo()); - return buildRequest(QUERIES_FOLDER, "getIrisByCodeDate.ftlh", params); - - } - - private static String getIrisList(String code, String date, EnumTypeGeographie typeGeo,boolean com){ - Map params = buildCodeAndDateAndFilterParams(code, date,Constants.NONE, com); - params.put("territoire", typeGeo.getTypeObjetGeo()); - return buildRequest(QUERIES_FOLDER, "getIrisList.ftlh",params); - } - private static String getTerritoireFiltre(String code, String date, String filtreNom, EnumTypeGeographie typeGeo,boolean com) { - Map params = buildCodeAndDateAndFilterParams(code, date, filtreNom,com); - params.put("territoire", typeGeo.getTypeObjetGeo()); - params.put("chefLieu", typeGeo.getChefLieuPredicate()); - return buildRequest(QUERIES_FOLDER, "getTerritoireByCodeDateNomcommune.ftlh", params); - } - - private static Map buildCodeAndDateAndFilterParams(String code, String date, String filtreNom, boolean com) { - Map params = new HashMap<>(); - params.put(CODE, code); - params.put(DATE, date); - params.put(FILTRE, filtreNom); - params.put(COM, String.valueOf(com)); - return params; - } - - public static String getPays(String code) { - return String.format( - "SELECT ?uri ?intitule ?intituleEntier ?code \n" - + "FROM \n" - + "WHERE { \n" - + " ?urilong a igeo:Pays ; \n" - + " igeo:codeINSEE \"%s\" ; \n" - + " igeo:nom ?intitule; \n" - + " owl:sameAs ?uri; \n" - + " igeo:nomLong ?intituleEntier . \n" - + " BIND(\"%s\" AS ?code)\n" - + " FILTER (REGEX(STR(?uri), \"http://id.insee.fr\")) \n" - + "}", code, code); - } - - -} diff --git a/src/main/java/fr/insee/rmes/queries/operations/OperationsQueries.java b/src/main/java/fr/insee/rmes/queries/operations/OperationsQueries.java deleted file mode 100644 index fa84f731..00000000 --- a/src/main/java/fr/insee/rmes/queries/operations/OperationsQueries.java +++ /dev/null @@ -1,215 +0,0 @@ -package fr.insee.rmes.queries.operations; - -import java.util.HashMap; -import java.util.Map; - -import fr.insee.rmes.queries.Queries; -import fr.insee.rmes.utils.Lang; - -public class OperationsQueries extends Queries { - - private static final String INDICATOR_BASEURI = "/produits/indicateur/"; - private static final String SERIES_BASEURI = "/operations/serie/"; - private static final String INDICATOR_RDF_MODEL = "insee:StatisticalIndicator"; - private static final String SERIES_RDF_MODEL = "insee:StatisticalOperationSeries"; - private static final String ID_INDIC = "idIndic"; - private static final String ID_SERIES = "idSeries"; - private static final String ID_SIMS = "idSims"; - private static final String QUERIES_FOLDER = "operations/"; - - - /**FAMILY**/ - - public static String getFamilies() { - return buildRequest(QUERIES_FOLDER, "getListFamilies.ftlh", null); - } - - - - /**SERIES**/ - - public static String getSeries() { - return buildRequest(QUERIES_FOLDER, "getListSeries.ftlh", null); - } - - public static String getSeries(String idSeries) { - Map params = new HashMap<>(); - params.put(ID_SERIES, idSeries); - return buildRequest(QUERIES_FOLDER, "getSeriesByIdQuery.ftlh", params); - } - - public static String getOperationBySeries(String idSeries) { - Map params = new HashMap<>(); - params.put(ID_SERIES, idSeries); - return buildRequest(QUERIES_FOLDER, "getOperationBySeriesQuery.ftlh", params); - } - - public static String getIndicBySeries(String idSeries) { - Map params = new HashMap<>(); - params.put(ID_SERIES, idSeries); - return buildRequest(QUERIES_FOLDER, "getIndicBySeriesQuery.ftlh", params); - } - - /** OPERATIONS */ - public static String getOperations() { - return buildRequest(QUERIES_FOLDER, "getListOperations.ftlh", null); - } - - - /** INDIC **/ - public static String getIndicators() { - return buildRequest(QUERIES_FOLDER, "getListIndicators.ftlh", null); - } - - - - public static String getSeriesByIndic(String idIndic) { - Map params = new HashMap<>(); - params.put(ID_INDIC, idIndic); - return buildRequest(QUERIES_FOLDER, "getSeriesByIndicQuery.ftlh", params); - } - - public static String getIndicator(String idIndic) { - Map params = new HashMap<>(); - params.put(ID_INDIC, idIndic); - return buildRequest(QUERIES_FOLDER, "getIndicatorByIdQuery.ftlh", params); - } - - - - /**SIMS**/ - - public static String getDocumentationTitle(String idSims) { - Map params = new HashMap<>(); - params.put(ID_SIMS, idSims); - return buildRequest(QUERIES_FOLDER, "getDocumentationTitleByIdSimsQuery.ftlh", params); - } - - public static String getDocumentationRubrics(String idSims) { - Map params = new HashMap<>(); - params.put(ID_SIMS, idSims); - params.put("LG1_CL", Lang.FR.getUri()); - params.put("LG2_CL", Lang.EN.getUri()); - - return buildRequest(QUERIES_FOLDER, "getDocumentationRubricsByIdSimsQuery.ftlh", params); - } - - public static String getDocuments(String idSims, String idRubric, Lang lang) { - Map params = new HashMap<>(); - params.put(ID_SIMS, idSims); - params.put("idRubric", idRubric); - params.put("LANG", lang.getUri()); - return buildRequest(QUERIES_FOLDER, "getDocumentsQueryByIdSimsIdRubric.ftlh", params); - } - - - - /** SEE ALSO - WAS GENERATED BY**/ - - public static String getSeeAlsoBySeries(String idSeries) { - return getLinkDifferentTypeByObject(idSeries, "rdfs:seeAlso", SERIES_RDF_MODEL, SERIES_BASEURI); - - } - - public static String getSeeAlsoByIndic(String idIndic) { - return getLinkDifferentTypeByObject(idIndic, "rdfs:seeAlso", INDICATOR_RDF_MODEL, INDICATOR_BASEURI); - } - - public static String getWasGeneratedByByIndic(String idIndic) { - return getLinkDifferentTypeByObject(idIndic, "prov:wasGeneratedBy", INDICATOR_RDF_MODEL, INDICATOR_BASEURI); - - } - - - private static String getLinkDifferentTypeByObject(String idObject, String linkPredicate, String typeObject, - String uriObject) { - Map params = new HashMap<>(); - params.put("idObject", idObject); - params.put("linkPredicate", linkPredicate); - params.put("typeObject", typeObject); - params.put("uriObject", uriObject); - return buildRequest(QUERIES_FOLDER, "getLinkDifferentTypeByObjectQuery.ftlh", params); - //TODO because graph are specified in query, perhaps idSims is always null - } - - - - /** REPLACES - IS REPLACED BY **/ - - public static String getIsReplacedByBySeries(String idSeries) { - return getLinkSameTypeByObject(idSeries, "dcterms:isReplacedBy", SERIES_RDF_MODEL, SERIES_BASEURI); - } - - public static String getReplacesBySeries(String idSeries) { - return getLinkSameTypeByObject(idSeries, "dcterms:replaces", SERIES_RDF_MODEL, SERIES_BASEURI); - } - - public static String getIsReplacedByByIndic(String idIndic) { - return getLinkSameTypeByObject(idIndic, "dcterms:isReplacedBy", INDICATOR_RDF_MODEL, INDICATOR_BASEURI); - } - - public static String getReplacesByIndic(String idIndic) { - return getLinkSameTypeByObject(idIndic, "dcterms:replaces", INDICATOR_RDF_MODEL, INDICATOR_BASEURI); - } - - private static String getLinkSameTypeByObject(String idObject, String linkPredicate, String typeObject, - String uriObject) { - Map params = new HashMap<>(); - params.put("idObject", idObject); - params.put("linkPredicate", linkPredicate); - params.put("typeObject", typeObject); - params.put("uriObject", uriObject); - return buildRequest(QUERIES_FOLDER, "getLinkSameTypeByObjectQuery.ftlh", params); - } - - - /** ORGANISMS **/ - - private static String getOrganismByObject(String idObject, String linkPredicate, String typeObject, - String uriObject) { - Map params = new HashMap<>(); - params.put("idObject", idObject); - params.put("linkPredicate", linkPredicate); - params.put("typeObject", typeObject); - params.put("uriObject", uriObject); - return buildRequest(QUERIES_FOLDER, "getOrganismByObjectQuery.ftlh", params); - } - - private static String getCreatorByObject(String idObject, String typeObject, String uriObject, String graph) { - Map params = new HashMap<>(); - params.put("idObject", idObject); - params.put("typeObject", typeObject); - params.put("uriObject", uriObject); - params.put("GRAPH", graph); - return buildRequest(QUERIES_FOLDER, "getCreatorsByObjectQuery.ftlh", params); - } - - - public static String getPublishersBySeries(String idSeries) { - return getOrganismByObject(idSeries, "dcterms:publisher", SERIES_RDF_MODEL, SERIES_BASEURI); - } - - public static String getContributorsBySeries(String idSeries) { - return getOrganismByObject(idSeries, "dcterms:contributor", SERIES_RDF_MODEL, SERIES_BASEURI); - } - - public static String getContributorsByIndic(String idIndic) { - return getOrganismByObject(idIndic, "dcterms:contributor", INDICATOR_RDF_MODEL, INDICATOR_BASEURI); - } - - public static String getCreatorsBySeries(String idSeries) { - return getCreatorByObject(idSeries, SERIES_RDF_MODEL, SERIES_BASEURI, "http://rdf.insee.fr/graphes/operations"); - } - - public static String getPublishersByIndic(String idIndicateur) { - return getOrganismByObject(idIndicateur, "dcterms:publisher", INDICATOR_RDF_MODEL, INDICATOR_BASEURI); - } - - public static String getCreatorsByIndic(String idIndicateur) { - return getCreatorByObject(idIndicateur, INDICATOR_RDF_MODEL, INDICATOR_BASEURI, "http://rdf.insee.fr/graphes/produits"); - } - - public static String getDataCollectorsBySeries(String idSeries) { - return getOrganismByObject(idSeries, "insee:dataCollector", SERIES_RDF_MODEL, SERIES_BASEURI); - } -} diff --git a/src/main/java/fr/insee/rmes/utils/CSVUtils.java b/src/main/java/fr/insee/rmes/utils/CSVUtils.java deleted file mode 100644 index c6e2343b..00000000 --- a/src/main/java/fr/insee/rmes/utils/CSVUtils.java +++ /dev/null @@ -1,124 +0,0 @@ -package fr.insee.rmes.utils; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.MappingIterator; -import com.fasterxml.jackson.databind.cfg.CoercionAction; -import com.fasterxml.jackson.databind.cfg.CoercionInputShape; -import com.fasterxml.jackson.databind.type.LogicalType; -import com.fasterxml.jackson.dataformat.csv.CsvMapper; -import com.fasterxml.jackson.dataformat.csv.CsvSchema; -import fr.insee.rmes.modeles.geo.EnumTypeGeographie; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import org.apache.commons.lang3.StringUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class CSVUtils { - - private static Logger logger = LogManager.getLogger(CSVUtils.class); - - private Object csvToPOJO(String csv, Object pojo) throws IOException { - CsvMapper mapper = CsvMapper.csvBuilder().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .build(); - // emptyScheme is necessary - CsvSchema bootstrapSchema = CsvSchema.emptySchema().withHeader(); - - MappingIterator it = mapper.readerForUpdating(pojo).with(bootstrapSchema).readValues(csv); - while (it.hasNextValue()) { - pojo = it.nextValue(); - } - return pojo; - } - - /* - * Create POJO with the result of a request - */ - public Object populatePOJO(String csv, Object pojo) { - try { - pojo = this.csvToPOJO(csv, pojo); - } - catch (Exception e) { - logger.error(e.getMessage()); - } - return pojo; - } - - private List csvToMultiPOJO(String csv, Class childClass) throws IOException { - List list = new ArrayList<>(); - CsvMapper mapper = CsvMapper.csvBuilder().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS) - .disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES) - .build(); - // Activer la coercition pour les chaînes vides vers null pour toutes les propriétés d'énumération - mapper.coercionConfigFor(LogicalType.Enum) - .setCoercion(CoercionInputShape.EmptyString, CoercionAction.AsNull); - CsvSchema schema = CsvSchema.emptySchema().withHeader(); - MappingIterator> it = mapper.readerFor(Map.class).with(schema).readValues(csv); - while (it.hasNext()) { - Map rowAsMap = it.next(); - if (childClass == Territoire.class) { - Territoire territoire = this.dealWithTerritoire(mapper, rowAsMap); - if (territoire != null) { - list.add(childClass.cast(territoire)); - } - } - else { - T activite = mapper.convertValue(rowAsMap, childClass); - list.add(activite); - } - } - return list; - } - - private Territoire dealWithTerritoire(CsvMapper mapper, Map rowAsMap) { - - String nomType = null; - - if (rowAsMap.get("type") != null) { - nomType = StringUtils.substringAfterLast(rowAsMap.get("type"), "#"); - } - else { - logger.info("Territoire not found"); - } - - Class classeTerritoire = EnumTypeGeographie.getClassByType(nomType); - Territoire territoireForMapping = null; - - try { - - if (classeTerritoire != null) { - territoireForMapping = mapper.convertValue(rowAsMap, classeTerritoire); - territoireForMapping.setType(classeTerritoire.getSimpleName()); - } - } - catch (ClassCastException e) { - logger.error("Error with cast geographie type"); - } - - return territoireForMapping; - } - - /** - * Create POJOs - * @param csv : result of the request - * @param childClass : POJO class - * @return - */ - public List populateMultiPOJO(String csv, Class childClass) { - List list = new ArrayList<>(); - try { - list = this.csvToMultiPOJO(csv, childClass); - } - catch (Exception e) { - logger.error(e); - } - return list; - } - -} diff --git a/src/main/java/fr/insee/rmes/utils/Constants.java b/src/main/java/fr/insee/rmes/utils/Constants.java deleted file mode 100644 index d517bc32..00000000 --- a/src/main/java/fr/insee/rmes/utils/Constants.java +++ /dev/null @@ -1,18 +0,0 @@ -package fr.insee.rmes.utils; - -public class Constants { - - public static final String NONE = "none"; - public static final String TYPE_STRING = "string"; - public static final String CODE = "code"; - public static final String TYPE_BOOLEAN = "boolean"; - public static final String FORMAT_DATE = "date"; - public static final String PARAMETER_DATE = "date"; - public static final String PARAMETER_DATE_PROJECTION = "dateProjection"; - public static final String PARAMETER_TYPE = "type"; - public static final String PARAMETER_FILTRE="filtreNom"; - public static final String PARAMETER_STRING="com"; - public static final String ABSENT="*"; - - private Constants() {} -} diff --git a/src/main/java/fr/insee/rmes/utils/CustomXmlEscapingWriterFactory.java b/src/main/java/fr/insee/rmes/utils/CustomXmlEscapingWriterFactory.java deleted file mode 100644 index b0bca0c3..00000000 --- a/src/main/java/fr/insee/rmes/utils/CustomXmlEscapingWriterFactory.java +++ /dev/null @@ -1,39 +0,0 @@ -package fr.insee.rmes.utils; - -import java.io.IOException; -import java.io.OutputStream; -import java.io.Writer; - -import org.codehaus.stax2.io.EscapingWriterFactory; - -public class CustomXmlEscapingWriterFactory implements EscapingWriterFactory { - - -public Writer createEscapingWriterFor(final Writer out, String enc) { - return new Writer(){ - @Override - public void write(char[] cbuf, int off, int len) throws IOException { - //WARN : the cbuf contains only part of the string = can't validate xml here - String val = ""; - for (int i = off; i < len; i++) { - val += cbuf[i]; - } - out.write(val); //no transformation because of the buffer - } - - @Override - public void flush() throws IOException { - out.flush(); - } - - @Override - public void close() throws IOException { - out.close(); - } - }; - } - - public Writer createEscapingWriterFor(OutputStream out, String enc) { - throw new IllegalArgumentException("not supported"); - } -} \ No newline at end of file diff --git a/src/main/java/fr/insee/rmes/utils/DateUtils.java b/src/main/java/fr/insee/rmes/utils/DateUtils.java deleted file mode 100644 index 30ad84c1..00000000 --- a/src/main/java/fr/insee/rmes/utils/DateUtils.java +++ /dev/null @@ -1,63 +0,0 @@ -package fr.insee.rmes.utils; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.Calendar; - -import org.joda.time.DateTime; -import org.joda.time.format.DateTimeFormat; -import org.joda.time.format.DateTimeFormatter; - -public class DateUtils { - - private static final String DATE_PATTERN = "yyyy-MM-dd"; - - public static DateTime getDateTimeFromDateString(String date) { - DateTimeFormatter formatter = DateTimeFormat.forPattern(DATE_PATTERN); - return formatter.parseDateTime(date); - } - - /** - * return "" or a date with yyyy-MM-dd pattern - * @param dateTime - * @return - */ - public static String getDateStringFromDateTimeString(String dateTime) { - if (dateTime == null || dateTime.equals("")) { - return ""; - } - DateTime dt = new DateTime(dateTime); - DateTimeFormatter formatter = DateTimeFormat.forPattern(DATE_PATTERN); - return formatter.print(dt); - } - - /** - * check date pattern - * @param date - * @return - */ - public static boolean isValidDate(String date) { - if (date == null || ! date.matches("\\d{4}-[01]\\d-[0-3]\\d")) { - return false; - } - SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN); - try { - format.parse(date); - return true; - } - catch (ParseException e) { - return false; - } - } - - private DateUtils() { - throw new IllegalStateException("Utility class"); - // please sonar - } - - public static String getDateTodayStringFormat() { - Calendar c = Calendar.getInstance(); - SimpleDateFormat format = new SimpleDateFormat(DATE_PATTERN); - return format.format(c.getTime()); - } -} diff --git a/src/main/java/fr/insee/rmes/utils/FileUtils.java b/src/main/java/fr/insee/rmes/utils/FileUtils.java deleted file mode 100644 index 50e17d7c..00000000 --- a/src/main/java/fr/insee/rmes/utils/FileUtils.java +++ /dev/null @@ -1,44 +0,0 @@ -package fr.insee.rmes.utils; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -public class FileUtils { - - private FileUtils() { - super(); - } - - private static Logger logger = LogManager.getLogger(FileUtils.class); - - /** - * Read a csv File and put data in a list - * @param pathFile - * @param csvSplitBy - * @return - */ - public static List> readFile(String pathFile, String csvSplitBy) { - List allLines = null; - List> fileContents = new ArrayList<>(); - - try { - allLines = Files.readAllLines(Paths.get(pathFile)); - } - catch (IOException e) { - logger.error(e.getMessage()); - return fileContents; - } - - for (String line : allLines) { - fileContents.add(Arrays.asList(line.split(csvSplitBy))); - } - return fileContents; - } -} diff --git a/src/main/java/fr/insee/rmes/utils/JavaLangUtils.java b/src/main/java/fr/insee/rmes/utils/JavaLangUtils.java deleted file mode 100644 index 4bd916ce..00000000 --- a/src/main/java/fr/insee/rmes/utils/JavaLangUtils.java +++ /dev/null @@ -1,15 +0,0 @@ -package fr.insee.rmes.utils; - -import java.util.List; -import java.util.function.BiFunction; -import java.util.stream.Stream; - -public class JavaLangUtils { - - private JavaLangUtils(){} - - public static Stream merge(Stream stream, List list, BiFunction merger) { - return stream.flatMap(s->list.stream().map(t->merger.apply(s,t))); - } - -} diff --git a/src/main/java/fr/insee/rmes/utils/Lang.java b/src/main/java/fr/insee/rmes/utils/Lang.java deleted file mode 100644 index 7ba8259c..00000000 --- a/src/main/java/fr/insee/rmes/utils/Lang.java +++ /dev/null @@ -1,26 +0,0 @@ -package fr.insee.rmes.utils; - -import fr.insee.rmes.config.Configuration; - -public enum Lang { - FR("fr", Configuration.getBaseHost() + "/codes/langue/fr"), - EN("en", Configuration.getBaseHost() + "/codes/langue/en"); - - private String language; - private String uri; - - private Lang(String language, String uri) { - this.language = language; - this.uri = uri; - } - - public String getLang() { - return language; - } - - public String getUri() { - return uri; - } - -} - diff --git a/src/main/java/fr/insee/rmes/utils/PropertiesUtils.java b/src/main/java/fr/insee/rmes/utils/PropertiesUtils.java deleted file mode 100644 index 28f2802e..00000000 --- a/src/main/java/fr/insee/rmes/utils/PropertiesUtils.java +++ /dev/null @@ -1,32 +0,0 @@ - -package fr.insee.rmes.utils; - -import jakarta.validation.constraints.NotNull; -import java.io.FileReader; -import java.io.IOException; -import java.io.Reader; -import java.nio.file.Path; -import java.util.Optional; -import java.util.Properties; - -public class PropertiesUtils { - - private static final Properties propsForReadPropertyFromFile=new Properties(); - - public static Optional readPropertyFromPath(@NotNull String propertyName, @NotNull Path filePath){ - propsForReadPropertyFromFile.remove(propertyName); - // Use OS charset : for example windows-1252 for windows, UTF-8 for linux, ... - // switch to java 11 to specify charset - try(Reader readerFromFile=new FileReader(filePath.toFile())){ - propsForReadPropertyFromFile.load(readerFromFile); - }catch (IOException e){ - //propsForReadPropertyFromFile remain empty if file cannot be read - } - return Optional.ofNullable(propsForReadPropertyFromFile.getProperty(propertyName)); - } - - private PropertiesUtils() { - // Hide the public one - } - -} diff --git a/src/main/java/fr/insee/rmes/utils/QueryUtils.java b/src/main/java/fr/insee/rmes/utils/QueryUtils.java deleted file mode 100644 index 21e54ee2..00000000 --- a/src/main/java/fr/insee/rmes/utils/QueryUtils.java +++ /dev/null @@ -1,23 +0,0 @@ -package fr.insee.rmes.utils; - -public class QueryUtils { - - private QueryUtils() { - super(); - } - - public static final String PREFIXES = - "PREFIX igeo: \n" - + "PREFIX dcterms: \n" - + "PREFIX xkos: \n" - + "PREFIX evoc: \n" - + "PREFIX skos: \n" - + "PREFIX dc: \n" - + "PREFIX insee: \n" - + "PREFIX rdf: \n" - + "PREFIX pav: \n" - + "PREFIX xsd: \n" - + "PREFIX prov: \n" - + "PREFIX sdmx-mm: \n"; - -} diff --git a/src/main/java/fr/insee/rmes/utils/ResponseUtils.java b/src/main/java/fr/insee/rmes/utils/ResponseUtils.java deleted file mode 100644 index f2f8381e..00000000 --- a/src/main/java/fr/insee/rmes/utils/ResponseUtils.java +++ /dev/null @@ -1,116 +0,0 @@ -package fr.insee.rmes.utils; - -import java.nio.charset.StandardCharsets; -import java.util.regex.Pattern; - -import jakarta.ws.rs.core.MediaType; - -import com.fasterxml.jackson.databind.MapperFeature; -import com.fasterxml.jackson.databind.json.JsonMapper; -import fr.insee.rmes.modeles.operations.documentations.DocumentationSims; -import org.apache.commons.text.StringEscapeUtils; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.codehaus.stax2.XMLOutputFactory2; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.dataformat.xml.XmlMapper; - -import fr.insee.rmes.modeles.StringWithLang; -import fr.insee.rmes.modeles.StringXmlMixIn; -import fr.insee.rmes.modeles.concepts.StringWithLangConcept; -import fr.insee.rmes.modeles.concepts.StringXmlMixInConcept; -import fr.insee.rmes.modeles.geo.TerritoireJsonMixIn; -import fr.insee.rmes.modeles.geo.territoire.Territoire; -import fr.insee.rmes.modeles.geo.territoires.Projections; -import fr.insee.rmes.modeles.operations.documentations.RubriqueRichText; -import fr.insee.rmes.modeles.operations.documentations.RubriqueRichTextXmlMixIn; - -public class ResponseUtils { - - private static Logger logger = LogManager.getLogger(ResponseUtils.class); - - public String produceResponse(Object obj, String header) { - String response = ""; - - - if (header != null && header.equals(MediaType.APPLICATION_XML)) { - XmlMapper mapper = XmlMapper.builder().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS).build(); - mapper.getFactory().getXMLOutputFactory().setProperty(XMLOutputFactory2.P_TEXT_ESCAPER, - new CustomXmlEscapingWriterFactory()); - mapper.addMixIn(StringWithLang.class, StringXmlMixIn.class); - mapper.addMixIn(StringWithLangConcept.class, StringXmlMixInConcept.class); - mapper.addMixIn(RubriqueRichText.class, RubriqueRichTextXmlMixIn.class); - - try { - response = mapper.writeValueAsString(obj); - // Replace XML namespace xmllang => xml:lang - response = Pattern.compile("xmllang=").matcher(response).replaceAll("xml:lang="); - // Remove XML tag - response = Pattern.compile("<\\/?listeTerritoires>").matcher(response).replaceAll(""); - // Remove duplications Territoires objects with tag for XML response - response = Pattern.compile("()").matcher(response).replaceAll(""); - // Remove last tags territoires - response = Pattern.compile("(<\\/territoires>)").matcher(response).replaceAll(""); - - if ( ! response.isEmpty() && obj.getClass() == Projections.class) { - // Remove XML tag - response = Pattern.compile("<\\/?origine>").matcher(response).replaceAll(""); - // Remove XML tag - response = Pattern.compile("<\\/?listeProj>").matcher(response).replaceAll(""); - } - } - catch (Exception e) { - logger.error(e.getMessage()); - } - - if (obj instanceof DocumentationSims){ - response = encodeXmlResponseforSims(response); - } - else { - response = encodeXmlResponse(response); - } - - } - else { - ObjectMapper mapper = JsonMapper.builder().enable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS).build(); - mapper.addMixIn(Territoire.class, TerritoireJsonMixIn.class); - try { - response = mapper.writeValueAsString(obj); - } catch (JsonProcessingException e) { - logger.error(e.getMessage()); - } - response = encodeJsonResponse(response); - - } - return response; - } - - private String escapeHtml(String s) { - s = StringEscapeUtils.unescapeHtml4(s); - return s.replace("&", "&") - .replace(">", ">") - .replace("<", "<") - .replace("\"", """); - } - - public String encodeXmlResponse(String response) { - response = XmlUtils.encodeXml(response); - return new String(response.getBytes(), StandardCharsets.UTF_8); - } - - public String encodeXmlResponseforSims(String response) { - response = escapeHtml(response); - response = XmlUtils.encodeXml(response); - return new String(response.getBytes(), StandardCharsets.UTF_8); - } - - public String encodeJsonResponse(String response) { - String ret = response.replaceAll("\\R", " ")//remove break lines that makes JSON invalid (breakline in texts are in

) - .replace('"', '\"'); //remove quote - return new String(ret.getBytes(), StandardCharsets.UTF_8); - } - - -} diff --git a/src/main/java/fr/insee/rmes/utils/SparqlUtils.java b/src/main/java/fr/insee/rmes/utils/SparqlUtils.java deleted file mode 100644 index 0ac7625e..00000000 --- a/src/main/java/fr/insee/rmes/utils/SparqlUtils.java +++ /dev/null @@ -1,65 +0,0 @@ -package fr.insee.rmes.utils; - -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import jakarta.ws.rs.client.Client; -import jakarta.ws.rs.client.ClientBuilder; -import jakarta.ws.rs.core.MediaType; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - -import fr.insee.rmes.config.Configuration; - -public class SparqlUtils { - - private static Logger logger = LogManager.getLogger(SparqlUtils.class); - - public String executeSparqlQuery(String query) { - return executeSparqlQuery(query, "text/csv"); - } - - public String executeSparqlQuery(String query, String resultType) { - logger.debug("Sent query : {}", query); - String uri = this.queryToURI(query); - Client client = ClientBuilder.newBuilder().build(); - String response = client.target(uri).request(resultType).get(String.class); - logger.debug("SPARQL query returned: \n {}", response); - return response; - } - - - public boolean executeAskQuery(String query) { - String uri = Configuration.getSparqlEndPoint() + "?query=" + this.encode(query); - Client client = ClientBuilder.newBuilder().build(); - String response = client.target(uri).request(MediaType.APPLICATION_XML).get(String.class); - logger.debug("SPARQL query returned: \n {}", response); - return response.contains("true"); - } - - private String queryToURI(String query) { - return Configuration.getSparqlEndPoint() + "?query=" + this.encode(QueryUtils.PREFIXES + query); - } - - public String encode(String url) { - try { - return URLEncoder.encode(url, "UTF-8"); - } - catch (UnsupportedEncodingException e) { - return "Issue while encoding: " + e.getMessage(); - } - } - - - public List getResponseAsList(String response){ - List list = new ArrayList<>(Arrays.asList(response.split("\r\n"))); - list.remove(0); - return list; - - } - -} diff --git a/src/main/java/fr/insee/rmes/utils/XmlUtils.java b/src/main/java/fr/insee/rmes/utils/XmlUtils.java deleted file mode 100644 index 028bd7ad..00000000 --- a/src/main/java/fr/insee/rmes/utils/XmlUtils.java +++ /dev/null @@ -1,22 +0,0 @@ -package fr.insee.rmes.utils; - -public class XmlUtils { - - public static String encodeXml(String s) { - return s.replaceAll("<<([a-zA-Z]+)>>", "<< $1 >>") //<> => << texte >> - .replaceAll("<([a-zA-Z]+)>", "<$1>") //xml open tag - .replaceAll("<([a-zA-Z]+) ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|')>", "<$1 $2=\"$4\">") //open tag with one attribute (text or xml:lang) - .replaceAll("<([a-zA-Z]+) ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|') ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|')>", "<$1 $2=\"$4\" $8=\"$10\">") //open tag with 2 attributes (text or xml:lang) - .replaceAll("<([a-zA-Z]+) ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|') ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|') ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|')>", "<$1 $2=\"$4\" $8=\"$10\" $14=\"$16\">") //open tag with 3 attributes (text or xml:lang) - .replaceAll("<([a-zA-Z]+) ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|') ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|') ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|') ([a-zA-Z:]+)?=("|')(((?!("|')).)*?)("|')>", "<$1 $2=\"$4\" $8=\"$10\" $14=\"$16\" $20=\"$22\">") //open tag with 4 attributes (text or xml:lang) - .replaceAll("</([a-zA-Z]+)>", "") //xml close tag - .replaceAll("<([a-zA-Z]+)/>", "<$1/>") //br - .replaceAll("<([a-zA-Z]+) />", "<$1 />") //br with space - - ; - - - - } - -} diff --git a/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer b/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer deleted file mode 100644 index 4ad0f471..00000000 --- a/src/main/resources/META-INF/services/javax.servlet.ServletContainerInitializer +++ /dev/null @@ -1 +0,0 @@ -fr.insee.rmes.config.Log4jInseeServletContainerInitializer \ No newline at end of file diff --git a/src/main/resources/api-stable.properties b/src/main/resources/api-stable.properties deleted file mode 100644 index 94e86555..00000000 --- a/src/main/resources/api-stable.properties +++ /dev/null @@ -1,5 +0,0 @@ -# Get properties from pom.xml -fr.insee.rmes.api.version = ${project.version} -fr.insee.rmes.api.title = ${title} -fr.insee.rmes.api.description = ${description} - diff --git a/src/main/resources/log4j2.xml b/src/main/resources/log4j2.xml deleted file mode 100644 index e4ab892c..00000000 --- a/src/main/resources/log4j2.xml +++ /dev/null @@ -1 +0,0 @@ - c:/logs 10MB 14 %d{yyyyMMddHHmmss} %d [%t] %-5p (%F [%M]:%L) - %m %n \ No newline at end of file diff --git a/src/main/resources/request/geographie/getCommunesCantonsByCodeDate.ftlh b/src/main/resources/request/geographie/getCommunesCantonsByCodeDate.ftlh deleted file mode 100644 index fca2c3ed..00000000 --- a/src/main/resources/request/geographie/getCommunesCantonsByCodeDate.ftlh +++ /dev/null @@ -1,29 +0,0 @@ -PREFIX : -SELECT ?uri ?type ?code ?typeArticle ?intitule ?intituleSansArticle ?dateCreation ?dateSuppression ?chefLieu -WHERE { -?commune a :Commune ; -:codeINSEE '${code}' . -?ressource a :Canton; -a ?typeRDF; -^:subdivisionDirecteDe|^:territoireCommunAvec ?commune ; -:codeINSEE ?code; -:codeArticle ?typeArticle ; -:nom ?intitule ; -:nomSansArticle ?intituleSansArticle . -BIND(STRAFTER(STR(?typeRDF),"http://rdf.insee.fr/def/geo#") AS ?type). -BIND(STR(?ressource) AS ?uri). -OPTIONAL {?commune (^:creation/:date) ?dateCreationCommune. } -OPTIONAL {?commune (^:suppression/:date) ?dateSuppressionCommune. } -OPTIONAL {?ressource (^:creation/:date) ?dateCreation. } -OPTIONAL {?ressource (^:suppression/:date) ?dateSuppression. } -OPTIONAL {?ressource :bureauCentralisateur ?chefLieuRDF. ?chefLieuRDF :codeINSEE ?chefLieu.} -OPTIONAL {?chefLieuRDF ^:creation/:date ?dateCreationChefLieu.} -OPTIONAL {?chefLieuRDF ^:suppression/:date ?dateSuppressionChefLieu.} -FILTER(!BOUND(?dateCreationCommune) || xsd:dateTime(?dateCreationCommune) <= '${date}'^^xsd:date) -FILTER(!BOUND(?dateSuppressionCommune) || xsd:dateTime(?dateSuppressionCommune) > '${date}'^^xsd:date) -FILTER(!BOUND(?dateCreation) || xsd:dateTime(?dateCreation) <= '${date}'^^xsd:date) -FILTER(!BOUND(?dateSuppression) || xsd:dateTime(?dateSuppression) > '${date}'^^xsd:date) -FILTER(!BOUND(?dateCreationChefLieu) || xsd:dateTime(?dateCreationChefLieu) <= '${date}'^^xsd:date) -FILTER(!BOUND(?dateSuppressionChefLieu) || xsd:dateTime(?dateSuppressionChefLieu) > '${date}'^^xsd:date) -} -ORDER BY ?code \ No newline at end of file diff --git a/src/main/resources/request/geographie/getTerritoireByCodeDateNomcommune.ftlh b/src/main/resources/request/geographie/getTerritoireByCodeDateNomcommune.ftlh deleted file mode 100644 index e1fa6ce7..00000000 --- a/src/main/resources/request/geographie/getTerritoireByCodeDateNomcommune.ftlh +++ /dev/null @@ -1,80 +0,0 @@ -SELECT DISTINCT ?uri ?code ?typeArticle ?intitule ?intituleSansArticle ?dateCreation ?dateSuppression ?chefLieu ?intitule ?categorieJuridique ?intituleComplet -FROM -FROM -WHERE { - - ?uri a igeo:${territoire} ; - igeo:codeArticle ?typeArticle ; - -<#if com != "true"> - (igeo:subdivisionDirecteDe/a) ?parent; - - igeo:nom ?intitule ; - igeo:nomSansArticle ?intituleSansArticle . -<#if territoire == "Intercommunalite"> - - - OPTIONAL { - ?uri a igeo:${territoire} ; - igeo:nomIntercommunalite ?intituleComplet . - } - - OPTIONAL { - ?uri a igeo:${territoire} ; - insee:categorieJuridique ?cj. - ?cj skos:prefLabel ?categorieJuridique. - } - -<#if code != "none"> - ?uri igeo:codeINSEE '${code}' . - BIND('${code}' as ?code) -<#else> - ?uri igeo:codeINSEE ?code . - - OPTIONAL { - ?evenementCreation igeo:creation ?uri ; - igeo:date ?dateCreation . - } - OPTIONAL { - ?evenementSuppression igeo:suppression ?uri ; - igeo:date ?dateSuppression. - } - -<#if chefLieu != "none"> - OPTIONAL { - ?uri igeo:${chefLieu} ?chefLieuRDF . - ?chefLieuRDF igeo:codeINSEE ?chefLieu. - OPTIONAL { - ?evenementCreationChefLieu igeo:creation ?chefLieuRDF ; - igeo:date ?dateCreationChefLieu . - } - OPTIONAL { - ?evenementSuppressionChefLieu igeo:suppression ?chefLieuRDF ; - igeo:date ?dateSuppressionChefLieu. - } - - <#if date != "*"> - FILTER(!BOUND(?dateCreationChefLieu) || ?dateCreationChefLieu <= '${date}'^^xsd:date) - FILTER(!BOUND(?dateSuppressionChefLieu) || ?dateSuppressionChefLieu > '${date}'^^xsd:date) - - - } - -<#if filtreNom != "*"> - BIND("${filtreNom ?no_esc}" AS ?query). - BIND (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?intitule), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "[-_\']", " "), "[^a-z0-9() ]", ""), "[ ]{2,}", " ") AS ?formattedNom) . - BIND (REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?intituleSansArticle), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "[-_']", " "), "[^a-z0-9() ]", ""), "[ ]{2,}", " ") AS ?formattedNomSansArticle) . - BIND (CONCAT("^", REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(LCASE(?query), "[àáâãäåaaa]", "a"), "ç", "c"), "[èééêë]", "e"), "[ìíîïì]", "i"), "[óôõö]", "o"), "[ùúûü]", "u"), "ÿ", "y"), "[œ]", "oe"), "([^/]+)[/]", "$1-sur-"),"([^\\\\]+)[\\\\]", "$1-sous-"), "[-_']", " "),"[^a-z0-9() ]", ""), "[ ]{2,}", " "), "^st(e)? ", "saint$1 "), "") AS ?formattedQuery) . - FILTER (REGEX(?formattedNom, ?formattedQuery) || REGEX(?formattedNomSansArticle, ?formattedQuery)) - -<#if com != "true"> -FILTER(REGEX(STR(?parent), "(Departement|Arrondissement)$")) - -<#if date != "*"> - FILTER(!BOUND(?dateCreation) || ?dateCreation <= '${date}'^^xsd:date) - FILTER(!BOUND(?dateSuppression) || ?dateSuppression > '${date}'^^xsd:date) - - - } - ORDER BY ?code - \ No newline at end of file diff --git a/src/main/resources/rmes-api.properties b/src/main/resources/rmes-api.properties deleted file mode 100644 index 95f5a446..00000000 --- a/src/main/resources/rmes-api.properties +++ /dev/null @@ -1,17 +0,0 @@ -# log -fr.insee.rmes.api.log.configuration = log4j2.xml - -# database -fr.insee.rmes.api.sparqlEndpoint = XXXXX -fr.insee.rmes.api.baseHost = http://id.insee.fr - -# files storage -# physical place -fr.insee.rmes.api.storage.document = C:/Temp/metadata-api -# just the short name after physical place for documents -fr.insee.rmes.api.fileStorage = /storage/documents/ - -# API -fr.insee.rmes.api.host= localhost:8080 -fr.insee.rmes.api.basepath= metadata-api -fr.insee.rmes.api.force.ssl = false diff --git a/src/main/webapp/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF deleted file mode 100644 index 254272e1..00000000 --- a/src/main/webapp/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml deleted file mode 100644 index b461ad45..00000000 --- a/src/main/webapp/WEB-INF/web.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - RMéS metadata API - - - - - - fr.insee.rmes.config.Configuration - - - - - default - fr.insee.rmes.config.StaticFilter - - - default - /swagger-ui/* - - - default - / - - - - - CorsFilter - org.apache.catalina.filters.CorsFilter - - cors.allowed.origins - * - - - cors.allowed.methods - GET,POST,HEAD,OPTIONS,PUT - - - cors.allowed.headers - Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers - - - cors.exposed.headers - Access-Control-Allow-Origin,Access-Control-Allow-Credentials,Content-Disposition - - - - CorsFilter - /* - - - - - jersey-filter - org.glassfish.jersey.servlet.ServletContainer - - jersey.config.server.provider.packages - fr.insee.rmes.api,io.swagger.jaxrs.v3.jaxrs2.integration.resources - - - jakarta.ws.rs.Application - fr.insee.rmes.config.MetadataApiConfig - - - jersey.config.server.tracing.type - ON_DEMAND - - - jersey.config.server.tracing.threshold - VERBOSE - - - jersey.config.server.provider.classnames - org.glassfish.jersey.filter.LoggingFilter - - 1 - - - jersey-filter - /* - - \ No newline at end of file diff --git a/src/main/webapp/swagger-ui/favicon-16x16.png b/src/main/webapp/swagger-ui/favicon-16x16.png deleted file mode 100644 index 0f7e13b0..00000000 Binary files a/src/main/webapp/swagger-ui/favicon-16x16.png and /dev/null differ diff --git a/src/main/webapp/swagger-ui/favicon-32x32.png b/src/main/webapp/swagger-ui/favicon-32x32.png deleted file mode 100644 index b0a3352f..00000000 Binary files a/src/main/webapp/swagger-ui/favicon-32x32.png and /dev/null differ diff --git a/src/main/webapp/swagger-ui/index.html b/src/main/webapp/swagger-ui/index.html deleted file mode 100644 index 92580580..00000000 --- a/src/main/webapp/swagger-ui/index.html +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - Swagger UI - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - diff --git a/src/main/webapp/swagger-ui/oauth2-redirect.html b/src/main/webapp/swagger-ui/oauth2-redirect.html deleted file mode 100644 index 4056fcc2..00000000 --- a/src/main/webapp/swagger-ui/oauth2-redirect.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - OAuth - - - - - diff --git a/src/main/webapp/swagger-ui/swagger-ui-bundle.js b/src/main/webapp/swagger-ui/swagger-ui-bundle.js deleted file mode 100644 index 09dc2e29..00000000 --- a/src/main/webapp/swagger-ui/swagger-ui-bundle.js +++ /dev/null @@ -1,93 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.SwaggerUIBundle=t():e.SwaggerUIBundle=t()}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/dist",n(n.s=446)}([function(e,t,n){"use strict";e.exports=n(74)},function(e,t,n){e.exports=n(853)()},function(e,t,n){"use strict";t.__esModule=!0,t.default=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(262),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(){function e(e,t){for(var n=0;n>>0;if(""+n!==t||4294967295===n)return NaN;t=n}return t<0?C(e)+t:t}function A(){return!0}function O(e,t,n){return(0===e||void 0!==n&&e<=-n)&&(void 0===t||void 0!==n&&t>=n)}function P(e,t){return M(e,t,0)}function T(e,t){return M(e,t,t)}function M(e,t,n){return void 0===e?n:e<0?Math.max(0,t+e):void 0===t?e:Math.min(t,e)}var I=0,j=1,N=2,R="function"==typeof Symbol&&Symbol.iterator,D="@@iterator",L=R||D;function U(e){this.next=e}function q(e,t,n,r){var o=0===e?t:1===e?n:[t,n];return r?r.value=o:r={value:o,done:!1},r}function F(){return{value:void 0,done:!0}}function z(e){return!!H(e)}function B(e){return e&&"function"==typeof e.next}function V(e){var t=H(e);return t&&t.call(e)}function H(e){var t=e&&(R&&e[R]||e[D]);if("function"==typeof t)return t}function W(e){return e&&"number"==typeof e.length}function J(e){return null===e||void 0===e?ie():a(e)?e.toSeq():function(e){var t=se(e)||"object"==typeof e&&new te(e);if(!t)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+e);return t}(e)}function Y(e){return null===e||void 0===e?ie().toKeyedSeq():a(e)?u(e)?e.toSeq():e.fromEntrySeq():ae(e)}function K(e){return null===e||void 0===e?ie():a(e)?u(e)?e.entrySeq():e.toIndexedSeq():ue(e)}function G(e){return(null===e||void 0===e?ie():a(e)?u(e)?e.entrySeq():e:ue(e)).toSetSeq()}U.prototype.toString=function(){return"[Iterator]"},U.KEYS=I,U.VALUES=j,U.ENTRIES=N,U.prototype.inspect=U.prototype.toSource=function(){return this.toString()},U.prototype[L]=function(){return this},t(J,n),J.of=function(){return J(arguments)},J.prototype.toSeq=function(){return this},J.prototype.toString=function(){return this.__toString("Seq {","}")},J.prototype.cacheResult=function(){return!this._cache&&this.__iterateUncached&&(this._cache=this.entrySeq().toArray(),this.size=this._cache.length),this},J.prototype.__iterate=function(e,t){return le(this,e,t,!0)},J.prototype.__iterator=function(e,t){return ce(this,e,t,!0)},t(Y,J),Y.prototype.toKeyedSeq=function(){return this},t(K,J),K.of=function(){return K(arguments)},K.prototype.toIndexedSeq=function(){return this},K.prototype.toString=function(){return this.__toString("Seq [","]")},K.prototype.__iterate=function(e,t){return le(this,e,t,!1)},K.prototype.__iterator=function(e,t){return ce(this,e,t,!1)},t(G,J),G.of=function(){return G(arguments)},G.prototype.toSetSeq=function(){return this},J.isSeq=oe,J.Keyed=Y,J.Set=G,J.Indexed=K;var $,Z,X,Q="@@__IMMUTABLE_SEQ__@@";function ee(e){this._array=e,this.size=e.length}function te(e){var t=Object.keys(e);this._object=e,this._keys=t,this.size=t.length}function ne(e){this._iterable=e,this.size=e.length||e.size}function re(e){this._iterator=e,this._iteratorCache=[]}function oe(e){return!(!e||!e[Q])}function ie(){return $||($=new ee([]))}function ae(e){var t=Array.isArray(e)?new ee(e).fromEntrySeq():B(e)?new re(e).fromEntrySeq():z(e)?new ne(e).fromEntrySeq():"object"==typeof e?new te(e):void 0;if(!t)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+e);return t}function ue(e){var t=se(e);if(!t)throw new TypeError("Expected Array or iterable object of values: "+e);return t}function se(e){return W(e)?new ee(e):B(e)?new re(e):z(e)?new ne(e):void 0}function le(e,t,n,r){var o=e._cache;if(o){for(var i=o.length-1,a=0;a<=i;a++){var u=o[n?i-a:a];if(!1===t(u[1],r?u[0]:a,e))return a+1}return a}return e.__iterateUncached(t,n)}function ce(e,t,n,r){var o=e._cache;if(o){var i=o.length-1,a=0;return new U(function(){var e=o[n?i-a:a];return a++>i?{value:void 0,done:!0}:q(t,r?e[0]:a-1,e[1])})}return e.__iteratorUncached(t,n)}function fe(e,t){return t?function e(t,n,r,o){if(Array.isArray(n))return t.call(o,r,K(n).map(function(r,o){return e(t,r,o,n)}));if(de(n))return t.call(o,r,Y(n).map(function(r,o){return e(t,r,o,n)}));return n}(t,e,"",{"":e}):pe(e)}function pe(e){return Array.isArray(e)?K(e).map(pe).toList():de(e)?Y(e).map(pe).toMap():e}function de(e){return e&&(e.constructor===Object||void 0===e.constructor)}function he(e,t){if(e===t||e!=e&&t!=t)return!0;if(!e||!t)return!1;if("function"==typeof e.valueOf&&"function"==typeof t.valueOf){if((e=e.valueOf())===(t=t.valueOf())||e!=e&&t!=t)return!0;if(!e||!t)return!1}return!("function"!=typeof e.equals||"function"!=typeof t.equals||!e.equals(t))}function ve(e,t){if(e===t)return!0;if(!a(t)||void 0!==e.size&&void 0!==t.size&&e.size!==t.size||void 0!==e.__hash&&void 0!==t.__hash&&e.__hash!==t.__hash||u(e)!==u(t)||s(e)!==s(t)||c(e)!==c(t))return!1;if(0===e.size&&0===t.size)return!0;var n=!l(e);if(c(e)){var r=e.entries();return t.every(function(e,t){var o=r.next().value;return o&&he(o[1],e)&&(n||he(o[0],t))})&&r.next().done}var o=!1;if(void 0===e.size)if(void 0===t.size)"function"==typeof e.cacheResult&&e.cacheResult();else{o=!0;var i=e;e=t,t=i}var f=!0,p=t.__iterate(function(t,r){if(n?!e.has(t):o?!he(t,e.get(r,y)):!he(e.get(r,y),t))return f=!1,!1});return f&&e.size===p}function me(e,t){if(!(this instanceof me))return new me(e,t);if(this._value=e,this.size=void 0===t?1/0:Math.max(0,t),0===this.size){if(Z)return Z;Z=this}}function ge(e,t){if(!e)throw new Error(t)}function ye(e,t,n){if(!(this instanceof ye))return new ye(e,t,n);if(ge(0!==n,"Cannot step a Range by 0"),e=e||0,void 0===t&&(t=1/0),n=void 0===n?1:Math.abs(n),tr?{value:void 0,done:!0}:q(e,o,n[t?r-o++:o++])})},t(te,Y),te.prototype.get=function(e,t){return void 0===t||this.has(e)?this._object[e]:t},te.prototype.has=function(e){return this._object.hasOwnProperty(e)},te.prototype.__iterate=function(e,t){for(var n=this._object,r=this._keys,o=r.length-1,i=0;i<=o;i++){var a=r[t?o-i:i];if(!1===e(n[a],a,this))return i+1}return i},te.prototype.__iterator=function(e,t){var n=this._object,r=this._keys,o=r.length-1,i=0;return new U(function(){var a=r[t?o-i:i];return i++>o?{value:void 0,done:!0}:q(e,a,n[a])})},te.prototype[h]=!0,t(ne,K),ne.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);var n=V(this._iterable),r=0;if(B(n))for(var o;!(o=n.next()).done&&!1!==e(o.value,r++,this););return r},ne.prototype.__iteratorUncached=function(e,t){if(t)return this.cacheResult().__iterator(e,t);var n=V(this._iterable);if(!B(n))return new U(F);var r=0;return new U(function(){var t=n.next();return t.done?t:q(e,r++,t.value)})},t(re,K),re.prototype.__iterateUncached=function(e,t){if(t)return this.cacheResult().__iterate(e,t);for(var n,r=this._iterator,o=this._iteratorCache,i=0;i=r.length){var t=n.next();if(t.done)return t;r[o]=t.value}return q(e,o,r[o++])})},t(me,K),me.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},me.prototype.get=function(e,t){return this.has(e)?this._value:t},me.prototype.includes=function(e){return he(this._value,e)},me.prototype.slice=function(e,t){var n=this.size;return O(e,t,n)?this:new me(this._value,T(t,n)-P(e,n))},me.prototype.reverse=function(){return this},me.prototype.indexOf=function(e){return he(this._value,e)?0:-1},me.prototype.lastIndexOf=function(e){return he(this._value,e)?this.size:-1},me.prototype.__iterate=function(e,t){for(var n=0;n=0&&t=0&&nn?{value:void 0,done:!0}:q(e,i++,a)})},ye.prototype.equals=function(e){return e instanceof ye?this._start===e._start&&this._end===e._end&&this._step===e._step:ve(this,e)},t(be,n),t(_e,be),t(we,be),t(Ee,be),be.Keyed=_e,be.Indexed=we,be.Set=Ee;var xe="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(e,t){var n=65535&(e|=0),r=65535&(t|=0);return n*r+((e>>>16)*r+n*(t>>>16)<<16>>>0)|0};function Se(e){return e>>>1&1073741824|3221225471&e}function Ce(e){if(!1===e||null===e||void 0===e)return 0;if("function"==typeof e.valueOf&&(!1===(e=e.valueOf())||null===e||void 0===e))return 0;if(!0===e)return 1;var t=typeof e;if("number"===t){if(e!=e||e===1/0)return 0;var n=0|e;for(n!==e&&(n^=4294967295*e);e>4294967295;)n^=e/=4294967295;return Se(n)}if("string"===t)return e.length>je?function(e){var t=De[e];void 0===t&&(t=ke(e),Re===Ne&&(Re=0,De={}),Re++,De[e]=t);return t}(e):ke(e);if("function"==typeof e.hashCode)return e.hashCode();if("object"===t)return function(e){var t;if(Te&&void 0!==(t=Pe.get(e)))return t;if(void 0!==(t=e[Ie]))return t;if(!Oe){if(void 0!==(t=e.propertyIsEnumerable&&e.propertyIsEnumerable[Ie]))return t;if(void 0!==(t=function(e){if(e&&e.nodeType>0)switch(e.nodeType){case 1:return e.uniqueID;case 9:return e.documentElement&&e.documentElement.uniqueID}}(e)))return t}t=++Me,1073741824&Me&&(Me=0);if(Te)Pe.set(e,t);else{if(void 0!==Ae&&!1===Ae(e))throw new Error("Non-extensible objects are not allowed as keys.");if(Oe)Object.defineProperty(e,Ie,{enumerable:!1,configurable:!1,writable:!1,value:t});else if(void 0!==e.propertyIsEnumerable&&e.propertyIsEnumerable===e.constructor.prototype.propertyIsEnumerable)e.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},e.propertyIsEnumerable[Ie]=t;else{if(void 0===e.nodeType)throw new Error("Unable to set a non-enumerable property on object.");e[Ie]=t}}return t}(e);if("function"==typeof e.toString)return ke(e.toString());throw new Error("Value type "+t+" cannot be hashed.")}function ke(e){for(var t=0,n=0;n=t.length)throw new Error("Missing value for key: "+t[n]);e.set(t[n],t[n+1])}})},Ue.prototype.toString=function(){return this.__toString("Map {","}")},Ue.prototype.get=function(e,t){return this._root?this._root.get(0,void 0,e,t):t},Ue.prototype.set=function(e,t){return Qe(this,e,t)},Ue.prototype.setIn=function(e,t){return this.updateIn(e,y,function(){return t})},Ue.prototype.remove=function(e){return Qe(this,e,y)},Ue.prototype.deleteIn=function(e){return this.updateIn(e,function(){return y})},Ue.prototype.update=function(e,t,n){return 1===arguments.length?e(this):this.updateIn([e],t,n)},Ue.prototype.updateIn=function(e,t,n){n||(n=t,t=void 0);var r=function e(t,n,r,o){var i=t===y;var a=n.next();if(a.done){var u=i?r:t,s=o(u);return s===u?t:s}ge(i||t&&t.set,"invalid keyPath");var l=a.value;var c=i?y:t.get(l,y);var f=e(c,n,r,o);return f===c?t:f===y?t.remove(l):(i?Xe():t).set(l,f)}(this,nn(e),t,n);return r===y?void 0:r},Ue.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):Xe()},Ue.prototype.merge=function(){return rt(this,void 0,arguments)},Ue.prototype.mergeWith=function(t){return rt(this,t,e.call(arguments,1))},Ue.prototype.mergeIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,Xe(),function(e){return"function"==typeof e.merge?e.merge.apply(e,n):n[n.length-1]})},Ue.prototype.mergeDeep=function(){return rt(this,ot,arguments)},Ue.prototype.mergeDeepWith=function(t){var n=e.call(arguments,1);return rt(this,it(t),n)},Ue.prototype.mergeDeepIn=function(t){var n=e.call(arguments,1);return this.updateIn(t,Xe(),function(e){return"function"==typeof e.mergeDeep?e.mergeDeep.apply(e,n):n[n.length-1]})},Ue.prototype.sort=function(e){return Pt(Wt(this,e))},Ue.prototype.sortBy=function(e,t){return Pt(Wt(this,t,e))},Ue.prototype.withMutations=function(e){var t=this.asMutable();return e(t),t.wasAltered()?t.__ensureOwner(this.__ownerID):this},Ue.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new x)},Ue.prototype.asImmutable=function(){return this.__ensureOwner()},Ue.prototype.wasAltered=function(){return this.__altered},Ue.prototype.__iterator=function(e,t){return new Ke(this,e,t)},Ue.prototype.__iterate=function(e,t){var n=this,r=0;return this._root&&this._root.iterate(function(t){return r++,e(t[1],t[0],n)},t),r},Ue.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?Ze(this.size,this._root,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},Ue.isMap=qe;var Fe,ze="@@__IMMUTABLE_MAP__@@",Be=Ue.prototype;function Ve(e,t){this.ownerID=e,this.entries=t}function He(e,t,n){this.ownerID=e,this.bitmap=t,this.nodes=n}function We(e,t,n){this.ownerID=e,this.count=t,this.nodes=n}function Je(e,t,n){this.ownerID=e,this.keyHash=t,this.entries=n}function Ye(e,t,n){this.ownerID=e,this.keyHash=t,this.entry=n}function Ke(e,t,n){this._type=t,this._reverse=n,this._stack=e._root&&$e(e._root)}function Ge(e,t){return q(e,t[0],t[1])}function $e(e,t){return{node:e,index:0,__prev:t}}function Ze(e,t,n,r){var o=Object.create(Be);return o.size=e,o._root=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function Xe(){return Fe||(Fe=Ze(0))}function Qe(e,t,n){var r,o;if(e._root){var i=w(b),a=w(_);if(r=et(e._root,e.__ownerID,0,void 0,t,n,i,a),!a.value)return e;o=e.size+(i.value?n===y?-1:1:0)}else{if(n===y)return e;o=1,r=new Ve(e.__ownerID,[[t,n]])}return e.__ownerID?(e.size=o,e._root=r,e.__hash=void 0,e.__altered=!0,e):r?Ze(o,r):Xe()}function et(e,t,n,r,o,i,a,u){return e?e.update(t,n,r,o,i,a,u):i===y?e:(E(u),E(a),new Ye(t,r,[o,i]))}function tt(e){return e.constructor===Ye||e.constructor===Je}function nt(e,t,n,r,o){if(e.keyHash===r)return new Je(t,r,[e.entry,o]);var i,a=(0===n?e.keyHash:e.keyHash>>>n)&g,u=(0===n?r:r>>>n)&g;return new He(t,1<>1&1431655765))+(e>>2&858993459))+(e>>4)&252645135,e+=e>>8,127&(e+=e>>16)}function st(e,t,n,r){var o=r?e:S(e);return o[t]=n,o}Be[ze]=!0,Be.delete=Be.remove,Be.removeIn=Be.deleteIn,Ve.prototype.get=function(e,t,n,r){for(var o=this.entries,i=0,a=o.length;i=lt)return function(e,t,n,r){e||(e=new x);for(var o=new Ye(e,Ce(n),[n,r]),i=0;i>>e)&g),i=this.bitmap;return 0==(i&o)?r:this.nodes[ut(i&o-1)].get(e+v,t,n,r)},He.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=Ce(r));var u=(0===t?n:n>>>t)&g,s=1<=ct)return function(e,t,n,r,o){for(var i=0,a=new Array(m),u=0;0!==n;u++,n>>>=1)a[u]=1&n?t[i++]:void 0;return a[r]=o,new We(e,i+1,a)}(e,p,l,u,h);if(c&&!h&&2===p.length&&tt(p[1^f]))return p[1^f];if(c&&h&&1===p.length&&tt(h))return h;var b=e&&e===this.ownerID,_=c?h?l:l^s:l|s,w=c?h?st(p,f,h,b):function(e,t,n){var r=e.length-1;if(n&&t===r)return e.pop(),e;for(var o=new Array(r),i=0,a=0;a>>e)&g,i=this.nodes[o];return i?i.get(e+v,t,n,r):r},We.prototype.update=function(e,t,n,r,o,i,a){void 0===n&&(n=Ce(r));var u=(0===t?n:n>>>t)&g,s=o===y,l=this.nodes,c=l[u];if(s&&!c)return this;var f=et(c,e,t+v,n,r,o,i,a);if(f===c)return this;var p=this.count;if(c){if(!f&&--p0&&r=0&&e=e.size||t<0)return e.withMutations(function(e){t<0?kt(e,t).set(0,n):kt(e,0,t+1).set(t,n)});t+=e._origin;var r=e._tail,o=e._root,i=w(_);t>=Ot(e._capacity)?r=xt(r,e.__ownerID,0,t,n,i):o=xt(o,e.__ownerID,e._level,t,n,i);if(!i.value)return e;if(e.__ownerID)return e._root=o,e._tail=r,e.__hash=void 0,e.__altered=!0,e;return wt(e._origin,e._capacity,e._level,o,r)}(this,e,t)},pt.prototype.remove=function(e){return this.has(e)?0===e?this.shift():e===this.size-1?this.pop():this.splice(e,1):this},pt.prototype.insert=function(e,t){return this.splice(e,0,t)},pt.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=v,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):Et()},pt.prototype.push=function(){var e=arguments,t=this.size;return this.withMutations(function(n){kt(n,0,t+e.length);for(var r=0;r>>t&g;if(r>=this.array.length)return new mt([],e);var o,i=0===r;if(t>0){var a=this.array[r];if((o=a&&a.removeBefore(e,t-v,n))===a&&i)return this}if(i&&!o)return this;var u=St(this,e);if(!i)for(var s=0;s>>t&g;if(o>=this.array.length)return this;if(t>0){var i=this.array[o];if((r=i&&i.removeAfter(e,t-v,n))===i&&o===this.array.length-1)return this}var a=St(this,e);return a.array.splice(o+1),r&&(a.array[o]=r),a};var gt,yt,bt={};function _t(e,t){var n=e._origin,r=e._capacity,o=Ot(r),i=e._tail;return a(e._root,e._level,0);function a(e,u,s){return 0===u?function(e,a){var u=a===o?i&&i.array:e&&e.array,s=a>n?0:n-a,l=r-a;l>m&&(l=m);return function(){if(s===l)return bt;var e=t?--l:s++;return u&&u[e]}}(e,s):function(e,o,i){var u,s=e&&e.array,l=i>n?0:n-i>>o,c=1+(r-i>>o);c>m&&(c=m);return function(){for(;;){if(u){var e=u();if(e!==bt)return e;u=null}if(l===c)return bt;var n=t?--c:l++;u=a(s&&s[n],o-v,i+(n<>>n&g,s=e&&u0){var l=e&&e.array[u],c=xt(l,t,n-v,r,o,i);return c===l?e:((a=St(e,t)).array[u]=c,a)}return s&&e.array[u]===o?e:(E(i),a=St(e,t),void 0===o&&u===a.array.length-1?a.array.pop():a.array[u]=o,a)}function St(e,t){return t&&e&&t===e.ownerID?e:new mt(e?e.array.slice():[],t)}function Ct(e,t){if(t>=Ot(e._capacity))return e._tail;if(t<1<0;)n=n.array[t>>>r&g],r-=v;return n}}function kt(e,t,n){void 0!==t&&(t|=0),void 0!==n&&(n|=0);var r=e.__ownerID||new x,o=e._origin,i=e._capacity,a=o+t,u=void 0===n?i:n<0?i+n:o+n;if(a===o&&u===i)return e;if(a>=u)return e.clear();for(var s=e._level,l=e._root,c=0;a+c<0;)l=new mt(l&&l.array.length?[void 0,l]:[],r),c+=1<<(s+=v);c&&(a+=c,o+=c,u+=c,i+=c);for(var f=Ot(i),p=Ot(u);p>=1<f?new mt([],r):d;if(d&&p>f&&av;y-=v){var b=f>>>y&g;m=m.array[b]=St(m.array[b],r)}m.array[f>>>v&g]=d}if(u=p)a-=p,u-=p,s=v,l=null,h=h&&h.removeBefore(r,0,a);else if(a>o||p>>s&g;if(_!==p>>>s&g)break;_&&(c+=(1<o&&(l=l.removeBefore(r,s,a-c)),l&&pi&&(i=l.size),a(s)||(l=l.map(function(e){return fe(e)})),r.push(l)}return i>e.size&&(e=e.setSize(i)),at(e,t,r)}function Ot(e){return e>>v<=m&&a.size>=2*i.size?(r=(o=a.filter(function(e,t){return void 0!==e&&u!==t})).toKeyedSeq().map(function(e){return e[0]}).flip().toMap(),e.__ownerID&&(r.__ownerID=o.__ownerID=e.__ownerID)):(r=i.remove(t),o=u===a.size-1?a.pop():a.set(u,void 0))}else if(s){if(n===a.get(u)[1])return e;r=i,o=a.set(u,[t,n])}else r=i.set(t,a.size),o=a.set(a.size,[t,n]);return e.__ownerID?(e.size=r.size,e._map=r,e._list=o,e.__hash=void 0,e):Mt(r,o)}function Nt(e,t){this._iter=e,this._useKeys=t,this.size=e.size}function Rt(e){this._iter=e,this.size=e.size}function Dt(e){this._iter=e,this.size=e.size}function Lt(e){this._iter=e,this.size=e.size}function Ut(e){var t=Qt(e);return t._iter=e,t.size=e.size,t.flip=function(){return e},t.reverse=function(){var t=e.reverse.apply(this);return t.flip=function(){return e.reverse()},t},t.has=function(t){return e.includes(t)},t.includes=function(t){return e.has(t)},t.cacheResult=en,t.__iterateUncached=function(t,n){var r=this;return e.__iterate(function(e,n){return!1!==t(n,e,r)},n)},t.__iteratorUncached=function(t,n){if(t===N){var r=e.__iterator(t,n);return new U(function(){var e=r.next();if(!e.done){var t=e.value[0];e.value[0]=e.value[1],e.value[1]=t}return e})}return e.__iterator(t===j?I:j,n)},t}function qt(e,t,n){var r=Qt(e);return r.size=e.size,r.has=function(t){return e.has(t)},r.get=function(r,o){var i=e.get(r,y);return i===y?o:t.call(n,i,r,e)},r.__iterateUncached=function(r,o){var i=this;return e.__iterate(function(e,o,a){return!1!==r(t.call(n,e,o,a),o,i)},o)},r.__iteratorUncached=function(r,o){var i=e.__iterator(N,o);return new U(function(){var o=i.next();if(o.done)return o;var a=o.value,u=a[0];return q(r,u,t.call(n,a[1],u,e),o)})},r}function Ft(e,t){var n=Qt(e);return n._iter=e,n.size=e.size,n.reverse=function(){return e},e.flip&&(n.flip=function(){var t=Ut(e);return t.reverse=function(){return e.flip()},t}),n.get=function(n,r){return e.get(t?n:-1-n,r)},n.has=function(n){return e.has(t?n:-1-n)},n.includes=function(t){return e.includes(t)},n.cacheResult=en,n.__iterate=function(t,n){var r=this;return e.__iterate(function(e,n){return t(e,n,r)},!n)},n.__iterator=function(t,n){return e.__iterator(t,!n)},n}function zt(e,t,n,r){var o=Qt(e);return r&&(o.has=function(r){var o=e.get(r,y);return o!==y&&!!t.call(n,o,r,e)},o.get=function(r,o){var i=e.get(r,y);return i!==y&&t.call(n,i,r,e)?i:o}),o.__iterateUncached=function(o,i){var a=this,u=0;return e.__iterate(function(e,i,s){if(t.call(n,e,i,s))return u++,o(e,r?i:u-1,a)},i),u},o.__iteratorUncached=function(o,i){var a=e.__iterator(N,i),u=0;return new U(function(){for(;;){var i=a.next();if(i.done)return i;var s=i.value,l=s[0],c=s[1];if(t.call(n,c,l,e))return q(o,r?l:u++,c,i)}})},o}function Bt(e,t,n,r){var o=e.size;if(void 0!==t&&(t|=0),void 0!==n&&(n===1/0?n=o:n|=0),O(t,n,o))return e;var i=P(t,o),a=T(n,o);if(i!=i||a!=a)return Bt(e.toSeq().cacheResult(),t,n,r);var u,s=a-i;s==s&&(u=s<0?0:s);var l=Qt(e);return l.size=0===u?u:e.size&&u||void 0,!r&&oe(e)&&u>=0&&(l.get=function(t,n){return(t=k(this,t))>=0&&tu)return{value:void 0,done:!0};var e=o.next();return r||t===j?e:q(t,s-1,t===I?void 0:e.value[1],e)})},l}function Vt(e,t,n,r){var o=Qt(e);return o.__iterateUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterate(o,i);var u=!0,s=0;return e.__iterate(function(e,i,l){if(!u||!(u=t.call(n,e,i,l)))return s++,o(e,r?i:s-1,a)}),s},o.__iteratorUncached=function(o,i){var a=this;if(i)return this.cacheResult().__iterator(o,i);var u=e.__iterator(N,i),s=!0,l=0;return new U(function(){var e,i,c;do{if((e=u.next()).done)return r||o===j?e:q(o,l++,o===I?void 0:e.value[1],e);var f=e.value;i=f[0],c=f[1],s&&(s=t.call(n,c,i,a))}while(s);return o===N?e:q(o,i,c,e)})},o}function Ht(e,t,n){var r=Qt(e);return r.__iterateUncached=function(r,o){var i=0,u=!1;return function e(s,l){var c=this;s.__iterate(function(o,s){return(!t||l0}function Kt(e,t,r){var o=Qt(e);return o.size=new ee(r).map(function(e){return e.size}).min(),o.__iterate=function(e,t){for(var n,r=this.__iterator(j,t),o=0;!(n=r.next()).done&&!1!==e(n.value,o++,this););return o},o.__iteratorUncached=function(e,o){var i=r.map(function(e){return e=n(e),V(o?e.reverse():e)}),a=0,u=!1;return new U(function(){var n;return u||(n=i.map(function(e){return e.next()}),u=n.some(function(e){return e.done})),u?{value:void 0,done:!0}:q(e,a++,t.apply(null,n.map(function(e){return e.value})))})},o}function Gt(e,t){return oe(e)?t:e.constructor(t)}function $t(e){if(e!==Object(e))throw new TypeError("Expected [K, V] tuple: "+e)}function Zt(e){return Le(e.size),C(e)}function Xt(e){return u(e)?r:s(e)?o:i}function Qt(e){return Object.create((u(e)?Y:s(e)?K:G).prototype)}function en(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):J.prototype.cacheResult.call(this)}function tn(e,t){return e>t?1:e=0;n--)t={value:arguments[n],next:t};return this.__ownerID?(this.size=e,this._head=t,this.__hash=void 0,this.__altered=!0,this):An(e,t)},En.prototype.pushAll=function(e){if(0===(e=o(e)).size)return this;Le(e.size);var t=this.size,n=this._head;return e.reverse().forEach(function(e){t++,n={value:e,next:n}}),this.__ownerID?(this.size=t,this._head=n,this.__hash=void 0,this.__altered=!0,this):An(t,n)},En.prototype.pop=function(){return this.slice(1)},En.prototype.unshift=function(){return this.push.apply(this,arguments)},En.prototype.unshiftAll=function(e){return this.pushAll(e)},En.prototype.shift=function(){return this.pop.apply(this,arguments)},En.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):On()},En.prototype.slice=function(e,t){if(O(e,t,this.size))return this;var n=P(e,this.size);if(T(t,this.size)!==this.size)return we.prototype.slice.call(this,e,t);for(var r=this.size-n,o=this._head;n--;)o=o.next;return this.__ownerID?(this.size=r,this._head=o,this.__hash=void 0,this.__altered=!0,this):An(r,o)},En.prototype.__ensureOwner=function(e){return e===this.__ownerID?this:e?An(this.size,this._head,e,this.__hash):(this.__ownerID=e,this.__altered=!1,this)},En.prototype.__iterate=function(e,t){if(t)return this.reverse().__iterate(e);for(var n=0,r=this._head;r&&!1!==e(r.value,n++,this);)r=r.next;return n},En.prototype.__iterator=function(e,t){if(t)return this.reverse().__iterator(e);var n=0,r=this._head;return new U(function(){if(r){var t=r.value;return r=r.next,q(e,n++,t)}return{value:void 0,done:!0}})},En.isStack=xn;var Sn,Cn="@@__IMMUTABLE_STACK__@@",kn=En.prototype;function An(e,t,n,r){var o=Object.create(kn);return o.size=e,o._head=t,o.__ownerID=n,o.__hash=r,o.__altered=!1,o}function On(){return Sn||(Sn=An(0))}function Pn(e,t){var n=function(n){e.prototype[n]=t[n]};return Object.keys(t).forEach(n),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(t).forEach(n),e}kn[Cn]=!0,kn.withMutations=Be.withMutations,kn.asMutable=Be.asMutable,kn.asImmutable=Be.asImmutable,kn.wasAltered=Be.wasAltered,n.Iterator=U,Pn(n,{toArray:function(){Le(this.size);var e=new Array(this.size||0);return this.valueSeq().__iterate(function(t,n){e[n]=t}),e},toIndexedSeq:function(){return new Rt(this)},toJS:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJS?e.toJS():e}).__toJS()},toJSON:function(){return this.toSeq().map(function(e){return e&&"function"==typeof e.toJSON?e.toJSON():e}).__toJS()},toKeyedSeq:function(){return new Nt(this,!0)},toMap:function(){return Ue(this.toKeyedSeq())},toObject:function(){Le(this.size);var e={};return this.__iterate(function(t,n){e[n]=t}),e},toOrderedMap:function(){return Pt(this.toKeyedSeq())},toOrderedSet:function(){return mn(u(this)?this.valueSeq():this)},toSet:function(){return sn(u(this)?this.valueSeq():this)},toSetSeq:function(){return new Dt(this)},toSeq:function(){return s(this)?this.toIndexedSeq():u(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return En(u(this)?this.valueSeq():this)},toList:function(){return pt(u(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(e,t){return 0===this.size?e+t:e+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+t},concat:function(){return Gt(this,function(e,t){var n=u(e),o=[e].concat(t).map(function(e){return a(e)?n&&(e=r(e)):e=n?ae(e):ue(Array.isArray(e)?e:[e]),e}).filter(function(e){return 0!==e.size});if(0===o.length)return e;if(1===o.length){var i=o[0];if(i===e||n&&u(i)||s(e)&&s(i))return i}var l=new ee(o);return n?l=l.toKeyedSeq():s(e)||(l=l.toSetSeq()),(l=l.flatten(!0)).size=o.reduce(function(e,t){if(void 0!==e){var n=t.size;if(void 0!==n)return e+n}},0),l}(this,e.call(arguments,0)))},includes:function(e){return this.some(function(t){return he(t,e)})},entries:function(){return this.__iterator(N)},every:function(e,t){Le(this.size);var n=!0;return this.__iterate(function(r,o,i){if(!e.call(t,r,o,i))return n=!1,!1}),n},filter:function(e,t){return Gt(this,zt(this,e,t,!0))},find:function(e,t,n){var r=this.findEntry(e,t);return r?r[1]:n},forEach:function(e,t){return Le(this.size),this.__iterate(t?e.bind(t):e)},join:function(e){Le(this.size),e=void 0!==e?""+e:",";var t="",n=!0;return this.__iterate(function(r){n?n=!1:t+=e,t+=null!==r&&void 0!==r?r.toString():""}),t},keys:function(){return this.__iterator(I)},map:function(e,t){return Gt(this,qt(this,e,t))},reduce:function(e,t,n){var r,o;return Le(this.size),arguments.length<2?o=!0:r=t,this.__iterate(function(t,i,a){o?(o=!1,r=t):r=e.call(n,r,t,i,a)}),r},reduceRight:function(e,t,n){var r=this.toKeyedSeq().reverse();return r.reduce.apply(r,arguments)},reverse:function(){return Gt(this,Ft(this,!0))},slice:function(e,t){return Gt(this,Bt(this,e,t,!0))},some:function(e,t){return!this.every(Nn(e),t)},sort:function(e){return Gt(this,Wt(this,e))},values:function(){return this.__iterator(j)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some(function(){return!0})},count:function(e,t){return C(e?this.toSeq().filter(e,t):this)},countBy:function(e,t){return function(e,t,n){var r=Ue().asMutable();return e.__iterate(function(o,i){r.update(t.call(n,o,i,e),0,function(e){return e+1})}),r.asImmutable()}(this,e,t)},equals:function(e){return ve(this,e)},entrySeq:function(){var e=this;if(e._cache)return new ee(e._cache);var t=e.toSeq().map(jn).toIndexedSeq();return t.fromEntrySeq=function(){return e.toSeq()},t},filterNot:function(e,t){return this.filter(Nn(e),t)},findEntry:function(e,t,n){var r=n;return this.__iterate(function(n,o,i){if(e.call(t,n,o,i))return r=[o,n],!1}),r},findKey:function(e,t){var n=this.findEntry(e,t);return n&&n[0]},findLast:function(e,t,n){return this.toKeyedSeq().reverse().find(e,t,n)},findLastEntry:function(e,t,n){return this.toKeyedSeq().reverse().findEntry(e,t,n)},findLastKey:function(e,t){return this.toKeyedSeq().reverse().findKey(e,t)},first:function(){return this.find(A)},flatMap:function(e,t){return Gt(this,function(e,t,n){var r=Xt(e);return e.toSeq().map(function(o,i){return r(t.call(n,o,i,e))}).flatten(!0)}(this,e,t))},flatten:function(e){return Gt(this,Ht(this,e,!0))},fromEntrySeq:function(){return new Lt(this)},get:function(e,t){return this.find(function(t,n){return he(n,e)},void 0,t)},getIn:function(e,t){for(var n,r=this,o=nn(e);!(n=o.next()).done;){var i=n.value;if((r=r&&r.get?r.get(i,y):y)===y)return t}return r},groupBy:function(e,t){return function(e,t,n){var r=u(e),o=(c(e)?Pt():Ue()).asMutable();e.__iterate(function(i,a){o.update(t.call(n,i,a,e),function(e){return(e=e||[]).push(r?[a,i]:i),e})});var i=Xt(e);return o.map(function(t){return Gt(e,i(t))})}(this,e,t)},has:function(e){return this.get(e,y)!==y},hasIn:function(e){return this.getIn(e,y)!==y},isSubset:function(e){return e="function"==typeof e.includes?e:n(e),this.every(function(t){return e.includes(t)})},isSuperset:function(e){return(e="function"==typeof e.isSubset?e:n(e)).isSubset(this)},keyOf:function(e){return this.findKey(function(t){return he(t,e)})},keySeq:function(){return this.toSeq().map(In).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(e){return this.toKeyedSeq().reverse().keyOf(e)},max:function(e){return Jt(this,e)},maxBy:function(e,t){return Jt(this,t,e)},min:function(e){return Jt(this,e?Rn(e):Un)},minBy:function(e,t){return Jt(this,t?Rn(t):Un,e)},rest:function(){return this.slice(1)},skip:function(e){return this.slice(Math.max(0,e))},skipLast:function(e){return Gt(this,this.toSeq().reverse().skip(e).reverse())},skipWhile:function(e,t){return Gt(this,Vt(this,e,t,!0))},skipUntil:function(e,t){return this.skipWhile(Nn(e),t)},sortBy:function(e,t){return Gt(this,Wt(this,t,e))},take:function(e){return this.slice(0,Math.max(0,e))},takeLast:function(e){return Gt(this,this.toSeq().reverse().take(e).reverse())},takeWhile:function(e,t){return Gt(this,function(e,t,n){var r=Qt(e);return r.__iterateUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterate(r,o);var a=0;return e.__iterate(function(e,o,u){return t.call(n,e,o,u)&&++a&&r(e,o,i)}),a},r.__iteratorUncached=function(r,o){var i=this;if(o)return this.cacheResult().__iterator(r,o);var a=e.__iterator(N,o),u=!0;return new U(function(){if(!u)return{value:void 0,done:!0};var e=a.next();if(e.done)return e;var o=e.value,s=o[0],l=o[1];return t.call(n,l,s,i)?r===N?e:q(r,s,l,e):(u=!1,{value:void 0,done:!0})})},r}(this,e,t))},takeUntil:function(e,t){return this.takeWhile(Nn(e),t)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(e){if(e.size===1/0)return 0;var t=c(e),n=u(e),r=t?1:0;return function(e,t){return t=xe(t,3432918353),t=xe(t<<15|t>>>-15,461845907),t=xe(t<<13|t>>>-13,5),t=xe((t=(t+3864292196|0)^e)^t>>>16,2246822507),t=Se((t=xe(t^t>>>13,3266489909))^t>>>16)}(e.__iterate(n?t?function(e,t){r=31*r+qn(Ce(e),Ce(t))|0}:function(e,t){r=r+qn(Ce(e),Ce(t))|0}:t?function(e){r=31*r+Ce(e)|0}:function(e){r=r+Ce(e)|0}),r)}(this))}});var Tn=n.prototype;Tn[f]=!0,Tn[L]=Tn.values,Tn.__toJS=Tn.toArray,Tn.__toStringMapper=Dn,Tn.inspect=Tn.toSource=function(){return this.toString()},Tn.chain=Tn.flatMap,Tn.contains=Tn.includes,Pn(r,{flip:function(){return Gt(this,Ut(this))},mapEntries:function(e,t){var n=this,r=0;return Gt(this,this.toSeq().map(function(o,i){return e.call(t,[i,o],r++,n)}).fromEntrySeq())},mapKeys:function(e,t){var n=this;return Gt(this,this.toSeq().flip().map(function(r,o){return e.call(t,r,o,n)}).flip())}});var Mn=r.prototype;function In(e,t){return t}function jn(e,t){return[t,e]}function Nn(e){return function(){return!e.apply(this,arguments)}}function Rn(e){return function(){return-e.apply(this,arguments)}}function Dn(e){return"string"==typeof e?JSON.stringify(e):String(e)}function Ln(){return S(arguments)}function Un(e,t){return et?-1:0}function qn(e,t){return e^t+2654435769+(e<<6)+(e>>2)|0}return Mn[p]=!0,Mn[L]=Tn.entries,Mn.__toJS=Tn.toObject,Mn.__toStringMapper=function(e,t){return JSON.stringify(t)+": "+Dn(e)},Pn(o,{toKeyedSeq:function(){return new Nt(this,!1)},filter:function(e,t){return Gt(this,zt(this,e,t,!1))},findIndex:function(e,t){var n=this.findEntry(e,t);return n?n[0]:-1},indexOf:function(e){var t=this.keyOf(e);return void 0===t?-1:t},lastIndexOf:function(e){var t=this.lastKeyOf(e);return void 0===t?-1:t},reverse:function(){return Gt(this,Ft(this,!1))},slice:function(e,t){return Gt(this,Bt(this,e,t,!1))},splice:function(e,t){var n=arguments.length;if(t=Math.max(0|t,0),0===n||2===n&&!t)return this;e=P(e,e<0?this.count():this.size);var r=this.slice(0,e);return Gt(this,1===n?r:r.concat(S(arguments,2),this.slice(e+t)))},findLastIndex:function(e,t){var n=this.findLastEntry(e,t);return n?n[0]:-1},first:function(){return this.get(0)},flatten:function(e){return Gt(this,Ht(this,e,!1))},get:function(e,t){return(e=k(this,e))<0||this.size===1/0||void 0!==this.size&&e>this.size?t:this.find(function(t,n){return n===e},void 0,t)},has:function(e){return(e=k(this,e))>=0&&(void 0!==this.size?this.size===1/0||e>",i={listOf:function(e){return l(e,"List",r.List.isList)},mapOf:function(e,t){return c(e,t,"Map",r.Map.isMap)},orderedMapOf:function(e,t){return c(e,t,"OrderedMap",r.OrderedMap.isOrderedMap)},setOf:function(e){return l(e,"Set",r.Set.isSet)},orderedSetOf:function(e){return l(e,"OrderedSet",r.OrderedSet.isOrderedSet)},stackOf:function(e){return l(e,"Stack",r.Stack.isStack)},iterableOf:function(e){return l(e,"Iterable",r.Iterable.isIterable)},recordOf:function(e){return u(function(t,n,o,i,u){for(var s=arguments.length,l=Array(s>5?s-5:0),c=5;c6?s-6:0),c=6;c5?l-5:0),f=5;f5?i-5:0),u=5;u key("+c[f]+")"].concat(a));if(d instanceof Error)return d}})).apply(void 0,i);var s})}function f(e){var t=void 0===arguments[1]?"Iterable":arguments[1],n=void 0===arguments[2]?r.Iterable.isIterable:arguments[2];return u(function(r,o,i,u,s){for(var l=arguments.length,c=Array(l>5?l-5:0),f=5;f5e3)return e.textContent;return function(e){for(var n,r,o,i,a,u=e.textContent,s=0,l=u[0],c=1,f=e.innerHTML="",p=0;r=n,n=p<7&&"\\"==n?1:c;){if(c=l,l=u[++s],i=f.length>1,!c||p>8&&"\n"==c||[/\S/.test(c),1,1,!/[$\w]/.test(c),("/"==n||"\n"==n)&&i,'"'==n&&i,"'"==n&&i,u[s-4]+r+n=="--\x3e",r+n=="*/"][p])for(f&&(e.appendChild(a=t.createElement("span")).setAttribute("style",["color: #555; font-weight: bold;","","","color: #555;",""][p?p<3?2:p>6?4:p>3?3:+/^(a(bstract|lias|nd|rguments|rray|s(m|sert)?|uto)|b(ase|egin|ool(ean)?|reak|yte)|c(ase|atch|har|hecked|lass|lone|ompl|onst|ontinue)|de(bugger|cimal|clare|f(ault|er)?|init|l(egate|ete)?)|do|double|e(cho|ls?if|lse(if)?|nd|nsure|num|vent|x(cept|ec|p(licit|ort)|te(nds|nsion|rn)))|f(allthrough|alse|inal(ly)?|ixed|loat|or(each)?|riend|rom|unc(tion)?)|global|goto|guard|i(f|mp(lements|licit|ort)|n(it|clude(_once)?|line|out|stanceof|t(erface|ernal)?)?|s)|l(ambda|et|ock|ong)|m(icrolight|odule|utable)|NaN|n(amespace|ative|ext|ew|il|ot|ull)|o(bject|perator|r|ut|verride)|p(ackage|arams|rivate|rotected|rotocol|ublic)|r(aise|e(adonly|do|f|gister|peat|quire(_once)?|scue|strict|try|turn))|s(byte|ealed|elf|hort|igned|izeof|tatic|tring|truct|ubscript|uper|ynchronized|witch)|t(emplate|hen|his|hrows?|ransient|rue|ry|ype(alias|def|id|name|of))|u(n(checked|def(ined)?|ion|less|signed|til)|se|sing)|v(ar|irtual|oid|olatile)|w(char_t|hen|here|hile|ith)|xor|yield)$/.test(f):0]),a.appendChild(t.createTextNode(f))),o=p&&p<7?p:o,f="",p=11;![1,/[\/{}[(\-+*=<>:;|\\.,?!&@~]/.test(c),/[\])]/.test(c),/[$\w]/.test(c),"/"==c&&o<2&&"<"!=n,'"'==c,"'"==c,c+l+u[s+1]+u[s+2]=="\x3c!--",c+l=="/*",c+l=="//","#"==c][--p];);f+=c}}(e)},t.mapToList=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"key";var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l.default.Map();if(!l.default.Map.isMap(t)||!t.size)return l.default.List();Array.isArray(n)||(n=[n]);if(n.length<1)return t.merge(r);var a=l.default.List();var u=n[0];var s=!0;var c=!1;var f=void 0;try{for(var p,d=(0,i.default)(t.entries());!(s=(p=d.next()).done);s=!0){var h=p.value,v=(0,o.default)(h,2),m=v[0],g=v[1],y=e(g,n.slice(1),r.set(u,m));a=l.default.List.isList(y)?a.concat(y):a.push(y)}}catch(e){c=!0,f=e}finally{try{!s&&d.return&&d.return()}finally{if(c)throw f}}return a},t.extractFileNameFromContentDispositionHeader=function(e){var t=/filename="([^;]*);?"/i.exec(e);null===t&&(t=/filename=([^;]*);?/i.exec(e));if(null!==t&&t.length>1)return t[1];return null},t.pascalCase=C,t.pascalCaseFilename=function(e){return C(e.replace(/\.[^./]*$/,""))},t.sanitizeUrl=function(e){if("string"!=typeof e||""===e)return"";return(0,c.sanitizeUrl)(e)},t.getAcceptControllingResponse=function(e){if(!l.default.OrderedMap.isOrderedMap(e))return null;if(!e.size)return null;var t=e.find(function(e,t){return t.startsWith("2")&&(0,u.default)(e.get("content")||{}).length>0}),n=e.get("default")||l.default.OrderedMap(),r=(n.get("content")||l.default.OrderedMap()).keySeq().toJS().length?n:null;return t||r},t.deeplyStripKey=function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(){return!0};if("object"!==(void 0===t?"undefined":(0,s.default)(t))||Array.isArray(t)||null===t||!n)return t;var o=(0,a.default)({},t);(0,u.default)(o).forEach(function(t){t===n&&r(o[t],t)?delete o[t]:o[t]=e(o[t],n,r)});return o},t.stringify=function(e){if("string"==typeof e)return e;e.toJS&&(e=e.toJS());if("object"===(void 0===e?"undefined":(0,s.default)(e))&&null!==e)try{return(0,r.default)(e,null,2)}catch(t){return String(e)}return e.toString()},t.numberToString=function(e){if("number"==typeof e)return e.toString();return e};var l=_(n(7)),c=n(572),f=_(n(573)),p=_(n(280)),d=_(n(285)),h=_(n(288)),v=_(n(650)),m=_(n(105)),g=n(192),y=_(n(32)),b=_(n(723));function _(e){return e&&e.__esModule?e:{default:e}}var w="default",E=t.isImmutable=function(e){return l.default.Iterable.isIterable(e)};function x(e){return Array.isArray(e)?e:[e]}function S(e){return!!e&&"object"===(void 0===e?"undefined":(0,s.default)(e))}t.memoize=d.default;function C(e){return(0,p.default)((0,f.default)(e))}t.propChecker=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return(0,u.default)(e).length!==(0,u.default)(t).length||((0,v.default)(e,function(e,n){if(r.includes(n))return!1;var o=t[n];return l.default.Iterable.isIterable(e)?!l.default.is(e,o):("object"!==(void 0===e?"undefined":(0,s.default)(e))||"object"!==(void 0===o?"undefined":(0,s.default)(o)))&&e!==o})||n.some(function(n){return!(0,m.default)(e[n],t[n])}))};var k=t.validateMaximum=function(e,t){if(e>t)return"Value must be less than Maximum"},A=t.validateMinimum=function(e,t){if(et)return"Value must be less than MaxLength"},D=t.validateMinLength=function(e,t){if(e.length2&&void 0!==arguments[2]&&arguments[2],r=[],o=t&&"body"===e.get("in")?e.get("value_xml"):e.get("value"),i=e.get("required"),a=n?e.get("schema"):e;if(!a)return r;var u=a.get("maximum"),c=a.get("minimum"),f=a.get("type"),p=a.get("format"),d=a.get("maxLength"),h=a.get("minLength"),v=a.get("pattern");if(f&&(i||o)){var m="string"===f&&o,g="array"===f&&Array.isArray(o)&&o.length,b="array"===f&&l.default.List.isList(o)&&o.count(),_="file"===f&&o instanceof y.default.File,w="boolean"===f&&(o||!1===o),E="number"===f&&(o||0===o),x="integer"===f&&(o||0===o),S=!1;if(n&&"object"===f)if("object"===(void 0===o?"undefined":(0,s.default)(o)))S=!0;else if("string"==typeof o)try{JSON.parse(o),S=!0}catch(e){return r.push("Parameter string value must be valid JSON"),r}var C=[m,g,b,_,w,E,x,S].some(function(e){return!!e});if(i&&!C)return r.push("Required field is not provided"),r;if(v){var U=L(o,v);U&&r.push(U)}if(d||0===d){var q=R(o,d);q&&r.push(q)}if(h){var F=D(o,h);F&&r.push(F)}if(u||0===u){var z=k(o,u);z&&r.push(z)}if(c||0===c){var B=A(o,c);B&&r.push(B)}if("string"===f){var V=void 0;if(!(V="date-time"===p?j(o):"uuid"===p?N(o):I(o)))return r;r.push(V)}else if("boolean"===f){var H=M(o);if(!H)return r;r.push(H)}else if("number"===f){var W=O(o);if(!W)return r;r.push(W)}else if("integer"===f){var J=P(o);if(!J)return r;r.push(J)}else if("array"===f){var Y;if(!b||!o.count())return r;Y=a.getIn(["items","type"]),o.forEach(function(e,t){var n=void 0;"number"===Y?n=O(e):"integer"===Y?n=P(e):"string"===Y&&(n=I(e)),n&&r.push({index:t,error:n})})}else if("file"===f){var K=T(o);if(!K)return r;r.push(K)}}return r},t.getSampleSchema=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(/xml/.test(t)){if(!e.xml||!e.xml.name){if(e.xml=e.xml||{},!e.$$ref)return e.type||e.items||e.properties||e.additionalProperties?'\n\x3c!-- XML example cannot be generated --\x3e':null;var o=e.$$ref.match(/\S*\/(\S+)$/);e.xml.name=o[1]}return(0,g.memoizedCreateXMLExample)(e,n)}var i=(0,g.memoizedSampleFromSchema)(e,n);return"object"===(void 0===i?"undefined":(0,s.default)(i))?(0,r.default)(i,null,2):i},t.parseSearch=function(){var e={},t=y.default.location.search;if(!t)return{};if(""!=t){var n=t.substr(1).split("&");for(var r in n)n.hasOwnProperty(r)&&(r=n[r].split("="),e[decodeURIComponent(r[0])]=r[1]&&decodeURIComponent(r[1])||"")}return e},t.serializeSearch=function(e){return(0,u.default)(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&")},t.btoa=function(t){return(t instanceof e?t:new e(t.toString(),"utf-8")).toString("base64")},t.sorters={operationsSorter:{alpha:function(e,t){return e.get("path").localeCompare(t.get("path"))},method:function(e,t){return e.get("method").localeCompare(t.get("method"))}},tagsSorter:{alpha:function(e,t){return e.localeCompare(t)}}},t.buildFormData=function(e){var t=[];for(var n in e){var r=e[n];void 0!==r&&""!==r&&t.push([n,"=",encodeURIComponent(r).replace(/%20/g,"+")].join(""))}return t.join("&")},t.shallowEqualKeys=function(e,t,n){return!!(0,h.default)(n,function(n){return(0,m.default)(e[n],t[n])})};var U=t.createDeepLinkPath=function(e){return"string"==typeof e||e instanceof String?e.trim().replace(/\s/g,"_"):""};t.escapeDeepLinkPath=function(e){return(0,b.default)(U(e))},t.getExtensions=function(e){return e.filter(function(e,t){return/^x-/.test(t)})},t.getCommonExtensions=function(e){return e.filter(function(e,t){return/^pattern|maxLength|minLength|maximum|minimum/.test(t)})}}).call(t,n(54).Buffer)},function(e,t,n){"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/var r=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,i=Object.prototype.propertyIsEnumerable;e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(e){r[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,a,u=function(e){if(null===e||void 0===e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),s=1;s?@[\]^_`{|}~-])/g;function a(e){return!(e>=55296&&e<=57343)&&(!(e>=64976&&e<=65007)&&(65535!=(65535&e)&&65534!=(65535&e)&&(!(e>=0&&e<=8)&&(11!==e&&(!(e>=14&&e<=31)&&(!(e>=127&&e<=159)&&!(e>1114111)))))))}function u(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var s=/&([a-z#][a-z0-9]{1,31});/gi,l=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))/i,c=n(417);function f(e,t){var n=0;return o(c,t)?c[t]:35===t.charCodeAt(0)&&l.test(t)&&a(n="x"===t[1].toLowerCase()?parseInt(t.slice(2),16):parseInt(t.slice(1),10))?u(n):e}var p=/[&<>"]/,d=/[&<>"]/g,h={"&":"&","<":"<",">":">",'"':"""};function v(e){return h[e]}t.assign=function(e){return[].slice.call(arguments,1).forEach(function(t){if(t){if("object"!=typeof t)throw new TypeError(t+"must be object");Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e},t.isString=function(e){return"[object String]"===function(e){return Object.prototype.toString.call(e)}(e)},t.has=o,t.unescapeMd=function(e){return e.indexOf("\\")<0?e:e.replace(i,"$1")},t.isValidEntityCode=a,t.fromCodePoint=u,t.replaceEntities=function(e){return e.indexOf("&")<0?e:e.replace(s,f)},t.escapeHtml=function(e){return p.test(e)?e.replace(d,v):e}},function(e,t){e.exports=function(e){return"object"==typeof e?null!==e:"function"==typeof e}},function(e,t,n){var r=n(33),o=n(60),i=n(58),a=n(72),u=n(120),s=function(e,t,n){var l,c,f,p,d=e&s.F,h=e&s.G,v=e&s.S,m=e&s.P,g=e&s.B,y=h?r:v?r[t]||(r[t]={}):(r[t]||{}).prototype,b=h?o:o[t]||(o[t]={}),_=b.prototype||(b.prototype={});for(l in h&&(n=t),n)f=((c=!d&&y&&void 0!==y[l])?y:n)[l],p=g&&c?u(f,r):m&&"function"==typeof f?u(Function.call,f):f,y&&a(y,l,f,e&s.U),b[l]!=f&&i(b,l,p),m&&_[l]!=f&&(_[l]=f)};r.core=o,s.F=1,s.G=2,s.S=4,s.P=8,s.B=16,s.W=32,s.U=64,s.R=128,e.exports=s},function(e,t,n){var r=n(29),o=n(101),i=n(53),a=/"/g,u=function(e,t,n,r){var o=String(i(e)),u="<"+t;return""!==n&&(u+=" "+n+'="'+String(r).replace(a,""")+'"'),u+">"+o+""};e.exports=function(e,t){var n={};n[e]=t(u),r(r.P+r.F*o(function(){var t=""[e]('"');return t!==t.toLowerCase()||t.split('"').length>3}),"String",n)}},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r,o=n(91),i=(r=o)&&r.__esModule?r:{default:r};e.exports=function(){var e={location:{},history:{},open:function(){},close:function(){},File:function(){}};if("undefined"==typeof window)return e;try{e=window;var t=!0,n=!1,r=void 0;try{for(var o,a=(0,i.default)(["File","Blob","FormData"]);!(t=(o=a.next()).done);t=!0){var u=o.value;u in window&&(e[u]=window[u])}}catch(e){n=!0,r=e}finally{try{!t&&a.return&&a.return()}finally{if(n)throw r}}}catch(e){console.error(e)}return e}()},function(e,t){var n=e.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=n)},function(e,t,n){"use strict";function r(e){return function(){return e}}var o=function(){};o.thatReturns=r,o.thatReturnsFalse=r(!1),o.thatReturnsTrue=r(!0),o.thatReturnsNull=r(null),o.thatReturnsThis=function(){return this},o.thatReturnsArgument=function(e){return e},e.exports=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=i(n(25));t.isOAS3=a,t.isSwagger2=function(e){var t=e.get("swagger");if("string"!=typeof t)return!1;return t.startsWith("2.0")},t.OAS3ComponentWrapFactory=function(e){return function(t,n){return function(i){if(n&&n.specSelectors&&n.specSelectors.specJson){var u=n.specSelectors.specJson();return a(u)?o.default.createElement(e,(0,r.default)({},i,n,{Ori:t})):o.default.createElement(t,i)}return console.warn("OAS3 wrapper: couldn't get spec"),null}}};var o=i(n(0));function i(e){return e&&e.__esModule?e:{default:e}}function a(e){var t=e.get("openapi");return"string"==typeof t&&(t.startsWith("3.0.")&&t.length>4)}},function(e,t,n){var r=n(28);e.exports=function(e){if(!r(e))throw TypeError(e+" is not an object!");return e}},function(e,t,n){var r=n(278),o="object"==typeof self&&self&&self.Object===Object&&self,i=r||o||Function("return this")();e.exports=i},function(e,t){e.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},function(e,t,n){"use strict";var r=null;e.exports={debugTool:r}},function(e,t,n){var r=n(36),o=n(238),i=n(157),a=Object.defineProperty;t.f=n(44)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t,n){e.exports={default:n(517),__esModule:!0}},function(e,t,n){e.exports={default:n(518),__esModule:!0}},function(e,t,n){"use strict";var r=n(10),o=n(13),i=n(355),a=n(68),u=n(356),s=n(88),l=n(147),c=n(8),f=[],p=0,d=i.getPooled(),h=!1,v=null;function m(){E.ReactReconcileTransaction&&v||r("123")}var g=[{initialize:function(){this.dirtyComponentsLength=f.length},close:function(){this.dirtyComponentsLength!==f.length?(f.splice(0,this.dirtyComponentsLength),w()):f.length=0}},{initialize:function(){this.callbackQueue.reset()},close:function(){this.callbackQueue.notifyAll()}}];function y(){this.reinitializeTransaction(),this.dirtyComponentsLength=null,this.callbackQueue=i.getPooled(),this.reconcileTransaction=E.ReactReconcileTransaction.getPooled(!0)}function b(e,t){return e._mountOrder-t._mountOrder}function _(e){var t=e.dirtyComponentsLength;t!==f.length&&r("124",t,f.length),f.sort(b),p++;for(var n=0;n - * @license MIT - */ -var r=n(529),o=n(530),i=n(261);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return F(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return z(e).length;default:if(r)return F(e).length;t=(""+t).toLowerCase(),r=!0}}function v(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function m(e,t,n,r,o){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:g(e,t,n,r,o);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,r,o);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,r,o){var i,a=1,u=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,u/=2,s/=2,n/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(o){var c=-1;for(i=n;iu&&(n=u-s),i=n;i>=0;i--){for(var f=!0,p=0;po&&(r=o):r=o;var i=t.length;if(i%2!=0)throw new TypeError("Invalid hex string");r>i/2&&(r=i/2);for(var a=0;a>8,o=n%256,i.push(o),i.push(r);return i}(t,e.length-n),e,n,r)}function S(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function C(e,t,n){n=Math.min(e.length,n);for(var r=[],o=t;o239?4:l>223?3:l>191?2:1;if(o+f<=n)switch(f){case 1:l<128&&(c=l);break;case 2:128==(192&(i=e[o+1]))&&(s=(31&l)<<6|63&i)>127&&(c=s);break;case 3:i=e[o+1],a=e[o+2],128==(192&i)&&128==(192&a)&&(s=(15&l)<<12|(63&i)<<6|63&a)>2047&&(s<55296||s>57343)&&(c=s);break;case 4:i=e[o+1],a=e[o+2],u=e[o+3],128==(192&i)&&128==(192&a)&&128==(192&u)&&(s=(15&l)<<18|(63&i)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(c=s)}null===c?(c=65533,f=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),o+=f}return function(e){var t=e.length;if(t<=k)return String.fromCharCode.apply(String,e);var n="",r=0;for(;rthis.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return P(this,t,n);case"utf8":case"utf-8":return C(this,t,n);case"ascii":return A(this,t,n);case"latin1":case"binary":return O(this,t,n);case"base64":return S(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}.apply(this,arguments)},s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,o){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===o&&(o=this.length),t<0||n>e.length||r<0||o>this.length)throw new RangeError("out of range index");if(r>=o&&t>=n)return 0;if(r>=o)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,o>>>=0,this===e)return 0;for(var i=o-r,a=n-t,u=Math.min(i,a),l=this.slice(r,o),c=e.slice(t,n),f=0;fo)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var i=!1;;)switch(r){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return b(this,e,t,n);case"ascii":return _(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return E(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var k=4096;function A(e,t,n){var r="";n=Math.min(e.length,n);for(var o=t;or)&&(n=r);for(var o="",i=t;in)throw new RangeError("Trying to access beyond buffer length")}function I(e,t,n,r,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||te.length)throw new RangeError("Index out of range")}function j(e,t,n,r){t<0&&(t=65535+t+1);for(var o=0,i=Math.min(e.length-n,2);o>>8*(r?o:1-o)}function N(e,t,n,r){t<0&&(t=4294967295+t+1);for(var o=0,i=Math.min(e.length-n,4);o>>8*(r?o:3-o)&255}function R(e,t,n,r,o,i){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function D(e,t,n,r,i){return i||R(e,0,n,4),o.write(e,t,n,r,23,4),n+4}function L(e,t,n,r,i){return i||R(e,0,n,8),o.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n,r=this.length;if(e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(o*=256);)r+=this[e+--t]*o;return r},s.prototype.readUInt8=function(e,t){return t||M(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||M(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||M(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||M(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||M(e,t,this.length);for(var r=this[e],o=1,i=0;++i=(o*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||M(e,t,this.length);for(var r=t,o=1,i=this[e+--r];r>0&&(o*=256);)i+=this[e+--r]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return t||M(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||M(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||M(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||M(e,4,this.length),o.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||M(e,4,this.length),o.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||M(e,8,this.length),o.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||M(e,8,this.length),o.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||I(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):N(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);I(this,e,t,n,o-1,-o)}var i=0,a=1,u=0;for(this[t]=255&e;++i>0)-u&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var o=Math.pow(2,8*n-1);I(this,e,t,n,o-1,-o)}var i=n-1,a=1,u=0;for(this[t+i]=255&e;--i>=0&&(a*=256);)e<0&&0===u&&0!==this[t+i+1]&&(u=1),this[t+i]=(e/a>>0)-u&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):j(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):j(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):N(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):N(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return D(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return D(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return L(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return L(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--o)e[o+t]=this[o+n];else if(i<1e3||!s.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function z(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(U,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,n,r){for(var o=0;o=t.length||o>=e.length);++o)t[o+n]=e[o];return o}}).call(t,n(31))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,l=[],c=!1,f=-1;function p(){c&&s&&(c=!1,s.length?l=s.concat(l):f=-1,l.length&&d())}function d(){if(!c){var e=u(p);c=!0;for(var t=l.length;t;){for(s=l,l=[];++f1)for(var n=1;n1?t-1:0),r=1;r2?n-2:0),o=2;o1){for(var h=Array(d),v=0;v1){for(var g=Array(m),y=0;y=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}},function(e,t,n){"use strict";function r(e){return void 0===e||null===e}e.exports.isNothing=r,e.exports.isObject=function(e){return"object"==typeof e&&null!==e},e.exports.toArray=function(e){return Array.isArray(e)?e:r(e)?[]:[e]},e.exports.repeat=function(e,t){var n,r="";for(n=0;n=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t){var n={}.toString;e.exports=function(e){return n.call(e).slice(8,-1)}},function(e,t,n){e.exports=!n(101)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(e,t){e.exports=function(e){try{return!!e()}catch(e){return!0}}},function(e,t){e.exports={}},function(e,t,n){var r=n(119),o=Math.min;e.exports=function(e){return e>0?o(r(e),9007199254740991):0}},function(e,t,n){"use strict";e.exports=function(e){for(var t=arguments.length-1,n="Minified React error #"+e+"; visit http://facebook.github.io/react/docs/error-decoder.html?invariant="+e,r=0;r0?o(r(e),9007199254740991):0}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(59),o=n(460),i=n(461),a=Object.defineProperty;t.f=n(100)?Object.defineProperty:function(e,t,n){if(r(e),t=i(t,!0),r(n),o)try{return a(e,t,n)}catch(e){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(e[t]=n.value),e}},function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(121);e.exports=function(e,t,n){if(r(e),void 0===t)return e;switch(n){case 1:return function(n){return e.call(t,n)};case 2:return function(n,r){return e.call(t,n,r)};case 3:return function(n,r,o){return e.call(t,n,r,o)}}return function(){return e.apply(t,arguments)}}},function(e,t){e.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},function(e,t,n){var r=n(466),o=n(53);e.exports=function(e){return r(o(e))}},function(e,t,n){"use strict";var r=n(58),o=n(72),i=n(101),a=n(53),u=n(17);e.exports=function(e,t,n){var s=u(e),l=n(a,s,""[e]),c=l[0],f=l[1];i(function(){var t={};return t[s]=function(){return 7},7!=""[e](t)})&&(o(String.prototype,e,c),r(RegExp.prototype,s,2==t?function(e,t){return f.call(e,this,t)}:function(e){return f.call(e,this)}))}},function(e,t,n){var r=n(116)("meta"),o=n(28),i=n(52),a=n(40).f,u=0,s=Object.isExtensible||function(){return!0},l=!n(51)(function(){return s(Object.preventExtensions({}))}),c=function(e){a(e,r,{value:{i:"O"+ ++u,w:{}}})},f=e.exports={KEY:r,NEED:!1,fastKey:function(e,t){if(!o(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!i(e,r)){if(!s(e))return"F";if(!t)return"E";c(e)}return e[r].i},getWeak:function(e,t){if(!i(e,r)){if(!s(e))return!0;if(!t)return!1;c(e)}return e[r].w},onFreeze:function(e){return l&&f.NEED&&s(e)&&!i(e,r)&&c(e),e}}},function(e,t){t.f={}.propertyIsEnumerable},function(e,t,n){"use strict";var r={};e.exports=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CLEAR_BY=t.CLEAR=t.NEW_AUTH_ERR=t.NEW_SPEC_ERR_BATCH=t.NEW_SPEC_ERR=t.NEW_THROWN_ERR_BATCH=t.NEW_THROWN_ERR=void 0,t.newThrownErr=function(e){return{type:a,payload:(0,i.default)(e)}},t.newThrownErrBatch=function(e){return{type:u,payload:e}},t.newSpecErr=function(e){return{type:s,payload:e}},t.newSpecErrBatch=function(e){return{type:l,payload:e}},t.newAuthErr=function(e){return{type:c,payload:e}},t.clear=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{type:f,payload:e}},t.clearBy=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return!0};return{type:p,payload:e}};var r,o=n(179),i=(r=o)&&r.__esModule?r:{default:r};var a=t.NEW_THROWN_ERR="err_new_thrown_err",u=t.NEW_THROWN_ERR_BATCH="err_new_thrown_err_batch",s=t.NEW_SPEC_ERR="err_new_spec_err",l=t.NEW_SPEC_ERR_BATCH="err_new_spec_err_batch",c=t.NEW_AUTH_ERR="err_new_auth_err",f=t.CLEAR="err_clear",p=t.CLEAR_BY="err_clear_by"},function(e,t,n){var r=n(61),o=n(47),i="[object Symbol]";e.exports=function(e){return"symbol"==typeof e||o(e)&&r(e)==i}},function(e,t,n){var r=n(62)(Object,"create");e.exports=r},function(e,t,n){var r=n(600),o=n(601),i=n(602),a=n(603),u=n(604);function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&eb;b++)if((m=t?y(a(h=e[b])[0],h[1]):y(e[b]))===l||m===c)return m}else for(v=g.call(e);!(h=v.next()).done;)if((m=o(v,y,h.value,t))===l||m===c)return m}).BREAK=l,t.RETURN=c},function(e,t,n){"use strict";var r=n(86);e.exports=r.DEFAULT=new r({include:[n(108)],explicit:[n(757),n(758),n(759)]})},function(e,t,n){var r=n(345),o=n(105),i=Object.prototype.hasOwnProperty;e.exports=function(e,t,n){var a=e[t];i.call(e,t)&&o(a,n)&&(void 0!==n||t in e)||r(e,t,n)}},function(e,t,n){"use strict";var r=n(10),o=(n(8),{}),i={reinitializeTransaction:function(){this.transactionWrappers=this.getTransactionWrappers(),this.wrapperInitData?this.wrapperInitData.length=0:this.wrapperInitData=[],this._isInTransaction=!1},_isInTransaction:!1,getTransactionWrappers:null,isInTransaction:function(){return!!this._isInTransaction},perform:function(e,t,n,o,i,a,u,s){var l,c;this.isInTransaction()&&r("27");try{this._isInTransaction=!0,l=!0,this.initializeAll(0),c=e.call(t,n,o,i,a,u,s),l=!1}finally{try{if(l)try{this.closeAll(0)}catch(e){}else this.closeAll(0)}finally{this._isInTransaction=!1}}return c},initializeAll:function(e){for(var t=this.transactionWrappers,n=e;n]/,s=n(218)(function(e,t){if(e.namespaceURI!==i.svg||"innerHTML"in e)e.innerHTML=t;else{(r=r||document.createElement("div")).innerHTML=""+t+"";for(var n=r.firstChild;n.firstChild;)e.appendChild(n.firstChild)}});if(o.canUseDOM){var l=document.createElement("div");l.innerHTML=" ",""===l.innerHTML&&(s=function(e,t){if(e.parentNode&&e.parentNode.replaceChild(e,e),a.test(t)||"<"===t[0]&&u.test(t)){e.innerHTML=String.fromCharCode(65279)+t;var n=e.firstChild;1===n.data.length?e.removeChild(n):n.deleteData(0,1)}else e.innerHTML=t}),l=null}e.exports=s},function(e,t,n){"use strict";var r=/["'&<>]/;e.exports=function(e){return"boolean"==typeof e||"number"==typeof e?""+e:function(e){var t,n=""+e,o=r.exec(n);if(!o)return n;var i="",a=0,u=0;for(a=o.index;adocument.F=Object<\/script>"),e.close(),s=e.F;r--;)delete s.prototype[i[r]];return s()};e.exports=Object.create||function(e,t){var n;return null!==e?(u.prototype=r(e),n=new u,u.prototype=null,n[a]=e):n=s(),void 0===t?n:o(n,t)}},function(e,t){var n=Math.ceil,r=Math.floor;e.exports=function(e){return isNaN(e=+e)?0:(e>0?r:n)(e)}},function(e,t,n){var r=n(162)("keys"),o=n(116);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(21),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(165),o=n(19)("iterator"),i=n(69);e.exports=n(15).getIteratorMethod=function(e){if(void 0!=e)return e[o]||e["@@iterator"]||i[r(e)]}},function(e,t,n){var r=n(93),o=n(19)("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?r(t):"Object"==(a=r(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t,n){var r=n(99),o=n(17)("toStringTag"),i="Arguments"==r(function(){return arguments}());e.exports=function(e){var t,n,a;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=Object(e),o))?n:i?r(t):"Object"==(a=r(t))&&"function"==typeof t.callee?"Arguments":a}},function(e,t){var n=0,r=Math.random();e.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+r).toString(36))}},function(e,t,n){var r=n(73),o=n(33).document,i=r(o)&&r(o.createElement);e.exports=function(e){return i?o.createElement(e):{}}},function(e,t,n){var r=n(242)("keys"),o=n(167);e.exports=function(e){return r[e]||(r[e]=o(e))}},function(e,t,n){var r=n(117).f,o=n(118),i=n(17)("toStringTag");e.exports=function(e,t,n){e&&!o(e=n?e:e.prototype,i)&&r(e,i,{configurable:!0,value:t})}},function(e,t,n){"use strict";var r=n(121);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){var r=n(256),o=n(53);e.exports=function(e,t,n){if(r(t))throw TypeError("String#"+n+" doesn't accept regex!");return String(o(e))}},function(e,t,n){var r=n(17)("match");e.exports=function(e){var t=/./;try{"/./"[e](t)}catch(n){try{return t[r]=!1,!"/./"[e](t)}catch(e){}}return!0}},function(e,t,n){t.f=n(19)},function(e,t,n){var r=n(21),o=n(15),i=n(114),a=n(174),u=n(40).f;e.exports=function(e){var t=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==e.charAt(0)||e in t||u(t,e,{value:a.f(e)})}},function(e,t){t.f=Object.getOwnPropertySymbols},function(e,t){},function(e,t,n){"use strict";(function(t){ -/*! - * @description Recursive object extending - * @author Viacheslav Lotsmanov - * @license MIT - * - * The MIT License (MIT) - * - * Copyright (c) 2013-2018 Viacheslav Lotsmanov - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ -function n(e){return e instanceof t||e instanceof Date||e instanceof RegExp}function r(e){if(e instanceof t){var n=t.alloc?t.alloc(e.length):new t(e.length);return e.copy(n),n}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e);throw new Error("Unexpected situation")}function o(e,t){return"__proto__"===t?void 0:e[t]}var i=e.exports=function(){if(arguments.length<1||"object"!=typeof arguments[0])return!1;if(arguments.length<2)return arguments[0];var e,t,a=arguments[0];return Array.prototype.slice.call(arguments,1).forEach(function(u){"object"!=typeof u||null===u||Array.isArray(u)||Object.keys(u).forEach(function(s){return t=o(a,s),(e=o(u,s))===a?void 0:"object"!=typeof e||null===e?void(a[s]=e):Array.isArray(e)?void(a[s]=function e(t){var o=[];return t.forEach(function(t,a){"object"==typeof t&&null!==t?Array.isArray(t)?o[a]=e(t):n(t)?o[a]=r(t):o[a]=i({},t):o[a]=t}),o}(e)):n(e)?void(a[s]=r(e)):"object"!=typeof t||null===t||Array.isArray(t)?void(a[s]=i({},e)):void(a[s]=i(t,e))})}),a}}).call(t,n(54).Buffer)},function(e,t,n){"use strict";e.exports=function(e){return"object"==typeof e?function e(t,n){var r;r=Array.isArray(t)?[]:{};n.push(t);Object.keys(t).forEach(function(o){var i=t[o];"function"!=typeof i&&(i&&"object"==typeof i?-1!==n.indexOf(t[o])?r[o]="[Circular]":r[o]=e(t[o],n.slice(0)):r[o]=i)});"string"==typeof t.name&&(r.name=t.name);"string"==typeof t.message&&(r.message=t.message);"string"==typeof t.stack&&(r.stack=t.stack);return r}(e,[]):"function"==typeof e?"[Function: "+(e.name||"anonymous")+"]":e}},function(e,t,n){var r=n(589),o=n(605),i=n(607),a=n(608),u=n(609);function s(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t-1&&e%1==0&&e<=n}},function(e,t){e.exports=function(e){return function(t){return e(t)}}},function(e,t,n){(function(e){var r=n(278),o="object"==typeof t&&t&&!t.nodeType&&t,i=o&&"object"==typeof e&&e&&!e.nodeType&&e,a=i&&i.exports===o&&r.process,u=function(){try{var e=i&&i.require&&i.require("util").types;return e||a&&a.binding&&a.binding("util")}catch(e){}}();e.exports=u}).call(t,n(134)(e))},function(e,t,n){var r=n(24),o=n(128),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;e.exports=function(e,t){if(r(e))return!1;var n=typeof e;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=e&&!o(e))||a.test(e)||!i.test(e)||null!=t&&e in Object(t)}},function(e,t){e.exports=function(e){return e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.memoizedSampleFromSchema=t.memoizedCreateXMLExample=t.sampleXmlFromSchema=t.inferSchema=t.sampleFromSchema=void 0,t.createXMLExample=f;var r=n(12),o=a(n(656)),i=a(n(669));function a(e){return e&&e.__esModule?e:{default:e}}var u={string:function(){return"string"},string_email:function(){return"user@example.com"},"string_date-time":function(){return(new Date).toISOString()},number:function(){return 0},number_float:function(){return 0},integer:function(){return 0},boolean:function(e){return"boolean"!=typeof e.default||e.default}},s=function(e){var t=e=(0,r.objectify)(e),n=t.type,o=t.format,i=u[n+"_"+o]||u[n];return(0,r.isFunc)(i)?i(e):"Unknown Type: "+e.type},l=t.sampleFromSchema=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=(0,r.objectify)(t),i=o.type,a=o.example,u=o.properties,l=o.additionalProperties,c=o.items,f=n.includeReadOnly,p=n.includeWriteOnly;if(void 0!==a)return(0,r.deeplyStripKey)(a,"$$ref",function(e){return"string"==typeof e&&e.indexOf("#")>-1});if(!i)if(u)i="object";else{if(!c)return;i="array"}if("object"===i){var d=(0,r.objectify)(u),h={};for(var v in d)d[v]&&d[v].readOnly&&!f||d[v]&&d[v].writeOnly&&!p||(h[v]=e(d[v],n));if(!0===l)h.additionalProp1={};else if(l)for(var m=(0,r.objectify)(l),g=e(m,n),y=1;y<4;y++)h["additionalProp"+y]=g;return h}return"array"===i?Array.isArray(c.anyOf)?c.anyOf.map(function(t){return e(t,n)}):Array.isArray(c.oneOf)?c.oneOf.map(function(t){return e(t,n)}):[e(c,n)]:t.enum?t.default?t.default:(0,r.normalizeArray)(t.enum)[0]:"file"!==i?s(t):void 0},c=(t.inferSchema=function(e){return e.schema&&(e=e.schema),e.properties&&(e.type="object"),e},t.sampleXmlFromSchema=function e(t){var n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=(0,r.objectify)(t),a=i.type,u=i.properties,l=i.additionalProperties,c=i.items,f=i.example,p=o.includeReadOnly,d=o.includeWriteOnly,h=i.default,v={},m={},g=t.xml,y=g.name,b=g.prefix,_=g.namespace,w=i.enum,E=void 0;if(!a)if(u||l)a="object";else{if(!c)return;a="array"}(y=y||"notagname",n=(b?b+":":"")+y,_)&&(m[b?"xmlns:"+b:"xmlns"]=_);if("array"===a&&c){if(c.xml=c.xml||g||{},c.xml.name=c.xml.name||g.name,g.wrapped)return v[n]=[],Array.isArray(f)?f.forEach(function(t){c.example=t,v[n].push(e(c,o))}):Array.isArray(h)?h.forEach(function(t){c.default=t,v[n].push(e(c,o))}):v[n]=[e(c,o)],m&&v[n].push({_attr:m}),v;var x=[];return Array.isArray(f)?(f.forEach(function(t){c.example=t,x.push(e(c,o))}),x):Array.isArray(h)?(h.forEach(function(t){c.default=t,x.push(e(c,o))}),x):e(c,o)}if("object"===a){var S=(0,r.objectify)(u);for(var C in v[n]=[],f=f||{},S)if(S.hasOwnProperty(C)&&(!S[C].readOnly||p)&&(!S[C].writeOnly||d))if(S[C].xml=S[C].xml||{},S[C].xml.attribute){var k=Array.isArray(S[C].enum)&&S[C].enum[0],A=S[C].example,O=S[C].default;m[S[C].xml.name||C]=void 0!==A&&A||void 0!==f[C]&&f[C]||void 0!==O&&O||k||s(S[C])}else{S[C].xml.name=S[C].xml.name||C,void 0===S[C].example&&void 0!==f[C]&&(S[C].example=f[C]);var P=e(S[C]);Array.isArray(P)?v[n]=v[n].concat(P):v[n].push(P)}return!0===l?v[n].push({additionalProp:"Anything can be here"}):l&&v[n].push({additionalProp:s(l)}),m&&v[n].push({_attr:m}),v}return E=void 0!==f?f:void 0!==h?h:Array.isArray(w)?w[0]:s(t),v[n]=m?[{_attr:m},E]:E,v});function f(e,t){var n=c(e,t);if(n)return(0,o.default)(n,{declaration:!0,indent:"\t"})}t.memoizedCreateXMLExample=(0,i.default)(f),t.memoizedSampleFromSchema=(0,i.default)(l)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,u,s,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(i(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:u=Array.prototype.slice.call(arguments,1),n.apply(this,u)}else if(o(n))for(u=Array.prototype.slice.call(arguments,1),a=(l=n.slice()).length,s=0;s0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function o(){this.removeListener(e,o),n||(n=!0,t.apply(this,arguments))}return o.listener=t,this.on(e,o),this},n.prototype.removeListener=function(e,t){var n,i,a,u;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(u=a;u-- >0;)if(n[u]===t||n[u].listener&&n[u].listener===t){i=u;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){(t=e.exports=n(306)).Stream=t,t.Readable=t,t.Writable=n(195),t.Duplex=n(64),t.Transform=n(311),t.PassThrough=n(664)},function(e,t,n){"use strict";(function(t,r,o){var i=n(140);function a(e){var t=this;this.next=null,this.entry=null,this.finish=function(){!function(e,t,n){var r=e.entry;e.entry=null;for(;r;){var o=r.callback;t.pendingcb--,o(n),r=r.next}t.corkedRequestsFree?t.corkedRequestsFree.next=e:t.corkedRequestsFree=e}(t,e)}}e.exports=y;var u,s=!t.browser&&["v0.10","v0.9."].indexOf(t.version.slice(0,5))>-1?r:i.nextTick;y.WritableState=g;var l=n(106);l.inherits=n(81);var c={deprecate:n(663)},f=n(307),p=n(141).Buffer,d=o.Uint8Array||function(){};var h,v=n(308);function m(){}function g(e,t){u=u||n(64),e=e||{};var r=t instanceof u;this.objectMode=!!e.objectMode,r&&(this.objectMode=this.objectMode||!!e.writableObjectMode);var o=e.highWaterMark,l=e.writableHighWaterMark,c=this.objectMode?16:16384;this.highWaterMark=o||0===o?o:r&&(l||0===l)?l:c,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var f=!1===e.decodeStrings;this.decodeStrings=!f,this.defaultEncoding=e.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(e){!function(e,t){var n=e._writableState,r=n.sync,o=n.writecb;if(function(e){e.writing=!1,e.writecb=null,e.length-=e.writelen,e.writelen=0}(n),t)!function(e,t,n,r,o){--t.pendingcb,n?(i.nextTick(o,r),i.nextTick(S,e,t),e._writableState.errorEmitted=!0,e.emit("error",r)):(o(r),e._writableState.errorEmitted=!0,e.emit("error",r),S(e,t))}(e,n,r,t,o);else{var a=E(n);a||n.corked||n.bufferProcessing||!n.bufferedRequest||w(e,n),r?s(_,e,n,a,o):_(e,n,a,o)}}(t,e)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new a(this)}function y(e){if(u=u||n(64),!(h.call(y,this)||this instanceof u))return new y(e);this._writableState=new g(e,this),this.writable=!0,e&&("function"==typeof e.write&&(this._write=e.write),"function"==typeof e.writev&&(this._writev=e.writev),"function"==typeof e.destroy&&(this._destroy=e.destroy),"function"==typeof e.final&&(this._final=e.final)),f.call(this)}function b(e,t,n,r,o,i,a){t.writelen=r,t.writecb=a,t.writing=!0,t.sync=!0,n?e._writev(o,t.onwrite):e._write(o,i,t.onwrite),t.sync=!1}function _(e,t,n,r){n||function(e,t){0===t.length&&t.needDrain&&(t.needDrain=!1,e.emit("drain"))}(e,t),t.pendingcb--,r(),S(e,t)}function w(e,t){t.bufferProcessing=!0;var n=t.bufferedRequest;if(e._writev&&n&&n.next){var r=t.bufferedRequestCount,o=new Array(r),i=t.corkedRequestsFree;i.entry=n;for(var u=0,s=!0;n;)o[u]=n,n.isBuf||(s=!1),n=n.next,u+=1;o.allBuffers=s,b(e,t,!0,t.length,o,"",i.finish),t.pendingcb++,t.lastBufferedRequest=null,i.next?(t.corkedRequestsFree=i.next,i.next=null):t.corkedRequestsFree=new a(t),t.bufferedRequestCount=0}else{for(;n;){var l=n.chunk,c=n.encoding,f=n.callback;if(b(e,t,!1,t.objectMode?1:l.length,l,c,f),n=n.next,t.bufferedRequestCount--,t.writing)break}null===n&&(t.lastBufferedRequest=null)}t.bufferedRequest=n,t.bufferProcessing=!1}function E(e){return e.ending&&0===e.length&&null===e.bufferedRequest&&!e.finished&&!e.writing}function x(e,t){e._final(function(n){t.pendingcb--,n&&e.emit("error",n),t.prefinished=!0,e.emit("prefinish"),S(e,t)})}function S(e,t){var n=E(t);return n&&(!function(e,t){t.prefinished||t.finalCalled||("function"==typeof e._final?(t.pendingcb++,t.finalCalled=!0,i.nextTick(x,e,t)):(t.prefinished=!0,e.emit("prefinish")))}(e,t),0===t.pendingcb&&(t.finished=!0,e.emit("finish"))),n}l.inherits(y,f),g.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(g.prototype,"buffer",{get:c.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch(e){}}(),"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(h=Function.prototype[Symbol.hasInstance],Object.defineProperty(y,Symbol.hasInstance,{value:function(e){return!!h.call(this,e)||this===y&&(e&&e._writableState instanceof g)}})):h=function(e){return e instanceof this},y.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},y.prototype.write=function(e,t,n){var r,o=this._writableState,a=!1,u=!o.objectMode&&(r=e,p.isBuffer(r)||r instanceof d);return u&&!p.isBuffer(e)&&(e=function(e){return p.from(e)}(e)),"function"==typeof t&&(n=t,t=null),u?t="buffer":t||(t=o.defaultEncoding),"function"!=typeof n&&(n=m),o.ended?function(e,t){var n=new Error("write after end");e.emit("error",n),i.nextTick(t,n)}(this,n):(u||function(e,t,n,r){var o=!0,a=!1;return null===n?a=new TypeError("May not write null values to stream"):"string"==typeof n||void 0===n||t.objectMode||(a=new TypeError("Invalid non-string/buffer chunk")),a&&(e.emit("error",a),i.nextTick(r,a),o=!1),o}(this,o,e,n))&&(o.pendingcb++,a=function(e,t,n,r,o,i){if(!n){var a=function(e,t,n){e.objectMode||!1===e.decodeStrings||"string"!=typeof t||(t=p.from(t,n));return t}(t,r,o);r!==a&&(n=!0,o="buffer",r=a)}var u=t.objectMode?1:r.length;t.length+=u;var s=t.length-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},Object.defineProperty(y.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}}),y.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},y.prototype._writev=null,y.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||function(e,t,n){t.ending=!0,S(e,t),n&&(t.finished?i.nextTick(n):e.once("finish",n));t.ended=!0,e.writable=!1}(this,r,n)},Object.defineProperty(y.prototype,"destroyed",{get:function(){return void 0!==this._writableState&&this._writableState.destroyed},set:function(e){this._writableState&&(this._writableState.destroyed=e)}}),y.prototype.destroy=v.destroy,y.prototype._undestroy=v.undestroy,y.prototype._destroy=function(e,t){this.end(),t(e)}}).call(t,n(55),n(309).setImmediate,n(31))},function(e,t,n){"use strict";e.exports=function(e){return"function"==typeof e}},function(e,t,n){"use strict";e.exports=n(690)()?Array.from:n(691)},function(e,t,n){"use strict";var r=n(704),o=n(66),i=n(82),a=Array.prototype.indexOf,u=Object.prototype.hasOwnProperty,s=Math.abs,l=Math.floor;e.exports=function(e){var t,n,c,f;if(!r(e))return a.apply(this,arguments);for(n=o(i(this).length),c=arguments[1],t=c=isNaN(c)?0:c>=0?l(c):o(this.length)-l(s(c));t1&&void 0!==arguments[1])||arguments[1];return e=(0,r.normalizeArray)(e),{type:u,payload:{thing:e,shown:t}}},t.changeMode=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return e=(0,r.normalizeArray)(e),{type:a,payload:{thing:e,mode:t}}};var r=n(12),o=t.UPDATE_LAYOUT="layout_update_layout",i=t.UPDATE_FILTER="layout_update_filter",a=t.UPDATE_MODE="layout_update_mode",u=t.SHOW="layout_show"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateBeforeExecute=t.canExecuteScheme=t.operationScheme=t.hasHost=t.operationWithMeta=t.parameterWithMeta=t.parameterInclusionSettingFor=t.parameterWithMetaByIdentity=t.allowTryItOutFor=t.mutatedRequestFor=t.requestFor=t.responseFor=t.mutatedRequests=t.requests=t.responses=t.taggedOperations=t.operationsWithTags=t.tagDetails=t.tags=t.operationsWithRootInherited=t.schemes=t.host=t.basePath=t.definitions=t.findDefinition=t.securityDefinitions=t.security=t.produces=t.consumes=t.operations=t.paths=t.semver=t.version=t.externalDocs=t.info=t.isOAS3=t.spec=t.specJsonWithResolvedSubtrees=t.specResolvedSubtree=t.specResolved=t.specJson=t.specSource=t.specStr=t.url=t.lastError=void 0;var r,o=n(83),i=(r=o)&&r.__esModule?r:{default:r};t.getParameter=function(e,t,n,r){return t=t||[],e.getIn(["meta","paths"].concat((0,i.default)(t),["parameters"]),(0,s.fromJS)([])).find(function(e){return s.Map.isMap(e)&&e.get("name")===n&&e.get("in")===r})||(0,s.Map)()},t.parameterValues=function(e,t,n){return t=t||[],P.apply(void 0,[e].concat((0,i.default)(t))).get("parameters",(0,s.List)()).reduce(function(e,t){var r=n&&"body"===t.get("in")?t.get("value_xml"):t.get("value");return e.set(t.get("in")+"."+t.get("name"),r)},(0,s.fromJS)({}))},t.parametersIncludeIn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(s.List.isList(e))return e.some(function(e){return s.Map.isMap(e)&&e.get("in")===t})},t.parametersIncludeType=T,t.contentTypeValues=function(e,t){t=t||[];var n=d(e).getIn(["paths"].concat((0,i.default)(t)),(0,s.fromJS)({})),r=e.getIn(["meta","paths"].concat((0,i.default)(t)),(0,s.fromJS)({})),o=M(e,t),a=n.get("parameters")||new s.List,u=r.get("consumes_value")?r.get("consumes_value"):T(a,"file")?"multipart/form-data":T(a,"formData")?"application/x-www-form-urlencoded":void 0;return(0,s.fromJS)({requestContentType:u,responseContentType:o})},t.operationConsumes=function(e,t){return t=t||[],d(e).getIn(["paths"].concat((0,i.default)(t),["consumes"]),(0,s.fromJS)({}))},t.currentProducesFor=M;var a=n(57),u=n(12),s=n(7);var l=["get","put","post","delete","options","head","patch","trace"],c=function(e){return e||(0,s.Map)()},f=(t.lastError=(0,a.createSelector)(c,function(e){return e.get("lastError")}),t.url=(0,a.createSelector)(c,function(e){return e.get("url")}),t.specStr=(0,a.createSelector)(c,function(e){return e.get("spec")||""}),t.specSource=(0,a.createSelector)(c,function(e){return e.get("specSource")||"not-editor"}),t.specJson=(0,a.createSelector)(c,function(e){return e.get("json",(0,s.Map)())})),p=(t.specResolved=(0,a.createSelector)(c,function(e){return e.get("resolved",(0,s.Map)())}),t.specResolvedSubtree=function(e,t){return e.getIn(["resolvedSubtrees"].concat((0,i.default)(t)),void 0)},function e(t,n){return s.Map.isMap(t)&&s.Map.isMap(n)?n.get("$$ref")?n:(0,s.OrderedMap)().mergeWith(e,t,n):n}),d=t.specJsonWithResolvedSubtrees=(0,a.createSelector)(c,function(e){return(0,s.OrderedMap)().mergeWith(p,e.get("json"),e.get("resolvedSubtrees"))}),h=t.spec=function(e){return f(e)},v=(t.isOAS3=(0,a.createSelector)(h,function(){return!1}),t.info=(0,a.createSelector)(h,function(e){return j(e&&e.get("info"))})),m=(t.externalDocs=(0,a.createSelector)(h,function(e){return j(e&&e.get("externalDocs"))}),t.version=(0,a.createSelector)(v,function(e){return e&&e.get("version")})),g=(t.semver=(0,a.createSelector)(m,function(e){return/v?([0-9]*)\.([0-9]*)\.([0-9]*)/i.exec(e).slice(1)}),t.paths=(0,a.createSelector)(d,function(e){return e.get("paths")})),y=t.operations=(0,a.createSelector)(g,function(e){if(!e||e.size<1)return(0,s.List)();var t=(0,s.List)();return e&&e.forEach?(e.forEach(function(e,n){if(!e||!e.forEach)return{};e.forEach(function(e,r){l.indexOf(r)<0||(t=t.push((0,s.fromJS)({path:n,method:r,operation:e,id:r+"-"+n})))})}),t):(0,s.List)()}),b=t.consumes=(0,a.createSelector)(h,function(e){return(0,s.Set)(e.get("consumes"))}),_=t.produces=(0,a.createSelector)(h,function(e){return(0,s.Set)(e.get("produces"))}),w=(t.security=(0,a.createSelector)(h,function(e){return e.get("security",(0,s.List)())}),t.securityDefinitions=(0,a.createSelector)(h,function(e){return e.get("securityDefinitions")}),t.findDefinition=function(e,t){var n=e.getIn(["resolvedSubtrees","definitions",t],null),r=e.getIn(["json","definitions",t],null);return n||r||null},t.definitions=(0,a.createSelector)(h,function(e){return e.get("definitions")||(0,s.Map)()}),t.basePath=(0,a.createSelector)(h,function(e){return e.get("basePath")}),t.host=(0,a.createSelector)(h,function(e){return e.get("host")}),t.schemes=(0,a.createSelector)(h,function(e){return e.get("schemes",(0,s.Map)())}),t.operationsWithRootInherited=(0,a.createSelector)(y,b,_,function(e,t,n){return e.map(function(e){return e.update("operation",function(e){if(e){if(!s.Map.isMap(e))return;return e.withMutations(function(e){return e.get("consumes")||e.update("consumes",function(e){return(0,s.Set)(e).merge(t)}),e.get("produces")||e.update("produces",function(e){return(0,s.Set)(e).merge(n)}),e})}return(0,s.Map)()})})})),E=t.tags=(0,a.createSelector)(h,function(e){return e.get("tags",(0,s.List)())}),x=t.tagDetails=function(e,t){return(E(e)||(0,s.List)()).filter(s.Map.isMap).find(function(e){return e.get("name")===t},(0,s.Map)())},S=t.operationsWithTags=(0,a.createSelector)(w,E,function(e,t){return e.reduce(function(e,t){var n=(0,s.Set)(t.getIn(["operation","tags"]));return n.count()<1?e.update("default",(0,s.List)(),function(e){return e.push(t)}):n.reduce(function(e,n){return e.update(n,(0,s.List)(),function(e){return e.push(t)})},e)},t.reduce(function(e,t){return e.set(t.get("name"),(0,s.List)())},(0,s.OrderedMap)()))}),C=(t.taggedOperations=function(e){return function(t){var n=(0,t.getConfigs)(),r=n.tagsSorter,o=n.operationsSorter;return S(e).sortBy(function(e,t){return t},function(e,t){var n="function"==typeof r?r:u.sorters.tagsSorter[r];return n?n(e,t):null}).map(function(t,n){var r="function"==typeof o?o:u.sorters.operationsSorter[o],i=r?t.sort(r):t;return(0,s.Map)({tagDetails:x(e,n),operations:i})})}},t.responses=(0,a.createSelector)(c,function(e){return e.get("responses",(0,s.Map)())})),k=t.requests=(0,a.createSelector)(c,function(e){return e.get("requests",(0,s.Map)())}),A=t.mutatedRequests=(0,a.createSelector)(c,function(e){return e.get("mutatedRequests",(0,s.Map)())}),O=(t.responseFor=function(e,t,n){return C(e).getIn([t,n],null)},t.requestFor=function(e,t,n){return k(e).getIn([t,n],null)},t.mutatedRequestFor=function(e,t,n){return A(e).getIn([t,n],null)},t.allowTryItOutFor=function(){return!0},t.parameterWithMetaByIdentity=function(e,t,n){var r=d(e).getIn(["paths"].concat((0,i.default)(t),["parameters"]),(0,s.OrderedMap)()),o=e.getIn(["meta","paths"].concat((0,i.default)(t),["parameters"]),(0,s.OrderedMap)());return r.map(function(e){var t=o.get(n.get("name")+"."+n.get("in")),r=o.get(n.get("name")+"."+n.get("in")+".hash-"+n.hashCode());return(0,s.OrderedMap)().merge(e,t,r)}).find(function(e){return e.get("in")===n.get("in")&&e.get("name")===n.get("name")},(0,s.OrderedMap)())}),P=(t.parameterInclusionSettingFor=function(e,t,n,r){var o=n+"."+r;return e.getIn(["meta","paths"].concat((0,i.default)(t),["parameter_inclusions",o]),!1)},t.parameterWithMeta=function(e,t,n,r){var o=d(e).getIn(["paths"].concat((0,i.default)(t),["parameters"]),(0,s.OrderedMap)()).find(function(e){return e.get("in")===r&&e.get("name")===n},(0,s.OrderedMap)());return O(e,t,o)},t.operationWithMeta=function(e,t,n){var r=d(e).getIn(["paths",t,n],(0,s.OrderedMap)()),o=e.getIn(["meta","paths",t,n],(0,s.OrderedMap)()),i=r.get("parameters",(0,s.List)()).map(function(r){return O(e,[t,n],r)});return(0,s.OrderedMap)().merge(r,o).set("parameters",i)});t.hasHost=(0,a.createSelector)(h,function(e){var t=e.get("host");return"string"==typeof t&&t.length>0&&"/"!==t[0]});function T(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(s.List.isList(e))return e.some(function(e){return s.Map.isMap(e)&&e.get("type")===t})}function M(e,t){t=t||[];var n=d(e).getIn(["paths"].concat((0,i.default)(t)),null);if(null!==n){var r=e.getIn(["meta","paths"].concat((0,i.default)(t),["produces_value"]),null),o=n.getIn(["produces",0],null);return r||o||"application/json"}}var I=t.operationScheme=function(e,t,n){var r=e.get("url").match(/^([a-z][a-z0-9+\-.]*):/),o=Array.isArray(r)?r[1]:null;return e.getIn(["scheme",t,n])||e.getIn(["scheme","_defaultScheme"])||o||""};t.canExecuteScheme=function(e,t,n){return["http","https"].indexOf(I(e,t,n))>-1},t.validateBeforeExecute=function(e,t){t=t||[];var n=!0;return e.getIn(["meta","paths"].concat((0,i.default)(t),["parameters"]),(0,s.fromJS)([])).forEach(function(e){var t=e.get("errors");t&&t.count()&&(n=!1)}),n};function j(e){return s.Map.isMap(e)?e:new s.Map}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.execute=t.executeRequest=t.logRequest=t.setMutatedRequest=t.setRequest=t.setResponse=t.updateEmptyParamInclusion=t.validateParams=t.invalidateResolvedSubtreeCache=t.updateResolvedSubtree=t.requestResolvedSubtree=t.resolveSpec=t.parseToJson=t.SET_SCHEME=t.UPDATE_RESOLVED_SUBTREE=t.UPDATE_RESOLVED=t.UPDATE_OPERATION_META_VALUE=t.CLEAR_VALIDATE_PARAMS=t.CLEAR_REQUEST=t.CLEAR_RESPONSE=t.LOG_REQUEST=t.SET_MUTATED_REQUEST=t.SET_REQUEST=t.SET_RESPONSE=t.VALIDATE_PARAMS=t.UPDATE_EMPTY_PARAM_INCLUSION=t.UPDATE_PARAM=t.UPDATE_JSON=t.UPDATE_URL=t.UPDATE_SPEC=void 0;var r=b(n(25)),o=b(n(84)),i=b(n(23)),a=b(n(42)),u=b(n(203)),s=b(n(339)),l=b(n(340)),c=b(n(45));t.updateSpec=function(e){var t=L(e).replace(/\t/g," ");if("string"==typeof e)return{type:_,payload:t}},t.updateResolved=function(e){return{type:N,payload:e}},t.updateUrl=function(e){return{type:w,payload:e}},t.updateJsonSpec=function(e){return{type:E,payload:e}},t.changeParam=function(e,t,n,r,o){return{type:x,payload:{path:e,value:r,paramName:t,paramIn:n,isXml:o}}},t.changeParamByIdentity=function(e,t,n,r){return{type:x,payload:{path:e,param:t,value:n,isXml:r}}},t.clearValidateParams=function(e){return{type:I,payload:{pathMethod:e}}},t.changeConsumesValue=function(e,t){return{type:j,payload:{path:e,value:t,key:"consumes_value"}}},t.changeProducesValue=function(e,t){return{type:j,payload:{path:e,value:t,key:"produces_value"}}},t.clearResponse=function(e,t){return{type:T,payload:{path:e,method:t}}},t.clearRequest=function(e,t){return{type:M,payload:{path:e,method:t}}},t.setScheme=function(e,t,n){return{type:D,payload:{scheme:e,path:t,method:n}}};var f=b(n(207)),p=n(7),d=b(n(209)),h=b(n(179)),v=b(n(343)),m=b(n(763)),g=b(n(765)),y=n(12);function b(e){return e&&e.__esModule?e:{default:e}}var _=t.UPDATE_SPEC="spec_update_spec",w=t.UPDATE_URL="spec_update_url",E=t.UPDATE_JSON="spec_update_json",x=t.UPDATE_PARAM="spec_update_param",S=t.UPDATE_EMPTY_PARAM_INCLUSION="spec_update_empty_param_inclusion",C=t.VALIDATE_PARAMS="spec_validate_param",k=t.SET_RESPONSE="spec_set_response",A=t.SET_REQUEST="spec_set_request",O=t.SET_MUTATED_REQUEST="spec_set_mutated_request",P=t.LOG_REQUEST="spec_log_request",T=t.CLEAR_RESPONSE="spec_clear_response",M=t.CLEAR_REQUEST="spec_clear_request",I=t.CLEAR_VALIDATE_PARAMS="spec_clear_validate_param",j=t.UPDATE_OPERATION_META_VALUE="spec_update_operation_meta_value",N=t.UPDATE_RESOLVED="spec_update_resolved",R=t.UPDATE_RESOLVED_SUBTREE="spec_update_resolved_subtree",D=t.SET_SCHEME="set_scheme",L=function(e){return(0,v.default)(e)?e:""};t.parseToJson=function(e){return function(t){var n=t.specActions,r=t.specSelectors,o=t.errActions,i=r.specStr,a=null;try{e=e||i(),o.clear({source:"parser"}),a=f.default.safeLoad(e)}catch(e){return console.error(e),o.newSpecErr({source:"parser",level:"error",message:e.reason,line:e.mark&&e.mark.line?e.mark.line+1:void 0})}return a&&"object"===(void 0===a?"undefined":(0,c.default)(a))?n.updateJsonSpec(a):{}}};var U=!1,q=(t.resolveSpec=function(e,t){return function(n){var r=n.specActions,o=n.specSelectors,i=n.errActions,a=n.fn,u=a.fetch,s=a.resolve,l=a.AST,c=void 0===l?{}:l,f=n.getConfigs;U||(console.warn("specActions.resolveSpec is deprecated since v3.10.0 and will be removed in v4.0.0; use requestResolvedSubtree instead!"),U=!0);var p=f(),d=p.modelPropertyMacro,h=p.parameterMacro,v=p.requestInterceptor,m=p.responseInterceptor;void 0===e&&(e=o.specJson()),void 0===t&&(t=o.url());var g=c.getLineNumberForPath?c.getLineNumberForPath:function(){},y=o.specStr();return s({fetch:u,spec:e,baseDoc:t,modelPropertyMacro:d,parameterMacro:h,requestInterceptor:v,responseInterceptor:m}).then(function(e){var t=e.spec,n=e.errors;if(i.clear({type:"thrown"}),Array.isArray(n)&&n.length>0){var o=n.map(function(e){return console.error(e),e.line=e.fullPath?g(y,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e});i.newThrownErrBatch(o)}return r.updateResolved(t)})}},[]),F=(0,m.default)((0,l.default)(s.default.mark(function e(){var t,n,r,o,i,a,c,f,d,h,v,m,y,b,_,w,E;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=q.system){e.next=4;break}return console.error("debResolveSubtrees: don't have a system to operate on, aborting."),e.abrupt("return");case 4:if(n=t.errActions,r=t.errSelectors,o=t.fn,i=o.resolveSubtree,a=o.AST,c=void 0===a?{}:a,f=t.specSelectors,d=t.specActions,i){e.next=8;break}return console.error("Error: Swagger-Client did not provide a `resolveSubtree` method, doing nothing."),e.abrupt("return");case 8:return h=c.getLineNumberForPath?c.getLineNumberForPath:function(){},v=f.specStr(),m=t.getConfigs(),y=m.modelPropertyMacro,b=m.parameterMacro,_=m.requestInterceptor,w=m.responseInterceptor,e.prev=11,e.next=14,q.reduce(function(){var e=(0,l.default)(s.default.mark(function e(t,o){var a,u,l,c,p,d,m;return s.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t;case 2:return a=e.sent,u=a.resultMap,l=a.specWithCurrentSubtrees,e.next=7,i(l,o,{baseDoc:f.url(),modelPropertyMacro:y,parameterMacro:b,requestInterceptor:_,responseInterceptor:w});case 7:return c=e.sent,p=c.errors,d=c.spec,r.allErrors().size&&n.clear({type:"thrown"}),Array.isArray(p)&&p.length>0&&(m=p.map(function(e){return e.line=e.fullPath?h(v,e.fullPath):null,e.path=e.fullPath?e.fullPath.join("."):null,e.level="error",e.type="thrown",e.source="resolver",Object.defineProperty(e,"message",{enumerable:!0,value:e.message}),e}),n.newThrownErrBatch(m)),(0,g.default)(u,o,d),(0,g.default)(l,o,d),e.abrupt("return",{resultMap:u,specWithCurrentSubtrees:l});case 15:case"end":return e.stop()}},e,void 0)}));return function(t,n){return e.apply(this,arguments)}}(),u.default.resolve({resultMap:(f.specResolvedSubtree([])||(0,p.Map)()).toJS(),specWithCurrentSubtrees:f.specJson().toJS()}));case 14:E=e.sent,delete q.system,q=[],e.next=22;break;case 19:e.prev=19,e.t0=e.catch(11),console.error(e.t0);case 22:d.updateResolvedSubtree([],E.resultMap);case 23:case"end":return e.stop()}},e,void 0,[[11,19]])})),35);t.requestResolvedSubtree=function(e){return function(t){q.push(e),q.system=t,F()}};t.updateResolvedSubtree=function(e,t){return{type:R,payload:{path:e,value:t}}},t.invalidateResolvedSubtreeCache=function(){return{type:R,payload:{path:[],value:(0,p.Map)()}}},t.validateParams=function(e,t){return{type:C,payload:{pathMethod:e,isOAS3:t}}},t.updateEmptyParamInclusion=function(e,t,n,r){return{type:S,payload:{pathMethod:e,paramName:t,paramIn:n,includeEmptyValue:r}}};t.setResponse=function(e,t,n){return{payload:{path:e,method:t,res:n},type:k}},t.setRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:A}},t.setMutatedRequest=function(e,t,n){return{payload:{path:e,method:t,req:n},type:O}},t.logRequest=function(e){return{payload:e,type:P}},t.executeRequest=function(e){return function(t){var n=t.fn,r=t.specActions,o=t.specSelectors,u=t.getConfigs,s=t.oas3Selectors,l=e.pathName,c=e.method,f=e.operation,p=u(),v=p.requestInterceptor,m=p.responseInterceptor,g=f.toJS();if(g&&g.parameters&&g.parameters.length&&g.parameters.filter(function(e){return e&&!0===e.allowEmptyValue}).forEach(function(t){if(o.parameterInclusionSettingFor([l,c],t.name,t.in)){e.parameters=e.parameters||{};var n=e.parameters[t.name];(!n||n&&0===n.size)&&(e.parameters[t.name]="")}}),e.contextUrl=(0,d.default)(o.url()).toString(),g&&g.operationId?e.operationId=g.operationId:g&&l&&c&&(e.operationId=n.opId(g,l,c)),o.isOAS3()){var b=l+":"+c;e.server=s.selectedServer(b)||s.selectedServer();var _=s.serverVariables({server:e.server,namespace:b}).toJS(),w=s.serverVariables({server:e.server}).toJS();e.serverVariables=(0,a.default)(_).length?_:w,e.requestContentType=s.requestContentType(l,c),e.responseContentType=s.responseContentType(l,c)||"*/*";var E=s.requestBodyValue(l,c);(0,y.isJSONObject)(E)?e.requestBody=JSON.parse(E):E&&E.toJS?e.requestBody=E.toJS():e.requestBody=E}var x=(0,i.default)({},e);x=n.buildRequest(x),r.setRequest(e.pathName,e.method,x);e.requestInterceptor=function(t){var n=v.apply(this,[t]),o=(0,i.default)({},n);return r.setMutatedRequest(e.pathName,e.method,o),n},e.responseInterceptor=m;var S=Date.now();return n.execute(e).then(function(t){t.duration=Date.now()-S,r.setResponse(e.pathName,e.method,t)}).catch(function(t){return r.setResponse(e.pathName,e.method,{error:!0,err:(0,h.default)(t)})})}};t.execute=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.path,n=e.method,i=(0,o.default)(e,["path","method"]);return function(e){var o=e.fn.fetch,a=e.specSelectors,u=e.specActions,s=a.specJsonWithResolvedSubtrees().toJS(),l=a.operationScheme(t,n),c=a.contentTypeValues([t,n]).toJS(),f=c.requestContentType,p=c.responseContentType,d=/xml/i.test(f),h=a.parameterValues([t,n],d).toJS();return u.executeRequest((0,r.default)({},i,{fetch:o,spec:s,pathName:t,method:n,parameters:h,requestContentType:f,scheme:l,responseContentType:p}))}}},function(e,t,n){e.exports={default:n(732),__esModule:!0}},function(e,t){e.exports=function(e,t,n,r){if(!(e instanceof t)||void 0!==r&&r in e)throw TypeError(n+": incorrect invocation!");return e}},function(e,t,n){"use strict";var r=n(94);e.exports.f=function(e){return new function(e){var t,n;this.promise=new e(function(e,r){if(void 0!==t||void 0!==n)throw TypeError("Bad Promise constructor");t=e,n=r}),this.resolve=r(t),this.reject=r(n)}(e)}},function(e,t,n){var r=n(50);e.exports=function(e,t,n){for(var o in t)n&&e[o]?e[o]=t[o]:r(e,o,t[o]);return e}},function(e,t,n){"use strict";var r=n(741);e.exports=r},function(e,t,n){"use strict";var r=n(86);e.exports=new r({explicit:[n(744),n(745),n(746)]})},function(e,t,n){"use strict";(function(t){var r=n(761),o=n(762),i=/^([a-z][a-z0-9.+-]*:)?(\/\/)?([\S\s]*)/i,a=/^[A-Za-z][A-Za-z0-9+-.]*:\/\//,u=[["#","hash"],["?","query"],["/","pathname"],["@","auth",1],[NaN,"host",void 0,1,1],[/:(\d+)$/,"port",void 0,1],[NaN,"hostname",void 0,1,1]],s={hash:1,query:1};function l(e){var n,r={},o=typeof(e=e||t.location||{});if("blob:"===e.protocol)r=new f(unescape(e.pathname),{});else if("string"===o)for(n in r=new f(e,{}),s)delete r[n];else if("object"===o){for(n in e)n in s||(r[n]=e[n]);void 0===r.slashes&&(r.slashes=a.test(e.href))}return r}function c(e){var t=i.exec(e);return{protocol:t[1]?t[1].toLowerCase():"",slashes:!!t[2],rest:t[3]}}function f(e,t,n){if(!(this instanceof f))return new f(e,t,n);var i,a,s,p,d,h,v=u.slice(),m=typeof t,g=this,y=0;for("object"!==m&&"string"!==m&&(n=t,t=null),n&&"function"!=typeof n&&(n=o.parse),t=l(t),i=!(a=c(e||"")).protocol&&!a.slashes,g.slashes=a.slashes||i&&t.slashes,g.protocol=a.protocol||t.protocol||"",e=a.rest,a.slashes||(v[2]=[/(.*)/,"pathname"]);y-1||r("96",e),!l.plugins[n]){t.extractEvents||r("97",e),l.plugins[n]=t;var a=t.eventTypes;for(var s in a)u(a[s],t,s)||r("98",s,e)}}}function u(e,t,n){l.eventNameDispatchConfigs.hasOwnProperty(n)&&r("99",n),l.eventNameDispatchConfigs[n]=e;var o=e.phasedRegistrationNames;if(o){for(var i in o){if(o.hasOwnProperty(i))s(o[i],t,n)}return!0}return!!e.registrationName&&(s(e.registrationName,t,n),!0)}function s(e,t,n){l.registrationNameModules[e]&&r("100",e),l.registrationNameModules[e]=t,l.registrationNameDependencies[e]=t.eventTypes[n].dependencies}var l={plugins:[],eventNameDispatchConfigs:{},registrationNameModules:{},registrationNameDependencies:{},possibleRegistrationNames:null,injectEventPluginOrder:function(e){o&&r("101"),o=Array.prototype.slice.call(e),a()},injectEventPluginsByName:function(e){var t=!1;for(var n in e)if(e.hasOwnProperty(n)){var o=e[n];i.hasOwnProperty(n)&&i[n]===o||(i[n]&&r("102",n),i[n]=o,t=!0)}t&&a()},getPluginModuleForEvent:function(e){var t=e.dispatchConfig;if(t.registrationName)return l.registrationNameModules[t.registrationName]||null;if(void 0!==t.phasedRegistrationNames){var n=t.phasedRegistrationNames;for(var r in n)if(n.hasOwnProperty(r)){var o=l.registrationNameModules[n[r]];if(o)return o}}return null},_resetEventPlugins:function(){for(var e in o=null,i)i.hasOwnProperty(e)&&delete i[e];l.plugins.length=0;var t=l.eventNameDispatchConfigs;for(var n in t)t.hasOwnProperty(n)&&delete t[n];var r=l.registrationNameModules;for(var a in r)r.hasOwnProperty(a)&&delete r[a]}};e.exports=l},function(e,t,n){"use strict";var r,o,i=n(10),a=n(212);n(8),n(9);function u(e,t,n,r){var o=e.type||"unknown-event";e.currentTarget=s.getNodeFromInstance(r),t?a.invokeGuardedCallbackWithCatch(o,n,e):a.invokeGuardedCallback(o,n,e),e.currentTarget=null}var s={isEndish:function(e){return"topMouseUp"===e||"topTouchEnd"===e||"topTouchCancel"===e},isMoveish:function(e){return"topMouseMove"===e||"topTouchMove"===e},isStartish:function(e){return"topMouseDown"===e||"topTouchStart"===e},executeDirectDispatch:function(e){var t=e._dispatchListeners,n=e._dispatchInstances;Array.isArray(t)&&i("103"),e.currentTarget=t?s.getNodeFromInstance(n):null;var r=t?t(e):null;return e.currentTarget=null,e._dispatchListeners=null,e._dispatchInstances=null,r},executeDispatchesInOrder:function(e,t){var n=e._dispatchListeners,r=e._dispatchInstances;if(Array.isArray(n))for(var o=0;o0&&r.length<20?n+" (keys: "+r.join(", ")+")":n}function s(e,t){var n=o.get(e);return n||null}var l={isMounted:function(e){var t=o.get(e);return!!t&&!!t._renderedComponent},enqueueCallback:function(e,t,n){l.validateCallback(t,n);var r=s(e);if(!r)return null;r._pendingCallbacks?r._pendingCallbacks.push(t):r._pendingCallbacks=[t],a(r)},enqueueCallbackInternal:function(e,t){e._pendingCallbacks?e._pendingCallbacks.push(t):e._pendingCallbacks=[t],a(e)},enqueueForceUpdate:function(e){var t=s(e);t&&(t._pendingForceUpdate=!0,a(t))},enqueueReplaceState:function(e,t,n){var r=s(e);r&&(r._pendingStateQueue=[t],r._pendingReplaceState=!0,void 0!==n&&null!==n&&(l.validateCallback(n,"replaceState"),r._pendingCallbacks?r._pendingCallbacks.push(n):r._pendingCallbacks=[n]),a(r))},enqueueSetState:function(e,t){var n=s(e);n&&((n._pendingStateQueue||(n._pendingStateQueue=[])).push(t),a(n))},enqueueElementInternal:function(e,t,n){e._pendingElement=t,e._context=n,a(e)},validateCallback:function(e,t){e&&"function"!=typeof e&&r("122",t,u(e))}};e.exports=l},function(e,t,n){"use strict";n(13);var r=n(34),o=(n(9),r);e.exports=o},function(e,t,n){"use strict";e.exports=function(e){var t,n=e.keyCode;return"charCode"in e?0===(t=e.charCode)&&13===n&&(t=13):t=n,t>=32||13===t?t:0}},function(e,t,n){var r=n(61),o=n(228),i=n(47),a="[object Object]",u=Function.prototype,s=Object.prototype,l=u.toString,c=s.hasOwnProperty,f=l.call(Object);e.exports=function(e){if(!i(e)||r(e)!=a)return!1;var t=o(e);if(null===t)return!0;var n=c.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&l.call(n)==f}},function(e,t,n){var r=n(298)(Object.getPrototypeOf,Object);e.exports=r},function(e,t,n){var r=n(292);e.exports=function(e){var t=new e.constructor(e.byteLength);return new r(t).set(new r(e)),t}},function(e,t){var n=this&&this.__extends||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function r(){this.constructor=e}e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)},r=Object.prototype.hasOwnProperty; -/*! - * https://github.com/Starcounter-Jack/JSON-Patch - * (c) 2017 Joachim Wester - * MIT license - */function o(e,t){return r.call(e,t)}function i(e){if(Array.isArray(e)){for(var t=new Array(e.length),n=0;n=48&&t<=57))return!1;n++}return!0},t.escapePathComponent=a,t.unescapePathComponent=function(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")},t._getPathRecursive=u,t.getPath=function(e,t){if(e===t)return"/";var n=u(e,t);if(""===n)throw new Error("Object not found in root");return"/"+n},t.hasUndefined=function e(t){if(void 0===t)return!0;if(t)if(Array.isArray(t)){for(var n=0,r=t.length;nw;w++)if((p||w in y)&&(m=b(v=y[w],w,g),e))if(n)E[w]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return w;case 2:E.push(v)}else if(c)return!1;return f?-1:l||c?c:E}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.authorizeRequest=t.authorizeAccessCodeWithBasicAuthentication=t.authorizeAccessCodeWithFormParams=t.authorizeApplication=t.authorizePassword=t.preAuthorizeImplicit=t.CONFIGURE_AUTH=t.VALIDATE=t.AUTHORIZE_OAUTH2=t.PRE_AUTHORIZE_OAUTH2=t.LOGOUT=t.AUTHORIZE=t.SHOW_AUTH_POPUP=void 0;var r=l(n(45)),o=l(n(23)),i=l(n(41));t.showDefinitions=function(e){return{type:c,payload:e}},t.authorize=function(e){return{type:f,payload:e}},t.logout=function(e){return{type:p,payload:e}},t.authorizeOauth2=function(e){return{type:d,payload:e}},t.configureAuth=function(e){return{type:h,payload:e}};var a=l(n(209)),u=l(n(32)),s=n(12);function l(e){return e&&e.__esModule?e:{default:e}}var c=t.SHOW_AUTH_POPUP="show_popup",f=t.AUTHORIZE="authorize",p=t.LOGOUT="logout",d=(t.PRE_AUTHORIZE_OAUTH2="pre_authorize_oauth2",t.AUTHORIZE_OAUTH2="authorize_oauth2"),h=(t.VALIDATE="validate",t.CONFIGURE_AUTH="configure_auth");t.preAuthorizeImplicit=function(e){return function(t){var n=t.authActions,r=t.errActions,o=e.auth,a=e.token,s=e.isValid,l=o.schema,c=o.name,f=l.get("flow");delete u.default.swaggerUIRedirectOauth2,"accessCode"===f||s||r.newAuthErr({authId:c,source:"auth",level:"warning",message:"Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"}),a.error?r.newAuthErr({authId:c,source:"auth",level:"error",message:(0,i.default)(a)}):n.authorizeOauth2({auth:o,token:a})}};t.authorizePassword=function(e){return function(t){var n=t.authActions,r=e.schema,i=e.name,a=e.username,u=e.password,l=e.passwordType,c=e.clientId,f=e.clientSecret,p={grant_type:"password",scope:e.scopes.join(" ")},d={},h={};return"basic"===l?h.Authorization="Basic "+(0,s.btoa)(a+":"+u):((0,o.default)(p,{username:a},{password:u}),"query"===l?(c&&(d.client_id=c),f&&(d.client_secret=f)):h.Authorization="Basic "+(0,s.btoa)(c+":"+f)),n.authorizeRequest({body:(0,s.buildFormData)(p),url:r.get("tokenUrl"),name:i,headers:h,query:d,auth:e})}},t.authorizeApplication=function(e){return function(t){var n=t.authActions,r=e.schema,o=e.scopes,i=e.name,a=e.clientId,u=e.clientSecret,l={Authorization:"Basic "+(0,s.btoa)(a+":"+u)},c={grant_type:"client_credentials",scope:o.join(" ")};return n.authorizeRequest({body:(0,s.buildFormData)(c),name:i,url:r.get("tokenUrl"),auth:e,headers:l})}},t.authorizeAccessCodeWithFormParams=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,o=t.schema,i=t.name,a=t.clientId,u=t.clientSecret,l={grant_type:"authorization_code",code:t.code,client_id:a,client_secret:u,redirect_uri:n};return r.authorizeRequest({body:(0,s.buildFormData)(l),name:i,url:o.get("tokenUrl"),auth:t})}},t.authorizeAccessCodeWithBasicAuthentication=function(e){var t=e.auth,n=e.redirectUrl;return function(e){var r=e.authActions,o=t.schema,i=t.name,a=t.clientId,u=t.clientSecret,l={Authorization:"Basic "+(0,s.btoa)(a+":"+u)},c={grant_type:"authorization_code",code:t.code,client_id:a,redirect_uri:n};return r.authorizeRequest({body:(0,s.buildFormData)(c),name:i,url:o.get("tokenUrl"),auth:t,headers:l})}},t.authorizeRequest=function(e){return function(t){var n=t.fn,u=t.getConfigs,s=t.authActions,l=t.errActions,c=t.oas3Selectors,f=t.specSelectors,p=t.authSelectors,d=e.body,h=e.query,v=void 0===h?{}:h,m=e.headers,g=void 0===m?{}:m,y=e.name,b=e.url,_=e.auth,w=(p.getConfigs()||{}).additionalQueryStringParams,E=void 0;E=f.isOAS3()?(0,a.default)(b,c.selectedServer(),!0):(0,a.default)(b,f.url(),!0),"object"===(void 0===w?"undefined":(0,r.default)(w))&&(E.query=(0,o.default)({},E.query,w));var x=E.toString(),S=(0,o.default)({Accept:"application/json, text/plain, */*","Content-Type":"application/x-www-form-urlencoded"},g);n.fetch({url:x,method:"post",headers:S,query:v,body:d,requestInterceptor:u().requestInterceptor,responseInterceptor:u().responseInterceptor}).then(function(e){var t=JSON.parse(e.data),n=t&&(t.error||""),r=t&&(t.parseError||"");e.ok?n||r?l.newAuthErr({authId:y,level:"error",source:"auth",message:(0,i.default)(t)}):s.authorizeOauth2({auth:_,token:t}):l.newAuthErr({authId:y,level:"error",source:"auth",message:e.statusText})}).catch(function(e){var t=new Error(e);l.newAuthErr({authId:y,level:"error",source:"auth",message:t.message})})}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseYamlConfig=void 0;var r,o=n(207),i=(r=o)&&r.__esModule?r:{default:r};t.parseYamlConfig=function(e,t){try{return i.default.safeLoad(e)}catch(e){return t&&t.errActions.newThrownErr(new Error(e)),{}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.loaded=t.TOGGLE_CONFIGS=t.UPDATE_CONFIGS=void 0;var r,o=n(22),i=(r=o)&&r.__esModule?r:{default:r};t.update=function(e,t){return{type:a,payload:(0,i.default)({},e,t)}},t.toggle=function(e){return{type:u,payload:e}};var a=t.UPDATE_CONFIGS="configs_update",u=t.TOGGLE_CONFIGS="configs_toggle";t.loaded=function(){return function(){}}},function(e,t,n){"use strict";function r(e,t,n,r,o){this.src=e,this.env=r,this.options=n,this.parser=t,this.tokens=o,this.pos=0,this.posMax=this.src.length,this.level=0,this.pending="",this.pendingLevel=0,this.cache=[],this.isInLabel=!1,this.linkLevel=0,this.linkContent="",this.labelUnmatchedScopes=0}r.prototype.pushPending=function(){this.tokens.push({type:"text",content:this.pending,level:this.pendingLevel}),this.pending=""},r.prototype.push=function(e){this.pending&&this.pushPending(),this.tokens.push(e),this.pendingLevel=this.level},r.prototype.cacheSet=function(e,t){for(var n=this.cache.length;n<=e;n++)this.cache.push(0);this.cache[e]=t},r.prototype.cacheGet=function(e){return es;)r(u,n=t[s++])&&(~i(l,n)||l.push(n));return l}},function(e,t,n){var r=n(21).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(52),o=n(71),i=n(161)("IE_PROTO"),a=Object.prototype;e.exports=Object.getPrototypeOf||function(e){return e=o(e),r(e,i)?e[i]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?a:null}},function(e,t,n){var r=n(33),o=r["__core-js_shared__"]||(r["__core-js_shared__"]={});e.exports=function(e){return o[e]||(o[e]={})}},function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},function(e,t,n){"use strict";var r=n(245)(!0);n(246)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=r(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var r=n(119),o=n(53);e.exports=function(e){return function(t,n){var i,a,u=String(o(t)),s=r(n),l=u.length;return s<0||s>=l?e?"":void 0:(i=u.charCodeAt(s))<55296||i>56319||s+1===l||(a=u.charCodeAt(s+1))<56320||a>57343?e?u.charAt(s):i:e?u.slice(s,s+2):a-56320+(i-55296<<10)+65536}}},function(e,t,n){"use strict";var r=n(247),o=n(29),i=n(72),a=n(58),u=n(102),s=n(462),l=n(170),c=n(468),f=n(17)("iterator"),p=!([].keys&&"next"in[].keys()),d=function(){return this};e.exports=function(e,t,n,h,v,m,g){s(n,t,h);var y,b,_,w=function(e){if(!p&&e in C)return C[e];switch(e){case"keys":case"values":return function(){return new n(this,e)}}return function(){return new n(this,e)}},E=t+" Iterator",x="values"==v,S=!1,C=e.prototype,k=C[f]||C["@@iterator"]||v&&C[v],A=k||w(v),O=v?x?w("entries"):A:void 0,P="Array"==t&&C.entries||k;if(P&&(_=c(P.call(new e)))!==Object.prototype&&_.next&&(l(_,E,!0),r||"function"==typeof _[f]||a(_,f,d)),x&&k&&"values"!==k.name&&(S=!0,A=function(){return k.call(this)}),r&&!g||!p&&!S&&C[f]||a(C,f,A),u[t]=A,u[E]=d,v)if(y={values:x?A:w("values"),keys:m?A:w("keys"),entries:O},g)for(b in y)b in C||i(C,b,y[b]);else o(o.P+o.F*(p||S),t,y);return y}},function(e,t){e.exports=!1},function(e,t,n){var r=n(465),o=n(250);e.exports=Object.keys||function(e){return r(e,o)}},function(e,t,n){var r=n(119),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t){e.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(e,t,n){var r=n(33).document;e.exports=r&&r.documentElement},function(e,t,n){var r=n(59),o=n(121),i=n(17)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||void 0==(n=r(a)[i])?t:o(n)}},function(e,t,n){var r,o,i,a=n(120),u=n(480),s=n(251),l=n(168),c=n(33),f=c.process,p=c.setImmediate,d=c.clearImmediate,h=c.MessageChannel,v=c.Dispatch,m=0,g={},y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){y.call(e.data)};p&&d||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++m]=function(){u("function"==typeof e?e:Function(e),t)},r(m),m},d=function(e){delete g[e]},"process"==n(99)(f)?r=function(e){f.nextTick(a(y,e,1))}:v&&v.now?r=function(e){v.now(a(y,e,1))}:h?(i=(o=new h).port2,o.port1.onmessage=b,r=a(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(r=function(e){c.postMessage(e+"","*")},c.addEventListener("message",b,!1)):r="onreadystatechange"in l("script")?function(e){s.appendChild(l("script")).onreadystatechange=function(){s.removeChild(this),y.call(e)}}:function(e){setTimeout(a(y,e,1),0)}),e.exports={set:p,clear:d}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r=n(59),o=n(73),i=n(171);e.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){var r=n(73),o=n(99),i=n(17)("match");e.exports=function(e){var t;return r(e)&&(void 0!==(t=e[i])?!!t:"RegExp"==o(e))}},function(e,t,n){var r=n(20),o=n(15),i=n(51);e.exports=function(e,t){var n=(o.Object||{})[e]||Object[e],a={};a[e]=t(n),r(r.S+r.F*i(function(){n(1)}),"Object",a)}},function(e,t,n){var r=n(93);e.exports=Array.isArray||function(e){return"Array"==r(e)}},function(e,t,n){var r=n(239),o=n(163).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,o)}},function(e,t,n){var r=n(125),o=n(95),i=n(70),a=n(157),u=n(52),s=n(238),l=Object.getOwnPropertyDescriptor;t.f=n(44)?l:function(e,t){if(e=i(e),t=a(t,!0),s)try{return l(e,t)}catch(e){}if(u(e,t))return o(!r.f.call(e,t),e[t])}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){e.exports={default:n(532),__esModule:!0}},function(e,t,n){"use strict";var r=n(96),o=n(176),i=n(125),a=n(71),u=n(154),s=Object.assign;e.exports=!s||n(51)(function(){var e={},t={},n=Symbol(),r="abcdefghijklmnopqrst";return e[n]=7,r.split("").forEach(function(e){t[e]=e}),7!=s({},e)[n]||Object.keys(s({},t)).join("")!=r})?function(e,t){for(var n=a(e),s=arguments.length,l=1,c=o.f,f=i.f;s>l;)for(var p,d=u(arguments[l++]),h=c?r(d).concat(c(d)):r(d),v=h.length,m=0;v>m;)f.call(d,p=h[m++])&&(n[p]=d[p]);return n}:s},function(e,t,n){"use strict";var r=n(104),o=n(13),i=n(265),a=(n(266),n(126));n(8),n(536);function u(e,t,n){this.props=e,this.context=t,this.refs=a,this.updater=n||i}function s(e,t,n){this.props=e,this.context=t,this.refs=a,this.updater=n||i}function l(){}u.prototype.isReactComponent={},u.prototype.setState=function(e,t){"object"!=typeof e&&"function"!=typeof e&&null!=e&&r("85"),this.updater.enqueueSetState(this,e),t&&this.updater.enqueueCallback(this,t,"setState")},u.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this),e&&this.updater.enqueueCallback(this,e,"forceUpdate")},l.prototype=u.prototype,s.prototype=new l,s.prototype.constructor=s,o(s.prototype,u.prototype),s.prototype.isPureReactComponent=!0,e.exports={Component:u,PureComponent:s}},function(e,t,n){"use strict";n(9);var r={isMounted:function(e){return!1},enqueueCallback:function(e,t){},enqueueForceUpdate:function(e){},enqueueReplaceState:function(e,t){},enqueueSetState:function(e,t){}};e.exports=r},function(e,t,n){"use strict";var r=!1;e.exports=r},function(e,t,n){"use strict";var r="function"==typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103;e.exports=r},function(e,t,n){"use strict";var r=n(544);e.exports=function(e){return r(e,!1)}},function(e,t,n){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(271),o=n(561),i=n(562),a=n(563),u=n(275);n(274);n.d(t,"createStore",function(){return r.b}),n.d(t,"combineReducers",function(){return o.a}),n.d(t,"bindActionCreators",function(){return i.a}),n.d(t,"applyMiddleware",function(){return a.a}),n.d(t,"compose",function(){return u.a})},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),t.b=function e(t,n,a){var u;"function"==typeof n&&void 0===a&&(a=n,n=void 0);if(void 0!==a){if("function"!=typeof a)throw new Error("Expected the enhancer to be a function.");return a(e)(t,n)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var s=t;var l=n;var c=[];var f=c;var p=!1;function d(){f===c&&(f=c.slice())}function h(){return l}function v(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return d(),f.push(e),function(){if(t){t=!1,d();var n=f.indexOf(e);f.splice(n,1)}}}function m(e){if(!r.a(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,l=s(l,e)}finally{p=!1}for(var t=c=f,n=0;no?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var i=Array(o);++rp))return!1;var h=c.get(e);if(h&&c.get(t))return h==t;var v=-1,m=!0,g=n&u?new r:void 0;for(c.set(e,t),c.set(t,e);++v0?("string"==typeof t||a.objectMode||Object.getPrototypeOf(t)===l.prototype||(t=function(e){return l.from(e)}(t)),r?a.endEmitted?e.emit("error",new Error("stream.unshift() after end event")):w(e,a,t,!0):a.ended?e.emit("error",new Error("stream.push() after EOF")):(a.reading=!1,a.decoder&&!n?(t=a.decoder.write(t),a.objectMode||0!==t.length?w(e,a,t,!1):k(e,a)):w(e,a,t,!1))):r||(a.reading=!1));return function(e){return!e.ended&&(e.needReadable||e.lengtht.highWaterMark&&(t.highWaterMark=function(e){return e>=E?e=E:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function S(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(d("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?o.nextTick(C,e):C(e))}function C(e){d("emit readable"),e.emit("readable"),T(e)}function k(e,t){t.readingMore||(t.readingMore=!0,o.nextTick(A,e,t))}function A(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=function(e,t,n){var r;ei.length?i.length:e;if(a===i.length?o+=i:o+=i.slice(0,e),0===(e-=a)){a===i.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=i.slice(a));break}++r}return t.length-=r,o}(e,t):function(e,t){var n=l.allocUnsafe(e),r=t.head,o=1;r.data.copy(n),e-=r.data.length;for(;r=r.next;){var i=r.data,a=e>i.length?i.length:e;if(i.copy(n,n.length-e,0,a),0===(e-=a)){a===i.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=i.slice(a));break}++o}return t.length-=o,n}(e,t);return r}(e,t.buffer,t.decoder),n);var n}function I(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,o.nextTick(j,t,e))}function j(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function N(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return d("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?I(this):S(this),null;if(0===(e=x(e,t))&&t.ended)return 0===t.length&&I(this),null;var r,o=t.needReadable;return d("need readable",o),(0===t.length||t.length-e0?M(e,t):null)?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&I(this)),null!==r&&this.emit("data",r),r},b.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},b.prototype.pipe=function(e,t){var n=this,i=this._readableState;switch(i.pipesCount){case 0:i.pipes=e;break;case 1:i.pipes=[i.pipes,e];break;default:i.pipes.push(e)}i.pipesCount+=1,d("pipe count=%d opts=%j",i.pipesCount,t);var s=(!t||!1!==t.end)&&e!==r.stdout&&e!==r.stderr?c:b;function l(t,r){d("onunpipe"),t===n&&r&&!1===r.hasUnpiped&&(r.hasUnpiped=!0,d("cleanup"),e.removeListener("close",g),e.removeListener("finish",y),e.removeListener("drain",f),e.removeListener("error",m),e.removeListener("unpipe",l),n.removeListener("end",c),n.removeListener("end",b),n.removeListener("data",v),p=!0,!i.awaitDrain||e._writableState&&!e._writableState.needDrain||f())}function c(){d("onend"),e.end()}i.endEmitted?o.nextTick(s):n.once("end",s),e.on("unpipe",l);var f=function(e){return function(){var t=e._readableState;d("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,0===t.awaitDrain&&u(e,"data")&&(t.flowing=!0,T(e))}}(n);e.on("drain",f);var p=!1;var h=!1;function v(t){d("ondata"),h=!1,!1!==e.write(t)||h||((1===i.pipesCount&&i.pipes===e||i.pipesCount>1&&-1!==N(i.pipes,e))&&!p&&(d("false write response, pause",n._readableState.awaitDrain),n._readableState.awaitDrain++,h=!0),n.pause())}function m(t){d("onerror",t),b(),e.removeListener("error",m),0===u(e,"error")&&e.emit("error",t)}function g(){e.removeListener("finish",y),b()}function y(){d("onfinish"),e.removeListener("close",g),b()}function b(){d("unpipe"),n.unpipe(e)}return n.on("data",v),function(e,t,n){if("function"==typeof e.prependListener)return e.prependListener(t,n);e._events&&e._events[t]?a(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]:e.on(t,n)}(e,"error",m),e.once("close",g),e.once("finish",y),e.emit("pipe",n),i.flowing||(d("pipe resume"),n.resume()),e},b.prototype.unpipe=function(e){var t=this._readableState,n={hasUnpiped:!1};if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this,n),this);if(!e){var r=t.pipes,o=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(662),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(t,n(31))},function(e,t,n){"use strict";var r=n(141).Buffer,o=r.isEncoding||function(e){switch((e=""+e)&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function i(e){var t;switch(this.encoding=function(e){var t=function(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}(e);if("string"!=typeof t&&(r.isEncoding===o||!o(e)))throw new Error("Unknown encoding: "+e);return t||e}(e),this.encoding){case"utf16le":this.text=s,this.end=l,t=4;break;case"utf8":this.fillLast=u,t=4;break;case"base64":this.text=c,this.end=f,t=3;break;default:return this.write=p,void(this.end=d)}this.lastNeed=0,this.lastTotal=0,this.lastChar=r.allocUnsafe(t)}function a(e){return e<=127?0:e>>5==6?2:e>>4==14?3:e>>3==30?4:e>>6==2?-1:-2}function u(e){var t=this.lastTotal-this.lastNeed,n=function(e,t,n){if(128!=(192&t[0]))return e.lastNeed=0,"�";if(e.lastNeed>1&&t.length>1){if(128!=(192&t[1]))return e.lastNeed=1,"�";if(e.lastNeed>2&&t.length>2&&128!=(192&t[2]))return e.lastNeed=2,"�"}}(this,e);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function s(e,t){if((e.length-t)%2==0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function l(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function c(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function f(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function p(e){return e.toString(this.encoding)}function d(e){return e&&e.length?this.write(e):""}t.StringDecoder=i,i.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(void 0===(t=this.fillLast(e)))return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n=0)return o>0&&(e.lastNeed=o-1),o;if(--r=0)return o>0&&(e.lastNeed=o-2),o;if(--r=0)return o>0&&(2===o?o=0:e.lastNeed=o-3),o;return 0}(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)},i.prototype.fillLast=function(e){if(this.lastNeed<=e.length)return e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,this.lastTotal-this.lastNeed,0,e.length),this.lastNeed-=e.length}},function(e,t,n){"use strict";e.exports=i;var r=n(64),o=n(106);function i(e){if(!(this instanceof i))return new i(e);r.call(this,e),this._transformState={afterTransform:function(e,t){var n=this._transformState;n.transforming=!1;var r=n.writecb;if(!r)return this.emit("error",new Error("write callback called multiple times"));n.writechunk=null,n.writecb=null,null!=t&&this.push(t),r(e);var o=this._readableState;o.reading=!1,(o.needReadable||o.length=0?n&&o?o-1:o:1:!1!==e&&r(e)}},function(e,t,n){"use strict";e.exports=n(678)()?Object.assign:n(679)},function(e,t,n){"use strict";var r,o,i,a,u,s=n(66),l=function(e,t){return t};try{Object.defineProperty(l,"length",{configurable:!0,writable:!1,enumerable:!1,value:1})}catch(e){}1===l.length?(r={configurable:!0,writable:!1,enumerable:!1},o=Object.defineProperty,e.exports=function(e,t){return t=s(t),e.length===t?e:(r.value=t,o(e,"length",r))}):(a=n(317),u=[],i=function(e){var t,n=0;if(u[e])return u[e];for(t=[];e--;)t.push("a"+(++n).toString(36));return new Function("fn","return function ("+t.join(", ")+") { return fn.apply(this, arguments); };")},e.exports=function(e,t){var n;if(t=s(t),e.length===t)return e;n=i(t)(e);try{a(n,e)}catch(e){}return n})},function(e,t,n){"use strict";var r=n(82),o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,u=Object.getOwnPropertySymbols;e.exports=function(e,t){var n,s=Object(r(t));if(e=Object(r(e)),a(s).forEach(function(r){try{o(e,r,i(t,r))}catch(e){n=e}}),"function"==typeof u&&u(s).forEach(function(r){try{o(e,r,i(t,r))}catch(e){n=e}}),void 0!==n)throw n;return e}},function(e,t,n){"use strict";var r=n(56),o=n(142),i=Function.prototype.call;e.exports=function(e,t){var n={},a=arguments[2];return r(t),o(e,function(e,r,o,u){n[r]=i.call(t,a,e,r,o,u)}),n}},function(e,t){e.exports=function(e){return!!e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof e.then}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){return{statePlugins:{err:{reducers:(0,i.default)(e),actions:a,selectors:u}}}};var r,o=n(321),i=(r=o)&&r.__esModule?r:{default:r},a=s(n(127)),u=s(n(326));function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(22)),o=s(n(23));t.default=function(e){var t;return t={},(0,r.default)(t,i.NEW_THROWN_ERR,function(t,n){var r=n.payload,i=(0,o.default)(l,r,{type:"thrown"});return t.update("errors",function(e){return(e||(0,a.List)()).push((0,a.fromJS)(i))}).update("errors",function(t){return(0,u.default)(t,e.getSystem())})}),(0,r.default)(t,i.NEW_THROWN_ERR_BATCH,function(t,n){var r=n.payload;return r=r.map(function(e){return(0,a.fromJS)((0,o.default)(l,e,{type:"thrown"}))}),t.update("errors",function(e){return(e||(0,a.List)()).concat((0,a.fromJS)(r))}).update("errors",function(t){return(0,u.default)(t,e.getSystem())})}),(0,r.default)(t,i.NEW_SPEC_ERR,function(t,n){var r=n.payload,o=(0,a.fromJS)(r);return o=o.set("type","spec"),t.update("errors",function(e){return(e||(0,a.List)()).push((0,a.fromJS)(o)).sortBy(function(e){return e.get("line")})}).update("errors",function(t){return(0,u.default)(t,e.getSystem())})}),(0,r.default)(t,i.NEW_SPEC_ERR_BATCH,function(t,n){var r=n.payload;return r=r.map(function(e){return(0,a.fromJS)((0,o.default)(l,e,{type:"spec"}))}),t.update("errors",function(e){return(e||(0,a.List)()).concat((0,a.fromJS)(r))}).update("errors",function(t){return(0,u.default)(t,e.getSystem())})}),(0,r.default)(t,i.NEW_AUTH_ERR,function(t,n){var r=n.payload,i=(0,a.fromJS)((0,o.default)({},r));return i=i.set("type","auth"),t.update("errors",function(e){return(e||(0,a.List)()).push((0,a.fromJS)(i))}).update("errors",function(t){return(0,u.default)(t,e.getSystem())})}),(0,r.default)(t,i.CLEAR,function(e,t){var n=t.payload;if(!n||!e.get("errors"))return e;var r=e.get("errors").filter(function(e){return e.keySeq().every(function(t){var r=e.get(t),o=n[t];return!o||r!==o})});return e.merge({errors:r})}),(0,r.default)(t,i.CLEAR_BY,function(e,t){var n=t.payload;if(!n||"function"!=typeof n)return e;var r=e.get("errors").filter(function(e){return n(e)});return e.merge({errors:r})}),t};var i=n(127),a=n(7),u=s(n(322));function s(e){return e&&e.__esModule?e:{default:e}}var l={line:0,level:"error",message:"Unknown error"}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){var n={jsSpec:t.specSelectors.specJson().toJS()};return(0,i.default)(u,function(e,t){try{var r=t.transform(e,n);return r.filter(function(e){return!!e})}catch(t){return console.error("Transformer error:",t),e}},e).filter(function(e){return!!e}).map(function(e){return!e.get("line")&&e.get("path"),e})};var r,o=n(726),i=(r=o)&&r.__esModule?r:{default:r};function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}var u=[a(n(323)),a(n(324)),a(n(325))]},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transform=function(e){return e.map(function(e){var t=e.get("message").indexOf("is not of a type(s)");if(t>-1){var n=e.get("message").slice(t+"is not of a type(s)".length).split(",");return e.set("message",e.get("message").slice(0,t)+function(e){return e.reduce(function(e,t,n,r){return n===r.length-1&&r.length>1?e+"or "+t:r[n+1]&&r.length>2?e+t+", ":r[n+1]?e+t+" ":e+t},"should be a")}(n))}return e})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transform=function(e,t){t.jsSpec;return e};var r,o=n(138);(r=o)&&r.__esModule,n(7)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.transform=function(e){return e.map(function(e){return e.set("message",(t=e.get("message"),n="instance.",t.replace(new RegExp(n,"g"),"")));var t,n})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.lastError=t.allErrors=void 0;var r=n(7),o=n(57),i=t.allErrors=(0,o.createSelector)(function(e){return e},function(e){return e.get("errors",(0,r.List)())});t.lastError=(0,o.createSelector)(i,function(e){return e.last()})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{statePlugins:{layout:{reducers:i.default,actions:a,selectors:u}}}};var r,o=n(328),i=(r=o)&&r.__esModule?r:{default:r},a=s(n(200)),u=s(n(329));function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o,i=n(22),a=(r=i)&&r.__esModule?r:{default:r},u=n(7),s=n(200);t.default=(o={},(0,a.default)(o,s.UPDATE_LAYOUT,function(e,t){return e.set("layout",t.payload)}),(0,a.default)(o,s.UPDATE_FILTER,function(e,t){return e.set("filter",t.payload)}),(0,a.default)(o,s.SHOW,function(e,t){var n=t.payload.shown,r=(0,u.fromJS)(t.payload.thing);return e.update("shown",(0,u.fromJS)({}),function(e){return e.set(r,n)})}),(0,a.default)(o,s.UPDATE_MODE,function(e,t){var n=t.payload.thing,r=t.payload.mode;return e.setIn(["modes"].concat(n),(r||"")+"")}),o)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.showSummary=t.whatMode=t.isShown=t.currentFilter=t.current=void 0;var r,o=n(83),i=(r=o)&&r.__esModule?r:{default:r},a=n(57),u=n(12),s=n(7);t.current=function(e){return e.get("layout")},t.currentFilter=function(e){return e.get("filter")};var l=t.isShown=function(e,t,n){return t=(0,u.normalizeArray)(t),e.get("shown",(0,s.fromJS)({})).get((0,s.fromJS)(t),n)};t.whatMode=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return t=(0,u.normalizeArray)(t),e.getIn(["modes"].concat((0,i.default)(t)),n)},t.showSummary=(0,a.createSelector)(function(e){return e},function(e){return!l(e,"editor")})},function(e,t,n){var r=n(36);e.exports=function(e,t,n,o){try{return o?t(r(n)[0],n[1]):t(n)}catch(t){var i=e.return;throw void 0!==i&&r(i.call(e)),t}}},function(e,t,n){var r=n(69),o=n(19)("iterator"),i=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||i[o]===e)}},function(e,t,n){var r=n(19)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(e){}e.exports=function(e,t){if(!t&&!o)return!1;var n=!1;try{var i=[7],a=i[r]();a.next=function(){return{done:n=!0}},i[r]=function(){return a},e(i)}catch(e){}return n}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{statePlugins:{spec:{wrapActions:s,reducers:i.default,actions:a,selectors:u}}}};var r,o=n(334),i=(r=o)&&r.__esModule?r:{default:r},a=l(n(202)),u=l(n(201)),s=l(n(347));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=p(n(22)),i=p(n(23)),a=p(n(83)),u=n(7),s=n(12),l=p(n(32)),c=n(201),f=n(202);function p(e){return e&&e.__esModule?e:{default:e}}t.default=(r={},(0,o.default)(r,f.UPDATE_SPEC,function(e,t){return"string"==typeof t.payload?e.set("spec",t.payload):e}),(0,o.default)(r,f.UPDATE_URL,function(e,t){return e.set("url",t.payload+"")}),(0,o.default)(r,f.UPDATE_JSON,function(e,t){return e.set("json",(0,s.fromJSOrdered)(t.payload))}),(0,o.default)(r,f.UPDATE_RESOLVED,function(e,t){return e.setIn(["resolved"],(0,s.fromJSOrdered)(t.payload))}),(0,o.default)(r,f.UPDATE_RESOLVED_SUBTREE,function(e,t){var n=t.payload,r=n.value,o=n.path;return e.setIn(["resolvedSubtrees"].concat((0,a.default)(o)),(0,s.fromJSOrdered)(r))}),(0,o.default)(r,f.UPDATE_PARAM,function(e,t){var n=t.payload,r=n.path,o=n.paramName,i=n.paramIn,u=n.param,s=n.value,l=n.isXml,c=void 0;c=u&&u.hashCode&&!i&&!o?u.get("name")+"."+u.get("in")+".hash-"+u.hashCode():o+"."+i;var f=l?"value_xml":"value";return e.setIn(["meta","paths"].concat((0,a.default)(r),["parameters",c,f]),s)}),(0,o.default)(r,f.UPDATE_EMPTY_PARAM_INCLUSION,function(e,t){var n=t.payload,r=n.pathMethod,o=n.paramName,i=n.paramIn,u=n.includeEmptyValue;if(!o||!i)return console.warn("Warning: UPDATE_EMPTY_PARAM_INCLUSION could not generate a paramKey."),e;var s=o+"."+i;return e.setIn(["meta","paths"].concat((0,a.default)(r),["parameter_inclusions",s]),u)}),(0,o.default)(r,f.VALIDATE_PARAMS,function(e,t){var n=t.payload,r=n.pathMethod,o=n.isOAS3,i=e.getIn(["meta","paths"].concat((0,a.default)(r)),(0,u.fromJS)({})),l=/xml/i.test(i.get("consumes_value")),f=c.operationWithMeta.apply(void 0,[e].concat((0,a.default)(r)));return e.updateIn(["meta","paths"].concat((0,a.default)(r),["parameters"]),(0,u.fromJS)({}),function(e){return f.get("parameters",(0,u.List)()).reduce(function(e,t){var n=(0,s.validateParam)(t,l,o);return e.setIn([t.get("name")+"."+t.get("in"),"errors"],(0,u.fromJS)(n))},e)})}),(0,o.default)(r,f.CLEAR_VALIDATE_PARAMS,function(e,t){var n=t.payload.pathMethod;return e.updateIn(["meta","paths"].concat((0,a.default)(n),["parameters"]),(0,u.fromJS)([]),function(e){return e.map(function(e){return e.set("errors",(0,u.fromJS)([]))})})}),(0,o.default)(r,f.SET_RESPONSE,function(e,t){var n=t.payload,r=n.res,o=n.path,a=n.method,u=void 0;(u=r.error?(0,i.default)({error:!0,name:r.err.name,message:r.err.message,statusCode:r.err.statusCode},r.err.response):r).headers=u.headers||{};var c=e.setIn(["responses",o,a],(0,s.fromJSOrdered)(u));return l.default.Blob&&r.data instanceof l.default.Blob&&(c=c.setIn(["responses",o,a,"text"],r.data)),c}),(0,o.default)(r,f.SET_REQUEST,function(e,t){var n=t.payload,r=n.req,o=n.path,i=n.method;return e.setIn(["requests",o,i],(0,s.fromJSOrdered)(r))}),(0,o.default)(r,f.SET_MUTATED_REQUEST,function(e,t){var n=t.payload,r=n.req,o=n.path,i=n.method;return e.setIn(["mutatedRequests",o,i],(0,s.fromJSOrdered)(r))}),(0,o.default)(r,f.UPDATE_OPERATION_META_VALUE,function(e,t){var n=t.payload,r=n.path,o=n.value,i=n.key,s=["paths"].concat((0,a.default)(r)),l=["meta","paths"].concat((0,a.default)(r));return e.getIn(["json"].concat((0,a.default)(s)))||e.getIn(["resolved"].concat((0,a.default)(s)))||e.getIn(["resolvedSubtrees"].concat((0,a.default)(s)))?e.setIn([].concat((0,a.default)(l),[i]),(0,u.fromJS)(o)):e}),(0,o.default)(r,f.CLEAR_RESPONSE,function(e,t){var n=t.payload,r=n.path,o=n.method;return e.deleteIn(["responses",r,o])}),(0,o.default)(r,f.CLEAR_REQUEST,function(e,t){var n=t.payload,r=n.path,o=n.method;return e.deleteIn(["requests",r,o])}),(0,o.default)(r,f.SET_SCHEME,function(e,t){var n=t.payload,r=n.scheme,o=n.path,i=n.method;return o&&i?e.setIn(["scheme",o,i],r):o||i?void 0:e.setIn(["scheme","_defaultScheme"],r)}),r)},function(e,t,n){var r=n(36),o=n(94),i=n(19)("species");e.exports=function(e,t){var n,a=r(e).constructor;return void 0===a||void 0==(n=r(a)[i])?t:o(n)}},function(e,t,n){var r,o,i,a=n(49),u=n(734),s=n(240),l=n(156),c=n(21),f=c.process,p=c.setImmediate,d=c.clearImmediate,h=c.MessageChannel,v=c.Dispatch,m=0,g={},y=function(){var e=+this;if(g.hasOwnProperty(e)){var t=g[e];delete g[e],t()}},b=function(e){y.call(e.data)};p&&d||(p=function(e){for(var t=[],n=1;arguments.length>n;)t.push(arguments[n++]);return g[++m]=function(){u("function"==typeof e?e:Function(e),t)},r(m),m},d=function(e){delete g[e]},"process"==n(93)(f)?r=function(e){f.nextTick(a(y,e,1))}:v&&v.now?r=function(e){v.now(a(y,e,1))}:h?(i=(o=new h).port2,o.port1.onmessage=b,r=a(i.postMessage,i,1)):c.addEventListener&&"function"==typeof postMessage&&!c.importScripts?(r=function(e){c.postMessage(e+"","*")},c.addEventListener("message",b,!1)):r="onreadystatechange"in l("script")?function(e){s.appendChild(l("script")).onreadystatechange=function(){s.removeChild(this),y.call(e)}}:function(e){setTimeout(a(y,e,1),0)}),e.exports={set:p,clear:d}},function(e,t){e.exports=function(e){try{return{e:!1,v:e()}}catch(e){return{e:!0,v:e}}}},function(e,t,n){var r=n(36),o=n(28),i=n(205);e.exports=function(e,t){if(r(e),o(t)&&t.constructor===e)return t;var n=i.f(e);return(0,n.resolve)(t),n.promise}},function(e,t,n){e.exports=n(739)},function(e,t,n){"use strict";t.__esModule=!0;var r,o=n(203),i=(r=o)&&r.__esModule?r:{default:r};t.default=function(e){return function(){var t=e.apply(this,arguments);return new i.default(function(e,n){return function r(o,a){try{var u=t[o](a),s=u.value}catch(e){return void n(e)}if(!u.done)return i.default.resolve(s).then(function(e){r("next",e)},function(e){r("throw",e)});e(s)}("next")})}}},function(e,t,n){"use strict";var r=n(86);e.exports=new r({include:[n(342)]})},function(e,t,n){"use strict";var r=n(86);e.exports=new r({include:[n(208)],implicit:[n(747),n(748),n(749),n(750)]})},function(e,t,n){var r=n(61),o=n(24),i=n(47),a="[object String]";e.exports=function(e){return"string"==typeof e||!o(e)&&i(e)&&r(e)==a}},function(e,t,n){var r=n(146),o=n(79),i=n(135),a=n(38),u=n(80);e.exports=function(e,t,n,s){if(!a(e))return e;for(var l=-1,c=(t=o(t,e)).length,f=c-1,p=e;null!=p&&++l.":"function"==typeof t?" Instead of passing a class like Foo, pass React.createElement(Foo) or .":null!=t&&void 0!==t.props?" This may be caused by unintentionally loading two independent copies of React.":"");var i,u=a.createElement(D,{child:t});if(e){var s=p.get(e);i=s._processChildContext(s._context)}else i=g;var l=N(n);if(l){var c=l._currentElement.props.child;if(_(c,t)){var f=l._renderedComponent.getPublicInstance(),d=o&&function(){o.call(f)};return L._updateRootComponent(l,u,i,n,d),f}L.unmountComponentAtNode(n)}var h=A(n),m=h&&!!O(h),y=I(n),b=m&&!l&&!y,w=L._renderNewRootComponent(u,n,b,i)._renderedComponent.getPublicInstance();return o&&o.call(w),w},render:function(e,t,n){return L._renderSubtreeIntoContainer(null,e,t,n)},unmountComponentAtNode:function(e){j(e)||r("40");var t=N(e);if(!t){I(e),1===e.nodeType&&e.hasAttribute(E);return!1}return delete k[t._instance.rootID],m.batchedUpdates(M,t,e,!1),!0},_mountImageIntoNode:function(e,t,n,i,a){if(j(t)||r("41"),i){var u=A(t);if(d.canReuseMarkup(e,u))return void s.precacheNode(n,u);var l=u.getAttribute(d.CHECKSUM_ATTR_NAME);u.removeAttribute(d.CHECKSUM_ATTR_NAME);var c=u.outerHTML;u.setAttribute(d.CHECKSUM_ATTR_NAME,l);var f=e,p=function(e,t){for(var n=Math.min(e.length,t.length),r=0;r1?r-1:0),a=1;a=o&&(t=console)[e].apply(t,i)}return i.warn=i.bind(null,"warn"),i.error=i.bind(null,"error"),i.info=i.bind(null,"info"),i.debug=i.bind(null,"debug"),{rootInjects:{log:i}}}},function(e,t,n){"use strict";var r,o=n(388),i=(r=o)&&r.__esModule?r:{default:r};e.exports=function(e){var t=e.configs;return{fn:{fetch:i.default.makeHttp(t.preFetch,t.postFetch),buildRequest:i.default.buildRequest,execute:i.default.execute,resolve:i.default.resolve,resolveSubtree:i.default.resolveSubtree,serializeRes:i.default.serializeRes,opId:i.default.helpers.opId}}}},function(e,t,n){e.exports=function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=23)}([function(e,t){e.exports=n(42)},function(e,t){e.exports=n(45)},function(e,t){e.exports=n(23)},function(e,t){e.exports=n(25)},function(e,t){e.exports=n(339)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:{}).v2OperationIdCompatibilityMode;return e&&"object"===(void 0===e?"undefined":(0,c.default)(e))?(e.operationId||"").replace(/\s/g,"").length?h(e.operationId):i(t,n,{v2OperationIdCompatibilityMode:r}):null}function i(e,t){if((arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).v2OperationIdCompatibilityMode){var n=(t.toLowerCase()+"_"+e).replace(/[\s!@#$%^&*()_+=[{\]};:<>|.\/?,\\'""-]/g,"_");return(n=n||e.substring(1)+"_"+t).replace(/((_){2,})/g,"_").replace(/^(_)*/g,"").replace(/([_])*$/g,"")}return""+d(t)+h(e)}function a(e,t){return d(t)+"-"+e}function u(e,t){return s(e,t,!0)||null}function s(e,t,n){if(!e||"object"!==(void 0===e?"undefined":(0,c.default)(e))||!e.paths||"object"!==(0,c.default)(e.paths))return null;var r=e.paths;for(var o in r)for(var i in r[o])if("PARAMETERS"!==i.toUpperCase()){var a=r[o][i];if(a&&"object"===(void 0===a?"undefined":(0,c.default)(a))){var u={spec:e,pathName:o,method:i.toUpperCase(),operation:a},s=t(u);if(n&&s)return u}}}Object.defineProperty(t,"__esModule",{value:!0});var l=r(n(18)),c=r(n(1));t.isOAS3=function(e){var t=e.openapi;return!!t&&(0,p.default)(t,"3")},t.isSwagger2=function(e){var t=e.swagger;return!!t&&(0,p.default)(t,"2")},t.opId=o,t.idFromPathMethod=i,t.legacyIdFromPathMethod=a,t.getOperationRaw=function(e,t){return e&&e.paths?u(e,function(e){var n=e.pathName,r=e.method,i=e.operation;if(!i||"object"!==(void 0===i?"undefined":(0,c.default)(i)))return!1;var u=i.operationId;return[o(i,n,r),a(n,r),u].some(function(e){return e&&e===t})}):null},t.findOperation=u,t.eachOperation=s,t.normalizeSwagger=function(e){var t=e.spec,n=t.paths,r={};if(!n||t.$$normalized)return e;for(var i in n){var a=n[i];if((0,f.default)(a)){var u=a.parameters;for(var s in a)!function(e){var n=a[e];if(!(0,f.default)(n))return"continue";var s=o(n,i,e);if(s){r[s]?r[s].push(n):r[s]=[n];var c=r[s];if(c.length>1)c.forEach(function(e,t){e.__originalOperationId=e.__originalOperationId||e.operationId,e.operationId=""+s+(t+1)});else if(void 0!==n.operationId){var p=c[0];p.__originalOperationId=p.__originalOperationId||n.operationId,p.operationId=s}}if("parameters"!==e){var d=[],h={};for(var v in t)"produces"!==v&&"consumes"!==v&&"security"!==v||(h[v]=t[v],d.push(h));if(u&&(h.parameters=u,d.push(h)),d.length){var m=!0,g=!1,y=void 0;try{for(var b,_=(0,l.default)(d);!(m=(b=_.next()).done);m=!0){var w=b.value;for(var E in w)if(n[E]){if("parameters"===E){var x=!0,S=!1,C=void 0;try{for(var k,A=(0,l.default)(w[E]);!(x=(k=A.next()).done);x=!0)!function(){var e=k.value;n[E].some(function(t){return t.name&&t.name===e.name||t.$ref&&t.$ref===e.$ref||t.$$ref&&t.$$ref===e.$$ref||t===e})||n[E].push(e)}()}catch(e){S=!0,C=e}finally{try{!x&&A.return&&A.return()}finally{if(S)throw C}}}}else n[E]=w[E]}}catch(e){g=!0,y=e}finally{try{!m&&_.return&&_.return()}finally{if(g)throw y}}}}}(s)}}return t.$$normalized=!0,e};var f=r(n(47)),p=r(n(14)),d=function(e){return String.prototype.toLowerCase.call(e)},h=function(e){return e.replace(/[^\w]/gi,"_")}},function(e,t){e.exports=n(892)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){var n=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).loadSpec,r=void 0!==n&&n,o={ok:e.ok,url:e.url||t,status:e.status,statusText:e.statusText,headers:i(e.headers)},a=o.headers["content-type"],u=r||_(a);return(u?e.text:e.blob||e.buffer).call(e).then(function(e){if(o.text=e,o.data=e,u)try{var t=function(e,t){return"application/json"===t?JSON.parse(e):g.default.safeLoad(e)}(e,a);o.body=t,o.obj=t}catch(e){o.parseError=e}return o})}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t={};return"function"==typeof e.forEach?(e.forEach(function(e,n){void 0!==t[n]?(t[n]=Array.isArray(t[n])?t[n]:[t[n]],t[n].push(e)):t[n]=e}),t):t}function a(e){return"undefined"!=typeof File?e instanceof File:null!==e&&"object"===(void 0===e?"undefined":(0,h.default)(e))&&"function"==typeof e.pipe}function u(e,t){var n=e.collectionFormat,r=e.allowEmptyValue,o="object"===(void 0===e?"undefined":(0,h.default)(e))?e.value:e;if(void 0===o&&r)return"";if(a(o)||"boolean"==typeof o)return o;var i=encodeURIComponent;return t&&(i=(0,y.default)(o)?function(e){return e}:function(e){return(0,p.default)(e)}),"object"!==(void 0===o?"undefined":(0,h.default)(o))||Array.isArray(o)?Array.isArray(o)?Array.isArray(o)&&!n?o.map(i).join(","):"multi"===n?o.map(i):o.map(i).join({csv:",",ssv:"%20",tsv:"%09",pipes:"|"}[n]):i(o):""}function s(e){var t=(0,f.default)(e).reduce(function(t,n){var r=e[n],o=!!r.skipEncoding,i=o?n:encodeURIComponent(n),a=function(e){return e&&"object"===(void 0===e?"undefined":(0,h.default)(e))}(r)&&!Array.isArray(r);return t[i]=u(a?r:{value:r},o),t},{});return m.default.stringify(t,{encode:!1,indices:!1})||""}function l(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.url,r=void 0===t?"":t,o=e.query,i=e.form;if(i){var l=(0,f.default)(i).some(function(e){return a(i[e].value)}),p=e.headers["content-type"]||e.headers["Content-Type"];if(l||/multipart\/form-data/i.test(p)){var d=n(30);e.body=new d,(0,f.default)(i).forEach(function(t){e.body.append(t,u(i[t],!0))})}else e.body=s(i);delete e.form}if(o){var h=r.split("?"),v=(0,c.default)(h,2),g=v[0],y=v[1],b="";if(y){var _=m.default.parse(y);(0,f.default)(o).forEach(function(e){return delete _[e]}),b=m.default.stringify(_,{encode:!0})}var w=function(){for(var e=arguments.length,t=Array(e),n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return d.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("object"===(void 0===t?"undefined":(0,h.default)(t))&&(t=(a=t).url),a.headers=a.headers||{},b.mergeInQueryOrForm(a),!a.requestInterceptor){e.next=10;break}return e.next=6,a.requestInterceptor(a);case 6:if(e.t0=e.sent,e.t0){e.next=9;break}e.t0=a;case 9:a=e.t0;case 10:return n=a.headers["content-type"]||a.headers["Content-Type"],/multipart\/form-data/i.test(n)&&(delete a.headers["content-type"],delete a.headers["Content-Type"]),r=void 0,e.prev=13,e.next=16,(a.userFetch||fetch)(a.url,a);case 16:return r=e.sent,e.next=19,b.serializeRes(r,t,a);case 19:if(r=e.sent,!a.responseInterceptor){e.next=27;break}return e.next=23,a.responseInterceptor(r);case 23:if(e.t1=e.sent,e.t1){e.next=26;break}e.t1=r;case 26:r=e.t1;case 27:e.next=37;break;case 29:if(e.prev=29,e.t2=e.catch(13),r){e.next=33;break}throw e.t2;case 33:throw(o=new Error(r.statusText)).statusCode=o.status=r.status,o.responseError=e.t2,o;case 37:if(r.ok){e.next=42;break}throw(i=new Error(r.statusText)).statusCode=i.status=r.status,i.response=r,i;case 42:return e.abrupt("return",r);case 43:case"end":return e.stop()}},e,this,[[13,29]])}));return function(t){return e.apply(this,arguments)}}();var _=t.shouldDownloadAsText=function(){return/(json|xml|yaml|text)\b/.test(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"")}},function(e,t){e.exports=n(41)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){return Array.isArray(e)?e.length<1?"":"/"+e.map(function(e){return(e+"").replace(/~/g,"~0").replace(/\//g,"~1")}).join("/"):e}function i(e,t,n){return{op:"replace",path:e,value:t,meta:n}}function a(e,t,n){return f(c(e.filter(m).map(function(e){return t(e.value,n,e.path)})||[]))}function u(e,t,n){return n=n||[],Array.isArray(e)?e.map(function(e,r){return u(e,t,n.concat(r))}):p(e)?(0,w.default)(e).map(function(r){return u(e[r],t,n.concat(r))}):t(e,n[n.length-1],n)}function s(e,t,n){var r=[];if((n=n||[]).length>0){var o=t(e,n[n.length-1],n);o&&(r=r.concat(o))}if(Array.isArray(e)){var i=e.map(function(e,r){return s(e,t,n.concat(r))});i&&(r=r.concat(i))}else if(p(e)){var a=(0,w.default)(e).map(function(r){return s(e[r],t,n.concat(r))});a&&(r=r.concat(a))}return c(r)}function l(e){return Array.isArray(e)?e:[e]}function c(e){var t;return(t=[]).concat.apply(t,(0,_.default)(e.map(function(e){return Array.isArray(e)?c(e):e})))}function f(e){return e.filter(function(e){return void 0!==e})}function p(e){return e&&"object"===(void 0===e?"undefined":(0,b.default)(e))}function d(e){return e&&"function"==typeof e}function h(e){if(g(e)){var t=e.op;return"add"===t||"remove"===t||"replace"===t}return!1}function v(e){return h(e)||g(e)&&"mutation"===e.type}function m(e){return v(e)&&("add"===e.op||"replace"===e.op||"merge"===e.op||"mergeDeep"===e.op)}function g(e){return e&&"object"===(void 0===e?"undefined":(0,b.default)(e))}function y(e,t){try{return S.default.getValueByPointer(e,t)}catch(e){return console.error(e),{}}}Object.defineProperty(t,"__esModule",{value:!0});var b=r(n(1)),_=r(n(34)),w=r(n(0)),E=r(n(35)),x=r(n(2)),S=r(n(36)),C=r(n(4)),k=r(n(37)),A=r(n(38));t.default={add:function(e,t){return{op:"add",path:e,value:t}},replace:i,remove:function(e,t){return{op:"remove",path:e}},merge:function(e,t){return{type:"mutation",op:"merge",path:e,value:t}},mergeDeep:function(e,t){return{type:"mutation",op:"mergeDeep",path:e,value:t}},context:function(e,t){return{type:"context",path:e,value:t}},getIn:function(e,t){return t.reduce(function(e,t){return void 0!==t&&e?e[t]:e},e)},applyPatch:function(e,t,n){if(n=n||{},"merge"===(t=(0,x.default)({},t,{path:t.path&&o(t.path)})).op){var r=y(e,t.path);(0,x.default)(r,t.value),S.default.applyPatch(e,[i(t.path,r)])}else if("mergeDeep"===t.op){var a=y(e,t.path);for(var u in t.value){var s=t.value[u],l=Array.isArray(s);if(l){var c=a[u]||[];a[u]=c.concat(s)}else if(p(s)&&!l){var f=(0,x.default)({},a[u]);for(var d in s){if(Object.prototype.hasOwnProperty.call(f,d)){f=(0,k.default)((0,A.default)({},f),s);break}(0,x.default)(f,(0,E.default)({},d,s[d]))}a[u]=f}else a[u]=s}}else if("add"===t.op&&""===t.path&&p(t.value)){var h=(0,w.default)(t.value).reduce(function(e,n){return e.push({op:"add",path:"/"+o(n),value:t.value[n]}),e},[]);S.default.applyPatch(e,h)}else if("replace"===t.op&&""===t.path){var v=t.value;n.allowMetaPatches&&t.meta&&m(t)&&(Array.isArray(t.value)||p(t.value))&&(v=(0,x.default)({},v,t.meta)),e=v}else if(S.default.applyPatch(e,[t]),n.allowMetaPatches&&t.meta&&m(t)&&(Array.isArray(t.value)||p(t.value))){var g=y(e,t.path),b=(0,x.default)({},g,t.meta);S.default.applyPatch(e,[i(t.path,b)])}return e},parentPathMatch:function(e,t){if(!Array.isArray(t))return!1;for(var n=0,r=t.length;n1&&void 0!==arguments[1]?arguments[1]:{},n=t.requestInterceptor,r=t.responseInterceptor,o=e.withCredentials?"include":"same-origin";return function(t){return e({url:t,loadSpec:!0,requestInterceptor:n,responseInterceptor:r,headers:{Accept:"application/json"},credentials:o}).then(function(e){return e.body})}}Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(4)),a=r(n(11));t.makeFetchJSON=o,t.clearCache=function(){s.plugins.refs.clearCache()},t.default=function(e){function t(e){var t=this;E&&(s.plugins.refs.docCache[E]=e),s.plugins.refs.fetchJSON=o(w,{requestInterceptor:y,responseInterceptor:b});var n=[s.plugins.refs];return"function"==typeof g&&n.push(s.plugins.parameters),"function"==typeof m&&n.push(s.plugins.properties),"strict"!==p&&n.push(s.plugins.allOf),(0,l.default)({spec:e,context:{baseDoc:E},plugins:n,allowMetaPatches:h,pathDiscriminator:v,parameterMacro:g,modelPropertyMacro:m}).then(_?function(){var e=(0,a.default)(i.default.mark(function e(n){return i.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n);case 1:case"end":return e.stop()}},e,t)}));return function(t){return e.apply(this,arguments)}}():c.normalizeSwagger)}var n=e.fetch,r=e.spec,f=e.url,p=e.mode,d=e.allowMetaPatches,h=void 0===d||d,v=e.pathDiscriminator,m=e.modelPropertyMacro,g=e.parameterMacro,y=e.requestInterceptor,b=e.responseInterceptor,_=e.skipNormalization,w=e.http,E=e.baseDoc;return E=E||f,w=n||w||u.default,r?t(r):o(w,{requestInterceptor:y,responseInterceptor:b})(E).then(t)};var u=r(n(7)),s=n(31),l=r(s),c=n(5)},function(e,t){e.exports=n(203)},function(e,t){e.exports=n(91)},function(e,t){e.exports=n(2)},function(e,t){e.exports=n(3)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){function n(){Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack;for(var e=arguments.length,n=Array(e),r=0;r-1||o.indexOf(n)>-1||i.some(function(e){return n.indexOf(e)>-1})};var r=["properties"],o=["definitions","parameters","responses","securityDefinitions","components/schemas","components/responses","components/parameters","components/securitySchemes"],i=["schema/example"]},function(e,t,n){e.exports=n(24)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e?n.url=e:n=e,!(this instanceof o))return new o(n);(0,a.default)(this,n);var r=this.resolve().then(function(){return t.disableInterfaces||(0,a.default)(t,o.makeApisTagOperation(t)),t});return r.client=this,r}Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(3)),a=r((r(n(25)),n(6))),u=r(n(14)),s=r(n(10)),l=n(7),c=r(l),f=n(16),p=r(f),d=r(n(48)),h=n(49),v=n(51),m=n(5);o.http=c.default,o.makeHttp=l.makeHttp.bind(null,o.http),o.resolve=p.default,o.resolveSubtree=d.default,o.execute=v.execute,o.serializeRes=l.serializeRes,o.serializeHeaders=l.serializeHeaders,o.clearCache=f.clearCache,o.parameterBuilders=v.PARAMETER_BUILDERS,o.makeApisTagOperation=h.makeApisTagOperation,o.buildRequest=v.buildRequest,o.helpers={opId:m.opId},o.prototype={http:c.default,execute:function(e){return this.applyDefaults(),o.execute((0,i.default)({spec:this.spec,http:this.http,securities:{authorized:this.authorizations},contextUrl:"string"==typeof this.url?this.url:void 0},e))},resolve:function(){var e=this;return o.resolve({spec:this.spec,url:this.url,allowMetaPatches:this.allowMetaPatches,requestInterceptor:this.requestInterceptor||null,responseInterceptor:this.responseInterceptor||null}).then(function(t){return e.originalSpec=e.spec,e.spec=t.spec,e.errors=t.errors,e})}},o.prototype.applyDefaults=function(){var e=this.spec,t=this.url;if(t&&(0,u.default)(t,"http")){var n=s.default.parse(t);e.host||(e.host=n.host),e.schemes||(e.schemes=[n.protocol.replace(":","")]),e.basePath||(e.basePath="/")}},t.default=o,e.exports=t.default},function(e,t){e.exports=n(904)},function(e,t){e.exports=n(18)},function(e,t){e.exports=n(905)},function(e,t){e.exports=n(906)},function(e,t){e.exports=n(343)},function(e,t){e.exports=n(909)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0}),t.plugins=t.SpecMap=void 0;var o=r(n(8)),i=r(n(1)),a=r(n(17)),u=r(n(4)),s=r(n(0)),l=r(n(18)),c=r(n(32)),f=r(n(2)),p=r(n(19)),d=r(n(20));t.default=function(e){return new w(e).dispatch()};var h=r(n(33)),v=r(n(9)),m=r(n(39)),g=r(n(43)),y=r(n(44)),b=r(n(45)),_=r(n(46)),w=function(){function e(t){(0,p.default)(this,e),(0,f.default)(this,{spec:"",debugLevel:"info",plugins:[],pluginHistory:{},errors:[],mutations:[],promisedPatches:[],state:{},patches:[],context:{},contextTree:new _.default,showDebug:!1,allPatches:[],pluginProp:"specMap",libMethods:(0,f.default)((0,c.default)(this),v.default),allowMetaPatches:!1},t),this.get=this._get.bind(this),this.getContext=this._getContext.bind(this),this.hasRun=this._hasRun.bind(this),this.wrappedPlugins=this.plugins.map(this.wrapPlugin.bind(this)).filter(v.default.isFunction),this.patches.push(v.default.add([],this.spec)),this.patches.push(v.default.context([],this.context)),this.updatePatches(this.patches)}return(0,d.default)(e,[{key:"debug",value:function(e){if(this.debugLevel===e){for(var t,n=arguments.length,r=Array(n>1?n-1:0),o=1;o1?n-1:0),o=1;o0})}},{key:"nextPromisedPatch",value:function(){if(this.promisedPatches.length>0)return a.default.race(this.promisedPatches.map(function(e){return e.value}))}},{key:"getPluginHistory",value:function(e){var t=this.getPluginName(e);return this.pluginHistory[t]||[]}},{key:"getPluginRunCount",value:function(e){return this.getPluginHistory(e).length}},{key:"getPluginHistoryTip",value:function(e){var t=this.getPluginHistory(e);return t&&t[t.length-1]||{}}},{key:"getPluginMutationIndex",value:function(e){var t=this.getPluginHistoryTip(e).mutationIndex;return"number"!=typeof t?-1:t}},{key:"getPluginName",value:function(e){return e.pluginName}},{key:"updatePluginHistory",value:function(e,t){var n=this.getPluginName(e);(this.pluginHistory[n]=this.pluginHistory[n]||[]).push(t)}},{key:"updatePatches",value:function(e,t){var n=this;v.default.normalizeArray(e).forEach(function(e){if(e instanceof Error)n.errors.push(e);else try{if(!v.default.isObject(e))return void n.debug("updatePatches","Got a non-object patch",e);if(n.showDebug&&n.allPatches.push(e),v.default.isPromise(e.value))return n.promisedPatches.push(e),void n.promisedPatchThen(e);if(v.default.isContextPatch(e))return void n.setContext(e.path,e.value);if(v.default.isMutation(e))return void n.updateMutations(e)}catch(e){console.error(e),n.errors.push(e)}})}},{key:"updateMutations",value:function(e){"object"===(0,i.default)(e.value)&&!Array.isArray(e.value)&&this.allowMetaPatches&&(e.value=(0,f.default)({},e.value));var t=v.default.applyPatch(this.state,e,{allowMetaPatches:this.allowMetaPatches});t&&(this.mutations.push(e),this.state=t)}},{key:"removePromisedPatch",value:function(e){var t=this.promisedPatches.indexOf(e);t<0?this.debug("Tried to remove a promisedPatch that isn't there!"):this.promisedPatches.splice(t,1)}},{key:"promisedPatchThen",value:function(e){var t=this;return e.value=e.value.then(function(n){var r=(0,f.default)({},e,{value:n});t.removePromisedPatch(e),t.updatePatches(r)}).catch(function(n){t.removePromisedPatch(e),t.updatePatches(n)})}},{key:"getMutations",value:function(e,t){return e=e||0,"number"!=typeof t&&(t=this.mutations.length),this.mutations.slice(e,t)}},{key:"getCurrentMutations",value:function(){return this.getMutationsForPlugin(this.getCurrentPlugin())}},{key:"getMutationsForPlugin",value:function(e){var t=this.getPluginMutationIndex(e);return this.getMutations(t+1)}},{key:"getCurrentPlugin",value:function(){return this.currentPlugin}},{key:"getPatchesOfType",value:function(e,t){return e.filter(t)}},{key:"getLib",value:function(){return this.libMethods}},{key:"_get",value:function(e){return v.default.getIn(this.state,e)}},{key:"_getContext",value:function(e){return this.contextTree.get(e)}},{key:"setContext",value:function(e,t){return this.contextTree.set(e,t)}},{key:"_hasRun",value:function(e){return this.getPluginRunCount(this.getCurrentPlugin())>(e||0)}},{key:"_clone",value:function(e){return JSON.parse((0,o.default)(e))}},{key:"dispatch",value:function(){function e(e){e&&(e=v.default.fullyNormalizeArray(e),n.updatePatches(e,r))}var t=this,n=this,r=this.nextPlugin();if(!r){var o=this.nextPromisedPatch();if(o)return o.then(function(){return t.dispatch()}).catch(function(){return t.dispatch()});var i={spec:this.state,errors:this.errors};return this.showDebug&&(i.patches=this.allPatches),a.default.resolve(i)}if(n.pluginCount=n.pluginCount||{},n.pluginCount[r]=(n.pluginCount[r]||0)+1,n.pluginCount[r]>100)return a.default.resolve({spec:n.state,errors:n.errors.concat(new Error("We've reached a hard limit of 100 plugin runs"))});if(r!==this.currentPlugin&&this.promisedPatches.length){var u=this.promisedPatches.map(function(e){return e.value});return a.default.all(u.map(function(e){return e.then(Function,Function)})).then(function(){return t.dispatch()})}return function(){n.currentPlugin=r;var t=n.getCurrentMutations(),o=n.mutations.length-1;try{if(r.isGenerator){var i=!0,a=!1,u=void 0;try{for(var s,p=(0,l.default)(r(t,n.getLib()));!(i=(s=p.next()).done);i=!0)e(s.value)}catch(e){a=!0,u=e}finally{try{!i&&p.return&&p.return()}finally{if(a)throw u}}}else e(r(t,n.getLib()))}catch(t){console.error(t),e([(0,f.default)((0,c.default)(t),{plugin:r})])}finally{n.updatePluginHistory(r,{mutationIndex:o})}return n.dispatch()}()}}]),e}(),E={refs:m.default,allOf:g.default,parameters:y.default,properties:b.default};t.SpecMap=w,t.plugins=E},function(e,t){e.exports=n(350)},function(e,t){e.exports=n(288)},function(e,t){e.exports=n(83)},function(e,t){e.exports=n(22)},function(e,t){e.exports=n(910)},function(e,t){e.exports=n(178)},function(e,t){e.exports=n(913)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!A.test(e)){if(!t)throw new O("Tried to resolve a relative URL, without having a basePath. path: '"+e+"' basePath: '"+t+"'");return x.default.resolve(t,e)}return e}function i(e,t){return new O("Could not resolve reference because of: "+e.message,t,e)}function a(e){return(e+"").split("#")}function u(e,t){var n=P[e];if(n&&!S.default.isPromise(n))try{var r=l(t,n);return(0,b.default)(g.default.resolve(r),{__value:r})}catch(e){return g.default.reject(e)}return s(e).then(function(e){return l(t,e)})}function s(e){var t=P[e];return t?S.default.isPromise(t)?t:g.default.resolve(t):(P[e]=I.fetchJSON(e).then(function(t){return P[e]=t,t}),P[e])}function l(e,t){var n=c(e);if(n.length<1)return t;var r=S.default.getIn(t,n);if(void 0===r)throw new O("Could not resolve pointer: "+e+" does not exist in document",{pointer:e});return r}function c(e){if("string"!=typeof e)throw new TypeError("Expected a string, got a "+(void 0===e?"undefined":(0,v.default)(e)));return"/"===e[0]&&(e=e.substr(1)),""===e?[]:e.split("/").map(f)}function f(e){return"string"!=typeof e?e:E.default.unescape(e.replace(/~1/g,"/").replace(/~0/g,"~"))}function p(e){return E.default.escape(e.replace(/~/g,"~0").replace(/\//g,"~1"))}function d(e,t){if(j(t))return!0;var n=e.charAt(t.length),r=t.slice(-1);return 0===e.indexOf(t)&&(!n||"/"===n||"#"===n)&&"#"!==r}function h(e,t,n,r){var o=T.get(r);o||(o={},T.set(r,o));var i=function(e){return 0===e.length?"":"/"+e.map(p).join("/")}(n),a=(t||"")+"#"+e;if(t==r.contextTree.get([]).baseDoc&&d(i,e))return!0;var u="";if(n.some(function(e){return u=u+"/"+p(e),o[u]&&o[u].some(function(e){return d(e,a)||d(a,e)})}))return!0;o[i]=(o[i]||[]).concat(a)}Object.defineProperty(t,"__esModule",{value:!0});var v=r(n(1)),m=r(n(0)),g=r(n(17)),y=r(n(40)),b=r(n(2)),_=n(41),w=r(n(15)),E=r(n(42)),x=r(n(10)),S=r(n(9)),C=r(n(21)),k=n(22),A=new RegExp("^([a-z]+://|//)","i"),O=(0,C.default)("JSONRefError",function(e,t,n){this.originalError=n,(0,b.default)(this,t||{})}),P={},T=new y.default,M={key:"$ref",plugin:function(e,t,n,r){var s=n.slice(0,-1);if(!(0,k.isFreelyNamed)(s)){var l=r.getContext(n).baseDoc;if("string"!=typeof e)return new O("$ref: must be a string (JSON-Ref)",{$ref:e,baseDoc:l,fullPath:n});var f=a(e),p=f[0],d=f[1]||"",v=void 0;try{v=l||p?o(p,l):null}catch(t){return i(t,{pointer:d,$ref:e,basePath:v,fullPath:n})}var g=void 0,y=void 0;if(!h(d,v,s,r)){if(null==v?(y=c(d),void 0===(g=r.get(y))&&(g=new O("Could not resolve reference: "+e,{pointer:d,$ref:e,baseDoc:l,fullPath:n}))):g=null!=(g=u(v,d)).__value?g.__value:g.catch(function(t){throw i(t,{pointer:d,$ref:e,baseDoc:l,fullPath:n})}),g instanceof Error)return[S.default.remove(n),g];var b=S.default.replace(s,g,{$$ref:e});return v&&v!==l?[b,S.default.context(s,{baseDoc:v})]:function(e,t){var n=[e];return t.path.reduce(function(e,t){return n.push(e[t]),e[t]},e),function e(t){return S.default.isObject(t)&&(n.indexOf(t)>=0||(0,m.default)(t).some(function(n){return e(t[n])}))}(t.value)}(r.state,b)?void 0:b}}}},I=(0,b.default)(M,{docCache:P,absoluteify:o,clearCache:function(e){void 0!==e?delete P[e]:(0,m.default)(P).forEach(function(e){delete P[e]})},JSONRefError:O,wrapError:i,getDoc:s,split:a,extractFromDoc:u,fetchJSON:function(e){return(0,_.fetch)(e,{headers:{Accept:"application/json, application/yaml"},loadSpec:!0}).then(function(e){return e.text()}).then(function(e){return w.default.safeLoad(e)})},extract:l,jsonPointerToArray:c,unescapeJsonPointerToken:f});t.default=I;var j=function(e){return!e||"/"===e||"#"===e};e.exports=t.default},function(e,t){e.exports=n(914)},function(e,t){e.exports=n(925)},function(e,t){e.exports=n(926)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e&&e.__esModule?e:{default:e}}(n(2)),o=n(22);t.default={key:"allOf",plugin:function(e,t,n,i,a){if(!a.meta||!a.meta.$$ref){var u=n.slice(0,-1);if(!(0,o.isFreelyNamed)(u)){if(!Array.isArray(e)){var s=new TypeError("allOf must be an array");return s.fullPath=n,s}var l=!1,c=a.value;u.forEach(function(e){c&&(c=c[e])}),delete(c=(0,r.default)({},c)).allOf;var f=[i.replace(u,{})].concat(e.map(function(e,t){if(!i.isObject(e)){if(l)return null;l=!0;var r=new TypeError("Elements in allOf must be objects");return r.fullPath=n,r}return i.mergeDeep(u,e)}));return f.push(i.mergeDeep(u,c)),c.$$ref||f.push(i.remove([].concat(u,"$$ref"))),f}}}},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(2)),i=r(n(9));t.default={key:"parameters",plugin:function(e,t,n,r,a){if(Array.isArray(e)&&e.length){var u=(0,o.default)([],e),s=n.slice(0,-1),l=(0,o.default)({},i.default.getIn(r.spec,s));return e.forEach(function(e,t){try{u[t].default=r.parameterMacro(l,e)}catch(e){var o=new Error(e);return o.fullPath=n,o}}),i.default.replace(n,u)}return i.default.replace(n,e)}},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(2)),i=r(n(9));t.default={key:"properties",plugin:function(e,t,n,r){var a=(0,o.default)({},e);for(var u in e)try{a[u].default=r.modelPropertyMacro(a[u])}catch(e){var s=new Error(e);return s.fullPath=n,s}return i.default.replace(n,a)}},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){return i({children:{}},e,t)}function i(e,t,n){return e.value=t||{},e.protoValue=n?(0,u.default)({},n.protoValue,e.value):e.value,(0,a.default)(e.children).forEach(function(t){var n=e.children[t];e.children[t]=i(n,n.value,e)}),e}Object.defineProperty(t,"__esModule",{value:!0});var a=r(n(0)),u=r(n(3)),s=r(n(19)),l=r(n(20)),c=function(){function e(t){(0,s.default)(this,e),this.root=o(t||{})}return(0,l.default)(e,[{key:"set",value:function(e,t){var n=this.getParent(e,!0);if(n){var r=e[e.length-1],a=n.children;a[r]?i(a[r],t,n):a[r]=o(t,n)}else i(this.root,t,null)}},{key:"get",value:function(e){if((e=e||[]).length<1)return this.root.value;for(var t=this.root,n=void 0,r=void 0,o=0;o2&&void 0!==arguments[2]?arguments[2]:{};return o.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=y.returnEntireTree,a=y.baseDoc,c=y.requestInterceptor,f=y.responseInterceptor,p=y.parameterMacro,d=y.modelPropertyMacro,h={pathDiscriminator:n,baseDoc:a,requestInterceptor:c,responseInterceptor:f,parameterMacro:p,modelPropertyMacro:d},v=(0,l.normalizeSwagger)({spec:t}),m=v.spec,e.next=5,(0,s.default)((0,i.default)({},h,{spec:m,allowMetaPatches:!0,skipNormalization:!0}));case 5:return g=e.sent,!r&&Array.isArray(n)&&n.length&&(g.spec=(0,u.default)(g.spec,n)||null),e.abrupt("return",g);case 8:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t){var n=t.pathName,r=t.method,o=t.operationId;return function(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.execute((0,a.default)({spec:e.spec},(0,u.default)(e,"requestInterceptor","responseInterceptor","userFetch"),{pathName:n,method:r,parameters:t,operationId:o},i))}}}function i(e){var t=e.spec,n=e.cb,r=void 0===n?l:n,o=e.defaultTag,i=void 0===o?"default":o,a=e.v2OperationIdCompatibilityMode,u={},f={};return(0,s.eachOperation)(t,function(e){var n=e.pathName,o=e.method,l=e.operation;(l.tags?c(l.tags):[i]).forEach(function(e){if("string"==typeof e){var i=f[e]=f[e]||{},c=(0,s.opId)(l,n,o,{v2OperationIdCompatibilityMode:a}),p=r({spec:t,pathName:n,method:o,operation:l,operationId:c});if(u[c])u[c]++,i[""+c+u[c]]=p;else if(void 0!==i[c]){var d=u[c]||1;u[c]=d+1,i[""+c+u[c]]=p;var h=i[c];delete i[c],i[""+c+d]=h}else i[c]=p}})}),f}Object.defineProperty(t,"__esModule",{value:!0}),t.self=void 0;var a=r(n(3));t.makeExecute=o,t.makeApisTagOperationsOperationExecute=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f.makeExecute(e),n=f.mapTagOperations({v2OperationIdCompatibilityMode:e.v2OperationIdCompatibilityMode,spec:e.spec,cb:t}),r={};for(var o in n)for(var i in r[o]={operations:{}},n[o])r[o].operations[i]={execute:n[o][i]};return{apis:r}},t.makeApisTagOperation=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=f.makeExecute(e);return{apis:f.mapTagOperations({v2OperationIdCompatibilityMode:e.v2OperationIdCompatibilityMode,spec:e.spec,cb:t})}},t.mapTagOperations=i;var u=r(n(50)),s=n(5),l=function(){return null},c=function(e){return Array.isArray(e)?e:[e]},f=t.self={mapTagOperations:i,makeExecute:o}},function(e,t){e.exports=n(927)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.spec,n=e.operationId,r=(e.securities,e.requestContentType,e.responseContentType),o=e.scheme,a=e.requestInterceptor,s=e.responseInterceptor,c=e.contextUrl,f=e.userFetch,p=(e.requestBody,e.server),d=e.serverVariables,h=e.http,g=e.parameters,y=e.parameterBuilders,O=(0,x.isOAS3)(t);y||(y=O?_.default:b.default);var P={url:"",credentials:h&&h.withCredentials?"include":"same-origin",headers:{},cookies:{}};a&&(P.requestInterceptor=a),s&&(P.responseInterceptor=s),f&&(P.userFetch=f);var T=(0,x.getOperationRaw)(t,n);if(!T)throw new C("Operation "+n+" not found");var M=T.operation,I=void 0===M?{}:M,j=T.method,N=T.pathName;if(P.url+=i({spec:t,scheme:o,contextUrl:c,server:p,serverVariables:d,pathName:N,method:j}),!n)return delete P.cookies,P;P.url+=N,P.method=(""+j).toUpperCase(),g=g||{};var R=t.paths[N]||{};r&&(P.headers.accept=r);var D=A([].concat(S(I.parameters)).concat(S(R.parameters)));D.forEach(function(e){var n=y[e.in],r=void 0;if("body"===e.in&&e.schema&&e.schema.properties&&(r=g),void 0===(r=e&&e.name&&g[e.name])?r=e&&e.name&&g[e.in+"."+e.name]:k(e.name,D).length>1&&console.warn("Parameter '"+e.name+"' is ambiguous because the defined spec has more than one parameter with the name: '"+e.name+"' and the passed-in parameter values did not define an 'in' value."),null!==r){if(void 0!==e.default&&void 0===r&&(r=e.default),void 0===r&&e.required&&!e.allowEmptyValue)throw new Error("Required parameter "+e.name+" is not provided");if(O&&e.schema&&"object"===e.schema.type&&"string"==typeof r)try{r=JSON.parse(r)}catch(e){throw new Error("Could not parse object parameter value string as JSON")}n&&n({req:P,parameter:e,value:r,operation:I,spec:t})}});var L=(0,u.default)({},e,{operation:I});if((P=O?(0,w.default)(L,P):(0,E.default)(L,P)).cookies&&(0,l.default)(P.cookies).length){var U=(0,l.default)(P.cookies).reduce(function(e,t){var n=P.cookies[t];return e+(e?"&":"")+v.default.serialize(t,n)},"");P.headers.Cookie=U}return P.cookies&&delete P.cookies,(0,m.mergeInQueryOrForm)(P),P}function i(e){return(0,x.isOAS3)(e.spec)?function(e){var t=e.spec,n=e.pathName,r=e.method,o=e.server,i=e.contextUrl,a=e.serverVariables,u=void 0===a?{}:a,s=(0,f.default)(t,["paths",n,(r||"").toLowerCase(),"servers"])||(0,f.default)(t,["paths",n,"servers"])||(0,f.default)(t,["servers"]),l="",c=null;if(o&&s&&s.length){var p=s.map(function(e){return e.url});p.indexOf(o)>-1&&(l=o,c=s[p.indexOf(o)])}!l&&s&&s.length&&(l=s[0].url,c=s[0]),l.indexOf("{")>-1&&function(e){for(var t=[],n=/{([^}]+)}/g,r=void 0;r=n.exec(e);)t.push(r[1]);return t}(l).forEach(function(e){if(c.variables&&c.variables[e]){var t=c.variables[e],n=u[e]||t.default,r=new RegExp("{"+e+"}","g");l=l.replace(r,n)}});return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=h.default.parse(e),r=h.default.parse(t),o=P(n.protocol)||P(r.protocol)||"",i=n.host||r.host,a=n.pathname||"",u=void 0;return"/"===(u=o&&i?o+"://"+(i+a):a)[u.length-1]?u.slice(0,-1):u}(l,i)}(e):function(e){var t=e.spec,n=e.scheme,r=e.contextUrl,o=void 0===r?"":r,i=h.default.parse(o),a=Array.isArray(t.schemes)?t.schemes[0]:null,u=n||a||P(i.protocol)||"http",s=t.host||i.host||"",l=t.basePath||"",c=void 0;return"/"===(c=u&&s?u+"://"+(s+l):l)[c.length-1]?c.slice(0,-1):c}(e)}Object.defineProperty(t,"__esModule",{value:!0}),t.self=void 0;var a=r(n(8)),u=r(n(3)),s=r(n(52)),l=r(n(0)),c=r(n(2));t.execute=function(e){var t=e.http,n=e.fetch,r=e.spec,o=e.operationId,i=e.pathName,l=e.method,c=e.parameters,f=e.securities,h=(0,s.default)(e,["http","fetch","spec","operationId","pathName","method","parameters","securities"]),v=t||n||g.default;i&&l&&!o&&(o=(0,x.legacyIdFromPathMethod)(i,l));var m=O.buildRequest((0,u.default)({spec:r,operationId:o,parameters:c,securities:f,http:v},h));return m.body&&((0,p.default)(m.body)||(0,d.default)(m.body))&&(m.body=(0,a.default)(m.body)),v(m)},t.buildRequest=o,t.baseUrl=i;var f=r((r(n(6)),n(12))),p=r(n(53)),d=r(n(54)),h=r((r(n(13)),n(10))),v=r(n(55)),m=n(7),g=r(m),y=r(n(21)),b=r(n(56)),_=r(n(57)),w=r(n(62)),E=r(n(64)),x=n(5),S=function(e){return Array.isArray(e)?e:[]},C=(0,y.default)("OperationNotFoundError",function(e,t,n){this.originalError=n,(0,c.default)(this,t||{})}),k=function(e,t){return t.filter(function(t){return t.name===e})},A=function(e){var t={};e.forEach(function(e){t[e.in]||(t[e.in]={}),t[e.in][e.name]=e});var n=[];return(0,l.default)(t).forEach(function(e){(0,l.default)(t[e]).forEach(function(r){n.push(t[e][r])})}),n},O=t.self={buildRequest:o},P=function(e){return e?e.replace(/\W/g,""):null}},function(e,t){e.exports=n(84)},function(e,t){e.exports=n(227)},function(e,t){e.exports=n(24)},function(e,t){e.exports=n(930)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={body:function(e){var t=e.req,n=e.value;t.body=n},header:function(e){var t=e.req,n=e.parameter,r=e.value;t.headers=t.headers||{},void 0!==r&&(t.headers[n.name]=r)},query:function(e){var t=e.req,n=e.value,r=e.parameter;if(t.query=t.query||{},!1===n&&"boolean"===r.type&&(n="false"),0===n&&["number","integer"].indexOf(r.type)>-1&&(n="0"),n)t.query[r.name]={collectionFormat:r.collectionFormat,value:n};else if(r.allowEmptyValue&&void 0!==n){var o=r.name;t.query[o]=t.query[o]||{},t.query[o].allowEmptyValue=!0}},path:function(e){var t=e.req,n=e.value,r=e.parameter;t.url=t.url.replace("{"+r.name+"}",encodeURIComponent(n))},formData:function(e){var t=e.req,n=e.value,r=e.parameter;(n||r.allowEmptyValue)&&(t.form=t.form||{},t.form[r.name]={value:n,allowEmptyValue:r.allowEmptyValue,collectionFormat:r.collectionFormat})}},e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(n(0)),i=r(n(1)),a=r(n(58));t.default={path:function(e){var t=e.req,n=e.value,r=e.parameter,o=r.name,i=r.style,u=r.explode,s=(0,a.default)({key:r.name,value:n,style:i||"simple",explode:u||!1,escape:!1});t.url=t.url.replace("{"+o+"}",s)},query:function(e){var t=e.req,n=e.value,r=e.parameter;if(t.query=t.query||{},!1===n&&(n="false"),0===n&&(n="0"),n){var u=void 0===n?"undefined":(0,i.default)(n);"deepObject"===r.style?(0,o.default)(n).forEach(function(e){var o=n[e];t.query[r.name+"["+e+"]"]={value:(0,a.default)({key:e,value:o,style:"deepObject",escape:r.allowReserved?"unsafe":"reserved"}),skipEncoding:!0}}):"object"!==u||Array.isArray(n)||"form"!==r.style&&r.style||!r.explode&&void 0!==r.explode?t.query[r.name]={value:(0,a.default)({key:r.name,value:n,style:r.style||"form",explode:void 0===r.explode||r.explode,escape:r.allowReserved?"unsafe":"reserved"}),skipEncoding:!0}:(0,o.default)(n).forEach(function(e){var o=n[e];t.query[e]={value:(0,a.default)({key:e,value:o,style:r.style||"form",escape:r.allowReserved?"unsafe":"reserved"}),skipEncoding:!0}})}else if(r.allowEmptyValue&&void 0!==n){var s=r.name;t.query[s]=t.query[s]||{},t.query[s].allowEmptyValue=!0}},header:function(e){var t=e.req,n=e.parameter,r=e.value;t.headers=t.headers||{},u.indexOf(n.name.toLowerCase())>-1||void 0!==r&&(t.headers[n.name]=(0,a.default)({key:n.name,value:r,style:n.style||"simple",explode:void 0!==n.explode&&n.explode,escape:!1}))},cookie:function(e){var t=e.req,n=e.parameter,r=e.value;t.headers=t.headers||{};var o=void 0===r?"undefined":(0,i.default)(r);if("undefined"!==o){var u="object"===o&&!Array.isArray(r)&&n.explode?"":n.name+"=";t.headers.Cookie=u+(0,a.default)({key:n.name,value:r,escape:!1,style:n.style||"form",explode:void 0!==n.explode&&n.explode})}}};var u=["accept","authorization","content-type"];e.exports=t.default},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).escape,n=arguments[2];return"number"==typeof e&&(e=e.toString()),"string"==typeof e&&e.length&&t?n?JSON.parse(e):(0,s.stringToCharArray)(e).map(function(e){return c(e)?e:l(e)&&"unsafe"===t?e:((0,u.default)(e)||[]).map(function(e){return e.toString(16).toUpperCase()}).map(function(e){return"%"+e}).join("")}).join(""):e}Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(0)),a=r(n(1));t.encodeDisallowedCharacters=o,t.default=function(e){var t=e.value;return Array.isArray(t)?function(e){var t=e.key,n=e.value,r=e.style,i=e.explode,a=e.escape,u=function(e){return o(e,{escape:a})};if("simple"===r)return n.map(function(e){return u(e)}).join(",");if("label"===r)return"."+n.map(function(e){return u(e)}).join(".");if("matrix"===r)return n.map(function(e){return u(e)}).reduce(function(e,n){return!e||i?(e||"")+";"+t+"="+n:e+","+n},"");if("form"===r){var s=i?"&"+t+"=":",";return n.map(function(e){return u(e)}).join(s)}if("spaceDelimited"===r){var l=i?t+"=":"";return n.map(function(e){return u(e)}).join(" "+l)}if("pipeDelimited"===r){var c=i?t+"=":"";return n.map(function(e){return u(e)}).join("|"+c)}}(e):"object"===(void 0===t?"undefined":(0,a.default)(t))?function(e){var t=e.key,n=e.value,r=e.style,a=e.explode,u=e.escape,s=function(e){return o(e,{escape:u})},l=(0,i.default)(n);return"simple"===r?l.reduce(function(e,t){var r=s(n[t]);return(e?e+",":"")+t+(a?"=":",")+r},""):"label"===r?l.reduce(function(e,t){var r=s(n[t]);return(e?e+".":".")+t+(a?"=":".")+r},""):"matrix"===r&&a?l.reduce(function(e,t){var r=s(n[t]);return(e?e+";":";")+t+"="+r},""):"matrix"===r?l.reduce(function(e,r){var o=s(n[r]);return(e?e+",":";"+t+"=")+r+","+o},""):"form"===r?l.reduce(function(e,t){var r=s(n[t]);return(e?e+(a?"&":","):"")+t+(a?"=":",")+r},""):void 0}(e):function(e){var t=e.key,n=e.value,r=e.style,i=e.escape,a=function(e){return o(e,{escape:i})};return"simple"===r?a(n):"label"===r?"."+a(n):"matrix"===r?";"+t+"="+a(n):"form"===r?a(n):"deepObject"===r?a(n):void 0}(e)};var u=r((r(n(59)),n(60))),s=n(61),l=function(e){return":/?#[]@!$&'()*+,;=".indexOf(e)>-1},c=function(e){return/^[a-z0-9\-._~]+$/i.test(e)}},function(e,t){e.exports=n(931)},function(e,t){e.exports=n(932)},function(e,t){e.exports=n(933)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.request,n=e.securities,r=void 0===n?{}:n,o=e.operation,i=void 0===o?{}:o,a=e.spec,f=(0,s.default)({},t),p=r.authorized,d=void 0===p?{}:p,h=i.security||a.security||[],v=d&&!!(0,u.default)(d).length,m=(0,l.default)(a,["components","securitySchemes"])||{};return f.headers=f.headers||{},f.query=f.query||{},(0,u.default)(r).length&&v&&h&&(!Array.isArray(i.security)||i.security.length)?(h.forEach(function(e,t){for(var n in e){var r=d[n],o=m[n];if(r){var i=r.value||r,a=o.type;if(r)if("apiKey"===a)"query"===o.in&&(f.query[o.name]=i),"header"===o.in&&(f.headers[o.name]=i),"cookie"===o.in&&(f.cookies[o.name]=i);else if("http"===a){if("basic"===o.scheme){var u=i.username,s=i.password,l=(0,c.default)(u+":"+s);f.headers.Authorization="Basic "+l}"bearer"===o.scheme&&(f.headers.Authorization="Bearer "+i)}else if("oauth2"===a){var p=r.token||{},h=p.access_token,v=p.token_type;v&&"bearer"!==v.toLowerCase()||(v="Bearer"),f.headers.Authorization=v+" "+h}}}}),f):t}Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(8)),a=r(n(1)),u=r(n(0));t.default=function(e,t){var n=e.operation,r=e.requestBody,s=e.securities,l=e.spec,c=e.attachContentTypeForEmptyPayload,p=e.requestContentType;t=o({request:t,securities:s,operation:n,spec:l});var d=n.requestBody||{},h=(0,u.default)(d.content||{}),v=p&&h.indexOf(p)>-1;if(r||c){if(p&&v)t.headers["Content-Type"]=p;else if(!p){var m=h[0];m&&(t.headers["Content-Type"]=m,p=m)}}else p&&v&&(t.headers["Content-Type"]=p);return r&&(p?h.indexOf(p)>-1&&("application/x-www-form-urlencoded"===p||0===p.indexOf("multipart/")?"object"===(void 0===r?"undefined":(0,a.default)(r))?(t.form={},(0,u.default)(r).forEach(function(e){var n,o=r[e],u=void 0;"undefined"!=typeof File&&(u=o instanceof File),"undefined"!=typeof Blob&&(u=u||o instanceof Blob),void 0!==f.Buffer&&(u=u||f.Buffer.isBuffer(o)),n="object"!==(void 0===o?"undefined":(0,a.default)(o))||u?o:Array.isArray(o)?o.toString():(0,i.default)(o),t.form[e]={value:n}})):t.form=r:t.body=r):t.body=r),t},t.applySecurities=o;var s=r(n(6)),l=r(n(12)),c=r(n(13)),f=n(63)},function(e,t){e.exports=n(54)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e){var t=e.request,n=e.securities,r=void 0===n?{}:n,o=e.operation,s=void 0===o?{}:o,l=e.spec,c=(0,u.default)({},t),f=r.authorized,p=void 0===f?{}:f,d=r.specSecurity,h=void 0===d?[]:d,v=s.security||h,m=p&&!!(0,i.default)(p).length,g=l.securityDefinitions;return c.headers=c.headers||{},c.query=c.query||{},(0,i.default)(r).length&&m&&v&&(!Array.isArray(s.security)||s.security.length)?(v.forEach(function(e,t){for(var n in e){var r=p[n];if(r){var o=r.token,i=r.value||r,u=g[n],s=u.type,l=o&&o.access_token,f=o&&o.token_type;if(r)if("apiKey"===s){var d="query"===u.in?"query":"headers";c[d]=c[d]||{},c[d][u.name]=i}else"basic"===s?i.header?c.headers.authorization=i.header:(i.base64=(0,a.default)(i.username+":"+i.password),c.headers.authorization="Basic "+i.base64):"oauth2"===s&&l&&(f=f&&"bearer"!==f.toLowerCase()?f:"Bearer",c.headers.authorization=f+" "+l)}}}),c):t}Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(0));t.default=function(e,t){var n=e.spec,r=e.operation,i=e.securities,a=e.requestContentType,u=e.attachContentTypeForEmptyPayload;if((t=o({request:t,securities:i,operation:r,spec:n})).body||t.form||u)a?t.headers["Content-Type"]=a:Array.isArray(r.consumes)?t.headers["Content-Type"]=r.consumes[0]:Array.isArray(n.consumes)?t.headers["Content-Type"]=n.consumes[0]:r.parameters&&r.parameters.filter(function(e){return"file"===e.type}).length?t.headers["Content-Type"]="multipart/form-data":r.parameters&&r.parameters.filter(function(e){return"formData"===e.in}).length&&(t.headers["Content-Type"]="application/x-www-form-urlencoded");else if(a){var s=r.parameters&&r.parameters.filter(function(e){return"body"===e.in}).length>0,l=r.parameters&&r.parameters.filter(function(e){return"formData"===e.in}).length>0;(s||l)&&(t.headers["Content-Type"]=a)}return t},t.applySecurities=o;var a=r(n(13)),u=r(n(6));r(n(7))}])},function(e,t,n){"use strict";var r=Object.prototype.hasOwnProperty,o=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}();t.arrayToObject=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r=48&&i<=57||i>=65&&i<=90||i>=97&&i<=122?n+=t.charAt(r):i<128?n+=o[i]:i<2048?n+=o[192|i>>6]+o[128|63&i]:i<55296||i>=57344?n+=o[224|i>>12]+o[128|i>>6&63]+o[128|63&i]:(r+=1,i=65536+((1023&i)<<10|1023&t.charCodeAt(r)),n+=o[240|i>>18]+o[128|i>>12&63]+o[128|i>>6&63]+o[128|63&i])}return n},t.compact=function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r=0;l--)if(f[l]!=p[l])return!1;for(l=f.length-1;l>=0;l--)if(c=f[l],!a(e[c],t[c],n))return!1;return typeof e==typeof t}(e,t,n))};function u(e){return null===e||void 0===e}function s(e){return!(!e||"object"!=typeof e||"number"!=typeof e.length)&&("function"==typeof e.copy&&"function"==typeof e.slice&&!(e.length>0&&"number"!=typeof e[0]))}},function(e,t,n){var r={strict:!0},o=n(391),i=function(e,t){return o(e,t,r)},a=n(230);t.JsonPatchError=a.PatchError,t.deepClone=a._deepClone;var u={add:function(e,t,n){return e[t]=this.value,{newDocument:n}},remove:function(e,t,n){var r=e[t];return delete e[t],{newDocument:n,removed:r}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:function(e,t,n){var r=l(n,this.path);r&&(r=a._deepClone(r));var o=c(n,{op:"remove",path:this.from}).removed;return c(n,{op:"add",path:this.path,value:o}),{newDocument:n,removed:r}},copy:function(e,t,n){var r=l(n,this.from);return c(n,{op:"add",path:this.path,value:a._deepClone(r)}),{newDocument:n}},test:function(e,t,n){return{newDocument:n,test:i(e[t],this.value)}},_get:function(e,t,n){return this.value=e[t],{newDocument:n}}},s={add:function(e,t,n){return a.isInteger(t)?e.splice(t,0,this.value):e[t]=this.value,{newDocument:n,index:t}},remove:function(e,t,n){return{newDocument:n,removed:e.splice(t,1)[0]}},replace:function(e,t,n){var r=e[t];return e[t]=this.value,{newDocument:n,removed:r}},move:u.move,copy:u.copy,test:u.test,_get:u._get};function l(e,t){if(""==t)return e;var n={op:"_get",path:t};return c(e,n),n.value}function c(e,n,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!0),r&&("function"==typeof r?r(n,0,e,n.path):p(n,0)),""===n.path){var c={newDocument:e};if("add"===n.op)return c.newDocument=n.value,c;if("replace"===n.op)return c.newDocument=n.value,c.removed=e,c;if("move"===n.op||"copy"===n.op)return c.newDocument=l(e,n.from),"move"===n.op&&(c.removed=e),c;if("test"===n.op){if(c.test=i(e,n.value),!1===c.test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",0,n,e);return c.newDocument=e,c}if("remove"===n.op)return c.removed=e,c.newDocument=null,c;if("_get"===n.op)return n.value=e,c;if(r)throw new t.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",0,n,e);return c}o||(e=a._deepClone(e));var f=(n.path||"").split("/"),d=e,h=1,v=f.length,m=void 0,g=void 0,y=void 0;for(y="function"==typeof r?r:p;;){if(g=f[h],r&&void 0===m&&(void 0===d[g]?m=f.slice(0,h).join("/"):h==v-1&&(m=n.path),void 0!==m&&y(n,0,e,m)),h++,Array.isArray(d)){if("-"===g)g=d.length;else{if(r&&!a.isInteger(g))throw new t.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",0,n.path,n);a.isInteger(g)&&(g=~~g)}if(h>=v){if(r&&"add"===n.op&&g>d.length)throw new t.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",0,n.path,n);if(!1===(c=s[n.op].call(n,d,g,e)).test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",0,n,e);return c}}else if(g&&-1!=g.indexOf("~")&&(g=a.unescapePathComponent(g)),h>=v){if(!1===(c=u[n.op].call(n,d,g,e)).test)throw new t.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",0,n,e);return c}d=d[g]}}function f(e,n,r,o){if(void 0===o&&(o=!0),r&&!Array.isArray(n))throw new t.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");o||(e=a._deepClone(e));for(var i=new Array(n.length),u=0,s=n.length;u0)throw new t.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",n,e,r);if(("move"===e.op||"copy"===e.op)&&"string"!=typeof e.from)throw new t.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",n,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&void 0===e.value)throw new t.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",n,e,r);if(("add"===e.op||"replace"===e.op||"test"===e.op)&&a.hasUndefined(e.value))throw new t.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",n,e,r);if(r)if("add"==e.op){var i=e.path.split("/").length,s=o.split("/").length;if(i!==s+1&&i!==s)throw new t.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",n,e,r)}else if("replace"===e.op||"remove"===e.op||"_get"===e.op){if(e.path!==o)throw new t.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",n,e,r)}else if("move"===e.op||"copy"===e.op){var l=d([{op:"_get",path:e.from,value:void 0}],r);if(l&&"OPERATION_PATH_UNRESOLVABLE"===l.name)throw new t.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",n,e,r)}}function d(e,n,r){try{if(!Array.isArray(e))throw new t.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(n)f(a._deepClone(n),a._deepClone(e),r||!0);else{r=r||p;for(var o=0;o1&&void 0!==arguments[1]?arguments[1]:(0,a.List)();return function(e){return(e.authSelectors.definitionsToAuthorize()||(0,a.List)()).filter(function(e){return t.some(function(t){return t.get(e.keySeq().first())})})}},t.authorized=(0,i.createSelector)(s,function(e){return e.get("authorized")||(0,a.Map)()}),t.isAuthorized=function(e,t){return function(e){var n=e.authSelectors.authorized();return a.List.isList(t)?!!t.toJS().filter(function(e){return-1===(0,r.default)(e).map(function(e){return!!n.get(e)}).indexOf(!1)}).length:null}},t.getConfigs=(0,i.createSelector)(s,function(e){return e.get("configs")})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.execute=void 0;var r,o=n(25),i=(r=o)&&r.__esModule?r:{default:r};t.execute=function(e,t){var n=t.authSelectors,r=t.specSelectors;return function(t){var o=t.path,a=t.method,u=t.operation,s=t.extras,l={authorized:n.authorized()&&n.authorized().toJS(),definitions:r.securityDefinitions()&&r.securityDefinitions().toJS(),specSecurity:r.security()&&r.security().toJS()};return e((0,i.default)({path:o,method:a,operation:u,securities:l},s))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{fn:{shallowEqualKeys:r.shallowEqualKeys}}};var r=n(12)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=s(n(41)),o=s(n(23));t.default=function(e){var t=e.fn,n={download:function(e){return function(n){var r=n.errActions,i=n.specSelectors,a=n.specActions,s=n.getConfigs,l=t.fetch,c=s();function f(t){if(t instanceof Error||t.status>=400)return a.updateLoadingStatus("failed"),r.newThrownErr((0,o.default)(new Error((t.message||t.statusText)+" "+e),{source:"fetch"})),void(!t.status&&t instanceof Error&&function(){try{var t=void 0;if("URL"in u.default?t=new URL(e):(t=document.createElement("a")).href=e,"https:"!==t.protocol&&"https:"===u.default.location.protocol){var n=(0,o.default)(new Error("Possible mixed-content issue? The page was loaded over https:// but a "+t.protocol+"// URL was specified. Check that you are not attempting to load mixed content."),{source:"fetch"});return void r.newThrownErr(n)}if(t.origin!==u.default.location.origin){var i=(0,o.default)(new Error("Possible cross-origin (CORS) issue? The URL origin ("+t.origin+") does not match the page ("+u.default.location.origin+"). Check the server returns the correct 'Access-Control-Allow-*' headers."),{source:"fetch"});r.newThrownErr(i)}}catch(e){return}}());a.updateLoadingStatus("success"),a.updateSpec(t.text),i.url()!==e&&a.updateUrl(e)}e=e||i.url(),a.updateLoadingStatus("loading"),r.clear({source:"fetch"}),l({url:e,loadSpec:!0,requestInterceptor:c.requestInterceptor||function(e){return e},responseInterceptor:c.responseInterceptor||function(e){return e},credentials:"same-origin",headers:{Accept:"application/json,*/*"}}).then(f,f)}},updateLoadingStatus:function(e){var t=[null,"loading","failed","success","failedConfig"];return-1===t.indexOf(e)&&console.error("Error: "+e+" is not one of "+(0,r.default)(t)),{type:"spec_update_loading_status",payload:e}}},s={loadingStatus:(0,i.createSelector)(function(e){return e||(0,a.Map)()},function(e){return e.get("loadingStatus")||null})};return{statePlugins:{spec:{actions:n,reducers:{spec_update_loading_status:function(e,t){return"string"==typeof t.payload?e.set("loadingStatus",t.payload):e}},selectors:s}}}};var i=n(57),a=n(7),u=s(n(32));function s(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return{statePlugins:{spec:{actions:a,selectors:f},configs:{reducers:s.default,actions:i,selectors:u}}}};var r=c(n(934)),o=n(233),i=l(n(234)),a=l(n(401)),u=l(n(402)),s=c(n(403));function l(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function c(e){return e&&e.__esModule?e:{default:e}}var f={getLocalConfig:function(){return(0,o.parseYamlConfig)(r.default)}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getConfigByUrl=t.downloadConfig=void 0;var r=n(233);t.downloadConfig=function(e){return function(t){return(0,t.fn.fetch)(e)}},t.getConfigByUrl=function(e,t){return function(n){var o=n.specActions;if(e)return o.downloadConfig(e).then(i,i);function i(n){n instanceof Error||n.status>=400?(o.updateLoadingStatus("failedConfig"),o.updateLoadingStatus("failedConfig"),o.updateUrl(""),console.error(n.statusText+" "+e.url),t(null)):t((0,r.parseYamlConfig)(n.text))}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.get=function(e,t){return e.getIn(Array.isArray(t)?t:[t])}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o,i=n(22),a=(r=i)&&r.__esModule?r:{default:r},u=n(7),s=n(234);t.default=(o={},(0,a.default)(o,s.UPDATE_CONFIGS,function(e,t){return e.merge((0,u.fromJS)(t.payload))}),(0,a.default)(o,s.TOGGLE_CONFIGS,function(e,t){var n=t.payload,r=e.get(n);return e.set(n,!r)}),o)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return[r.default,{statePlugins:{configs:{wrapActions:{loaded:function(e,t){return function(){e.apply(void 0,arguments);var n=window.location.hash;t.layoutActions.parseDeepLinkHash(n)}}}}},wrapComponents:{operation:o.default,OperationTag:i.default}}]};var r=a(n(405)),o=a(n(407)),i=a(n(408));function a(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearScrollTo=t.scrollToElement=t.readyToScroll=t.parseDeepLinkHash=t.scrollTo=t.show=void 0;var r,o=c(n(22)),i=c(n(18)),a=n(406),u=c(n(935)),s=n(7),l=c(s);function c(e){return e&&e.__esModule?e:{default:e}}var f=t.show=function(e,t){var n=t.getConfigs,r=t.layoutSelectors;return function(){for(var t=arguments.length,o=Array(t),u=0;u",Gt:"≫",gt:">",gtcc:"⪧",gtcir:"⩺",gtdot:"⋗",gtlPar:"⦕",gtquest:"⩼",gtrapprox:"⪆",gtrarr:"⥸",gtrdot:"⋗",gtreqless:"⋛",gtreqqless:"⪌",gtrless:"≷",gtrsim:"≳",gvertneqq:"≩︀",gvnE:"≩︀",Hacek:"ˇ",hairsp:" ",half:"½",hamilt:"ℋ",HARDcy:"Ъ",hardcy:"ъ",hArr:"⇔",harr:"↔",harrcir:"⥈",harrw:"↭",Hat:"^",hbar:"ℏ",Hcirc:"Ĥ",hcirc:"ĥ",hearts:"♥",heartsuit:"♥",hellip:"…",hercon:"⊹",Hfr:"ℌ",hfr:"𝔥",HilbertSpace:"ℋ",hksearow:"⤥",hkswarow:"⤦",hoarr:"⇿",homtht:"∻",hookleftarrow:"↩",hookrightarrow:"↪",Hopf:"ℍ",hopf:"𝕙",horbar:"―",HorizontalLine:"─",Hscr:"ℋ",hscr:"𝒽",hslash:"ℏ",Hstrok:"Ħ",hstrok:"ħ",HumpDownHump:"≎",HumpEqual:"≏",hybull:"⁃",hyphen:"‐",Iacute:"Í",iacute:"í",ic:"⁣",Icirc:"Î",icirc:"î",Icy:"И",icy:"и",Idot:"İ",IEcy:"Е",iecy:"е",iexcl:"¡",iff:"⇔",Ifr:"ℑ",ifr:"𝔦",Igrave:"Ì",igrave:"ì",ii:"ⅈ",iiiint:"⨌",iiint:"∭",iinfin:"⧜",iiota:"℩",IJlig:"IJ",ijlig:"ij",Im:"ℑ",Imacr:"Ī",imacr:"ī",image:"ℑ",ImaginaryI:"ⅈ",imagline:"ℐ",imagpart:"ℑ",imath:"ı",imof:"⊷",imped:"Ƶ",Implies:"⇒",in:"∈",incare:"℅",infin:"∞",infintie:"⧝",inodot:"ı",Int:"∬",int:"∫",intcal:"⊺",integers:"ℤ",Integral:"∫",intercal:"⊺",Intersection:"⋂",intlarhk:"⨗",intprod:"⨼",InvisibleComma:"⁣",InvisibleTimes:"⁢",IOcy:"Ё",iocy:"ё",Iogon:"Į",iogon:"į",Iopf:"𝕀",iopf:"𝕚",Iota:"Ι",iota:"ι",iprod:"⨼",iquest:"¿",Iscr:"ℐ",iscr:"𝒾",isin:"∈",isindot:"⋵",isinE:"⋹",isins:"⋴",isinsv:"⋳",isinv:"∈",it:"⁢",Itilde:"Ĩ",itilde:"ĩ",Iukcy:"І",iukcy:"і",Iuml:"Ï",iuml:"ï",Jcirc:"Ĵ",jcirc:"ĵ",Jcy:"Й",jcy:"й",Jfr:"𝔍",jfr:"𝔧",jmath:"ȷ",Jopf:"𝕁",jopf:"𝕛",Jscr:"𝒥",jscr:"𝒿",Jsercy:"Ј",jsercy:"ј",Jukcy:"Є",jukcy:"є",Kappa:"Κ",kappa:"κ",kappav:"ϰ",Kcedil:"Ķ",kcedil:"ķ",Kcy:"К",kcy:"к",Kfr:"𝔎",kfr:"𝔨",kgreen:"ĸ",KHcy:"Х",khcy:"х",KJcy:"Ќ",kjcy:"ќ",Kopf:"𝕂",kopf:"𝕜",Kscr:"𝒦",kscr:"𝓀",lAarr:"⇚",Lacute:"Ĺ",lacute:"ĺ",laemptyv:"⦴",lagran:"ℒ",Lambda:"Λ",lambda:"λ",Lang:"⟪",lang:"⟨",langd:"⦑",langle:"⟨",lap:"⪅",Laplacetrf:"ℒ",laquo:"«",Larr:"↞",lArr:"⇐",larr:"←",larrb:"⇤",larrbfs:"⤟",larrfs:"⤝",larrhk:"↩",larrlp:"↫",larrpl:"⤹",larrsim:"⥳",larrtl:"↢",lat:"⪫",lAtail:"⤛",latail:"⤙",late:"⪭",lates:"⪭︀",lBarr:"⤎",lbarr:"⤌",lbbrk:"❲",lbrace:"{",lbrack:"[",lbrke:"⦋",lbrksld:"⦏",lbrkslu:"⦍",Lcaron:"Ľ",lcaron:"ľ",Lcedil:"Ļ",lcedil:"ļ",lceil:"⌈",lcub:"{",Lcy:"Л",lcy:"л",ldca:"⤶",ldquo:"“",ldquor:"„",ldrdhar:"⥧",ldrushar:"⥋",ldsh:"↲",lE:"≦",le:"≤",LeftAngleBracket:"⟨",LeftArrow:"←",Leftarrow:"⇐",leftarrow:"←",LeftArrowBar:"⇤",LeftArrowRightArrow:"⇆",leftarrowtail:"↢",LeftCeiling:"⌈",LeftDoubleBracket:"⟦",LeftDownTeeVector:"⥡",LeftDownVector:"⇃",LeftDownVectorBar:"⥙",LeftFloor:"⌊",leftharpoondown:"↽",leftharpoonup:"↼",leftleftarrows:"⇇",LeftRightArrow:"↔",Leftrightarrow:"⇔",leftrightarrow:"↔",leftrightarrows:"⇆",leftrightharpoons:"⇋",leftrightsquigarrow:"↭",LeftRightVector:"⥎",LeftTee:"⊣",LeftTeeArrow:"↤",LeftTeeVector:"⥚",leftthreetimes:"⋋",LeftTriangle:"⊲",LeftTriangleBar:"⧏",LeftTriangleEqual:"⊴",LeftUpDownVector:"⥑",LeftUpTeeVector:"⥠",LeftUpVector:"↿",LeftUpVectorBar:"⥘",LeftVector:"↼",LeftVectorBar:"⥒",lEg:"⪋",leg:"⋚",leq:"≤",leqq:"≦",leqslant:"⩽",les:"⩽",lescc:"⪨",lesdot:"⩿",lesdoto:"⪁",lesdotor:"⪃",lesg:"⋚︀",lesges:"⪓",lessapprox:"⪅",lessdot:"⋖",lesseqgtr:"⋚",lesseqqgtr:"⪋",LessEqualGreater:"⋚",LessFullEqual:"≦",LessGreater:"≶",lessgtr:"≶",LessLess:"⪡",lesssim:"≲",LessSlantEqual:"⩽",LessTilde:"≲",lfisht:"⥼",lfloor:"⌊",Lfr:"𝔏",lfr:"𝔩",lg:"≶",lgE:"⪑",lHar:"⥢",lhard:"↽",lharu:"↼",lharul:"⥪",lhblk:"▄",LJcy:"Љ",ljcy:"љ",Ll:"⋘",ll:"≪",llarr:"⇇",llcorner:"⌞",Lleftarrow:"⇚",llhard:"⥫",lltri:"◺",Lmidot:"Ŀ",lmidot:"ŀ",lmoust:"⎰",lmoustache:"⎰",lnap:"⪉",lnapprox:"⪉",lnE:"≨",lne:"⪇",lneq:"⪇",lneqq:"≨",lnsim:"⋦",loang:"⟬",loarr:"⇽",lobrk:"⟦",LongLeftArrow:"⟵",Longleftarrow:"⟸",longleftarrow:"⟵",LongLeftRightArrow:"⟷",Longleftrightarrow:"⟺",longleftrightarrow:"⟷",longmapsto:"⟼",LongRightArrow:"⟶",Longrightarrow:"⟹",longrightarrow:"⟶",looparrowleft:"↫",looparrowright:"↬",lopar:"⦅",Lopf:"𝕃",lopf:"𝕝",loplus:"⨭",lotimes:"⨴",lowast:"∗",lowbar:"_",LowerLeftArrow:"↙",LowerRightArrow:"↘",loz:"◊",lozenge:"◊",lozf:"⧫",lpar:"(",lparlt:"⦓",lrarr:"⇆",lrcorner:"⌟",lrhar:"⇋",lrhard:"⥭",lrm:"‎",lrtri:"⊿",lsaquo:"‹",Lscr:"ℒ",lscr:"𝓁",Lsh:"↰",lsh:"↰",lsim:"≲",lsime:"⪍",lsimg:"⪏",lsqb:"[",lsquo:"‘",lsquor:"‚",Lstrok:"Ł",lstrok:"ł",LT:"<",Lt:"≪",lt:"<",ltcc:"⪦",ltcir:"⩹",ltdot:"⋖",lthree:"⋋",ltimes:"⋉",ltlarr:"⥶",ltquest:"⩻",ltri:"◃",ltrie:"⊴",ltrif:"◂",ltrPar:"⦖",lurdshar:"⥊",luruhar:"⥦",lvertneqq:"≨︀",lvnE:"≨︀",macr:"¯",male:"♂",malt:"✠",maltese:"✠",Map:"⤅",map:"↦",mapsto:"↦",mapstodown:"↧",mapstoleft:"↤",mapstoup:"↥",marker:"▮",mcomma:"⨩",Mcy:"М",mcy:"м",mdash:"—",mDDot:"∺",measuredangle:"∡",MediumSpace:" ",Mellintrf:"ℳ",Mfr:"𝔐",mfr:"𝔪",mho:"℧",micro:"µ",mid:"∣",midast:"*",midcir:"⫰",middot:"·",minus:"−",minusb:"⊟",minusd:"∸",minusdu:"⨪",MinusPlus:"∓",mlcp:"⫛",mldr:"…",mnplus:"∓",models:"⊧",Mopf:"𝕄",mopf:"𝕞",mp:"∓",Mscr:"ℳ",mscr:"𝓂",mstpos:"∾",Mu:"Μ",mu:"μ",multimap:"⊸",mumap:"⊸",nabla:"∇",Nacute:"Ń",nacute:"ń",nang:"∠⃒",nap:"≉",napE:"⩰̸",napid:"≋̸",napos:"ʼn",napprox:"≉",natur:"♮",natural:"♮",naturals:"ℕ",nbsp:" ",nbump:"≎̸",nbumpe:"≏̸",ncap:"⩃",Ncaron:"Ň",ncaron:"ň",Ncedil:"Ņ",ncedil:"ņ",ncong:"≇",ncongdot:"⩭̸",ncup:"⩂",Ncy:"Н",ncy:"н",ndash:"–",ne:"≠",nearhk:"⤤",neArr:"⇗",nearr:"↗",nearrow:"↗",nedot:"≐̸",NegativeMediumSpace:"​",NegativeThickSpace:"​",NegativeThinSpace:"​",NegativeVeryThinSpace:"​",nequiv:"≢",nesear:"⤨",nesim:"≂̸",NestedGreaterGreater:"≫",NestedLessLess:"≪",NewLine:"\n",nexist:"∄",nexists:"∄",Nfr:"𝔑",nfr:"𝔫",ngE:"≧̸",nge:"≱",ngeq:"≱",ngeqq:"≧̸",ngeqslant:"⩾̸",nges:"⩾̸",nGg:"⋙̸",ngsim:"≵",nGt:"≫⃒",ngt:"≯",ngtr:"≯",nGtv:"≫̸",nhArr:"⇎",nharr:"↮",nhpar:"⫲",ni:"∋",nis:"⋼",nisd:"⋺",niv:"∋",NJcy:"Њ",njcy:"њ",nlArr:"⇍",nlarr:"↚",nldr:"‥",nlE:"≦̸",nle:"≰",nLeftarrow:"⇍",nleftarrow:"↚",nLeftrightarrow:"⇎",nleftrightarrow:"↮",nleq:"≰",nleqq:"≦̸",nleqslant:"⩽̸",nles:"⩽̸",nless:"≮",nLl:"⋘̸",nlsim:"≴",nLt:"≪⃒",nlt:"≮",nltri:"⋪",nltrie:"⋬",nLtv:"≪̸",nmid:"∤",NoBreak:"⁠",NonBreakingSpace:" ",Nopf:"ℕ",nopf:"𝕟",Not:"⫬",not:"¬",NotCongruent:"≢",NotCupCap:"≭",NotDoubleVerticalBar:"∦",NotElement:"∉",NotEqual:"≠",NotEqualTilde:"≂̸",NotExists:"∄",NotGreater:"≯",NotGreaterEqual:"≱",NotGreaterFullEqual:"≧̸",NotGreaterGreater:"≫̸",NotGreaterLess:"≹",NotGreaterSlantEqual:"⩾̸",NotGreaterTilde:"≵",NotHumpDownHump:"≎̸",NotHumpEqual:"≏̸",notin:"∉",notindot:"⋵̸",notinE:"⋹̸",notinva:"∉",notinvb:"⋷",notinvc:"⋶",NotLeftTriangle:"⋪",NotLeftTriangleBar:"⧏̸",NotLeftTriangleEqual:"⋬",NotLess:"≮",NotLessEqual:"≰",NotLessGreater:"≸",NotLessLess:"≪̸",NotLessSlantEqual:"⩽̸",NotLessTilde:"≴",NotNestedGreaterGreater:"⪢̸",NotNestedLessLess:"⪡̸",notni:"∌",notniva:"∌",notnivb:"⋾",notnivc:"⋽",NotPrecedes:"⊀",NotPrecedesEqual:"⪯̸",NotPrecedesSlantEqual:"⋠",NotReverseElement:"∌",NotRightTriangle:"⋫",NotRightTriangleBar:"⧐̸",NotRightTriangleEqual:"⋭",NotSquareSubset:"⊏̸",NotSquareSubsetEqual:"⋢",NotSquareSuperset:"⊐̸",NotSquareSupersetEqual:"⋣",NotSubset:"⊂⃒",NotSubsetEqual:"⊈",NotSucceeds:"⊁",NotSucceedsEqual:"⪰̸",NotSucceedsSlantEqual:"⋡",NotSucceedsTilde:"≿̸",NotSuperset:"⊃⃒",NotSupersetEqual:"⊉",NotTilde:"≁",NotTildeEqual:"≄",NotTildeFullEqual:"≇",NotTildeTilde:"≉",NotVerticalBar:"∤",npar:"∦",nparallel:"∦",nparsl:"⫽⃥",npart:"∂̸",npolint:"⨔",npr:"⊀",nprcue:"⋠",npre:"⪯̸",nprec:"⊀",npreceq:"⪯̸",nrArr:"⇏",nrarr:"↛",nrarrc:"⤳̸",nrarrw:"↝̸",nRightarrow:"⇏",nrightarrow:"↛",nrtri:"⋫",nrtrie:"⋭",nsc:"⊁",nsccue:"⋡",nsce:"⪰̸",Nscr:"𝒩",nscr:"𝓃",nshortmid:"∤",nshortparallel:"∦",nsim:"≁",nsime:"≄",nsimeq:"≄",nsmid:"∤",nspar:"∦",nsqsube:"⋢",nsqsupe:"⋣",nsub:"⊄",nsubE:"⫅̸",nsube:"⊈",nsubset:"⊂⃒",nsubseteq:"⊈",nsubseteqq:"⫅̸",nsucc:"⊁",nsucceq:"⪰̸",nsup:"⊅",nsupE:"⫆̸",nsupe:"⊉",nsupset:"⊃⃒",nsupseteq:"⊉",nsupseteqq:"⫆̸",ntgl:"≹",Ntilde:"Ñ",ntilde:"ñ",ntlg:"≸",ntriangleleft:"⋪",ntrianglelefteq:"⋬",ntriangleright:"⋫",ntrianglerighteq:"⋭",Nu:"Ν",nu:"ν",num:"#",numero:"№",numsp:" ",nvap:"≍⃒",nVDash:"⊯",nVdash:"⊮",nvDash:"⊭",nvdash:"⊬",nvge:"≥⃒",nvgt:">⃒",nvHarr:"⤄",nvinfin:"⧞",nvlArr:"⤂",nvle:"≤⃒",nvlt:"<⃒",nvltrie:"⊴⃒",nvrArr:"⤃",nvrtrie:"⊵⃒",nvsim:"∼⃒",nwarhk:"⤣",nwArr:"⇖",nwarr:"↖",nwarrow:"↖",nwnear:"⤧",Oacute:"Ó",oacute:"ó",oast:"⊛",ocir:"⊚",Ocirc:"Ô",ocirc:"ô",Ocy:"О",ocy:"о",odash:"⊝",Odblac:"Ő",odblac:"ő",odiv:"⨸",odot:"⊙",odsold:"⦼",OElig:"Œ",oelig:"œ",ofcir:"⦿",Ofr:"𝔒",ofr:"𝔬",ogon:"˛",Ograve:"Ò",ograve:"ò",ogt:"⧁",ohbar:"⦵",ohm:"Ω",oint:"∮",olarr:"↺",olcir:"⦾",olcross:"⦻",oline:"‾",olt:"⧀",Omacr:"Ō",omacr:"ō",Omega:"Ω",omega:"ω",Omicron:"Ο",omicron:"ο",omid:"⦶",ominus:"⊖",Oopf:"𝕆",oopf:"𝕠",opar:"⦷",OpenCurlyDoubleQuote:"“",OpenCurlyQuote:"‘",operp:"⦹",oplus:"⊕",Or:"⩔",or:"∨",orarr:"↻",ord:"⩝",order:"ℴ",orderof:"ℴ",ordf:"ª",ordm:"º",origof:"⊶",oror:"⩖",orslope:"⩗",orv:"⩛",oS:"Ⓢ",Oscr:"𝒪",oscr:"ℴ",Oslash:"Ø",oslash:"ø",osol:"⊘",Otilde:"Õ",otilde:"õ",Otimes:"⨷",otimes:"⊗",otimesas:"⨶",Ouml:"Ö",ouml:"ö",ovbar:"⌽",OverBar:"‾",OverBrace:"⏞",OverBracket:"⎴",OverParenthesis:"⏜",par:"∥",para:"¶",parallel:"∥",parsim:"⫳",parsl:"⫽",part:"∂",PartialD:"∂",Pcy:"П",pcy:"п",percnt:"%",period:".",permil:"‰",perp:"⊥",pertenk:"‱",Pfr:"𝔓",pfr:"𝔭",Phi:"Φ",phi:"φ",phiv:"ϕ",phmmat:"ℳ",phone:"☎",Pi:"Π",pi:"π",pitchfork:"⋔",piv:"ϖ",planck:"ℏ",planckh:"ℎ",plankv:"ℏ",plus:"+",plusacir:"⨣",plusb:"⊞",pluscir:"⨢",plusdo:"∔",plusdu:"⨥",pluse:"⩲",PlusMinus:"±",plusmn:"±",plussim:"⨦",plustwo:"⨧",pm:"±",Poincareplane:"ℌ",pointint:"⨕",Popf:"ℙ",popf:"𝕡",pound:"£",Pr:"⪻",pr:"≺",prap:"⪷",prcue:"≼",prE:"⪳",pre:"⪯",prec:"≺",precapprox:"⪷",preccurlyeq:"≼",Precedes:"≺",PrecedesEqual:"⪯",PrecedesSlantEqual:"≼",PrecedesTilde:"≾",preceq:"⪯",precnapprox:"⪹",precneqq:"⪵",precnsim:"⋨",precsim:"≾",Prime:"″",prime:"′",primes:"ℙ",prnap:"⪹",prnE:"⪵",prnsim:"⋨",prod:"∏",Product:"∏",profalar:"⌮",profline:"⌒",profsurf:"⌓",prop:"∝",Proportion:"∷",Proportional:"∝",propto:"∝",prsim:"≾",prurel:"⊰",Pscr:"𝒫",pscr:"𝓅",Psi:"Ψ",psi:"ψ",puncsp:" ",Qfr:"𝔔",qfr:"𝔮",qint:"⨌",Qopf:"ℚ",qopf:"𝕢",qprime:"⁗",Qscr:"𝒬",qscr:"𝓆",quaternions:"ℍ",quatint:"⨖",quest:"?",questeq:"≟",QUOT:'"',quot:'"',rAarr:"⇛",race:"∽̱",Racute:"Ŕ",racute:"ŕ",radic:"√",raemptyv:"⦳",Rang:"⟫",rang:"⟩",rangd:"⦒",range:"⦥",rangle:"⟩",raquo:"»",Rarr:"↠",rArr:"⇒",rarr:"→",rarrap:"⥵",rarrb:"⇥",rarrbfs:"⤠",rarrc:"⤳",rarrfs:"⤞",rarrhk:"↪",rarrlp:"↬",rarrpl:"⥅",rarrsim:"⥴",Rarrtl:"⤖",rarrtl:"↣",rarrw:"↝",rAtail:"⤜",ratail:"⤚",ratio:"∶",rationals:"ℚ",RBarr:"⤐",rBarr:"⤏",rbarr:"⤍",rbbrk:"❳",rbrace:"}",rbrack:"]",rbrke:"⦌",rbrksld:"⦎",rbrkslu:"⦐",Rcaron:"Ř",rcaron:"ř",Rcedil:"Ŗ",rcedil:"ŗ",rceil:"⌉",rcub:"}",Rcy:"Р",rcy:"р",rdca:"⤷",rdldhar:"⥩",rdquo:"”",rdquor:"”",rdsh:"↳",Re:"ℜ",real:"ℜ",realine:"ℛ",realpart:"ℜ",reals:"ℝ",rect:"▭",REG:"®",reg:"®",ReverseElement:"∋",ReverseEquilibrium:"⇋",ReverseUpEquilibrium:"⥯",rfisht:"⥽",rfloor:"⌋",Rfr:"ℜ",rfr:"𝔯",rHar:"⥤",rhard:"⇁",rharu:"⇀",rharul:"⥬",Rho:"Ρ",rho:"ρ",rhov:"ϱ",RightAngleBracket:"⟩",RightArrow:"→",Rightarrow:"⇒",rightarrow:"→",RightArrowBar:"⇥",RightArrowLeftArrow:"⇄",rightarrowtail:"↣",RightCeiling:"⌉",RightDoubleBracket:"⟧",RightDownTeeVector:"⥝",RightDownVector:"⇂",RightDownVectorBar:"⥕",RightFloor:"⌋",rightharpoondown:"⇁",rightharpoonup:"⇀",rightleftarrows:"⇄",rightleftharpoons:"⇌",rightrightarrows:"⇉",rightsquigarrow:"↝",RightTee:"⊢",RightTeeArrow:"↦",RightTeeVector:"⥛",rightthreetimes:"⋌",RightTriangle:"⊳",RightTriangleBar:"⧐",RightTriangleEqual:"⊵",RightUpDownVector:"⥏",RightUpTeeVector:"⥜",RightUpVector:"↾",RightUpVectorBar:"⥔",RightVector:"⇀",RightVectorBar:"⥓",ring:"˚",risingdotseq:"≓",rlarr:"⇄",rlhar:"⇌",rlm:"‏",rmoust:"⎱",rmoustache:"⎱",rnmid:"⫮",roang:"⟭",roarr:"⇾",robrk:"⟧",ropar:"⦆",Ropf:"ℝ",ropf:"𝕣",roplus:"⨮",rotimes:"⨵",RoundImplies:"⥰",rpar:")",rpargt:"⦔",rppolint:"⨒",rrarr:"⇉",Rrightarrow:"⇛",rsaquo:"›",Rscr:"ℛ",rscr:"𝓇",Rsh:"↱",rsh:"↱",rsqb:"]",rsquo:"’",rsquor:"’",rthree:"⋌",rtimes:"⋊",rtri:"▹",rtrie:"⊵",rtrif:"▸",rtriltri:"⧎",RuleDelayed:"⧴",ruluhar:"⥨",rx:"℞",Sacute:"Ś",sacute:"ś",sbquo:"‚",Sc:"⪼",sc:"≻",scap:"⪸",Scaron:"Š",scaron:"š",sccue:"≽",scE:"⪴",sce:"⪰",Scedil:"Ş",scedil:"ş",Scirc:"Ŝ",scirc:"ŝ",scnap:"⪺",scnE:"⪶",scnsim:"⋩",scpolint:"⨓",scsim:"≿",Scy:"С",scy:"с",sdot:"⋅",sdotb:"⊡",sdote:"⩦",searhk:"⤥",seArr:"⇘",searr:"↘",searrow:"↘",sect:"§",semi:";",seswar:"⤩",setminus:"∖",setmn:"∖",sext:"✶",Sfr:"𝔖",sfr:"𝔰",sfrown:"⌢",sharp:"♯",SHCHcy:"Щ",shchcy:"щ",SHcy:"Ш",shcy:"ш",ShortDownArrow:"↓",ShortLeftArrow:"←",shortmid:"∣",shortparallel:"∥",ShortRightArrow:"→",ShortUpArrow:"↑",shy:"­",Sigma:"Σ",sigma:"σ",sigmaf:"ς",sigmav:"ς",sim:"∼",simdot:"⩪",sime:"≃",simeq:"≃",simg:"⪞",simgE:"⪠",siml:"⪝",simlE:"⪟",simne:"≆",simplus:"⨤",simrarr:"⥲",slarr:"←",SmallCircle:"∘",smallsetminus:"∖",smashp:"⨳",smeparsl:"⧤",smid:"∣",smile:"⌣",smt:"⪪",smte:"⪬",smtes:"⪬︀",SOFTcy:"Ь",softcy:"ь",sol:"/",solb:"⧄",solbar:"⌿",Sopf:"𝕊",sopf:"𝕤",spades:"♠",spadesuit:"♠",spar:"∥",sqcap:"⊓",sqcaps:"⊓︀",sqcup:"⊔",sqcups:"⊔︀",Sqrt:"√",sqsub:"⊏",sqsube:"⊑",sqsubset:"⊏",sqsubseteq:"⊑",sqsup:"⊐",sqsupe:"⊒",sqsupset:"⊐",sqsupseteq:"⊒",squ:"□",Square:"□",square:"□",SquareIntersection:"⊓",SquareSubset:"⊏",SquareSubsetEqual:"⊑",SquareSuperset:"⊐",SquareSupersetEqual:"⊒",SquareUnion:"⊔",squarf:"▪",squf:"▪",srarr:"→",Sscr:"𝒮",sscr:"𝓈",ssetmn:"∖",ssmile:"⌣",sstarf:"⋆",Star:"⋆",star:"☆",starf:"★",straightepsilon:"ϵ",straightphi:"ϕ",strns:"¯",Sub:"⋐",sub:"⊂",subdot:"⪽",subE:"⫅",sube:"⊆",subedot:"⫃",submult:"⫁",subnE:"⫋",subne:"⊊",subplus:"⪿",subrarr:"⥹",Subset:"⋐",subset:"⊂",subseteq:"⊆",subseteqq:"⫅",SubsetEqual:"⊆",subsetneq:"⊊",subsetneqq:"⫋",subsim:"⫇",subsub:"⫕",subsup:"⫓",succ:"≻",succapprox:"⪸",succcurlyeq:"≽",Succeeds:"≻",SucceedsEqual:"⪰",SucceedsSlantEqual:"≽",SucceedsTilde:"≿",succeq:"⪰",succnapprox:"⪺",succneqq:"⪶",succnsim:"⋩",succsim:"≿",SuchThat:"∋",Sum:"∑",sum:"∑",sung:"♪",Sup:"⋑",sup:"⊃",sup1:"¹",sup2:"²",sup3:"³",supdot:"⪾",supdsub:"⫘",supE:"⫆",supe:"⊇",supedot:"⫄",Superset:"⊃",SupersetEqual:"⊇",suphsol:"⟉",suphsub:"⫗",suplarr:"⥻",supmult:"⫂",supnE:"⫌",supne:"⊋",supplus:"⫀",Supset:"⋑",supset:"⊃",supseteq:"⊇",supseteqq:"⫆",supsetneq:"⊋",supsetneqq:"⫌",supsim:"⫈",supsub:"⫔",supsup:"⫖",swarhk:"⤦",swArr:"⇙",swarr:"↙",swarrow:"↙",swnwar:"⤪",szlig:"ß",Tab:"\t",target:"⌖",Tau:"Τ",tau:"τ",tbrk:"⎴",Tcaron:"Ť",tcaron:"ť",Tcedil:"Ţ",tcedil:"ţ",Tcy:"Т",tcy:"т",tdot:"⃛",telrec:"⌕",Tfr:"𝔗",tfr:"𝔱",there4:"∴",Therefore:"∴",therefore:"∴",Theta:"Θ",theta:"θ",thetasym:"ϑ",thetav:"ϑ",thickapprox:"≈",thicksim:"∼",ThickSpace:"  ",thinsp:" ",ThinSpace:" ",thkap:"≈",thksim:"∼",THORN:"Þ",thorn:"þ",Tilde:"∼",tilde:"˜",TildeEqual:"≃",TildeFullEqual:"≅",TildeTilde:"≈",times:"×",timesb:"⊠",timesbar:"⨱",timesd:"⨰",tint:"∭",toea:"⤨",top:"⊤",topbot:"⌶",topcir:"⫱",Topf:"𝕋",topf:"𝕥",topfork:"⫚",tosa:"⤩",tprime:"‴",TRADE:"™",trade:"™",triangle:"▵",triangledown:"▿",triangleleft:"◃",trianglelefteq:"⊴",triangleq:"≜",triangleright:"▹",trianglerighteq:"⊵",tridot:"◬",trie:"≜",triminus:"⨺",TripleDot:"⃛",triplus:"⨹",trisb:"⧍",tritime:"⨻",trpezium:"⏢",Tscr:"𝒯",tscr:"𝓉",TScy:"Ц",tscy:"ц",TSHcy:"Ћ",tshcy:"ћ",Tstrok:"Ŧ",tstrok:"ŧ",twixt:"≬",twoheadleftarrow:"↞",twoheadrightarrow:"↠",Uacute:"Ú",uacute:"ú",Uarr:"↟",uArr:"⇑",uarr:"↑",Uarrocir:"⥉",Ubrcy:"Ў",ubrcy:"ў",Ubreve:"Ŭ",ubreve:"ŭ",Ucirc:"Û",ucirc:"û",Ucy:"У",ucy:"у",udarr:"⇅",Udblac:"Ű",udblac:"ű",udhar:"⥮",ufisht:"⥾",Ufr:"𝔘",ufr:"𝔲",Ugrave:"Ù",ugrave:"ù",uHar:"⥣",uharl:"↿",uharr:"↾",uhblk:"▀",ulcorn:"⌜",ulcorner:"⌜",ulcrop:"⌏",ultri:"◸",Umacr:"Ū",umacr:"ū",uml:"¨",UnderBar:"_",UnderBrace:"⏟",UnderBracket:"⎵",UnderParenthesis:"⏝",Union:"⋃",UnionPlus:"⊎",Uogon:"Ų",uogon:"ų",Uopf:"𝕌",uopf:"𝕦",UpArrow:"↑",Uparrow:"⇑",uparrow:"↑",UpArrowBar:"⤒",UpArrowDownArrow:"⇅",UpDownArrow:"↕",Updownarrow:"⇕",updownarrow:"↕",UpEquilibrium:"⥮",upharpoonleft:"↿",upharpoonright:"↾",uplus:"⊎",UpperLeftArrow:"↖",UpperRightArrow:"↗",Upsi:"ϒ",upsi:"υ",upsih:"ϒ",Upsilon:"Υ",upsilon:"υ",UpTee:"⊥",UpTeeArrow:"↥",upuparrows:"⇈",urcorn:"⌝",urcorner:"⌝",urcrop:"⌎",Uring:"Ů",uring:"ů",urtri:"◹",Uscr:"𝒰",uscr:"𝓊",utdot:"⋰",Utilde:"Ũ",utilde:"ũ",utri:"▵",utrif:"▴",uuarr:"⇈",Uuml:"Ü",uuml:"ü",uwangle:"⦧",vangrt:"⦜",varepsilon:"ϵ",varkappa:"ϰ",varnothing:"∅",varphi:"ϕ",varpi:"ϖ",varpropto:"∝",vArr:"⇕",varr:"↕",varrho:"ϱ",varsigma:"ς",varsubsetneq:"⊊︀",varsubsetneqq:"⫋︀",varsupsetneq:"⊋︀",varsupsetneqq:"⫌︀",vartheta:"ϑ",vartriangleleft:"⊲",vartriangleright:"⊳",Vbar:"⫫",vBar:"⫨",vBarv:"⫩",Vcy:"В",vcy:"в",VDash:"⊫",Vdash:"⊩",vDash:"⊨",vdash:"⊢",Vdashl:"⫦",Vee:"⋁",vee:"∨",veebar:"⊻",veeeq:"≚",vellip:"⋮",Verbar:"‖",verbar:"|",Vert:"‖",vert:"|",VerticalBar:"∣",VerticalLine:"|",VerticalSeparator:"❘",VerticalTilde:"≀",VeryThinSpace:" ",Vfr:"𝔙",vfr:"𝔳",vltri:"⊲",vnsub:"⊂⃒",vnsup:"⊃⃒",Vopf:"𝕍",vopf:"𝕧",vprop:"∝",vrtri:"⊳",Vscr:"𝒱",vscr:"𝓋",vsubnE:"⫋︀",vsubne:"⊊︀",vsupnE:"⫌︀",vsupne:"⊋︀",Vvdash:"⊪",vzigzag:"⦚",Wcirc:"Ŵ",wcirc:"ŵ",wedbar:"⩟",Wedge:"⋀",wedge:"∧",wedgeq:"≙",weierp:"℘",Wfr:"𝔚",wfr:"𝔴",Wopf:"𝕎",wopf:"𝕨",wp:"℘",wr:"≀",wreath:"≀",Wscr:"𝒲",wscr:"𝓌",xcap:"⋂",xcirc:"◯",xcup:"⋃",xdtri:"▽",Xfr:"𝔛",xfr:"𝔵",xhArr:"⟺",xharr:"⟷",Xi:"Ξ",xi:"ξ",xlArr:"⟸",xlarr:"⟵",xmap:"⟼",xnis:"⋻",xodot:"⨀",Xopf:"𝕏",xopf:"𝕩",xoplus:"⨁",xotime:"⨂",xrArr:"⟹",xrarr:"⟶",Xscr:"𝒳",xscr:"𝓍",xsqcup:"⨆",xuplus:"⨄",xutri:"△",xvee:"⋁",xwedge:"⋀",Yacute:"Ý",yacute:"ý",YAcy:"Я",yacy:"я",Ycirc:"Ŷ",ycirc:"ŷ",Ycy:"Ы",ycy:"ы",yen:"¥",Yfr:"𝔜",yfr:"𝔶",YIcy:"Ї",yicy:"ї",Yopf:"𝕐",yopf:"𝕪",Yscr:"𝒴",yscr:"𝓎",YUcy:"Ю",yucy:"ю",Yuml:"Ÿ",yuml:"ÿ",Zacute:"Ź",zacute:"ź",Zcaron:"Ž",zcaron:"ž",Zcy:"З",zcy:"з",Zdot:"Ż",zdot:"ż",zeetrf:"ℨ",ZeroWidthSpace:"​",Zeta:"Ζ",zeta:"ζ",Zfr:"ℨ",zfr:"𝔷",ZHcy:"Ж",zhcy:"ж",zigrarr:"⇝",Zopf:"ℤ",zopf:"𝕫",Zscr:"𝒵",zscr:"𝓏",zwj:"‍",zwnj:"‌"}},function(e,t,n){"use strict";var r=n(419),o=n(27).unescapeMd;e.exports=function(e,t){var n,i,a,u=t,s=e.posMax;if(60===e.src.charCodeAt(t)){for(t++;t8&&n<14);)if(92===n&&t+11)break;if(41===n&&--i<0)break;t++}return u!==t&&(a=o(e.src.slice(u,t)),!!e.parser.validateLink(a)&&(e.linkContent=a,e.pos=t,!0))}},function(e,t,n){"use strict";var r=n(27).replaceEntities;e.exports=function(e){var t=r(e);try{t=decodeURI(t)}catch(e){}return encodeURI(t)}},function(e,t,n){"use strict";var r=n(27).unescapeMd;e.exports=function(e,t){var n,o=t,i=e.posMax,a=e.src.charCodeAt(t);if(34!==a&&39!==a&&40!==a)return!1;for(t++,40===a&&(a=41);t1?r-1:0),i=1;i1?t-1:0),r=1;r0?Array(e+1).join(" ")+t:t}).join("\n")}(0,(0,r.default)(a,null,2))||"{}",c.default.createElement("br",null)))}}]),t}(l.Component);t.default=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=c(n(4)),o=c(n(2)),i=c(n(3)),a=c(n(5)),u=c(n(6)),s=c(n(0)),l=n(7);c(n(1)),c(n(11));function c(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(){var e,n,i,u;(0,o.default)(this,t);for(var s=arguments.length,l=Array(s),c=0;c=e.length?(this._t=void 0,o(1)):o(0,"keys"==t?n:"values"==t?e[n]:[n,e[n]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(e,t){e.exports=function(){}},function(e,t){e.exports=function(e,t){return{value:t,done:!!e}}},function(e,t,n){"use strict";var r=n(159),o=n(95),i=n(97),a={};n(50)(a,n(19)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:o(1,n)}),i(e,t+" Iterator")}},function(e,t,n){var r=n(40),o=n(36),i=n(96);e.exports=n(44)?Object.defineProperties:function(e,t){o(e);for(var n,a=i(t),u=a.length,s=0;u>s;)r.f(e,n=a[s++],t[n]);return e}},function(e,t,n){var r=n(70),o=n(115),i=n(455);e.exports=function(e){return function(t,n,a){var u,s=r(t),l=o(s.length),c=i(a,l);if(e&&n!=n){for(;l>c;)if((u=s[c++])!=u)return!0}else for(;l>c;c++)if((e||c in s)&&s[c]===n)return e||c||0;return!e&&-1}}},function(e,t,n){var r=n(160),o=Math.max,i=Math.min;e.exports=function(e,t){return(e=r(e))<0?o(e+t,0):i(e,t)}},function(e,t,n){var r=n(160),o=n(155);e.exports=function(e){return function(t,n){var i,a,u=String(o(t)),s=r(n),l=u.length;return s<0||s>=l?e?"":void 0:(i=u.charCodeAt(s))<55296||i>56319||s+1===l||(a=u.charCodeAt(s+1))<56320||a>57343?e?u.charAt(s):i:e?u.slice(s,s+2):a-56320+(i-55296<<10)+65536}}},function(e,t,n){var r=n(36),o=n(164);e.exports=n(15).getIterator=function(e){var t=o(e);if("function"!=typeof t)throw TypeError(e+" is not iterable!");return r(t.call(e))}},function(e,t,n){n(459),n(244),n(470),n(474),n(485),n(486),e.exports=n(60).Promise},function(e,t,n){"use strict";var r=n(166),o={};o[n(17)("toStringTag")]="z",o+""!="[object z]"&&n(72)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(e,t,n){e.exports=!n(100)&&!n(101)(function(){return 7!=Object.defineProperty(n(168)("div"),"a",{get:function(){return 7}}).a})},function(e,t,n){var r=n(73);e.exports=function(e,t){if(!r(e))return e;var n,o;if(t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;if("function"==typeof(n=e.valueOf)&&!r(o=n.call(e)))return o;if(!t&&"function"==typeof(n=e.toString)&&!r(o=n.call(e)))return o;throw TypeError("Can't convert object to primitive value")}},function(e,t,n){"use strict";var r=n(463),o=n(243),i=n(170),a={};n(58)(a,n(17)("iterator"),function(){return this}),e.exports=function(e,t,n){e.prototype=r(a,{next:o(1,n)}),i(e,t+" Iterator")}},function(e,t,n){var r=n(59),o=n(464),i=n(250),a=n(169)("IE_PROTO"),u=function(){},s=function(){var e,t=n(168)("iframe"),r=i.length;for(t.style.display="none",n(251).appendChild(t),t.src="javascript:",(e=t.contentWindow.document).open(),e.write("