3 import java.rmi.RemoteException;
4 import java.util.Vector;
6 import dataAccess.DB4oManager;
8 import domain.RuralHouse;
10 public class HouseManager implements HouseManagerInterface {
13 public HouseManager() {
15 dbMngr = DB4oManager.getInstance();
16 } catch (Exception e) {
23 private boolean suitsRegulations(int nKitchens, int nBaths, int nLivings) {
24 if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
31 public boolean registerNewHouse(RuralHouse rh) {
33 boolean stored = false;
34 if (!suitsRegulations(rh.getFeatures().getnKitchens(), rh.getFeatures()
35 .getnBaths(), rh.getFeatures().getnKitchens()))
37 stored = this.dbMngr.storeRuralHouses(rh);
41 public void removeHouse(RuralHouse rh, Owner owner) {
42 Vector<RuralHouse> temp = owner.getRuralHouses();
44 this.dbMngr.removeHouse(rh, owner);
49 public Vector<RuralHouse> getHouses(String name,String town, int nBed, int nKit,
50 int nBath, int nPark, int nLiv) {
52 return this.dbMngr.getRuralHouses(name ,town, nBed, nKit, nBath, nPark, nLiv);
56 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
58 return dbMngr.getAllRuralHouses();
63 // For future implementation
65 // public void modifyHouse(int houseName, Owner owner, String description,
66 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
68 // // TODO Auto-generated method stub
72 // Maybe returning the offer is not necessary. Depends on GUI