import java.io.Serializable;
import java.util.Date;
+import java.util.LinkedList;
+import java.util.Vector;
@SuppressWarnings("serial")
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;
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
* @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