Merge branch 'master' of ssh://xp-dev.com/RRRRHHHH_Code
authorpinene <epinzolas001@ikasle.ehu.eus>
Wed, 20 May 2015 16:58:12 +0000 (18:58 +0200)
committerpinene <epinzolas001@ikasle.ehu.eus>
Wed, 20 May 2015 16:58:12 +0000 (18:58 +0200)
ruralHouses client/src/common/BookingInterface.java
ruralHouses client/src/gui/listOfBookingRequestsGUI.java
ruralHouses/src/businessLogic/BookingManager.java
ruralHouses/src/common/BookingInterface.java
ruralHouses/src/dataAccess/DB4oManager.java

index 598a537..023d792 100644 (file)
@@ -7,13 +7,14 @@ import java.util.Vector;
 
 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;
 
index 423ea4d..2106e88 100644 (file)
@@ -22,7 +22,8 @@ import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 
 import common.BookingInterface;
-
+import common.HouseInterface;
+import common.OfferInterface;
 import configuration.___IntNames;
 import domain.Booking;
 import domain.Offer;
@@ -62,7 +63,22 @@ public class listOfBookingRequestsGUI extends JFrame {
                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);
index 356d3ba..3fe64f2 100644 (file)
@@ -9,11 +9,12 @@ import javax.mail.MessagingException;
 
 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;
 
@@ -76,4 +77,11 @@ public final class BookingManager extends UnicastRemoteObject implements Booking
                                client);
        }
 
+
+
+       @Override
+       public Vector<Booking> getOffersbookings(Offer o) throws RemoteException {
+               return dbMngr.getOfBok(o);
+       }
+
 }
\ No newline at end of file
index 598a537..aa1c737 100644 (file)
@@ -7,12 +7,14 @@ import java.util.Vector;
 
 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;
index d17876f..4553f48 100644 (file)
@@ -607,4 +607,21 @@ public class DB4oManager {
                }
 
        }
+
+       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();
+               }
+       }
 }