3 import java.rmi.RemoteException;
5 import java.util.Vector;
7 import dataAccess.DB4oManager;
9 import domain.HouseFeatures;
12 import domain.RuralHouse;
14 public class HouseManager implements HouseManagerInterface {
17 public HouseManager() {
19 dbMngr = DB4oManager.getInstance();
20 } catch (Exception e) {
29 public boolean registerNewHouse(int houseNumber, Owner owner,
30 String description, String town, int nRooms, int nKitchens,
31 int nBaths, int nLivings, int nParkings) {
32 boolean stored = false;
33 if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
35 HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
37 RuralHouse rh = new RuralHouse(houseNumber,
38 owner, description, town, feature);
39 owner.getRuralHouses().add(rh);
40 stored = this.dbMngr.storeRuralHouses(rh);
46 public void removeHouse(int houseNumber) {
47 this.dbMngr.removeHouse(houseNumber);
53 public Vector<RuralHouse> getHousesByTown(String town) {
55 return this.dbMngr.getRuralHousesByTown(town);
61 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
63 // TODO Auto-generated method stub
64 return dbMngr.getAllRuralHouses();
67 // For future implementation
69 // public void modifyHouse(int houseNumber, Owner owner, String description,
70 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
72 // // TODO Auto-generated method stub
76 // Maybe returning the offer is not necessary. Depends on GUI