3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
6 import java.util.Vector;
8 import javax.mail.MessagingException;
10 import common.BookingInterface;
12 import dataAccess.DB4oManager;
13 import domain.Booking;
16 import domain.RuralHouse;
17 import exceptions.OfferCanNotBeBooked;
21 public final class BookingManager extends UnicastRemoteObject implements BookingInterface {
26 private static final long serialVersionUID = 1L;
27 dataAccess.DB4oManager dbMngr;
30 public BookingManager() throws RemoteException {
33 this.dbMngr = DB4oManager.getInstance();
34 } catch (Exception e) {
41 public void denyBooking(Booking b) throws RemoteException{
42 this.dbMngr.removeBooking(b);
44 MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has not been accepted","We are sorry");
45 } catch (MessagingException e) {
51 public void acceptBooking(Booking b) throws RemoteException{
52 b.getOffer().setBooked(true);
53 b.getOffer().getBookings().clear();
54 b.getOffer().getBookings().add(b);
55 this.dbMngr.acceptBooking(b.getOffer());
57 MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has been accepted","Here should be the bill");
58 } catch (MessagingException e) {
64 * This method creates a book with a corresponding parameters
67 * day, last day, house number and telephone
70 public Vector<Booking> createBooking(RuralHouse ruralHouse, Date firstDate,
71 Date lastDate, Client client)
72 throws OfferCanNotBeBooked,RemoteException {
74 return dbMngr.createBooking(ruralHouse, firstDate, lastDate,
81 public Vector<Booking> getOffersbookings(Offer o) throws RemoteException {
82 return dbMngr.getOfBok(o);