1 22 package org.jboss.test.bank.ejb; 23 24 import java.rmi.RemoteException ; 25 import javax.ejb.CreateException ; 26 27 import org.jboss.test.bank.interfaces.AccountData; 28 import org.jboss.test.bank.interfaces.Customer; 29 30 36 public class AccountBeanCMP 37 extends AccountBean 38 { 39 41 public String id; 43 public float balance; 44 public Customer owner; 45 46 private boolean dirty; 47 48 50 52 public String getId() 54 { 55 return id; 56 } 57 58 public void setId(String id) 59 { 60 this.id = id; 61 dirty = true; 62 } 63 64 public float getBalance() 65 { 66 return balance; 67 } 68 69 public void setBalance(float balance) 70 { 71 this.balance = balance; 72 dirty = true; 73 } 74 75 public Customer getOwner() 76 { 77 return owner; 78 } 79 80 public void setOwner(Customer owner) 81 { 82 this.owner = owner; 83 dirty = true; 84 } 85 86 public void setData(AccountData data) 87 { 88 setBalance(data.getBalance()); 89 setOwner(data.getOwner()); 90 } 91 92 public AccountData getData() 93 { 94 AccountData data = new AccountData(); 95 data.setId(id); 96 data.setBalance(balance); 97 data.setOwner(owner); 98 return data; 99 } 100 101 public boolean isModified() 102 { 103 return dirty; 104 } 105 106 public String ejbCreate(AccountData data) 108 throws RemoteException , CreateException 109 { 110 setId(data.id); 111 setData(data); 112 dirty = false; 113 return null; 114 } 115 116 public void ejbPostCreate(AccountData data) 117 throws RemoteException , CreateException 118 { 119 } 120 121 public void ejbLoad() 122 throws RemoteException 123 { 124 super.ejbLoad(); 125 dirty = false; 126 } 127 } 128 129 149 | Popular Tags |