3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
6 import java.util.Vector;
8 import javax.mail.MessagingException;
10 import com.db4o.ObjectContainer;
11 import com.db4o.ObjectSet;
12 import common.BookingInterface;
14 import dataAccess.DB4oManager;
15 import domain.Booking;
17 import domain.RuralHouse;
18 import exceptions.OfferCanNotBeBooked;
22 public final class BookingManager extends UnicastRemoteObject implements BookingInterface {
27 private static final long serialVersionUID = 1L;
28 dataAccess.DB4oManager dbMngr;
31 public BookingManager() throws RemoteException {
34 this.dbMngr = DB4oManager.getInstance();
35 } catch (Exception e) {
42 public void denyBooking(Booking b) throws RemoteException{
43 this.dbMngr.removeBooking(b);
47 public void acceptBooking(Booking b) throws RemoteException{
48 b.getOffer().setBooked(true);
49 b.getOffer().getBookings().clear();
50 b.getOffer().getBookings().add(b);
51 this.dbMngr.acceptBooking(b.getOffer());
53 MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has been accepted","Here should be the bill");
54 } catch (MessagingException e) {
60 * This method creates a book with a corresponding parameters
63 * day, last day, house number and telephone
66 public Vector<Booking> createBooking(RuralHouse ruralHouse, Date firstDate,
67 Date lastDate, Client client)
68 throws OfferCanNotBeBooked,RemoteException {
70 return dbMngr.createBooking(ruralHouse, firstDate, lastDate,