X-Git-Url: https://xp-dev.com/git/RRRRHHHH_Code/blobdiff_plain/5538790d8fc54f60de9b5c989eae82b446374aca..a927255f6eb55fb1f52738b9b88ce51f9b0ed9bc:/ruralHouses/src/businessLogic/HouseManager.java diff --git a/ruralHouses/src/businessLogic/HouseManager.java b/ruralHouses/src/businessLogic/HouseManager.java index 21b8925..82eedfc 100644 --- a/ruralHouses/src/businessLogic/HouseManager.java +++ b/ruralHouses/src/businessLogic/HouseManager.java @@ -18,41 +18,31 @@ public class HouseManager implements HouseManagerInterface { try { dbMngr = DB4oManager.getInstance(); } catch (Exception e) { - // TODO Auto-generated catch block + e.printStackTrace(); } } - @Override - public boolean registerNewHouse(int houseNumber, Owner owner, String town, - int nRooms, int nKitchens, int nBaths, int nLivings, int nParkings) { - // TODO Auto-generated method stub - boolean stored = false; - if (nKitchens < 1 || nLivings < 3 || nBaths < 2) - return false; - HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths, - nLivings, nParkings); - stored = this.dbMngr.storeRuralHouses(new RuralHouse(houseNumber, - owner, town, feature)); - return stored; - } @Override public boolean registerNewHouse(int houseNumber, Owner owner, String description, String town, int nRooms, int nKitchens, int nBaths, int nLivings, int nParkings) { - // TODO Auto-generated method stub boolean stored = false; if (nKitchens < 1 || nLivings < 3 || nBaths < 2) return false; HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths, nLivings, nParkings); - stored = this.dbMngr.storeRuralHouses(new RuralHouse(houseNumber, - owner, description, town, feature)); + RuralHouse rh = new RuralHouse(houseNumber, + owner, description, town, feature); + owner.getRuralHouses().add(rh); + stored = this.dbMngr.storeRuralHouses(rh); return stored; } + + public void removeHouse(int houseNumber) { this.dbMngr.removeHouse(houseNumber); }