Merge branch 'develop' of https://bitbucket-student.it.hs-heilbronn.de/scm/labswp19/labswp_2019_sose_geocaching into develop
This commit is contained in:
commit
efa5e5b954
@ -72,7 +72,8 @@ module.exports = function (ctx) {
|
|||||||
'QPopupEdit',
|
'QPopupEdit',
|
||||||
'QSlideTransition',
|
'QSlideTransition',
|
||||||
'QToggle',
|
'QToggle',
|
||||||
'QLinearProgress'
|
'QLinearProgress',
|
||||||
|
'QBtnGroup'
|
||||||
],
|
],
|
||||||
|
|
||||||
directives: [
|
directives: [
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<!-- <div :is="stationComponent" @q-tb="scrollToBottomState" :stationObject="tempStation">STATION</div>-->
|
|
||||||
<!-- <div v-show="!stationComponent">-->
|
|
||||||
<form>
|
<form>
|
||||||
<div class="q-pa-md q-gutter-y-md">
|
<div class="q-pa-md q-gutter-y-md">
|
||||||
<p class="text-h5">{{ isNewCache ? "Neuen Cache erstellen" : "Cache bearbeiten"}}</p>
|
<p class="text-h5">{{ isNewCache ? "Neuen Cache erstellen" : "Cache bearbeiten"}}</p>
|
||||||
@ -94,40 +92,56 @@
|
|||||||
</q-item>
|
</q-item>
|
||||||
</q-card>
|
</q-card>
|
||||||
<div class="row q-mt-xl">
|
<div class="row q-mt-xl">
|
||||||
<q-btn @click="saveCache" class="full-width" color="primary" unelevated stack label="Cache speichern"
|
<q-btn @click="saveCache" class="full-width q-mb-md" color="primary" unelevated stack label="Cache speichern"
|
||||||
icon="save_alt"/>
|
icon="save_alt"/>
|
||||||
|
<q-btn to="/overview" class="full-width" color="negative" unelevated stack label="Abbrechen" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<!-- </div>-->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// import station from './StationEdit'
|
|
||||||
import {mapGetters} from 'vuex';
|
import {mapGetters} from 'vuex';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Cache",
|
name: "Cache",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
// stations: [],
|
|
||||||
// endStation: {},
|
|
||||||
//endStation: {},
|
|
||||||
scrolldown: false,
|
scrolldown: false,
|
||||||
isNewCache: this.$route.params.id === undefined,
|
isNewCache: this.$route.params.id === undefined,
|
||||||
tempCache: {},
|
//tempCache: {},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// components: {
|
beforeRouteUpdate(to, from, next) {
|
||||||
// station
|
console.log("beforeRouteUpdate: reset data and fetch");
|
||||||
// },
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
|
next()
|
||||||
|
},
|
||||||
|
|
||||||
beforeCreate: function () {
|
beforeCreate: function () {
|
||||||
},
|
},
|
||||||
created: function () {
|
created: function () {
|
||||||
console.log("isNewCache: " + this.isNewCache);
|
console.log("isNewCache: " + this.isNewCache);
|
||||||
console.log("fetch Caches from Store");
|
console.log("Route Params: " + this.$route.params.id);
|
||||||
//this.tempCache = JSON.parse(JSON.stringify(this.cache));
|
if (!this.isNewCache) {
|
||||||
|
this.$axios.get('/api/allCaches')
|
||||||
|
.then((response) => {
|
||||||
|
console.log("/api/allCaches");
|
||||||
|
//console.log(JSON.stringify(response.data));
|
||||||
|
console.log(response.data);
|
||||||
|
let cache = response.data.find(cache => Number(cache.id) === Number(this.$route.params.id));
|
||||||
|
console.log(cache);
|
||||||
|
let stations = cache.stationen.filter(station => station.description !== "Endstation");
|
||||||
|
let endstation = cache.stationen.find(station => station.description === "Endstation");
|
||||||
|
console.log(stations);
|
||||||
|
console.log(endstation);
|
||||||
|
this.$store.commit('cacheCollector/SET_CACHE', cache);
|
||||||
|
this.$store.commit('cacheCollector/SET_STATIONS', stations);
|
||||||
|
this.$store.commit('cacheCollector/SET_ENDSTATION', endstation);
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
beforeMount: function () {
|
beforeMount: function () {
|
||||||
},
|
},
|
||||||
@ -146,37 +160,12 @@
|
|||||||
methods: {
|
methods: {
|
||||||
editEndStation() {
|
editEndStation() {
|
||||||
console.log("editEndStation()");
|
console.log("editEndStation()");
|
||||||
const station = this.endStation;
|
const station = this.$store.getters['cacheCollector/GET_ENDSTATION'];
|
||||||
console.log(station);
|
console.log(station);
|
||||||
if (station.hasOwnProperty('id')) {
|
this.$store.commit('cacheCollector/SET_TEMPSTATION', station);
|
||||||
//this.$router.push({ path: '/station/'+station.id});
|
this.$router.push({path: `/tempendstation/`}); // add parameter
|
||||||
} else {
|
|
||||||
// TODO Stationen bearbeitbar machen bevor sie abgeschickt werden. Am besten Station Objekt als Übergabe Parameter bei Router
|
|
||||||
this.$store.commit('cacheCollector/SET_TEMPSTATION', station);
|
|
||||||
//this.$router.push({path: `/tempendstation/${index}`}); // add parameter
|
|
||||||
this.$router.push({path: `/tempendstation/`}); // add parameter
|
|
||||||
}
|
|
||||||
|
|
||||||
},
|
},
|
||||||
// getStations() {
|
|
||||||
// console.log("get Stations");
|
|
||||||
// let stations = this.computedStations.get();
|
|
||||||
// this.stations = stations.filter(station => station.description !== "Endstation");
|
|
||||||
// console.log(this.stations);
|
|
||||||
// this.endStation = stations.filter(station => station.description === "Endstation");
|
|
||||||
// console.log(this.endStation);
|
|
||||||
// },
|
|
||||||
// setStations() {
|
|
||||||
// let stations = this.stations;
|
|
||||||
// stations.push(this.endStation);
|
|
||||||
// this.computedStations.set(stations);
|
|
||||||
// },
|
|
||||||
// cacheToStore() {
|
|
||||||
// // push tempCache to Store
|
|
||||||
// console.log("set Cache");
|
|
||||||
// this.$store.commit('cacheCollector/SET_CACHE', JSON.parse(JSON.stringify(this.tempCache)));
|
|
||||||
// // this.SET_CACHE(JSON.parse(JSON.stringify(this.tempCache)));
|
|
||||||
// },
|
|
||||||
addStation() {
|
addStation() {
|
||||||
this.$router.push({path: '/station'});
|
this.$router.push({path: '/station'});
|
||||||
},
|
},
|
||||||
@ -199,10 +188,10 @@
|
|||||||
},
|
},
|
||||||
saveCache() {
|
saveCache() {
|
||||||
// commit to store, send to api, if success -> reset store
|
// commit to store, send to api, if success -> reset store
|
||||||
|
let cache = JSON.parse(JSON.stringify(this.computedCache));
|
||||||
|
console.log(cache);
|
||||||
|
cache.stationen.push(this.computedEndstation);
|
||||||
if (this.isNewCache) {
|
if (this.isNewCache) {
|
||||||
let cache = JSON.parse(JSON.stringify(this.computedCache));
|
|
||||||
console.log(cache);
|
|
||||||
cache.stationen.push(this.computedEndstation);
|
|
||||||
|
|
||||||
this.$axios.post('/api/createCache', cache)
|
this.$axios.post('/api/createCache', cache)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
@ -210,7 +199,7 @@
|
|||||||
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
this.$router.push({path: '/overview'});
|
this.$router.push({path: '/overview'});
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
//TODO: Fehlermeldungen
|
//TODO: Fehlermeldungen
|
||||||
// Error
|
// Error
|
||||||
let msg;
|
let msg;
|
||||||
let title;
|
let title;
|
||||||
@ -233,26 +222,16 @@
|
|||||||
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
this.$store.commit('dialog/NEW_MESSAGE_DIALOG', {message: msg, title: title,});
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// TODO update existing Cache
|
this.$axios.put('/api/editCache', cache)
|
||||||
|
.then((response) => {
|
||||||
|
console.log("POST api/editCache: " + response.statusText);
|
||||||
|
this.$store.commit('cacheCollector/RESET_NEW_CACHE');
|
||||||
|
this.$router.push({path: '/overview'});
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters({
|
|
||||||
//cache: 'cacheCollector/GET_CACHE',
|
|
||||||
//endStation: 'cacheCollector/GET_ENDSTATION'
|
|
||||||
}),
|
|
||||||
// computedStations: {
|
|
||||||
// set(value) {
|
|
||||||
// console.log("set stations");
|
|
||||||
// this.computedCache.set(value);
|
|
||||||
// },
|
|
||||||
// get() {
|
|
||||||
// console.log("get stations");
|
|
||||||
// let stations = this.computedCache.stationen;
|
|
||||||
// return stations.filter(station => station.description !== "Endstation");
|
|
||||||
// }
|
|
||||||
// },
|
|
||||||
computedCache: {
|
computedCache: {
|
||||||
set(value) {
|
set(value) {
|
||||||
console.log("set cache");
|
console.log("set cache");
|
||||||
|
|||||||
@ -120,10 +120,14 @@
|
|||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
console.log("created(): " + this.caches);
|
console.log("created(): " + this.caches);
|
||||||
await this.fetchAllCaches();
|
this.loadData();
|
||||||
this.render = await this.fetchMyCaches();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
async loadData() {
|
||||||
|
this.render = false;
|
||||||
|
await this.fetchAllCaches();
|
||||||
|
this.render = await this.fetchMyCaches();
|
||||||
|
},
|
||||||
getColorClass(cache) {
|
getColorClass(cache) {
|
||||||
switch (this.getCacheAccesDefinition(cache)) {
|
switch (this.getCacheAccesDefinition(cache)) {
|
||||||
case -1:
|
case -1:
|
||||||
@ -232,6 +236,7 @@
|
|||||||
this.$router.push({path: `/cache`})
|
this.$router.push({path: `/cache`})
|
||||||
},
|
},
|
||||||
editCache(cacheID) {
|
editCache(cacheID) {
|
||||||
|
this.$router.push({path: `/cache/${cacheID}`})
|
||||||
},
|
},
|
||||||
initMap() {
|
initMap() {
|
||||||
console.log("Signalwort: " + this.pois);
|
console.log("Signalwort: " + this.pois);
|
||||||
@ -249,9 +254,9 @@
|
|||||||
},
|
},
|
||||||
deleteCache(id) {
|
deleteCache(id) {
|
||||||
console.log('delete cache: ' + id);
|
console.log('delete cache: ' + id);
|
||||||
axios.get('/api/deleteCache', {params: {cacheID: id}})
|
this.$axios.delete('/api/deleteCache', {params: {cacheID: id}})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
this.fetchAllCaches()
|
this.loadData();
|
||||||
}).catch((error) => {
|
}).catch((error) => {
|
||||||
let message;
|
let message;
|
||||||
let header = "Fehler: ";
|
let header = "Fehler: ";
|
||||||
|
|||||||
@ -70,7 +70,7 @@ export default function ({store}/* { store, ssrContext } */) {
|
|||||||
console.log(error.response.headers);
|
console.log(error.response.headers);
|
||||||
//store.commit('auth/SET_LOGOUT');
|
//store.commit('auth/SET_LOGOUT');
|
||||||
store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
store.commit('dialog/NEW_MESSAGE_DIALOG', {
|
||||||
message: "Ihr Token ist nicht mehr gültig. Bitte loggen Sie sich erneut ein.",
|
message: "Ihre Session ist abgelaufen. Bitte loggen Sie sich erneut ein.",
|
||||||
title: "Bitte erneut anmelden.",
|
title: "Bitte erneut anmelden.",
|
||||||
color: "blue",
|
color: "blue",
|
||||||
});
|
});
|
||||||
|
|||||||
@ -42,8 +42,8 @@ export const RESET_NEW_CACHE = (state) => {
|
|||||||
};
|
};
|
||||||
state.endStation = {
|
state.endStation = {
|
||||||
description: "Endstation",
|
description: "Endstation",
|
||||||
longitude: 9.206628,
|
longitude: 0.000,
|
||||||
lattitude: 49.147734,
|
lattitude: 0.000,
|
||||||
solution: "",
|
solution: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -11,8 +11,8 @@ export default {
|
|||||||
tempStation: {},
|
tempStation: {},
|
||||||
endStation: {
|
endStation: {
|
||||||
description: "Endstation",
|
description: "Endstation",
|
||||||
longitude: 9.206628,
|
longitude: 0.000,
|
||||||
lattitude: 49.147734,
|
lattitude: 0.000,
|
||||||
solution: "",
|
solution: "",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import hhn.labsw.bugageocaching.helper.POI;
|
|||||||
import hhn.labsw.bugageocaching.helper.RankingListHelper;
|
import hhn.labsw.bugageocaching.helper.RankingListHelper;
|
||||||
import hhn.labsw.bugageocaching.helper.TeamRankingListHelper;
|
import hhn.labsw.bugageocaching.helper.TeamRankingListHelper;
|
||||||
import hhn.labsw.bugageocaching.repositories.*;
|
import hhn.labsw.bugageocaching.repositories.*;
|
||||||
|
import hhn.labsw.bugageocaching.util.CacheConstructionUtil;
|
||||||
import hhn.labsw.bugageocaching.util.FinderUtil;
|
import hhn.labsw.bugageocaching.util.FinderUtil;
|
||||||
import hhn.labsw.bugageocaching.util.VerificationUtil;
|
import hhn.labsw.bugageocaching.util.VerificationUtil;
|
||||||
import io.jsonwebtoken.Claims;
|
import io.jsonwebtoken.Claims;
|
||||||
@ -25,6 +26,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static hhn.labsw.bugageocaching.util.CacheConstructionUtil.createCacheUtil;
|
import static hhn.labsw.bugageocaching.util.CacheConstructionUtil.createCacheUtil;
|
||||||
import static hhn.labsw.bugageocaching.util.CacheConstructionUtil.deleteCacheUtil;
|
import static hhn.labsw.bugageocaching.util.CacheConstructionUtil.deleteCacheUtil;
|
||||||
|
import static hhn.labsw.bugageocaching.util.CacheConstructionUtil.editCacheUtil;
|
||||||
import static hhn.labsw.bugageocaching.util.VerificationUtil.fetchPublicKey;
|
import static hhn.labsw.bugageocaching.util.VerificationUtil.fetchPublicKey;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@ -339,26 +341,7 @@ public class Controller {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public ResponseEntity editCache(@RequestBody Cache newCache) {
|
public ResponseEntity editCache(@RequestBody Cache newCache) {
|
||||||
|
|
||||||
//----------------------
|
return editCacheUtil(newCache);
|
||||||
//Get Cache
|
|
||||||
ResponseEntity getCache = FinderUtil.findCacheById(newCache.getId() + "");
|
|
||||||
|
|
||||||
if (getCache.getStatusCodeValue() != 200) {
|
|
||||||
return getCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
Cache oldCache = (Cache) getCache.getBody();
|
|
||||||
//----------------------
|
|
||||||
|
|
||||||
oldCache.setDescription(newCache.getDescription());
|
|
||||||
oldCache.setName(newCache.getName());
|
|
||||||
oldCache.setRankingPoints(newCache.getRankingPoints());
|
|
||||||
oldCache.setReward(newCache.getReward());
|
|
||||||
oldCache.setStationen(newCache.getStationen());
|
|
||||||
|
|
||||||
cacheRepository.save(oldCache);
|
|
||||||
|
|
||||||
return ResponseEntity.status(200).body("Cache edited");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "Checks if the given User has an admin role")
|
@ApiOperation(value = "Checks if the given User has an admin role")
|
||||||
|
|||||||
@ -8,11 +8,13 @@ import hhn.labsw.bugageocaching.repositories.BearbeitetRepository;
|
|||||||
import hhn.labsw.bugageocaching.repositories.CacheRepository;
|
import hhn.labsw.bugageocaching.repositories.CacheRepository;
|
||||||
import hhn.labsw.bugageocaching.repositories.StationRepository;
|
import hhn.labsw.bugageocaching.repositories.StationRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.persistence.RollbackException;
|
import javax.persistence.RollbackException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
@ -120,6 +122,103 @@ public class CacheConstructionUtil {
|
|||||||
return ResponseEntity.status(200).body(new Gson().toJson(station));
|
return ResponseEntity.status(200).body(new Gson().toJson(station));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ResponseEntity editCacheUtil(Cache cache) {
|
||||||
|
Optional<Cache> oldCacheOptional = cacheRepository.findById(cache.getId());
|
||||||
|
Cache oldCache;
|
||||||
|
// List<Station> oldStationen;
|
||||||
|
if (oldCacheOptional.isPresent()) {
|
||||||
|
oldCache = oldCacheOptional.get();
|
||||||
|
// oldStationen = new ArrayList<>(oldCache.getStationen());
|
||||||
|
} else {
|
||||||
|
return ResponseEntity.status(404).body("There isnt a cache with the id " + cache.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
ResponseEntity response = new ResponseEntity(HttpStatus.ACCEPTED);
|
||||||
|
List<Station> newCreatedStationList = new ArrayList<Station>();
|
||||||
|
for (Station station : cache.getStationen()) {
|
||||||
|
boolean stationIsNew = true;
|
||||||
|
for (Station oldStation : oldCache.getStationen()) {
|
||||||
|
// wenn Station schon vorher vorhanden war, wird diese mit den neuen Daten geupdatet
|
||||||
|
if (oldStation.getId() == station.getId()) {
|
||||||
|
response = createStationUtil(station);
|
||||||
|
stationIsNew = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// wenn Station neu hinzugefügt wurde, wird die Station zusätzlich in die Datenbank gespeichert
|
||||||
|
if (stationIsNew) {
|
||||||
|
response = createStationUtil(station);
|
||||||
|
if (response.getStatusCodeValue() == 200) {
|
||||||
|
newCreatedStationList.add(station);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (response.getStatusCodeValue() == 400) {
|
||||||
|
// neu erzeugte Stationen werden gelöscht, falls es einen Fehler gibt
|
||||||
|
// alle veränderten Stationen werden resettet
|
||||||
|
// for (Station oldStation : oldStationen) {
|
||||||
|
// stationRepository.save(oldStation);
|
||||||
|
// }
|
||||||
|
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// überprüft den Cache nach validen Daten
|
||||||
|
if (cache.getDescription().length() == 0 || cache.getName().length() == 0 || cache.getRankingPoints() == 0.0) {
|
||||||
|
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||||
|
return ResponseEntity.status(400).body("cache fields can´t be empty");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache.getStationen().size() < 2) {
|
||||||
|
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||||
|
return ResponseEntity.status(400).body("a cache needs atleast 2 stations");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Cache cache1 : cacheRepository.findAll()) {
|
||||||
|
if (cache1.getName().equals(cache.getName())) {
|
||||||
|
if (cache1.getId() != oldCache.getId()) {
|
||||||
|
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||||
|
return ResponseEntity.status(400).body("name is already taken");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cache.getRankingPoints() < 0) {
|
||||||
|
deleteNewCreatedStationsUtil(newCreatedStationList);
|
||||||
|
return ResponseEntity.status(400).body("Ranking points has to be a positive number");
|
||||||
|
}
|
||||||
|
|
||||||
|
cacheRepository.save(cache);
|
||||||
|
|
||||||
|
// nicht gebrauchte Stationen müssen noch aus der DB gelöscht werden
|
||||||
|
// for (Station oldStation : oldCache.getStationen()) {
|
||||||
|
// // wenn Station entfernt wurde, wird diese auch aus der Datenbank gelöscht
|
||||||
|
// if (!cache.getStationen().contains(station)) {
|
||||||
|
// stationRepository.delete(station);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
return ResponseEntity.status(200).body(new Gson().toJson(cache));
|
||||||
|
}
|
||||||
|
|
||||||
|
// public static ResponseEntity checkStationUtil(Station station) {
|
||||||
|
// if (station.getDescription().length() == 0 || station.getLattitude() == 0.0 || station.getLongitude() == 0.0 /*|| station.getSolution().length() == 0*/) {
|
||||||
|
// return ResponseEntity.status(400).body("station fields can´t be empty");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (station.getLattitude() < 9 || station.getLattitude() > 10) {
|
||||||
|
// return ResponseEntity.status(400).body("Lattitude has to be between 9 and 10 degrees");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (station.getLongitude() < 49 || station.getLongitude() > 50) {
|
||||||
|
// return ResponseEntity.status(400).body("Longitude has to be in the range of 49 to 50 degrees");
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// return ResponseEntity.status(200).body(new Gson().toJson(station));
|
||||||
|
// }
|
||||||
|
|
||||||
public static void deleteStationenUtil(Cache cache) {
|
public static void deleteStationenUtil(Cache cache) {
|
||||||
for (Station station : cache.getStationen()) {
|
for (Station station : cache.getStationen()) {
|
||||||
try {
|
try {
|
||||||
@ -130,6 +229,16 @@ public class CacheConstructionUtil {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void deleteNewCreatedStationsUtil(List<Station> newCreatedStationList) {
|
||||||
|
for (Station station : newCreatedStationList) {
|
||||||
|
try {
|
||||||
|
stationRepository.delete(station);
|
||||||
|
} catch (IllegalArgumentException e) { // station is null
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static ResponseEntity deleteCacheUtil(String cacheID) {
|
public static ResponseEntity deleteCacheUtil(String cacheID) {
|
||||||
Optional<Cache> optionalCache = cacheRepository.findById(Integer.valueOf(cacheID));
|
Optional<Cache> optionalCache = cacheRepository.findById(Integer.valueOf(cacheID));
|
||||||
if (!optionalCache.isPresent()) {
|
if (!optionalCache.isPresent()) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user