Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/main/java/fr/insee/rmes/api/DescribeApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

import org.apache.commons.lang3.StringUtils;

import fr.insee.rmes.modeles.utils.Header;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.media.Schema;
Expand All @@ -23,6 +25,7 @@
@Path("/technicalService")
public class DescribeApi extends AbstractMetadataApi {


@GET
@Path("/describe")
@Produces(MediaType.APPLICATION_JSON)
Expand Down
1 change: 1 addition & 0 deletions src/main/java/fr/insee/rmes/api/geo/PaysApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public Response getByCode(
}
return Response.ok(responseUtils.produceResponse(country, acceptHeader)).build();
}

}
private boolean isValidCode(String code) {
return code != null && code.matches(ConstGeoApi.PATTERN_PAYS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class BassinDeVie2022Api extends AbstractGeoApi {
description = LITTERAL_RESPONSE_DESCRIPTION)
})
public Response getByCode(

@Parameter(
description = ConstGeoApi.PATTERN_BASSINDEVIE_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -105,6 +106,7 @@ public Response getByCode(
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,
Expand Down Expand Up @@ -166,6 +168,7 @@ private String sanitizeFiltreNom(String filtreNom) {
description = LITTERAL_RESPONSE_DESCRIPTION)
})
public Response getDescendants(

@Parameter(
description = ConstGeoApi.PATTERN_BASSINDEVIE_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -195,6 +198,7 @@ public Response getDescendants(
// Exécution de la requête SPARQL
return this
.generateResponseListOfTerritoire(

sparqlUtils.executeSparqlQuery(
GeoQueries.getDescendantsBassinDeVie(
code,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public Response getDescendants(
.getDescendantsCantonOuVille(
code,
this.formatValidParameterDateIfIsNull(dateString),

this.formatValidParametertypeTerritoireIfIsNull(typeTerritoire), this.formatValidParameterFiltreIfIsNull(filtreNomString))),
header,
Territoires.class,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ public Response getDescendants(
if (date != null){
dateString = date.getString();
}

String filtreNomString = (filtreNom != null) ? sanitizeFiltreNom(filtreNom.getString()) : null;
if ( ! this.verifyParametersTypeAndDateAreValid(typeTerritoire, dateString)) {
return this.generateBadRequestResponse();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public class IntercommunaliteAPI extends AbstractGeoApi {
content = @Content(schema = @Schema(implementation = Intercommunalite.class)),
description = LITTERAL_RESPONSE_DESCRIPTION)
})

public Response getByCode(
@Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -96,6 +97,7 @@ public Response getByCode(
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')",
Expand Down Expand Up @@ -146,6 +148,7 @@ private String sanitizeFiltreNom(String filtreNom) {
content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)),
description = LITTERAL_RESPONSE_DESCRIPTION)
})

public Response getAscendants(
@Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -186,6 +189,7 @@ public Response getAscendants(
content = @Content(schema = @Schema(type = ARRAY, implementation = Territoire.class)),
description = LITTERAL_RESPONSE_DESCRIPTION)
})

public Response getDescendants(
@Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -233,6 +237,7 @@ public Response getDescendants(
content = @Content(schema = @Schema(implementation = Intercommunalite.class)),
description = LITTERAL_RESPONSE_DESCRIPTION)
})

public Response getSuivant(
@Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -274,6 +279,7 @@ public Response getSuivant(
content = @Content(schema = @Schema(implementation = Intercommunalite.class)),
description = LITTERAL_RESPONSE_DESCRIPTION)
})

public Response getProjection(
@Parameter(description = ConstGeoApi.PATTERN_INTERCO_DESCRIPTION,
required = true,
Expand Down Expand Up @@ -304,5 +310,4 @@ public Response getProjection(
Intercommunalite.class);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public Response getByCode(
description = LITTERAL_RESPONSE_DESCRIPTION)
})
public Response getDescendants(

@Parameter(
description = ConstGeoApi.PATTERN_REGION_DESCRIPTION,
required = true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ void givenGetActivities_whenCorrectRequest_thenResponseIsOk() {
codesAPI.getActivities("25.2", null, MediaType.APPLICATION_JSON);
verify(mockResponseUtils, times(1)).produceResponse(Mockito.any(), Mockito.any());


codesAPI.getActivities("25.2", new Date("*"), MediaType.APPLICATION_JSON);
verify(mockResponseUtils, times(2)).produceResponse(Mockito.any(), Mockito.any());

Expand Down
2 changes: 2 additions & 0 deletions src/test/java/fr/insee/rmes/api/geo/PaysApiTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ void givenGetCountry_whenCorrectRequest_andHeaderContentIsJson_thenResponseIsOk(
this.mockUtilsMethodsThenReturnOnePojo(country, Boolean.TRUE);

// Call method

geoApi.getByCode("something",headerJSON);
verify(mockResponseUtils, times(1)).produceResponse(Mockito.any(), Mockito.any());
}*/
Expand All @@ -60,6 +61,7 @@ void givenGetCountry_whenCorrectRequest_andHeaderContentIsXml_thenResponseIsOk()
this.mockUtilsMethodsThenReturnOnePojo(country, Boolean.TRUE);

// Mock methods

geoApi.getByCode("something",headerXML);
verify(mockResponseUtils, times(1)).produceResponse(Mockito.any(), Mockito.any());
}*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ void givenGetListeCommune_WhenCorrectRequest_thenParameterDateIsRight(String dat
list.add(new Commune());

// Call method header content = xml
geoApi.getListe(MediaType.APPLICATION_XML, new Date(date), date, Boolean.TRUE);/*modifier suite a changement du nombre de variables */
geoApi.getListe(MediaType.APPLICATION_XML, new Date(date), date, Boolean.TRUE);*//*modifier suite a changement du nombre de variables *//*
verify(mockResponseUtils, times(1)).produceResponse(Mockito.any(), Mockito.any());
}*/
Expand Down