diff --git a/src/main/java/com/tecnalia/urbanite/anonymize/rest/AnonymizerAPI.java b/src/main/java/com/tecnalia/urbanite/anonymize/rest/AnonymizerAPI.java index a7ecca393100dea539d7b4572d97182668968087..7e031173e4244658daeb5ec26acff0bca129a109 100644 --- a/src/main/java/com/tecnalia/urbanite/anonymize/rest/AnonymizerAPI.java +++ b/src/main/java/com/tecnalia/urbanite/anonymize/rest/AnonymizerAPI.java @@ -15,12 +15,16 @@ */ package com.tecnalia.urbanite.anonymize.rest; +import javax.websocket.server.PathParam; + import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Required; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.tecnalia.urbanite.anonymize.service.AnonymizerService; @@ -39,7 +43,7 @@ public class AnonymizerAPI { @Autowired AnonymizerService anonymizerService; - /* @RequestMapping(method = RequestMethod.POST, value = "/anonymize/{city}/{model}/{property}/{value}") + @RequestMapping(method = RequestMethod.POST, value = "/anonymize/{city}/{model}/{property}/{value}") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successful operation."), @ApiResponse(responseCode = "400", description = "Bad request. (User unknow)")}) @@ -52,7 +56,7 @@ public class AnonymizerAPI { return anonymizerService.anonymizeProperty(city,model,property,value); - } */ + } @RequestMapping(method = RequestMethod.POST, value = "/removePointsOutOfArea/{city}/{model}/{property}/{value}") @ApiResponses(value = { @@ -79,17 +83,17 @@ public class AnonymizerAPI { } - @RequestMapping(method = RequestMethod.POST, value = "/generateAnonymousVehicleTripFromVehiclePointsString/{city}/{model}/{property}") + @RequestMapping(method = RequestMethod.POST, value = "/generateAnonymousVehicleTripFromVehiclePoints") @ApiResponses(value = { @ApiResponse(responseCode = "200", description = "Successful operation."), @ApiResponse(responseCode = "400", description = "Bad request. ")}) - public ResponseEntity<String> generateAnonymousVehicleTripFromVehiclePointsString( - - @Parameter(description = "City where is the model to be anonymized", example = "messina") @PathVariable String city, - @Parameter(description = "Model that is going to be anonymized.", example = "vehicle") @PathVariable String model, - @Parameter(description = "Property of the model that is going to be anonymized.", example = "name") @PathVariable String property) throws Exception { + @Operation(summary = "Generate anonymiced routes from trips.", description = "The service get the messina Vehicle points of ebikes and generate GPS Routes, then anonymice this routas deleting the " + + " {meters} of the beginnig and the end.") + public ResponseEntity<String> generateAnonymousVehicleTripFromVehiclePoints( + @Parameter(description = "Meters to delete", example = "50", required = false) @RequestParam(required = false) double meters + ) throws Exception { - return anonymizerService.generateAnonymousVehicleTripFromVehiclePointsString(city,model,property, 50); + return anonymizerService.generateAnonymousVehicleTripFromVehiclePointsString("messina","vehicle","name", meters); } }