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 boolean registerNewHouse(RuralHouse rh) {
49 boolean stored = false;
51 rh.getOwner().getRuralHouses().add(rh);
52 stored = this.dbMngr.storeRuralHouses(rh);
57 public void removeHouse(RuralHouse rh , Owner owner) {
58 Vector<RuralHouse> temp = owner.getRuralHouses();
60 this.dbMngr.removeHouse(rh, owner);
66 public Vector<RuralHouse> getHousesByDistrict(String town) {
68 return this.dbMngr.getRuralHousesByTown(town);
71 public Vector<RuralHouse> getHouses(String town,int nBed , int nKit, int nBath, int nPark, int nLiv) {
73 return this.dbMngr.getRuralHouses(town, nBed, nKit, nBath, nPark, nLiv);
79 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
81 return dbMngr.getAllRuralHouses();
87 public RuralHouse getHouseByName(String Name) {
88 return this.dbMngr.getRuralHouseByName(Name);
95 // For future implementation
97 // public void modifyHouse(int houseName, Owner owner, String description,
98 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
100 // // TODO Auto-generated method stub
104 // Maybe returning the offer is not necessary. Depends on GUI