3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
6 import javax.mail.MessagingException;
8 import common.AccountInterface;
9 import dataAccess.DB4oManager;
10 import domain.Account;
11 import domain.Administrator;
14 public class AccountManager extends UnicastRemoteObject implements
20 private static final long serialVersionUID = 1L;
21 private DB4oManager dbMngr;
23 public AccountManager() throws RemoteException {
25 dbMngr = DB4oManager.getInstance();
26 } catch (Exception e) {
32 public boolean addAccount(int index) throws RemoteException {
33 Account ac = Administrator.getInstance().getNewOwnerRequest()
35 if (this.dbMngr.addAccount(ac)) {
37 MailManager.getInstance().Send(ac.getOwner().getMailAccount(),
38 "Entered into the system", "Congratulations");
39 } catch (MessagingException e) {
48 public boolean removeAccount(int index) throws RemoteException {
49 AdminManager adm = new AdminManager();
50 Owner own = adm.getAllOwners().get(index);
52 if (this.dbMngr.removeAccount(own)) {
54 MailManager.getInstance().Send(own.getMailAccount(), "Removed from the system", "We are sorry");
55 } catch (MessagingException e) {
60 } catch (Exception e) {