Skip to content
Snippets Groups Projects
Commit 34b4b655 authored by Rodríguez Ortega, Alejandro's avatar Rodríguez Ortega, Alejandro
Browse files

Simplified rest interface for Anonymice methods.

parent 173af029
Branches
Tags
No related merge requests found
...@@ -15,12 +15,16 @@ ...@@ -15,12 +15,16 @@
*/ */
package com.tecnalia.urbanite.anonymize.rest; package com.tecnalia.urbanite.anonymize.rest;
import javax.websocket.server.PathParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.tecnalia.urbanite.anonymize.service.AnonymizerService; import com.tecnalia.urbanite.anonymize.service.AnonymizerService;
...@@ -39,7 +43,7 @@ public class AnonymizerAPI { ...@@ -39,7 +43,7 @@ public class AnonymizerAPI {
@Autowired @Autowired
AnonymizerService anonymizerService; AnonymizerService anonymizerService;
/* @RequestMapping(method = RequestMethod.POST, value = "/anonymize/{city}/{model}/{property}/{value}") @RequestMapping(method = RequestMethod.POST, value = "/anonymize/{city}/{model}/{property}/{value}")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful operation."), @ApiResponse(responseCode = "200", description = "Successful operation."),
@ApiResponse(responseCode = "400", description = "Bad request. (User unknow)")}) @ApiResponse(responseCode = "400", description = "Bad request. (User unknow)")})
...@@ -52,7 +56,7 @@ public class AnonymizerAPI { ...@@ -52,7 +56,7 @@ public class AnonymizerAPI {
return anonymizerService.anonymizeProperty(city,model,property,value); return anonymizerService.anonymizeProperty(city,model,property,value);
} */ }
@RequestMapping(method = RequestMethod.POST, value = "/removePointsOutOfArea/{city}/{model}/{property}/{value}") @RequestMapping(method = RequestMethod.POST, value = "/removePointsOutOfArea/{city}/{model}/{property}/{value}")
@ApiResponses(value = { @ApiResponses(value = {
...@@ -79,17 +83,17 @@ public class AnonymizerAPI { ...@@ -79,17 +83,17 @@ public class AnonymizerAPI {
} }
@RequestMapping(method = RequestMethod.POST, value = "/generateAnonymousVehicleTripFromVehiclePointsString/{city}/{model}/{property}") @RequestMapping(method = RequestMethod.POST, value = "/generateAnonymousVehicleTripFromVehiclePoints")
@ApiResponses(value = { @ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful operation."), @ApiResponse(responseCode = "200", description = "Successful operation."),
@ApiResponse(responseCode = "400", description = "Bad request. ")}) @ApiResponse(responseCode = "400", description = "Bad request. ")})
public ResponseEntity<String> generateAnonymousVehicleTripFromVehiclePointsString( @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.")
@Parameter(description = "City where is the model to be anonymized", example = "messina") @PathVariable String city, public ResponseEntity<String> generateAnonymousVehicleTripFromVehiclePoints(
@Parameter(description = "Model that is going to be anonymized.", example = "vehicle") @PathVariable String model, @Parameter(description = "Meters to delete", example = "50", required = false) @RequestParam(required = false) double meters
@Parameter(description = "Property of the model that is going to be anonymized.", example = "name") @PathVariable String property) throws Exception { ) throws Exception {
return anonymizerService.generateAnonymousVehicleTripFromVehiclePointsString(city,model,property, 50); return anonymizerService.generateAnonymousVehicleTripFromVehiclePointsString("messina","vehicle","name", meters);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment