|
@@ -1,61 +1,89 @@ |
1 |
1 |
|
package businessLogic; |
2 |
2 |
|
|
|
3 |
+ |
import java.rmi.RemoteException; |
|
4 |
+ |
import java.rmi.server.UnicastRemoteObject; |
3 |
5 |
|
import java.util.Vector; |
4 |
6 |
|
|
|
7 |
+ |
import common.AdminInterface; |
|
8 |
+ |
|
5 |
9 |
|
import domain.Account; |
6 |
10 |
|
import domain.Administrator; |
7 |
11 |
|
import domain.RuralHouse; |
8 |
12 |
|
|
9 |
|
- |
public class AdminManager { |
10 |
|
- |
public AdminManager() { |
|
13 |
+ |
public class AdminManager extends UnicastRemoteObject implements AdminInterface { |
|
14 |
+ |
/** |
|
15 |
+ |
* |
|
16 |
+ |
*/ |
|
17 |
+ |
private static final long serialVersionUID = 1L; |
|
18 |
+ |
|
|
19 |
+ |
|
|
20 |
+ |
|
|
21 |
+ |
|
|
22 |
+ |
public AdminManager() throws RemoteException { |
11 |
23 |
|
|
12 |
24 |
|
} |
13 |
25 |
|
|
14 |
|
- |
public Vector<RuralHouse> getAdditionRequests() { |
|
26 |
+ |
public Vector<RuralHouse> getAdditionRequests() throws RemoteException { |
15 |
27 |
|
return new Vector<RuralHouse>(Administrator.getInstance() |
16 |
28 |
|
.getAddRequest()); |
17 |
29 |
|
} |
18 |
30 |
|
|
19 |
|
- |
public Vector<RuralHouse> getDeletionRequests() { |
|
31 |
+ |
public Vector<RuralHouse> getDeletionRequests() throws RemoteException { |
20 |
32 |
|
return new Vector<RuralHouse>(Administrator.getInstance() |
21 |
33 |
|
.getRemoveRequest()); |
22 |
34 |
|
} |
23 |
35 |
|
|
24 |
|
- |
public Vector<Account> getOwnerAdditionReuests() { |
|
36 |
+ |
public Vector<Account> getOwnerAdditionRequests() throws RemoteException { |
25 |
37 |
|
return new Vector<Account>(Administrator.getInstance() |
26 |
38 |
|
.getNewOwnerRequest()); |
27 |
39 |
|
} |
28 |
40 |
|
|
29 |
|
- |
public void removeHouseAdditionRequests(RuralHouse house) { |
|
41 |
+ |
public void removeHouseAdditionRequests(RuralHouse house) throws RemoteException { |
30 |
42 |
|
Administrator.getInstance().getAddRequest().remove(house); |
31 |
43 |
|
} |
32 |
44 |
|
|
33 |
|
- |
public void removeHouseDeletionRequests(RuralHouse house) { |
|
45 |
+ |
public void removeHouseDeletionRequests(RuralHouse house) throws RemoteException { |
34 |
46 |
|
Administrator.getInstance().getRemoveRequest().remove(house); |
35 |
47 |
|
} |
36 |
|
- |
public void removeOwnerAdditionRequests(Account acc) { |
|
48 |
+ |
|
|
49 |
+ |
public void removeOwnerAdditionRequests(Account acc) throws RemoteException { |
37 |
50 |
|
Administrator.getInstance().getNewOwnerRequest().remove(acc); |
38 |
51 |
|
} |
39 |
|
- |
public boolean addAdditionRequest(RuralHouse rh) { |
|
52 |
+ |
|
|
53 |
+ |
public boolean addAdditionRequest(RuralHouse rh) throws RemoteException { |
40 |
54 |
|
if (this.getAdditionRequests().contains(rh)) { |
41 |
55 |
|
return false; |
42 |
56 |
|
} |
43 |
57 |
|
return Administrator.getInstance().getAddRequest().add(rh); |
|
58 |
+ |
|
44 |
59 |
|
} |
45 |
60 |
|
|
46 |
|
- |
public boolean addDeletionRequest(RuralHouse rh) { |
|
61 |
+ |
public boolean addDeletionRequest(RuralHouse rh) throws RemoteException { |
47 |
62 |
|
if (this.getDeletionRequests().contains(rh)) |
48 |
63 |
|
return false; |
|
64 |
+ |
|
49 |
65 |
|
return Administrator.getInstance().getRemoveRequest().add(rh); |
|
66 |
+ |
|
50 |
67 |
|
} |
51 |
68 |
|
|
52 |
|
- |
public boolean addAccount(Account acc) { |
53 |
|
- |
if (this.getOwnerAdditionReuests().contains(acc)) { |
|
69 |
+ |
|
|
70 |
+ |
|
|
71 |
+ |
|
|
72 |
+ |
public boolean addAccount(Account acc) throws RemoteException { |
|
73 |
+ |
if (this.getOwnerAdditionRequests().contains(acc)) { |
54 |
74 |
|
return false; |
55 |
75 |
|
} |
56 |
76 |
|
return Administrator.getInstance().getNewOwnerRequest().add(acc); |
57 |
77 |
|
} |
58 |
78 |
|
|
|
79 |
+ |
@Override |
|
80 |
+ |
public void saveInstance() throws RemoteException { |
|
81 |
+ |
Administrator.saveInstance(); |
|
82 |
+ |
|
|
83 |
+ |
} |
|
84 |
+ |
|
|
85 |
+ |
|
|
86 |
+ |
|
59 |
87 |
|
// public boolean removeAccount(Account acc) { |
60 |
88 |
|
// if (this.getDeletionRequests().contains(acc)) |
61 |
89 |
|
// return false; |