1 27 28 29 package com.sun.ebank.web; 30 31 import javax.ejb.*; 32 import javax.naming.*; 33 import javax.rmi.PortableRemoteObject ; 34 import java.rmi.RemoteException ; 35 import com.sun.ebank.ejb.exception.*; 36 import com.sun.ebank.util.*; 37 import com.sun.ebank.ejb.account.*; 38 import com.sun.ebank.ejb.customer.*; 39 import com.sun.ebank.ejb.tx.*; 40 import java.util.*; 41 42 43 public class CustomerBean { 44 private BeanManager beanManager; 45 private String customer; 46 private String account; 47 48 public CustomerBean() { 49 beanManager = null; 50 customer = null; 51 account = null; 52 } 53 54 public void setBeanManager(BeanManager beanManager) { 55 this.beanManager = beanManager; 56 } 57 58 public BeanManager getBeanManager() { 59 return this.beanManager; 60 } 61 62 public void setCustomer(String customer) { 63 this.customer = customer; 64 } 65 66 public String getCustomer() { 67 return this.customer; 68 } 69 70 public void setAccount(String account) { 71 this.account = account; 72 } 73 74 public String getAccount() { 75 return this.account; 76 } 77 78 public CustomerDetails getCustomerDetails() { 79 CustomerDetails cd = null; 80 81 try { 82 cd = beanManager.getCustomerController() 83 .getDetails(this.customer); 84 } catch (InvalidParameterException e) { 85 Debug.print(e.getMessage()); 86 87 } catch (RemoteException e) { 89 Debug.print(e.getMessage()); 90 91 } catch (CustomerNotFoundException e) { 93 Debug.print(e.getMessage()); 94 95 } 97 98 Debug.print(cd.getCustomerId()); 99 100 return cd; 101 } 102 103 public AccountDetails getAccountDetails() { 104 AccountDetails ad = null; 105 106 try { 107 ad = beanManager.getAccountController() 108 .getDetails(this.account); 109 } catch (InvalidParameterException e) { 110 Debug.print(e.getMessage()); 111 112 } catch (RemoteException e) { 114 Debug.print(e.getMessage()); 115 116 } catch (AccountNotFoundException e) { 118 Debug.print(e.getMessage()); 119 120 } 122 123 Debug.print(ad.getAccountId()); 124 125 return ad; 126 } 127 128 public ArrayList getAccounts() { 129 ArrayList accounts = null; 130 131 try { 132 accounts = 133 beanManager.getAccountController() 134 .getAccountsOfCustomer(this.customer); 135 } catch (InvalidParameterException e) { 136 } catch (RemoteException e) { 138 } catch (AccountNotFoundException e) { 140 } 142 143 return accounts; 144 } 145 146 public void destroy() { 147 beanManager = null; 148 customer = null; 149 account = null; 150 } 151 } 152 | Popular Tags |