implemented lacking GUIs and corrected errors
[RRRRHHHH_Code] / ruralHouses / src / businessLogic / HouseManager.java
index 21b8925..82eedfc 100644 (file)
@@ -18,41 +18,31 @@ public class HouseManager implements HouseManagerInterface {
                try {
                        dbMngr = DB4oManager.getInstance();
                } catch (Exception e) {
                try {
                        dbMngr = DB4oManager.getInstance();
                } catch (Exception e) {
-                       // TODO Auto-generated catch block
+
                        e.printStackTrace();
                }
        }
 
                        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) {
 
        @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);
                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;
        }
 
                return stored;
        }
 
+       
+       
        public void removeHouse(int houseNumber) {
                this.dbMngr.removeHouse(houseNumber);
        }
        public void removeHouse(int houseNumber) {
                this.dbMngr.removeHouse(houseNumber);
        }