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(String houseName, Owner owner,
30 String description, String district, int nRooms, int nKitchens,
31 int nBaths, int nLivings, int nParkings) {
33 boolean stored = false;
34 if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
36 HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
38 RuralHouse rh = new RuralHouse(houseName,
39 owner, description, district, feature);
40 owner.getRuralHouses().add(rh);
41 stored = this.dbMngr.storeRuralHouses(rh);
48 public void removeHouse(RuralHouse rh , Owner owner) {
49 Vector<RuralHouse> temp = owner.getRuralHouses();
51 this.dbMngr.removeHouse(rh, owner);
57 public Vector<RuralHouse> getHousesByDistrict(String town) {
59 return this.dbMngr.getRuralHousesByTown(town);
65 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
67 return dbMngr.getAllRuralHouses();
73 public RuralHouse getHouseByName(String Name) {
74 return this.dbMngr.getRuralHouseByName(Name);
81 // For future implementation
83 // public void modifyHouse(int houseName, Owner owner, String description,
84 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
86 // // TODO Auto-generated method stub
90 // Maybe returning the offer is not necessary. Depends on GUI