From 34b4b655a2df2837794c8c20ecab1d7149359d5b Mon Sep 17 00:00:00 2001
From: alexrodriguez <alejandro.rodriguez@tecnalia.com>
Date: Tue, 29 Nov 2022 10:56:44 +0100
Subject: [PATCH] Simplified rest interface for Anonymice methods.

---
 .../anonymize/rest/AnonymizerAPI.java         | 22 +++++++++++--------
 1 file changed, 13 insertions(+), 9 deletions(-)

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 a7ecca3..7e03117 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);
             
     }    	
 }
-- 
GitLab