View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.paneris.bibliomania.generated;
4   
5   
6   import java.util.Collections;
7   import java.util.Enumeration;
8   import java.util.List;
9   import org.melati.poem.AccessPoemException;
10  import org.melati.poem.CachedSelection;
11  import org.melati.poem.Column;
12  import org.melati.poem.Field;
13  import org.melati.poem.JdbcPersistent;
14  import org.melati.poem.ValidationPoemException;
15  import org.melati.poem.util.EmptyEnumeration;
16  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
17  import org.paneris.bibliomania.Currency;
18  import org.paneris.bibliomania.CurrencyTable;
19  import org.paneris.bibliomania.ShopOrder;
20  
21  
22  /**
23   * Melati POEM generated abstract base class for a <code>Persistent</code> 
24   * <code>Currency</code> Object.
25   *
26   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
27   */
28  public abstract class CurrencyBase extends JdbcPersistent {
29  
30  
31   /**
32    * Retrieves the Database object.
33    * 
34    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
35    * @return the database
36    */
37    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
38      return (BibliomaniaDatabaseTables)getDatabase();
39    }
40  
41  
42   /**
43    * Retrieves the  <code>CurrencyTable</code> table 
44    * which this <code>Persistent</code> is from.
45    * 
46    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
47    * @return the CurrencyTable
48    */
49    @SuppressWarnings("unchecked")
50    public CurrencyTable<Currency> getCurrencyTable() {
51      return (CurrencyTable<Currency>)getTable();
52    }
53  
54    @SuppressWarnings("unchecked")
55    private CurrencyTable<Currency> _getCurrencyTable() {
56      return (CurrencyTable<Currency>)getTable();
57    }
58  
59    // Fields in this table 
60   /**
61    * id 
62    */
63    protected Integer id;
64   /**
65    * Currency name - The name of the currency 
66    */
67    protected String name;
68   /**
69    * Conversion Rate - The rate at which UK Pounds Sterling are converted into 
70    * this currency 
71    */
72    protected Double conversionrate;
73   /**
74    * Currency locale - The locale of the currency for formatting 
75    */
76    protected String locale;
77  
78  
79   /**
80    * Retrieves the <code>Id</code> value, without locking, 
81    * for this <code>Currency</code> <code>Persistent</code>.
82    *
83    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
84    * @return the Integer id
85    */
86    public Integer getId_unsafe() {
87      return id;
88    }
89  
90  
91   /**
92    * Sets the <code>Id</code> value directly, without checking, 
93    * for this Currency <code>Persistent</code>.
94    * 
95    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
96    * @param cooked  the pre-validated value to set
97    */
98    public void setId_unsafe(Integer cooked) {
99      id = cooked;
100   }
101 
102  /**
103   * Retrieves the Id value, with locking, for this 
104   * <code>Currency</code> <code>Persistent</code>.
105   * 
106   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
107   * @throws AccessPoemException 
108   *         if the current <code>AccessToken</code> 
109   *         does not confer write access rights 
110   * @return the value of the field <code>Id</code> for this 
111   *         <code>Currency</code> <code>Persistent</code>  
112   */
113 
114   public Integer getId()
115       throws AccessPoemException {
116     readLock();
117     return getId_unsafe();
118   }
119 
120 
121  /**
122   * Sets the <code>Id</code> value, with checking, for this 
123   * <code>Currency</code> <code>Persistent</code>.
124   * 
125   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
126   * @param cooked  a validated <code>int</code> 
127   * @throws AccessPoemException 
128   *         if the current <code>AccessToken</code> 
129   *         does not confer write access rights
130   * @throws ValidationPoemException 
131   *         if the value is not valid
132   */
133   public void setId(Integer cooked)
134       throws AccessPoemException, ValidationPoemException {
135     _getCurrencyTable().getIdColumn().
136       getType().assertValidCooked(cooked);
137     writeLock();
138     setId_unsafe(cooked);
139   }
140 
141  /**
142   * Sets the <code>Id</code> value, with checking, for this 
143   * <code>Currency</code> <code>Persistent</code>.
144   * 
145   * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
146   * @param cooked  a validated <code>int</code>
147   * @throws AccessPoemException 
148   *         if the current <code>AccessToken</code> 
149   *         does not confer write access rights
150   * @throws ValidationPoemException 
151   *         if the value is not valid
152   */
153 
154   public final void setId(int cooked)
155       throws AccessPoemException, ValidationPoemException {
156     setId(new Integer(cooked));
157   }
158 
159 
160  /**
161   * Retrieves the <code>Id</code> value as a <code>Field</code>
162   * from this <code>Currency</code> <code>Persistent</code>.
163   * 
164   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
165   * @throws AccessPoemException 
166   *         if the current <code>AccessToken</code> 
167   *         does not confer write access rights
168   * @return the Integer id
169   */
170   public Field<Integer> getIdField() throws AccessPoemException {
171     Column<Integer> c = _getCurrencyTable().getIdColumn();
172     return new Field<Integer>((Integer)c.getRaw(this), c);
173   }
174 
175 
176  /**
177   * Retrieves the <code>Name</code> value, without locking, 
178   * for this <code>Currency</code> <code>Persistent</code>.
179   *
180   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
181   * @return the String name
182   */
183   public String getName_unsafe() {
184     return name;
185   }
186 
187 
188  /**
189   * Sets the <code>Name</code> value directly, without checking, 
190   * for this Currency <code>Persistent</code>.
191   * 
192   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
193   * @param cooked  the pre-validated value to set
194   */
195   public void setName_unsafe(String cooked) {
196     name = cooked;
197   }
198 
199  /**
200   * Retrieves the Name value, with locking, for this 
201   * <code>Currency</code> <code>Persistent</code>.
202   * Field description: 
203   *   The name of the currency 
204   * 
205   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
206   * @throws AccessPoemException 
207   *         if the current <code>AccessToken</code> 
208   *         does not confer write access rights 
209   * @return the value of the field <code>Name</code> for this 
210   *         <code>Currency</code> <code>Persistent</code>  
211   */
212 
213   public String getName()
214       throws AccessPoemException {
215     readLock();
216     return getName_unsafe();
217   }
218 
219 
220  /**
221   * Sets the <code>Name</code> value, with checking, for this 
222   * <code>Currency</code> <code>Persistent</code>.
223   * Field description: 
224   *   The name of the currency 
225   * 
226   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
227   * @param cooked  a validated <code>int</code> 
228   * @throws AccessPoemException 
229   *         if the current <code>AccessToken</code> 
230   *         does not confer write access rights
231   * @throws ValidationPoemException 
232   *         if the value is not valid
233   */
234   public void setName(String cooked)
235       throws AccessPoemException, ValidationPoemException {
236     _getCurrencyTable().getNameColumn().
237       getType().assertValidCooked(cooked);
238     writeLock();
239     setName_unsafe(cooked);
240   }
241 
242 
243  /**
244   * Retrieves the <code>Name</code> value as a <code>Field</code>
245   * from this <code>Currency</code> <code>Persistent</code>.
246   * 
247   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
248   * @throws AccessPoemException 
249   *         if the current <code>AccessToken</code> 
250   *         does not confer write access rights
251   * @return the String name
252   */
253   public Field<String> getNameField() throws AccessPoemException {
254     Column<String> c = _getCurrencyTable().getNameColumn();
255     return new Field<String>((String)c.getRaw(this), c);
256   }
257 
258 
259  /**
260   * Retrieves the <code>Conversionrate</code> value, without locking, 
261   * for this <code>Currency</code> <code>Persistent</code>.
262   *
263   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
264   * @return the Double conversionrate
265   */
266   public Double getConversionrate_unsafe() {
267     return conversionrate;
268   }
269 
270 
271  /**
272   * Sets the <code>Conversionrate</code> value directly, without checking, 
273   * for this Currency <code>Persistent</code>.
274   * 
275   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
276   * @param cooked  the pre-validated value to set
277   */
278   public void setConversionrate_unsafe(Double cooked) {
279     conversionrate = cooked;
280   }
281 
282  /**
283   * Retrieves the Conversionrate value, with locking, for this 
284   * <code>Currency</code> <code>Persistent</code>.
285   * Field description: 
286   *   The rate at which UK Pounds Sterling are converted into this currency 
287   * 
288   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
289   * @throws AccessPoemException 
290   *         if the current <code>AccessToken</code> 
291   *         does not confer write access rights 
292   * @return the value of the field <code>Conversionrate</code> for this 
293   *         <code>Currency</code> <code>Persistent</code>  
294   */
295 
296   public Double getConversionrate()
297       throws AccessPoemException {
298     readLock();
299     return getConversionrate_unsafe();
300   }
301 
302 
303  /**
304   * Sets the <code>Conversionrate</code> value, with checking, for this 
305   * <code>Currency</code> <code>Persistent</code>.
306   * Field description: 
307   *   The rate at which UK Pounds Sterling are converted into this currency 
308   * 
309   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
310   * @param cooked  a validated <code>int</code> 
311   * @throws AccessPoemException 
312   *         if the current <code>AccessToken</code> 
313   *         does not confer write access rights
314   * @throws ValidationPoemException 
315   *         if the value is not valid
316   */
317   public void setConversionrate(Double cooked)
318       throws AccessPoemException, ValidationPoemException {
319     _getCurrencyTable().getConversionrateColumn().
320       getType().assertValidCooked(cooked);
321     writeLock();
322     setConversionrate_unsafe(cooked);
323   }
324 
325  /**
326   * Sets the <code>Conversionrate</code> value, with checking, for this <code>Currency</code> <code>Persistent</code>.
327   * Field description: 
328   *   The rate at which UK Pounds Sterling are converted into this currency 
329   * 
330   * 
331   * Generated by org.melati.poem.prepro.DoubleFieldDef#generateBaseMethods 
332   * @param cooked  a validated <code>int</code> 
333   * @throws AccessPoemException 
334   *         if the current <code>AccessToken</code> 
335   *         does not confer write access rights
336   * @throws ValidationPoemException 
337   *         if the value is not valid
338   */
339 
340   public final void setConversionrate(double cooked)
341       throws AccessPoemException, ValidationPoemException {
342     setConversionrate(new Double(cooked));
343   }
344 
345 
346  /**
347   * Retrieves the <code>Conversionrate</code> value as a <code>Field</code>
348   * from this <code>Currency</code> <code>Persistent</code>.
349   * 
350   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
351   * @throws AccessPoemException 
352   *         if the current <code>AccessToken</code> 
353   *         does not confer write access rights
354   * @return the Double conversionrate
355   */
356   public Field<Double> getConversionrateField() throws AccessPoemException {
357     Column<Double> c = _getCurrencyTable().getConversionrateColumn();
358     return new Field<Double>((Double)c.getRaw(this), c);
359   }
360 
361 
362  /**
363   * Retrieves the <code>Locale</code> value, without locking, 
364   * for this <code>Currency</code> <code>Persistent</code>.
365   *
366   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
367   * @return the String locale
368   */
369   public String getLocale_unsafe() {
370     return locale;
371   }
372 
373 
374  /**
375   * Sets the <code>Locale</code> value directly, without checking, 
376   * for this Currency <code>Persistent</code>.
377   * 
378   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
379   * @param cooked  the pre-validated value to set
380   */
381   public void setLocale_unsafe(String cooked) {
382     locale = cooked;
383   }
384 
385  /**
386   * Retrieves the Locale value, with locking, for this 
387   * <code>Currency</code> <code>Persistent</code>.
388   * Field description: 
389   *   The locale of the currency for formatting 
390   * 
391   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
392   * @throws AccessPoemException 
393   *         if the current <code>AccessToken</code> 
394   *         does not confer write access rights 
395   * @return the value of the field <code>Locale</code> for this 
396   *         <code>Currency</code> <code>Persistent</code>  
397   */
398 
399   public String getLocale()
400       throws AccessPoemException {
401     readLock();
402     return getLocale_unsafe();
403   }
404 
405 
406  /**
407   * Sets the <code>Locale</code> value, with checking, for this 
408   * <code>Currency</code> <code>Persistent</code>.
409   * Field description: 
410   *   The locale of the currency for formatting 
411   * 
412   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
413   * @param cooked  a validated <code>int</code> 
414   * @throws AccessPoemException 
415   *         if the current <code>AccessToken</code> 
416   *         does not confer write access rights
417   * @throws ValidationPoemException 
418   *         if the value is not valid
419   */
420   public void setLocale(String cooked)
421       throws AccessPoemException, ValidationPoemException {
422     _getCurrencyTable().getLocaleColumn().
423       getType().assertValidCooked(cooked);
424     writeLock();
425     setLocale_unsafe(cooked);
426   }
427 
428 
429  /**
430   * Retrieves the <code>Locale</code> value as a <code>Field</code>
431   * from this <code>Currency</code> <code>Persistent</code>.
432   * 
433   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
434   * @throws AccessPoemException 
435   *         if the current <code>AccessToken</code> 
436   *         does not confer write access rights
437   * @return the String locale
438   */
439   public Field<String> getLocaleField() throws AccessPoemException {
440     Column<String> c = _getCurrencyTable().getLocaleColumn();
441     return new Field<String>((String)c.getRaw(this), c);
442   }
443 
444   private CachedSelection<ShopOrder> currencyShopOrders = null;
445   /** References to this Currency in the ShopOrder table via its currency field.*/
446   @SuppressWarnings("unchecked")
447   public Enumeration<ShopOrder> getCurrencyShopOrders() {
448     if (getTroid() == null)
449       return new EmptyEnumeration<ShopOrder>();
450     else {
451       if (currencyShopOrders == null)
452         currencyShopOrders =
453           getBibliomaniaDatabaseTables().getShopOrderTable().getCurrencyColumn().cachedSelectionWhereEq(getTroid());
454       return currencyShopOrders.objects();
455     }
456   }
457 
458 
459   /** References to this Currency in the ShopOrder table via its currency field, as a List.*/
460   public List<ShopOrder> getCurrencyShopOrderList() {
461     return Collections.list(getCurrencyShopOrders());
462   }
463 
464 
465 
466 }
467