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,
|
||||
@RequestParam String cacheID,
|
||||
@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.setUserID(Integer.valueOf(userID));
|
||||
bearbeitet.setCacheID(Integer.valueOf(cacheID));
|
||||
bearbeitet.setCacheAccesDefinitionID(Integer.valueOf(cacheAccesDefinitionID));
|
||||
bearbeitet.setUser(user);
|
||||
bearbeitet.setCache(cache);
|
||||
bearbeitet.setCacheAccesDefinition(cacheAccesDefinition);
|
||||
|
||||
bearbeitetRepository.save(bearbeitet);
|
||||
|
||||
|
||||
@ -11,9 +11,14 @@ public class Bearbeitet {
|
||||
@GeneratedValue
|
||||
private int id;
|
||||
|
||||
private int userID;
|
||||
private int cacheID;
|
||||
private int cacheAccesDefinitionID;
|
||||
@OneToOne
|
||||
private User user;
|
||||
|
||||
@OneToOne
|
||||
private Cache cache;
|
||||
|
||||
@OneToOne
|
||||
private CacheAccesDefinition cacheAccesDefinition;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
@ -23,27 +28,27 @@ public class Bearbeitet {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getUserID() {
|
||||
return userID;
|
||||
public User getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUserID(int userID) {
|
||||
this.userID = userID;
|
||||
public void setUser(User user) {
|
||||
this.user = user;
|
||||
}
|
||||
|
||||
public int getCacheID() {
|
||||
return cacheID;
|
||||
public Cache getCache() {
|
||||
return cache;
|
||||
}
|
||||
|
||||
public void setCacheID(int cacheID) {
|
||||
this.cacheID = cacheID;
|
||||
public void setCache(Cache cache) {
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
public int getCacheAccesDefinitionID() {
|
||||
return cacheAccesDefinitionID;
|
||||
public CacheAccesDefinition getCacheAccesDefinition() {
|
||||
return cacheAccesDefinition;
|
||||
}
|
||||
|
||||
public void setCacheAccesDefinitionID(int cacheAccesDefinitionID) {
|
||||
this.cacheAccesDefinitionID = cacheAccesDefinitionID;
|
||||
public void setCacheAccesDefinition(CacheAccesDefinition cacheAccesDefinition) {
|
||||
this.cacheAccesDefinition = cacheAccesDefinition;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user