From e86aa6adc2dcac9d52612a8e78b64b104b84ecf8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 7 Apr 2019 14:06:41 +0200 Subject: [PATCH] removed stationReihenfolge database table, because its not needed --- .../bugageocaching/controller/Controller.java | 17 ------ .../entities/StationReihenfolge.java | 53 ------------------- .../StationReihenfolgeRepository.java | 7 --- 3 files changed, 77 deletions(-) delete mode 100644 src/main/java/hhn/labsw/bugageocaching/entities/StationReihenfolge.java delete mode 100644 src/main/java/hhn/labsw/bugageocaching/repositories/StationReihenfolgeRepository.java diff --git a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java index a0d9afc..6499b71 100644 --- a/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java +++ b/src/main/java/hhn/labsw/bugageocaching/controller/Controller.java @@ -40,9 +40,6 @@ public class Controller { @Autowired UserRepository userRepository; - @Autowired - StationReihenfolgeRepository stationReihenfolgeRepository; - private AtomicLong counter = new AtomicLong(); @CrossOrigin(origins = "http://localhost:8081") // only for dev purpose @@ -177,14 +174,6 @@ public class Controller { cacheRepository.save(cache); - for (int i = 0; i + 1 < cache.getStationen().size(); i++) { - StationReihenfolge stationReihenfolge = new StationReihenfolge(); - stationReihenfolge.setCache(cache); - stationReihenfolge.setStation(cache.getStationen().get(i)); - stationReihenfolge.setNachfolgeStation(cache.getStationen().get(i + 1)); - stationReihenfolgeRepository.save(stationReihenfolge); - } - return ResponseEntity.status(200).body(new Gson().toJson(cache)); } @@ -270,12 +259,6 @@ public class Controller { Cache cache = optionalCache.get(); - for (StationReihenfolge stationReihenfolge : stationReihenfolgeRepository.findAll()) { - if (stationReihenfolge.getCache().getId() == cache.getId()) { - stationReihenfolgeRepository.delete(stationReihenfolge); - } - } - for (Bearbeitet bearbeitet : bearbeitetRepository.findAll()) { if (bearbeitet.getCache().getId() == cache.getId()) { bearbeitetRepository.delete(bearbeitet); diff --git a/src/main/java/hhn/labsw/bugageocaching/entities/StationReihenfolge.java b/src/main/java/hhn/labsw/bugageocaching/entities/StationReihenfolge.java deleted file mode 100644 index b51ef51..0000000 --- a/src/main/java/hhn/labsw/bugageocaching/entities/StationReihenfolge.java +++ /dev/null @@ -1,53 +0,0 @@ -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; - } -} diff --git a/src/main/java/hhn/labsw/bugageocaching/repositories/StationReihenfolgeRepository.java b/src/main/java/hhn/labsw/bugageocaching/repositories/StationReihenfolgeRepository.java deleted file mode 100644 index 8897965..0000000 --- a/src/main/java/hhn/labsw/bugageocaching/repositories/StationReihenfolgeRepository.java +++ /dev/null @@ -1,7 +0,0 @@ -package hhn.labsw.bugageocaching.repositories; - -import hhn.labsw.bugageocaching.entities.StationReihenfolge; -import org.springframework.data.repository.CrudRepository; - -public interface StationReihenfolgeRepository extends CrudRepository { -}