From: camjan Date: Wed, 20 May 2015 12:44:59 +0000 (+0200) Subject: Now AdminManager gets the owner for removing them X-Git-Url: https://xp-dev.com/git/RRRRHHHH_Code/commitdiff_plain/32ba0e29d5e028120ff2b25622ee8ed3b7361364?ds=sidebyside Now AdminManager gets the owner for removing them --- diff --git a/ruralHouses client/src/common/AdminInterface.java b/ruralHouses client/src/common/AdminInterface.java index 5a76296..0f2887e 100644 --- a/ruralHouses client/src/common/AdminInterface.java +++ b/ruralHouses client/src/common/AdminInterface.java @@ -10,27 +10,29 @@ import domain.RuralHouse; public interface AdminInterface extends Remote { - public Vector getAdditionRequests() throws RemoteException; - public Vector getDeletionRequests() throws RemoteException ; + public Vector getDeletionRequests() throws RemoteException; - public Vector getOwnerAdditionRequests() throws RemoteException ; - - public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException ; + public Vector 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 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; - - + } diff --git a/ruralHouses client/src/gui/DeleteOfferGUI.java b/ruralHouses client/src/gui/DeleteOfferGUI.java index 7c1903d..d9f5ab8 100644 --- a/ruralHouses client/src/gui/DeleteOfferGUI.java +++ b/ruralHouses client/src/gui/DeleteOfferGUI.java @@ -18,6 +18,7 @@ import javax.swing.border.EmptyBorder; import common.HouseInterface; import common.OfferInterface; + import configuration.___IntNames; import domain.Offer; import domain.Owner; diff --git a/ruralHouses client/src/gui/DeleteOwnerGUI.java b/ruralHouses client/src/gui/DeleteOwnerGUI.java index fb2fcdb..19d5513 100644 --- a/ruralHouses client/src/gui/DeleteOwnerGUI.java +++ b/ruralHouses client/src/gui/DeleteOwnerGUI.java @@ -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 owners = new Vector(); /** @@ -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); diff --git a/ruralHouses/src/businessLogic/AdminManager.java b/ruralHouses/src/businessLogic/AdminManager.java index e7b38c9..11d26b0 100644 --- a/ruralHouses/src/businessLogic/AdminManager.java +++ b/ruralHouses/src/businessLogic/AdminManager.java @@ -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 getAllOwners()throws RemoteException { + try { + return new Vector(DB4oManager.getInstance().getOwners()); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException { Administrator.getInstance().getAddRequest().remove(house); } diff --git a/ruralHouses/src/common/AdminInterface.java b/ruralHouses/src/common/AdminInterface.java index 5a76296..7e3289f 100644 --- a/ruralHouses/src/common/AdminInterface.java +++ b/ruralHouses/src/common/AdminInterface.java @@ -17,6 +17,8 @@ public interface AdminInterface extends Remote { public Vector getOwnerAdditionRequests() throws RemoteException ; + public Vector getAllOwners()throws RemoteException ; + public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException ; public void removeHouseDeletionRequests(RuralHouse house) throws RemoteException ;