3 import java.rmi.RemoteException;
4 import java.util.Vector;
6 import dataAccess.DB4oManager;
7 import domain.HouseFeatures;
9 import domain.RuralHouse;
11 public class HouseManager implements HouseManagerInterface {
14 public HouseManager() {
16 dbMngr = DB4oManager.getInstance();
17 } catch (Exception e) {
26 public boolean registerNewHouse(String houseName, Owner owner,
27 String description, String district, int nRooms, int nKitchens,
28 int nBaths, int nLivings, int nParkings) {
30 boolean stored = false;
31 if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
33 HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
35 RuralHouse rh = new RuralHouse(houseName,
36 owner, description, district, feature);
37 owner.getRuralHouses().add(rh);
38 stored = this.dbMngr.storeRuralHouses(rh);
44 public boolean registerNewHouse(RuralHouse rh) {
46 boolean stored = false;
48 rh.getOwner().getRuralHouses().add(rh);
49 stored = this.dbMngr.storeRuralHouses(rh);
54 public void removeHouse(RuralHouse rh , Owner owner) {
55 Vector<RuralHouse> temp = owner.getRuralHouses();
57 this.dbMngr.removeHouse(rh, owner);
63 public Vector<RuralHouse> getHousesByDistrict(String town) {
65 return this.dbMngr.getRuralHousesByTown(town);
68 public Vector<RuralHouse> getHouses(String town,int nBed , int nKit, int nBath, int nPark, int nLiv) {
70 return this.dbMngr.getRuralHouses(town, nBed, nKit, nBath, nPark, nLiv);
76 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
78 return dbMngr.getAllRuralHouses();
84 public RuralHouse getHouseByName(String Name) {
85 return this.dbMngr.getRuralHouseByName(Name);
92 // For future implementation
94 // public void modifyHouse(int houseName, Owner owner, String description,
95 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
97 // // TODO Auto-generated method stub
101 // Maybe returning the offer is not necessary. Depends on GUI