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 org.melati.poem.AccessPoemException;
7   import org.melati.poem.Column;
8   import org.melati.poem.Database;
9   import org.melati.poem.DefinitionSource;
10  import org.melati.poem.DisplayLevel;
11  import org.melati.poem.DoublePoemType;
12  import org.melati.poem.Field;
13  import org.melati.poem.JdbcPersistent;
14  import org.melati.poem.Persistent;
15  import org.melati.poem.PoemException;
16  import org.melati.poem.Searchability;
17  import org.melati.poem.StringPoemType;
18  import org.melati.poem.TroidPoemType;
19  import org.melati.poem.ValidationPoemException;
20  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
21  import org.paneris.bibliomania.BibliomaniaTable;
22  import org.paneris.bibliomania.Currency;
23  
24  
25  /**
26   * Melati POEM generated base class for <code>Table</code> <code>Currency</code>.
27   *
28   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
29   */
30  
31  public class CurrencyTableBase<T extends Currency> extends BibliomaniaTable<T> {
32  
33    private Column<Integer> col_id = null;
34    private Column<String> col_name = null;
35    private Column<Double> col_conversionrate = null;
36    private Column<String> col_locale = null;
37  
38   /**
39    * Constructor. 
40    * 
41    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
42    * @param database          the POEM database we are using
43    * @param name              the name of this <code>Table</code>
44    * @param definitionSource  which definition is being used
45    * @throws PoemException    if anything goes wrong
46    */
47  
48    public CurrencyTableBase(
49        Database database, String name,
50        DefinitionSource definitionSource) throws PoemException {
51      super(database, name, definitionSource);
52    }
53  
54  
55   /**
56    * Get the database tables.
57    *
58    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
59    * @return the database tables
60    */
61    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
62      return (BibliomaniaDatabaseTables)getDatabase();
63    }
64  
65  
66   /**
67    * Initialise this table by defining its columns.
68    *
69    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
70    */
71    public void init() throws PoemException {
72      super.init();
73      defineColumn(col_id =
74          new Column<Integer>(this, "id",
75                     new TroidPoemType(),
76                     DefinitionSource.dsd) { 
77            public Object getCooked(Persistent g)
78                throws AccessPoemException, PoemException {
79              return ((Currency)g).getId();
80            }
81  
82            public void setCooked(Persistent g, Object cooked)
83                throws AccessPoemException, ValidationPoemException {
84              ((Currency)g).setId((Integer)cooked);
85            }
86  
87            public Field<Integer> asField(Persistent g) {
88              return ((Currency)g).getIdField();
89            }
90  
91            public boolean defaultUserEditable() {
92              return false;
93            }
94  
95            public boolean defaultUserCreateable() {
96              return false;
97            }
98  
99            public DisplayLevel defaultDisplayLevel() {
100             return DisplayLevel.record;
101           }
102 
103           public int defaultDisplayOrder() {
104             return 0;
105           }
106 
107           public Object getRaw_unsafe(Persistent g)
108               throws AccessPoemException {
109             return ((Currency)g).getId_unsafe();
110           }
111 
112           public void setRaw_unsafe(Persistent g, Object raw)
113               throws AccessPoemException {
114             ((Currency)g).setId_unsafe((Integer)raw);
115           }
116 
117           public Object getRaw(Persistent g)
118               throws AccessPoemException {
119             return ((Currency)g).getId();
120           }
121 
122           public void setRaw(Persistent g, Object raw)
123               throws AccessPoemException {
124             ((Currency)g).setId((Integer)raw);
125           }
126         });
127 
128     defineColumn(col_name =
129         new Column<String>(this, "name",
130                    new StringPoemType(false, -1),
131                    DefinitionSource.dsd) { 
132           public Object getCooked(Persistent g)
133               throws AccessPoemException, PoemException {
134             return ((Currency)g).getName();
135           }
136 
137           public void setCooked(Persistent g, Object cooked)
138               throws AccessPoemException, ValidationPoemException {
139             ((Currency)g).setName((String)cooked);
140           }
141 
142           public Field<String> asField(Persistent g) {
143             return ((Currency)g).getNameField();
144           }
145 
146           public DisplayLevel defaultDisplayLevel() {
147             return DisplayLevel.primary;
148           }
149 
150           public Searchability defaultSearchability() {
151             return Searchability.primary;
152           }
153 
154           public String defaultDisplayName() {
155             return "Currency name";
156           }
157 
158           public int defaultDisplayOrder() {
159             return 1;
160           }
161 
162           public String defaultDescription() {
163             return "The name of the currency";
164           }
165 
166           public Object getRaw_unsafe(Persistent g)
167               throws AccessPoemException {
168             return ((Currency)g).getName_unsafe();
169           }
170 
171           public void setRaw_unsafe(Persistent g, Object raw)
172               throws AccessPoemException {
173             ((Currency)g).setName_unsafe((String)raw);
174           }
175 
176           public Object getRaw(Persistent g)
177               throws AccessPoemException {
178             return ((Currency)g).getName();
179           }
180 
181           public void setRaw(Persistent g, Object raw)
182               throws AccessPoemException {
183             ((Currency)g).setName((String)raw);
184           }
185         });
186 
187     defineColumn(col_conversionrate =
188         new Column<Double>(this, "conversionrate",
189                    new DoublePoemType(false),
190                    DefinitionSource.dsd) { 
191           public Object getCooked(Persistent g)
192               throws AccessPoemException, PoemException {
193             return ((Currency)g).getConversionrate();
194           }
195 
196           public void setCooked(Persistent g, Object cooked)
197               throws AccessPoemException, ValidationPoemException {
198             ((Currency)g).setConversionrate((Double)cooked);
199           }
200 
201           public Field<Double> asField(Persistent g) {
202             return ((Currency)g).getConversionrateField();
203           }
204 
205           public DisplayLevel defaultDisplayLevel() {
206             return DisplayLevel.summary;
207           }
208 
209           public Searchability defaultSearchability() {
210             return Searchability.no;
211           }
212 
213           public String defaultDisplayName() {
214             return "Conversion Rate";
215           }
216 
217           public int defaultDisplayOrder() {
218             return 2;
219           }
220 
221           public String defaultDescription() {
222             return "The rate at which UK Pounds Sterling are converted into this currency";
223           }
224 
225           public Object getRaw_unsafe(Persistent g)
226               throws AccessPoemException {
227             return ((Currency)g).getConversionrate_unsafe();
228           }
229 
230           public void setRaw_unsafe(Persistent g, Object raw)
231               throws AccessPoemException {
232             ((Currency)g).setConversionrate_unsafe((Double)raw);
233           }
234 
235           public Object getRaw(Persistent g)
236               throws AccessPoemException {
237             return ((Currency)g).getConversionrate();
238           }
239 
240           public void setRaw(Persistent g, Object raw)
241               throws AccessPoemException {
242             ((Currency)g).setConversionrate((Double)raw);
243           }
244         });
245 
246     defineColumn(col_locale =
247         new Column<String>(this, "locale",
248                    new StringPoemType(false, -1),
249                    DefinitionSource.dsd) { 
250           public Object getCooked(Persistent g)
251               throws AccessPoemException, PoemException {
252             return ((Currency)g).getLocale();
253           }
254 
255           public void setCooked(Persistent g, Object cooked)
256               throws AccessPoemException, ValidationPoemException {
257             ((Currency)g).setLocale((String)cooked);
258           }
259 
260           public Field<String> asField(Persistent g) {
261             return ((Currency)g).getLocaleField();
262           }
263 
264           public DisplayLevel defaultDisplayLevel() {
265             return DisplayLevel.summary;
266           }
267 
268           public Searchability defaultSearchability() {
269             return Searchability.no;
270           }
271 
272           public String defaultDisplayName() {
273             return "Currency locale";
274           }
275 
276           public int defaultDisplayOrder() {
277             return 3;
278           }
279 
280           public String defaultDescription() {
281             return "The locale of the currency for formatting";
282           }
283 
284           public Object getRaw_unsafe(Persistent g)
285               throws AccessPoemException {
286             return ((Currency)g).getLocale_unsafe();
287           }
288 
289           public void setRaw_unsafe(Persistent g, Object raw)
290               throws AccessPoemException {
291             ((Currency)g).setLocale_unsafe((String)raw);
292           }
293 
294           public Object getRaw(Persistent g)
295               throws AccessPoemException {
296             return ((Currency)g).getLocale();
297           }
298 
299           public void setRaw(Persistent g, Object raw)
300               throws AccessPoemException {
301             ((Currency)g).setLocale((String)raw);
302           }
303         });
304   }
305 
306 
307  /**
308   * Retrieves the <code>Id</code> <code>Column</code> for this 
309   * <code>Currency</code> <code>Table</code>.
310   * 
311   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
312   * @return the id <code>Column</code>
313   */
314   public final Column<Integer> getIdColumn() {
315     return col_id;
316   }
317 
318 
319  /**
320   * Retrieves the <code>Name</code> <code>Column</code> for this 
321   * <code>Currency</code> <code>Table</code>.
322   * 
323   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
324   * @return the name <code>Column</code>
325   */
326   public final Column<String> getNameColumn() {
327     return col_name;
328   }
329 
330 
331  /**
332   * Retrieves the <code>Conversionrate</code> <code>Column</code> for this 
333   * <code>Currency</code> <code>Table</code>.
334   * 
335   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
336   * @return the conversionrate <code>Column</code>
337   */
338   public final Column<Double> getConversionrateColumn() {
339     return col_conversionrate;
340   }
341 
342 
343  /**
344   * Retrieves the <code>Locale</code> <code>Column</code> for this 
345   * <code>Currency</code> <code>Table</code>.
346   * 
347   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
348   * @return the locale <code>Column</code>
349   */
350   public final Column<String> getLocaleColumn() {
351     return col_locale;
352   }
353 
354 
355  /**
356   * Retrieve the <code>Currency</code> as a <code>Currency</code>.
357   *
358   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
359   * @param troid a Table Row Oject ID
360   * @return the <code>Persistent</code> identified by the <code>troid</code>
361   */
362   public Currency getCurrencyObject(Integer troid) {
363     return (Currency)getObject(troid);
364   }
365 
366 
367  /**
368   * Retrieve the <code>Currency</code> 
369   * as a <code>Currency</code>.
370   *
371   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
372   * @param troid a Table Row Object ID
373   * @return the <code>Persistent</code> identified   */
374   public Currency getCurrencyObject(int troid) {
375     return (Currency)getObject(troid);
376   }
377 
378   protected JdbcPersistent _newPersistent() {
379     return new Currency();
380   }
381   public String defaultDisplayName() {
382     return "Currency";
383   }
384 
385   public String defaultDescription() {
386     return "A currency used for shopping";
387   }
388 
389   public boolean defaultRememberAllTroids() {
390     return true;
391   }
392 
393   public Integer defaultCacheLimit() {
394     return new Integer(999999999);
395   }
396 
397   public String defaultCategory() {
398     return "Shop";
399   }
400 
401   public int defaultDisplayOrder() {
402     return 1230;
403   }
404 }
405