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