startCache wurde aufgrund des neuen Attributs station in der bearbeitet-Tabelle überarbeitet
This commit is contained in:
parent
161d29f248
commit
d5ca26bbd3
@ -69,7 +69,8 @@ public class Controller {
|
|||||||
@RequestMapping("/api/startCache")
|
@RequestMapping("/api/startCache")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
String startCache(@RequestParam(value = "userID", defaultValue = "-1") String userID,
|
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)
|
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);
|
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 =
|
Optional<CacheAccesDefinition> cacheAccesDefinitionOptional =
|
||||||
cacheAccesDefinitionRepository.findById(1); // bearbeitet
|
cacheAccesDefinitionRepository.findById(1); // bearbeitet
|
||||||
if (cacheAccesDefinitionOptional.isPresent()) {
|
if (cacheAccesDefinitionOptional.isPresent()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user