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) {
24 private boolean suitsRegulations(int nKitchens, int nBaths, int nLivings) {
25 if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
32 public boolean registerNewHouse(RuralHouse rh) {
34 boolean stored = false;
35 if (!suitsRegulations(rh.getFeatures().getnKitchens(), rh.getFeatures()
36 .getnBaths(), rh.getFeatures().getnKitchens()))
38 rh.getOwner().getRuralHouses().add(rh);
39 stored = this.dbMngr.storeRuralHouses(rh);
43 public void removeHouse(RuralHouse rh, Owner owner) {
44 Vector<RuralHouse> temp = owner.getRuralHouses();
46 this.dbMngr.removeHouse(rh, owner);
51 public Vector<RuralHouse> getHouses(String name,String town, int nBed, int nKit,
52 int nBath, int nPark, int nLiv) {
54 return this.dbMngr.getRuralHouses(name ,town, nBed, nKit, nBath, nPark, nLiv);
58 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
60 return dbMngr.getAllRuralHouses();
65 // For future implementation
67 // public void modifyHouse(int houseName, Owner owner, String description,
68 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
70 // // TODO Auto-generated method stub
74 // Maybe returning the offer is not necessary. Depends on GUI