X-Git-Url: https://xp-dev.com/git/RRRRHHHH_Code/blobdiff_plain/e3043c3b5cbff18b2388a9c95c411cc60367000d..b09f345318baa9ca734e11c87f52f8522d7cc1fb:/ruralHouses/src/businessLogic/BookingManager.java diff --git a/ruralHouses/src/businessLogic/BookingManager.java b/ruralHouses/src/businessLogic/BookingManager.java index 519dc54..356d3ba 100644 --- a/ruralHouses/src/businessLogic/BookingManager.java +++ b/ruralHouses/src/businessLogic/BookingManager.java @@ -25,10 +25,8 @@ public final class BookingManager extends UnicastRemoteObject implements Booking * */ private static final long serialVersionUID = 1L; - private int bookingNumber = 0; dataAccess.DB4oManager dbMngr; - private static BookingManager theBookingManager; public BookingManager() throws RemoteException { super(); @@ -39,39 +37,7 @@ public final class BookingManager extends UnicastRemoteObject implements Booking } } - /** - * This method returns the next Booking number - * - * @return the book number - */ - - public int getNumber() throws RemoteException{ - ObjectContainer db=DB4oManager.getContainer(); - BookingManager b=getInstance(); - b.bookingNumber++; - db.store(b); - db.commit(); - return b.bookingNumber; - } - /** - * This method returns the instance of the BookingManager class - * - * @return the booking manager - * @throws RemoteException - */ - - public BookingManager getInstance() throws RemoteException { - ObjectContainer db=DB4oManager.getContainer(); - BookingManager b = new BookingManager(); - ObjectSet result = db.queryByExample(b); - if (!result.hasNext()){ - theBookingManager = new BookingManager(); - db.store(theBookingManager); - db.commit(); - } else theBookingManager=(BookingManager)result.next(); - return theBookingManager; - } public void denyBooking(Booking b) throws RemoteException{ this.dbMngr.removeBooking(b);