3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
5 import java.util.Vector;
7 import common.HouseInterface;
9 import dataAccess.DB4oManager;
11 import domain.RuralHouse;
14 public class HouseManager extends UnicastRemoteObject implements HouseInterface {
18 private static final long serialVersionUID = 1L;
20 public HouseManager() throws RemoteException {
23 dbMngr = DB4oManager.getInstance();
24 } catch (Exception e) {
31 private boolean suitsRegulations(int nKitchens, int nBaths, int nLivings) {
32 if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
39 public boolean registerNewHouse(RuralHouse rh) {
41 boolean stored = false;
42 if (!suitsRegulations(rh.getFeatures().getnKitchens(), rh.getFeatures()
43 .getnBaths(), rh.getFeatures().getnKitchens()))
45 stored = this.dbMngr.storeRuralHouses(rh);
49 public void removeHouse(RuralHouse rh, Owner owner) {
50 Vector<RuralHouse> temp = owner.getRuralHouses();
52 this.dbMngr.removeHouse(rh, owner);
57 public Vector<RuralHouse> getHouses(Owner ow, String name,String town, int nBed, int nKit,
58 int nBath, int nPark, int nLiv) {
60 return this.dbMngr.getRuralHouses( ow, name ,town, nBed, nKit, nBath, nPark, nLiv);
64 public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
66 return dbMngr.getAllRuralHouses();
71 // For future implementation
73 // public void modifyHouse(int houseName, Owner owner, String description,
74 // String town, int nRooms, int nKitchens, int nBaths, int nLivings,
76 // // TODO Auto-generated method stub
80 // Maybe returning the offer is not necessary. Depends on GUI