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;
13 public class AccountManager extends UnicastRemoteObject implements AccountInterface {
18 private static final long serialVersionUID = 1L;
19 private DB4oManager dbMngr;
22 public AccountManager() throws RemoteException {
24 dbMngr = DB4oManager.getInstance();
25 } catch (Exception e) {
31 public boolean addAccount(int index) throws RemoteException {
32 Account ac = Administrator.getInstance().getNewOwnerRequest().get(index);
33 if(this.dbMngr.addAccount(ac)){
35 MailManager.getInstance().Send(ac.getOwner().getMailAccount(), "Entered into the system", "Congratulations");
36 } catch (MessagingException e) {
45 public boolean removeAccount(int index)throws RemoteException {
46 OwnerManager own = new OwnerManager();
48 if(this.dbMngr.removeAccount(own.getOwners().get(index)))
50 } catch (Exception e) {
51 // TODO Auto-generated catch block