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