Now AdminManager gets the owner for removing them
authorcamjan <jcampos004@ikasle.ehu.es>
Wed, 20 May 2015 12:44:59 +0000 (14:44 +0200)
committercamjan <jcampos004@ikasle.ehu.es>
Wed, 20 May 2015 12:44:59 +0000 (14:44 +0200)
ruralHouses client/src/common/AdminInterface.java
ruralHouses client/src/gui/DeleteOfferGUI.java
ruralHouses client/src/gui/DeleteOwnerGUI.java
ruralHouses/src/businessLogic/AdminManager.java
ruralHouses/src/common/AdminInterface.java

index 5a76296..0f2887e 100644 (file)
@@ -10,27 +10,29 @@ import domain.RuralHouse;
 
 public interface AdminInterface extends Remote {
 
-       
        public Vector<RuralHouse> getAdditionRequests() throws RemoteException;
 
-       public Vector<RuralHouse> getDeletionRequests() throws RemoteException ;
+       public Vector<RuralHouse> getDeletionRequests() throws RemoteException;
 
-       public Vector<Account> getOwnerAdditionRequests() throws RemoteException ;
-       
-       public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException ;
+       public Vector<Account> getOwnerAdditionRequests() throws RemoteException;
 
-       public void removeHouseDeletionRequests(RuralHouse house) throws RemoteException ;
-       
-       public void removeOwnerAdditionRequests(int index) throws RemoteException ;
-       
-       public boolean addAdditionRequest(RuralHouse rh) throws RemoteException ;
+       public Vector<Owner> getAllOwners() throws RemoteException;
+
+       public void removeHouseAdditionRequests(RuralHouse house)
+                       throws RemoteException;
+
+       public void removeHouseDeletionRequests(RuralHouse house)
+                       throws RemoteException;
+
+       public void removeOwnerAdditionRequests(int index) throws RemoteException;
+
+       public boolean addAdditionRequest(RuralHouse rh) throws RemoteException;
+
+       public boolean addDeletionRequest(RuralHouse rh) throws RemoteException;
+
+       public boolean addAccountRequest(String usr, String pss, Owner ow)
+                       throws RemoteException;
 
-       public boolean addDeletionRequest(RuralHouse rh) throws RemoteException ;
-       
-       public boolean addAccountRequest(String usr,
-                       String pss, Owner ow) throws RemoteException;
-       
        public void saveInstance() throws RemoteException;
-       
-       
+
 }
index 7c1903d..d9f5ab8 100644 (file)
@@ -18,6 +18,7 @@ import javax.swing.border.EmptyBorder;
 
 import common.HouseInterface;
 import common.OfferInterface;
+
 import configuration.___IntNames;
 import domain.Offer;
 import domain.Owner;
index fb2fcdb..19d5513 100644 (file)
@@ -19,7 +19,7 @@ import javax.swing.border.EmptyBorder;
 import javax.swing.table.DefaultTableModel;
 
 import common.AccountInterface;
-import common.OwnerInterface;
+import common.AdminInterface;
 
 import configuration.___IntNames;
 import domain.Owner;
@@ -34,7 +34,7 @@ public class DeleteOwnerGUI extends JFrame {
        private JTable table;
 
        private DefaultTableModel tableModel;
-       private OwnerInterface Own = null;
+       private AdminInterface AdM = null;
        private Vector<Owner> owners = new Vector<Owner>();
 
        /**
@@ -56,14 +56,14 @@ public class DeleteOwnerGUI extends JFrame {
                setContentPane(contentPane);
                contentPane.setLayout(null);
                try {
-                       Own = (OwnerInterface) Naming
-                                       .lookup(___IntNames.OwnerManager);
+                       AdM = (AdminInterface) Naming
+                                       .lookup(___IntNames.AdminManager);
                } catch (Exception e1) {
                        System.out
                                        .println("Error accessing remote authentication: "
                                                        + e1.toString());
                }
-               this.owners = Own.getOwners();
+               this.owners = AdM.getAllOwners();
                JLabel lblNewLabel = new JLabel();
                lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
                lblNewLabel.setBounds(23, 41, 536, 33);
index e7b38c9..11d26b0 100644 (file)
@@ -6,6 +6,7 @@ import java.util.Vector;
 
 import common.AdminInterface;
 
+import dataAccess.DB4oManager;
 import domain.Account;
 import domain.Administrator;
 import domain.Owner;
@@ -39,6 +40,14 @@ public class AdminManager extends UnicastRemoteObject implements AdminInterface
                                .getNewOwnerRequest());
        }
        
+       public Vector<Owner> getAllOwners()throws RemoteException {
+               try {
+                       return new Vector<Owner>(DB4oManager.getInstance().getOwners());
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+               return null;
+       }
        public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException {
                Administrator.getInstance().getAddRequest().remove(house);
        }
index 5a76296..7e3289f 100644 (file)
@@ -17,6 +17,8 @@ public interface AdminInterface extends Remote {
 
        public Vector<Account> getOwnerAdditionRequests() throws RemoteException ;
        
+       public Vector<Owner> getAllOwners()throws RemoteException ;
+       
        public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException ;
 
        public void removeHouseDeletionRequests(RuralHouse house) throws RemoteException ;