3 import java.rmi.RemoteException;
4 import java.rmi.server.UnicastRemoteObject;
6 import javax.mail.MessagingException;
8 import common.AccountInterface;
10 import dataAccess.DB4oManager;
11 import domain.Account;
12 import domain.Administrator;
15 public class AccountManager extends UnicastRemoteObject implements
21 private static final long serialVersionUID = 1L;
22 private DB4oManager dbMngr;
24 public AccountManager() throws RemoteException {
26 dbMngr = DB4oManager.getInstance();
27 } catch (Exception e) {
33 public boolean addAccount(int index) throws RemoteException {
34 Account ac = Administrator.getInstance().getNewOwnerRequest()
36 if (this.dbMngr.addAccount(ac)) {
38 MailManager.getInstance().Send(ac.getOwner().getMailAccount(),
39 "Entered into the system", "Congratulations");
40 } catch (MessagingException e) {
49 public boolean removeAccount(int index) throws RemoteException {
50 AdminManager adm = new AdminManager();
51 Owner own = adm.getAllOwners().get(index);
53 if (this.dbMngr.removeAccount(own)) {
55 MailManager.getInstance().Send(own.getMailAccount(), "Removed from the system", "We are sorry");
56 } catch (MessagingException e) {
61 } catch (Exception e) {