Possibility of registering new owners added
[RRRRHHHH_Code] / ruralHouses / src / domain / Offer.java
index 8e4e785..00a3e70 100644 (file)
@@ -2,6 +2,8 @@ package domain;
 
 import java.io.Serializable;
 import java.util.Date;
+import java.util.LinkedList;
+import java.util.Vector;
 
 
 @SuppressWarnings("serial")
@@ -12,7 +14,7 @@ public class Offer implements Serializable {
        private Date firstDay; // Dates are stored as java.util.Date objects instead of java.sql.Date objects
        private Date lastDay;  // because, they are not well stored in db4o as java.util.Date objects
        private float price;   // This is coherent because objects of java.sql.Date are objects of java.util.Date 
-       private Booking booking;  // That is: java.sql.Date is a subclass (or extends) java.util.Date
+       private Vector<Booking> bookings;  // That is: java.sql.Date is a subclass (or extends) java.util.Date
        private RuralHouse ruralHouse;
 
        
@@ -109,25 +111,6 @@ public class Offer implements Serializable {
                this.price = price;
        }
 
-       /**
-        * Get the book number
-        * 
-        * @return book object
-        */
-       public Booking getBooking() {
-               return this.booking;
-       }
-
-       /**
-        * Set the book object
-        * 
-        * @param book
-        *            Book object
-        * @return None
-        */
-       public void setBooking(Booking booking) {
-               this.booking = booking;
-       }
        
        /**
         * This method creates a book with a corresponding parameters
@@ -135,12 +118,21 @@ public class Offer implements Serializable {
         * @param First day, last day, house number and telephone
         * @return a book
         */
-       public Booking createBooking(int numBooking,String bookTelephoneNumber) {
-               return booking=new Booking(numBooking,bookTelephoneNumber,this);
+       public Booking createBooking(int numBooking,String bookTelephoneNumber,String name , String mail) {
+               Client client = new Client(name,mail,bookTelephoneNumber);
+               Booking b = new Booking(numBooking,this,client);
+               this.bookings.add(b);
+               return b;
                        
        }
        
        public String toString(){
                return firstDay.toString()+", "+lastDay.toString()+", "+price;
        }
+       public Vector<Booking> getBookings() {
+               return bookings;
+       }
+       public void setBookings(Vector<Booking> bookings) {
+               this.bookings = bookings;
+       }
 }
\ No newline at end of file