Merge branch 'develop' into frontend/timo
This commit is contained in:
commit
3527b681be
@ -74,7 +74,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)
|
||||
|
||||
@ -96,6 +97,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()) {
|
||||
|
||||
@ -20,6 +20,9 @@ public class Bearbeitet {
|
||||
@OneToOne
|
||||
private CacheAccesDefinition cacheAccesDefinition;
|
||||
|
||||
@OneToOne
|
||||
private Station aktuelleStation;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
@ -51,4 +54,12 @@ public class Bearbeitet {
|
||||
public void setCacheAccesDefinition(CacheAccesDefinition cacheAccesDefinition) {
|
||||
this.cacheAccesDefinition = cacheAccesDefinition;
|
||||
}
|
||||
|
||||
public Station getAktuelleStation() {
|
||||
return aktuelleStation;
|
||||
}
|
||||
|
||||
public void setAktuelleStation(Station aktuelleStation) {
|
||||
this.aktuelleStation = aktuelleStation;
|
||||
}
|
||||
}
|
||||
@ -14,6 +14,7 @@ public class Station {
|
||||
private String description;
|
||||
private double longitude;
|
||||
private double lattitude;
|
||||
private int code;
|
||||
|
||||
public Station() {
|
||||
}
|
||||
@ -50,4 +51,11 @@ public class Station {
|
||||
this.lattitude = lattitude;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,53 @@
|
||||
package hhn.labsw.bugageocaching.entities;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table
|
||||
public class StationReihenfolge {
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
|
||||
@OneToOne
|
||||
private Cache cache;
|
||||
|
||||
@OneToOne
|
||||
private Station station;
|
||||
|
||||
@OneToOne
|
||||
private Station nachfolgeStation;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Cache getCache() {
|
||||
return cache;
|
||||
}
|
||||
|
||||
public void setCache(Cache cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
public Station getStation() {
|
||||
return station;
|
||||
}
|
||||
|
||||
public void setStation(Station station) {
|
||||
this.station = station;
|
||||
}
|
||||
|
||||
public Station getNachfolgeStation() {
|
||||
return nachfolgeStation;
|
||||
}
|
||||
|
||||
public void setNachfolgeStation(Station nachfolgeStation) {
|
||||
this.nachfolgeStation = nachfolgeStation;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package hhn.labsw.bugageocaching.repositories;
|
||||
|
||||
import hhn.labsw.bugageocaching.entities.StationReihenfolge;
|
||||
import org.springframework.data.repository.CrudRepository;
|
||||
|
||||
public interface StationReihenfolgeRepository extends CrudRepository<StationReihenfolge, Integer> {
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user