bearbeitet uses objects foreign keys now
This commit is contained in:
parent
99f8a26c9f
commit
033682ada1
@ -43,10 +43,21 @@ public class Controller {
|
|||||||
Bearbeitet startCache(@RequestParam String userID,
|
Bearbeitet startCache(@RequestParam String userID,
|
||||||
@RequestParam String cacheID,
|
@RequestParam String cacheID,
|
||||||
@RequestParam String cacheAccesDefinitionID) {
|
@RequestParam String cacheAccesDefinitionID) {
|
||||||
|
|
||||||
|
Optional<User> userOptional = userRepository.findById(Integer.valueOf(userID));
|
||||||
|
User user = userOptional.get();
|
||||||
|
|
||||||
|
Optional<Cache> cacheOptional = cacheRepository.findById(Integer.valueOf(cacheID));
|
||||||
|
Cache cache = cacheOptional.get();
|
||||||
|
|
||||||
|
Optional<CacheAccesDefinition> cacheAccesDefinitionOptional =
|
||||||
|
cacheAccesDefinitionRepository.findById(Integer.valueOf(cacheAccesDefinitionID));
|
||||||
|
CacheAccesDefinition cacheAccesDefinition = cacheAccesDefinitionOptional.get();
|
||||||
|
|
||||||
Bearbeitet bearbeitet = new Bearbeitet();
|
Bearbeitet bearbeitet = new Bearbeitet();
|
||||||
bearbeitet.setUserID(Integer.valueOf(userID));
|
bearbeitet.setUser(user);
|
||||||
bearbeitet.setCacheID(Integer.valueOf(cacheID));
|
bearbeitet.setCache(cache);
|
||||||
bearbeitet.setCacheAccesDefinitionID(Integer.valueOf(cacheAccesDefinitionID));
|
bearbeitet.setCacheAccesDefinition(cacheAccesDefinition);
|
||||||
|
|
||||||
bearbeitetRepository.save(bearbeitet);
|
bearbeitetRepository.save(bearbeitet);
|
||||||
|
|
||||||
|
|||||||
@ -11,9 +11,14 @@ public class Bearbeitet {
|
|||||||
@GeneratedValue
|
@GeneratedValue
|
||||||
private int id;
|
private int id;
|
||||||
|
|
||||||
private int userID;
|
@OneToOne
|
||||||
private int cacheID;
|
private User user;
|
||||||
private int cacheAccesDefinitionID;
|
|
||||||
|
@OneToOne
|
||||||
|
private Cache cache;
|
||||||
|
|
||||||
|
@OneToOne
|
||||||
|
private CacheAccesDefinition cacheAccesDefinition;
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
@ -23,27 +28,27 @@ public class Bearbeitet {
|
|||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUserID() {
|
public User getUser() {
|
||||||
return userID;
|
return user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUserID(int userID) {
|
public void setUser(User user) {
|
||||||
this.userID = userID;
|
this.user = user;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCacheID() {
|
public Cache getCache() {
|
||||||
return cacheID;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCacheID(int cacheID) {
|
public void setCache(Cache cache) {
|
||||||
this.cacheID = cacheID;
|
this.cache = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCacheAccesDefinitionID() {
|
public CacheAccesDefinition getCacheAccesDefinition() {
|
||||||
return cacheAccesDefinitionID;
|
return cacheAccesDefinition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setCacheAccesDefinitionID(int cacheAccesDefinitionID) {
|
public void setCacheAccesDefinition(CacheAccesDefinition cacheAccesDefinition) {
|
||||||
this.cacheAccesDefinitionID = cacheAccesDefinitionID;
|
this.cacheAccesDefinition = cacheAccesDefinition;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user