Minor error correction and some bugs, alongside with modify offers quality of life...
[RRRRHHHH_Code] / ruralHouses / src / businessLogic / BookingManager.java
index 18670e1..24dd41c 100644 (file)
@@ -1,9 +1,14 @@
 package businessLogic;
 
+import java.util.Date;
+
 import com.db4o.ObjectContainer;
 import com.db4o.ObjectSet;
 
 import dataAccess.DB4oManager;
+import domain.Booking;
+import domain.RuralHouse;
+import exceptions.OfferCanNotBeBooked;
 
 
 public final class BookingManager {
@@ -13,7 +18,13 @@ public final class BookingManager {
 
        private static BookingManager theBookingManager;
 
-       private BookingManager() {}
+       public BookingManager() {
+               try {
+                       this.dbMngr = DB4oManager.getInstance();
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
        
        /**
         * This method returns the next Booking number 
@@ -46,4 +57,17 @@ public final class BookingManager {
                return theBookingManager;
        }
        
+       /**
+        * This method creates a book with a corresponding parameters
+        * 
+        * @param First
+        *            day, last day, house number and telephone
+        * @return a book
+        */
+       public Booking createBooking(RuralHouse ruralHouse, Date firstDate, Date lastDate, String bookTelephoneNumber)
+                       throws OfferCanNotBeBooked {
+
+               return dbMngr.createBooking(ruralHouse,firstDate,lastDate,bookTelephoneNumber);
+       }
+       
 }
\ No newline at end of file