refactored code
This commit is contained in:
parent
38097dad8e
commit
baab96059b
@ -97,7 +97,7 @@ public class Controller {
|
||||
}
|
||||
|
||||
Optional<CacheAccesDefinition> 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<Station> stationen) throws IllegalParameterException {
|
||||
@RequestParam String name,
|
||||
@RequestParam String rankingPoints,
|
||||
@RequestParam(value = "rewardID", defaultValue = "-1") String rewardID,
|
||||
@RequestParam List<Station> 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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user