3 import java.rmi.RemoteException;
4 import java.util.Vector;
6 import dataAccess.DB4oManager;
8 import domain.RuralHouse;
10 public class HouseManager implements HouseManagerInterface {
12 private DB4oManager dbMngr;
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 stored = this.dbMngr.storeRuralHouses(rh);
42 public void removeHouse(RuralHouse rh, Owner owner) {
43 Vector<RuralHouse> temp = owner.getRuralHouses();
45 this.dbMngr.removeHouse(rh, owner);
50 public Vector<RuralHouse> getHouses(String name,String town, int nBed, int nKit,
51 int nBath, int nPark, int nLiv) {
53 return this.dbMngr.getRuralHouses(name ,town, nBed, nKit, nBath, nPark, nLiv);
57 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
59 return dbMngr.getAllRuralHouses();
64 // For future implementation
66 // public void modifyHouse(int houseName, Owner owner, String description,
67 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
69 // // TODO Auto-generated method stub
73 // Maybe returning the offer is not necessary. Depends on GUI