1 10 package net.sourceforge.ejosa.piggybank.business.entity; 11 12 14 import net.sourceforge.ejosa.piggybank.business.*; 15 import net.sourceforge.ejosa.piggybank.data.coin.*; 16 import net.sourceforge.ejosa.piggybank.spec.business.*; 17 import net.sourceforge.ejosa.piggybank.spec.*; 18 19 20 26 public class CoinImpl implements Coin { 27 protected CoinDO myDO = null; 29 30 public String id; 32 33 public String date; 35 public String amount; 36 public String currency; 37 38 41 public CoinImpl() throws CoinException { 42 try { 43 this.myDO = CoinDO.createVirgin(); 44 } catch (Exception ex) { 45 System.out.println("Exception: " + ex); 46 } 48 } 49 50 53 public CoinImpl(CoinDO theCoin) throws CoinException { 54 try { 55 this.myDO = theCoin; 56 } catch (Exception ex) { 57 System.out.println("Exception: " + ex); 58 } 60 } 61 62 65 public CoinImpl(String id) throws CoinException { 66 try { 67 this.id = id; 68 } catch (Exception ex) { 69 System.out.println("Exception: " + ex); 70 } 72 } 73 74 public String getHandle() throws CoinException { 75 try { 76 return this.myDO.getHandle(); 77 } catch (Exception ex) { 78 System.out.println("Exception: " + ex); 79 return null; 81 } 82 } 83 84 90 public String getId() throws CoinException { 91 try { 92 id = myDO.getID(); 93 return id; 94 } catch (Exception ex) { 95 System.out.println("Exception: " + ex); 96 return null; 98 } 99 } 100 101 107 public void setId(String id) throws CoinException { 108 try { 109 this.id = id; 110 this.myDO.setID(id); 111 } catch (Exception ex) { 112 System.out.println("Exception: " + ex); 113 } 115 } 116 117 123 public String getDate() throws CoinException { 124 try { 125 date = myDO.getDATE(); 126 return date; 127 } catch (Exception ex) { 128 System.out.println("Exception: " + ex); 129 return null; 131 } 132 } 133 134 140 public void setDate(String inputDate) throws CoinException { 141 try { 142 date = inputDate; 143 this.myDO.setDATE(inputDate); 144 } catch (Exception ex) { 145 System.out.println("Exception: " + ex); 146 } 148 } 149 150 156 public String getAmount() throws CoinException { 157 try { 158 amount = myDO.getAMOUNT(); 159 return amount; 160 } catch (Exception ex) { 161 System.out.println("Exception: " + ex); 162 return null; 164 } 165 } 166 167 173 public void setAmount(String amount) throws CoinException { 174 try { 175 this.amount = amount; 176 this.myDO.setAMOUNT(amount); 177 } catch (Exception ex) { 178 System.out.println("Exception: " + ex); 179 } 181 } 182 183 189 public String getCurrency() throws CoinException { 190 try { 191 currency = myDO.getCURENCY(); 192 return currency; 193 } catch (Exception ex) { 194 System.out.println("Exception: " + ex); 195 return null; 197 } 198 } 199 200 206 public void setCurrency(String currency) throws CoinException { 207 try { 208 this.currency = currency; 209 this.myDO.setCURENCY(currency); 210 } catch (Exception ex) { 211 System.out.println("Exception: " + ex); 212 } 214 } 215 216 223 public void save() throws CoinException { 224 try { 225 this.myDO.commit(); 226 } catch(Exception ex) { 227 System.out.println("Exception: " + ex); 228 } 230 } 231 232 239 public void delete() throws CoinException { 240 try { 241 this.myDO.delete(); 242 } catch(Exception ex) { 243 System.out.println("Exception: " + ex); 244 } 246 } 247 } | Popular Tags |