From baab96059bccfdc7b349248ca830668dd717c342 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 29 Mar 2019 01:57:49 +0100 Subject: [PATCH] refactored code --- .../bugageocaching/controller/Controller.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index a4935d9..29ed66c 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -97,7 +97,7 @@ public class Controller { } Optional cacheAccesDefinitionOptional = - cacheAccesDefinitionRepository.findById(0); // bearbeitet + cacheAccesDefinitionRepository.findById(0); // bearbeitet if (cacheAccesDefinitionOptional.isPresent()) { CacheAccesDefinition cacheAccesDefinition = cacheAccesDefinitionOptional.get(); bearbeitet.setCacheAccesDefinition(cacheAccesDefinition); @@ -135,9 +135,9 @@ public class Controller { @RequestMapping("/api/createStation") @ResponseBody String createStation(@RequestParam String description, - @RequestParam String lattitude, - @RequestParam String longitude, - @RequestParam String solution) throws IllegalParameterException { + @RequestParam String lattitude, + @RequestParam String longitude, + @RequestParam String solution) throws IllegalParameterException { if (description.length() == 0 || lattitude.length() == 0 || longitude.length() == 0 || solution.length() == 0) { throw new IllegalParameterException("Fields can´t be empty"); @@ -205,10 +205,10 @@ public class Controller { @RequestMapping("/api/createCache") @ResponseBody String createCache(@RequestParam String description, - @RequestParam String name, - @RequestParam String rankingPoints, - @RequestParam(value = "rewardID", defaultValue = "-1") String rewardID, - @RequestParam List stationen) throws IllegalParameterException { + @RequestParam String name, + @RequestParam String rankingPoints, + @RequestParam(value = "rewardID", defaultValue = "-1") String rewardID, + @RequestParam List stationen) throws IllegalParameterException { if (description.length() == 0 || name.length() == 0 || rankingPoints.length() == 0 || stationen.size() == 0) { throw new IllegalParameterException("Fields can´t be empty"); @@ -244,11 +244,11 @@ public class Controller { cacheRepository.save(cache); - for(int i = 0; i + 1 < stationen.size(); i++) { + for (int i = 0; i + 1 < stationen.size(); i++) { StationReihenfolge stationReihenfolge = new StationReihenfolge(); stationReihenfolge.setCache(cache); stationReihenfolge.setStation(stationen.get(i)); - stationReihenfolge.setNachfolgeStation(stationen.get(i+1)); + stationReihenfolge.setNachfolgeStation(stationen.get(i + 1)); } return new Gson().toJson(cache);