3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
6 import java.util.Vector;
8 import com.db4o.ObjectContainer;
9 import com.db4o.ObjectSet;
10 import common.BookingInterface;
12 import dataAccess.DB4oManager;
13 import domain.Booking;
15 import domain.RuralHouse;
16 import exceptions.OfferCanNotBeBooked;
20 public final class BookingManager extends UnicastRemoteObject implements BookingInterface {
25 private static final long serialVersionUID = 1L;
26 dataAccess.DB4oManager dbMngr;
29 public BookingManager() throws RemoteException {
32 this.dbMngr = DB4oManager.getInstance();
33 } catch (Exception e) {
40 public void removeDenyBooking(Booking b) throws RemoteException{
41 b.getOffer().getBookings().remove(b);
42 this.dbMngr.removeBooking(b);
46 public void acceptBooking(Booking b) throws RemoteException{
47 b.getOffer().setBooked(true);
48 for(Booking boo : b.getOffer().getBookings()){
50 b.getOffer().getBookings().remove(b);
52 this.dbMngr.acceptBooking(b.getOffer());
54 MailManager.getInstance().Send(b.getClient().getMailAccount(), "Your booking has been accepted","Here should be the bill");
55 } catch (MessagingException e) {
56 // TODO Auto-generated catch block
62 * This method creates a book with a corresponding parameters
65 * day, last day, house number and telephone
68 public Vector<Booking> createBooking(RuralHouse ruralHouse, Date firstDate,
69 Date lastDate, Client client)
70 throws OfferCanNotBeBooked,RemoteException {
72 return dbMngr.createBooking(ruralHouse, firstDate, lastDate,