startCache wurde aufgrund des neuen Attributs station in der bearbeitet-Tabelle überarbeitet

This commit is contained in:
Michael 2019-03-25 21:51:00 +01:00
parent 161d29f248
commit d5ca26bbd3

View File

@ -69,7 +69,8 @@ public class Controller {
@RequestMapping("/api/startCache")
public @ResponseBody
String startCache(@RequestParam(value = "userID", defaultValue = "-1") String userID,
@RequestParam String cacheID) throws IllegalParameterException {
@RequestParam String cacheID,
@RequestParam String stationID) throws IllegalParameterException {
if (!userID.equals("-1")) { // ein angemeldeter user startet den cache(es werden zwei parameter übergeben)
@ -91,6 +92,14 @@ public class Controller {
throw new IllegalParameterException("There is no cache with the ID " + cacheID);
}
Optional<Station> stationOptional = stationRepository.findById(Integer.valueOf(stationID));
if (stationOptional.isPresent()) {
Station station = stationOptional.get();
bearbeitet.setAktuelleStation(station);
} else {
throw new IllegalParameterException("There is no station with the ID " + stationID);
}
Optional<CacheAccesDefinition> cacheAccesDefinitionOptional =
cacheAccesDefinitionRepository.findById(1); // bearbeitet
if (cacheAccesDefinitionOptional.isPresent()) {