import domain.Booking;
import domain.Client;
+import domain.Offer;
import domain.RuralHouse;
import exceptions.OfferCanNotBeBooked;
public interface BookingInterface extends Remote {
-
+ public Vector<Booking> getOffersbookings(Offer o) throws RemoteException;
public void denyBooking(Booking b) throws RemoteException;
import javax.swing.table.DefaultTableModel;
import common.BookingInterface;
-
+import common.HouseInterface;
+import common.OfferInterface;
import configuration.___IntNames;
import domain.Booking;
import domain.Offer;
setContentPane(contentPane);
contentPane.setLayout(null);
- this.bookings = this.off.getBookings();
+ BookingInterface bm = null;
+
+ try {
+ bm = (BookingInterface) Naming
+ .lookup(___IntNames.BookingManager);
+
+ } catch (Exception e1) {
+ System.out.println("Error accessing remote authentication: "
+ + e1.toString());
+ }
+ try {
+ this.bookings = bm.getOffersbookings(this.off);
+ } catch (RemoteException e1) {
+ e1.printStackTrace();
+ }
+
JLabel lblNewLabel = new JLabel();
lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
lblNewLabel.setBounds(23, 41, 536, 33);
import com.db4o.ObjectContainer;
import com.db4o.ObjectSet;
-import common.BookingInterface;
+import common.BookingInterface;
import dataAccess.DB4oManager;
import domain.Booking;
import domain.Client;
+import domain.Offer;
import domain.RuralHouse;
import exceptions.OfferCanNotBeBooked;
client);
}
+
+
+ @Override
+ public Vector<Booking> getOffersbookings(Offer o) throws RemoteException {
+ return dbMngr.getOfBok(o);
+ }
+
}
\ No newline at end of file
import domain.Booking;
import domain.Client;
+import domain.Offer;
import domain.RuralHouse;
import exceptions.OfferCanNotBeBooked;
public interface BookingInterface extends Remote {
+ public Vector<Booking> getOffersbookings(Offer o) throws RemoteException;
public void denyBooking(Booking b) throws RemoteException;
}
}
+
+ public Vector<Booking> getOfBok(Offer o) {
+ if (c.isDatabaseLocal() == false)
+ openSDB();
+ else
+ openDB();
+
+ try {
+ Offer of = (Offer) db.queryByExample(
+ new Offer(0, o.getRuralHouse(), null, null, 0)).get(0);
+ Booking proto = new Booking(0, of, null, null);
+ ObjectSet<Booking> result = db.queryByExample(proto);
+ return new Vector<Booking>(result);
+ } finally {
+ db.close();
+ }
+ }
}