Git Repository Public Repository

RRRRHHHH_Code

URLs

Copy to Clipboard

Diff Revisions e2ae30 ... vs 5761bc ... for ruralHouses/src/businessLogic/OfferManager.java

Diff revisions: vs.
  @@ -61,7 +61,8 @@
61 61 */
62 62 public Offer createOffer(RuralHouse ruralHouse, Date firstDay, Date lastDay,
63 63 float price) throws OverlappingOfferExists, BadDates, RemoteException, Exception {
64 - if (firstDay.compareTo(lastDay)>=0) throw new BadDates();
64 + if (firstDay.after(lastDay)||firstDay==null||lastDay==null)
65 + throw new BadDates();
65 66
66 67 boolean b = dbMngr.existsOverlappingOffer(ruralHouse,firstDay,lastDay); // The ruralHouse object in the client may not be updated
67 68 if (!b) {
  @@ -71,19 +72,10 @@
71 72 return null;
72 73 }
73 74
74 - public Offer modifyOffer(RuralHouse ruralHouse, Date firstDay, Date lastDay,
75 - float price, Offer offer) throws OverlappingOfferExists, BadDates, RemoteException, Exception {
76 - if (firstDay.compareTo(lastDay)>=0) throw new BadDates();
77 - offer.setFirstDay(firstDay);
78 - offer.setLastDay(lastDay);
79 - offer.setPrice(price);
80 -
81 - return dbMngr.modifyOffer(offer);
82 -
83 - }
75 +
84 76 public void deleteOffer(RuralHouse rh, Offer o) throws RemoteException, Exception{
85 77 rh.offers.removeElement(o);
86 - dbMngr.deleteOffer(rh, o);
78 + dbMngr.deleteOffer( o);
87 79 }
88 80
89 81 }