try {
dbMngr = DB4oManager.getInstance();
} catch (Exception e) {
- // TODO Auto-generated catch block
+
e.printStackTrace();
}
}
+
+
@Override
- public boolean registerNewHouse(int houseNumber, Owner owner, String town,
- int nRooms, int nKitchens, int nBaths, int nLivings, int nParkings) {
- // TODO Auto-generated method stub
+ public boolean registerNewHouse(String houseName, Owner owner,
+ String description, String district, int nRooms, int nKitchens,
+ int nBaths, int nLivings, int nParkings) {
+
boolean stored = false;
if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
return false;
HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
nLivings, nParkings);
- stored = this.dbMngr.storeRuralHouses(new RuralHouse(houseNumber,
- owner, town, feature));
+ RuralHouse rh = new RuralHouse(houseName,
+ owner, description, district, feature);
+ owner.getRuralHouses().add(rh);
+ stored = this.dbMngr.storeRuralHouses(rh);
return stored;
+ }
+
+
+ public void removeHouse(RuralHouse rh) {
+ this.dbMngr.removeHouse(rh);
}
+
+
@Override
- public boolean registerNewHouse(int houseNumber, Owner owner,
- String description, String town, int nRooms, int nKitchens,
- int nBaths, int nLivings, int nParkings) {
+ public Vector<RuralHouse> getHousesByDistrict(String town) {
+
+ return this.dbMngr.getRuralHousesByTown(town);
+ }
+
+
+
+ @Override
+ public Vector<RuralHouse> getAllRuralHouses() throws RemoteException,
+ Exception {
// TODO Auto-generated method stub
- boolean stored = false;
- if (nKitchens < 1 || nLivings < 3 || nBaths < 2)
- return false;
- HouseFeatures feature = new HouseFeatures(nRooms, nKitchens, nBaths,
- nLivings, nParkings);
- stored = this.dbMngr.storeRuralHouses(new RuralHouse(houseNumber,
- owner, description, town, feature));
- return stored;
+ return dbMngr.getAllRuralHouses();
}
- public void removeHouse(int houseNumber) {
- this.dbMngr.removeHouse(houseNumber);
+
+
+ @Override
+ public RuralHouse getHouseByName(String Name) {
+ return this.dbMngr.getRuralHouseByName(Name);
}
// For future implementation
// @Override
- // public void modifyHouse(int houseNumber, Owner owner, String description,
+ // public void modifyHouse(int houseName, Owner owner, String description,
// String town, int nRooms, int nKitchens, int nBaths, int nLivings,
// int nParkings) {
// // TODO Auto-generated method stub