|
@@ -85,8 +85,7 @@ |
85 |
85 |
|
configuration.common().objectClass(Booking.class).cascadeOnDelete(true); |
86 |
86 |
|
configuration.common().objectClass(RuralHouse.class) |
87 |
87 |
|
.cascadeOnDelete(true); |
88 |
|
- |
configuration.common().objectClass(Account.class) |
89 |
|
- |
.cascadeOnDelete(true); |
|
88 |
+ |
configuration.common().objectClass(Account.class).cascadeOnDelete(true); |
90 |
89 |
|
configuration.common().objectClass(Offer.class).cascadeOnDelete(true); |
91 |
90 |
|
configuration.common().objectClass(Account.class).cascadeOnUpdate(true); |
92 |
91 |
|
db = Db4oEmbedded.openFile(configuration, c.getDb4oFilename()); |
|
@@ -222,14 +221,15 @@ |
222 |
221 |
|
} |
223 |
222 |
|
} |
224 |
223 |
|
|
225 |
|
- |
public Vector<Offer> getRHsOffer(String name){ |
|
224 |
+ |
public Vector<Offer> getRHsOffer(String name) { |
226 |
225 |
|
if (c.isDatabaseLocal() == false) |
227 |
226 |
|
openSDB(); |
228 |
227 |
|
else |
229 |
228 |
|
openDB(); |
230 |
229 |
|
|
231 |
230 |
|
try { |
232 |
|
- |
RuralHouse rh = (RuralHouse)db.queryByExample(new RuralHouse(name, null, null, null, null)).get(0); |
|
231 |
+ |
RuralHouse rh = (RuralHouse) db.queryByExample( |
|
232 |
+ |
new RuralHouse(name, null, null, null, null)).get(0); |
233 |
233 |
|
Offer proto = new Offer(0, rh, null, null, 0); |
234 |
234 |
|
ObjectSet<Offer> result = db.queryByExample(proto); |
235 |
235 |
|
return new Vector<Offer>(result); |
|
@@ -237,8 +237,8 @@ |
237 |
237 |
|
db.close(); |
238 |
238 |
|
} |
239 |
239 |
|
} |
240 |
|
- |
|
241 |
|
- |
public Administrator getAdminData(){ |
|
240 |
+ |
|
|
241 |
+ |
public Administrator getAdminData() { |
242 |
242 |
|
|
243 |
243 |
|
if (c.isDatabaseLocal() == false) |
244 |
244 |
|
openSDB(); |
|
@@ -374,7 +374,6 @@ |
374 |
374 |
|
} |
375 |
375 |
|
} |
376 |
376 |
|
|
377 |
|
- |
|
378 |
377 |
|
public Vector<RuralHouse> getAllRuralHouses() throws RemoteException, |
379 |
378 |
|
Exception { |
380 |
379 |
|
|
|
@@ -511,8 +510,8 @@ |
511 |
510 |
|
|
512 |
511 |
|
} |
513 |
512 |
|
|
514 |
|
- |
public Vector<RuralHouse> getRuralHouses(Owner ow, String name, String town, |
515 |
|
- |
int nBed, int nKit, int nBath, int nPark, int nLiv) { |
|
513 |
+ |
public Vector<RuralHouse> getRuralHouses(Owner ow, String name, |
|
514 |
+ |
String town, int nBed, int nKit, int nBath, int nPark, int nLiv) { |
516 |
515 |
|
HouseFeatures fea = new HouseFeatures(nBed, nKit, nBath, nLiv, nPark); |
517 |
516 |
|
RuralHouse rh = new RuralHouse(name, ow, null, town, fea); |
518 |
517 |
|
if (c.isDatabaseLocal() == false) |
|
@@ -607,10 +606,15 @@ |
607 |
606 |
|
else |
608 |
607 |
|
openDB(); |
609 |
608 |
|
try { |
610 |
|
- |
ObjectSet<Booking> result = db.queryByExample(b); |
611 |
|
- |
result.get(0).getOffer().getBookings().remove(b); |
612 |
|
- |
db.store(result.get(0).getOffer()); |
613 |
|
- |
db.delete(result.get(0)); |
|
609 |
+ |
Booking book = new Booking(b.getBookNumber(), new Offer(b |
|
610 |
+ |
.getOffer().getOfferNumber(), new RuralHouse(b.getOffer() |
|
611 |
+ |
.getRuralHouse().getHouseName(), null, null, null, null), |
|
612 |
+ |
null, null, 0), b.getClient(), b.getBookDate()); |
|
613 |
+ |
|
|
614 |
+ |
ObjectSet<Booking> result = db.queryByExample(book); |
|
615 |
+ |
Offer of = result.get(0).getOffer(); |
|
616 |
+ |
of.getBookings().remove(result.get(0)); |
|
617 |
+ |
db.store(of); |
614 |
618 |
|
db.commit(); |
615 |
619 |
|
} catch (Exception e) { |
616 |
620 |
|
e.printStackTrace(); |