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);
47 public void removeHouse(String houseName, Owner owner) {
48 Vector<RuralHouse> temp = owner.getRuralHouses();
49 temp.remove(temp.size() -1);
50 this.dbMngr.removeHouse(houseName, owner);
56 public Vector<RuralHouse> getHousesByDistrict(String town) {
58 return this.dbMngr.getRuralHousesByTown(town);
64 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
66 return dbMngr.getAllRuralHouses();
72 public RuralHouse getHouseByName(String Name) {
73 return this.dbMngr.getRuralHouseByName(Name);
76 // For future implementation
78 // public void modifyHouse(int houseName, Owner owner, String description,
79 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
81 // // TODO Auto-generated method stub
85 // Maybe returning the offer is not necessary. Depends on GUI