RRRRHHHH_Code
Diff Revisions
6a5d4d ...
vs
4f8bcc ...
for ruralHouses/src/businessLogic/AccountManager.java
|
@@ -1,16 +1,24 @@ |
1 |
1 |
|
package businessLogic; |
2 |
2 |
|
|
|
3 |
+ |
import java.rmi.RemoteException; |
|
4 |
+ |
import java.rmi.server.UnicastRemoteObject; |
|
5 |
+ |
|
3 |
6 |
|
import javax.mail.MessagingException; |
4 |
7 |
|
|
|
8 |
+ |
import common.AccountInterface; |
5 |
9 |
|
import dataAccess.DB4oManager; |
6 |
10 |
|
import domain.Account; |
7 |
11 |
|
|
8 |
|
- |
public class AccountManager { |
|
12 |
+ |
public class AccountManager extends UnicastRemoteObject implements AccountInterface { |
9 |
13 |
|
|
|
14 |
+ |
/** |
|
15 |
+ |
* |
|
16 |
+ |
*/ |
|
17 |
+ |
private static final long serialVersionUID = 1L; |
10 |
18 |
|
private DB4oManager dbMngr; |
11 |
19 |
|
|
12 |
20 |
|
|
13 |
|
- |
public AccountManager() { |
|
21 |
+ |
public AccountManager() throws RemoteException { |
14 |
22 |
|
try { |
15 |
23 |
|
dbMngr = DB4oManager.getInstance(); |
16 |
24 |
|
} catch (Exception e) { |
|
@@ -19,12 +27,11 @@ |
19 |
27 |
|
} |
20 |
28 |
|
} |
21 |
29 |
|
|
22 |
|
- |
public boolean addAccount(Account ac){ |
|
30 |
+ |
public boolean addAccount(Account ac) throws RemoteException { |
23 |
31 |
|
if(this.dbMngr.addAccount(ac)){ |
24 |
32 |
|
try { |
25 |
33 |
|
MailManager.getInstance().Send(ac.getOwner().getMailAccount(), "Entered into the system", "Congratulations"); |
26 |
34 |
|
} catch (MessagingException e) { |
27 |
|
- |
// TODO Auto-generated catch block |
28 |
35 |
|
e.printStackTrace(); |
29 |
36 |
|
} |
30 |
37 |
|
return true; |
|
@@ -33,7 +40,7 @@ |
33 |
40 |
|
|
34 |
41 |
|
} |
35 |
42 |
|
|
36 |
|
- |
public boolean removeAccount(Account ac){ |
|
43 |
+ |
public boolean removeAccount(Account ac)throws RemoteException { |
37 |
44 |
|
if(this.dbMngr.removeAccount(ac)) |
38 |
45 |
|
return true; |
39 |
46 |
|
return false; |