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.BooleanPoemType;
8   import org.melati.poem.Column;
9   import org.melati.poem.Database;
10  import org.melati.poem.DefinitionSource;
11  import org.melati.poem.DisplayLevel;
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.Bookshop;
23  
24  
25  /**
26   * Melati POEM generated base class for <code>Table</code> <code>Bookshop</code>.
27   *
28   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
29   */
30  
31  public class BookshopTableBase<T extends Bookshop> extends BibliomaniaTable<T> {
32  
33    private Column<Integer> col_id = null;
34    private Column<String> col_code = null;
35    private Column<String> col_displayname = null;
36    private Column<String> col_flagfilename = null;
37    private Column<Boolean> col_disabled = null;
38  
39   /**
40    * Constructor. 
41    * 
42    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
43    * @param database          the POEM database we are using
44    * @param name              the name of this <code>Table</code>
45    * @param definitionSource  which definition is being used
46    * @throws PoemException    if anything goes wrong
47    */
48  
49    public BookshopTableBase(
50        Database database, String name,
51        DefinitionSource definitionSource) throws PoemException {
52      super(database, name, definitionSource);
53    }
54  
55  
56   /**
57    * Get the database tables.
58    *
59    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
60    * @return the database tables
61    */
62    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
63      return (BibliomaniaDatabaseTables)getDatabase();
64    }
65  
66  
67   /**
68    * Initialise this table by defining its columns.
69    *
70    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
71    */
72    public void init() throws PoemException {
73      super.init();
74      defineColumn(col_id =
75          new Column<Integer>(this, "id",
76                     new TroidPoemType(),
77                     DefinitionSource.dsd) { 
78            public Object getCooked(Persistent g)
79                throws AccessPoemException, PoemException {
80              return ((Bookshop)g).getId();
81            }
82  
83            public void setCooked(Persistent g, Object cooked)
84                throws AccessPoemException, ValidationPoemException {
85              ((Bookshop)g).setId((Integer)cooked);
86            }
87  
88            public Field<Integer> asField(Persistent g) {
89              return ((Bookshop)g).getIdField();
90            }
91  
92            public boolean defaultUserEditable() {
93              return false;
94            }
95  
96            public boolean defaultUserCreateable() {
97              return false;
98            }
99  
100           public DisplayLevel defaultDisplayLevel() {
101             return DisplayLevel.record;
102           }
103 
104           public int defaultDisplayOrder() {
105             return 0;
106           }
107 
108           public Object getRaw_unsafe(Persistent g)
109               throws AccessPoemException {
110             return ((Bookshop)g).getId_unsafe();
111           }
112 
113           public void setRaw_unsafe(Persistent g, Object raw)
114               throws AccessPoemException {
115             ((Bookshop)g).setId_unsafe((Integer)raw);
116           }
117 
118           public Object getRaw(Persistent g)
119               throws AccessPoemException {
120             return ((Bookshop)g).getId();
121           }
122 
123           public void setRaw(Persistent g, Object raw)
124               throws AccessPoemException {
125             ((Bookshop)g).setId((Integer)raw);
126           }
127         });
128 
129     defineColumn(col_code =
130         new Column<String>(this, "code",
131                    new StringPoemType(false, 10),
132                    DefinitionSource.dsd) { 
133           public Object getCooked(Persistent g)
134               throws AccessPoemException, PoemException {
135             return ((Bookshop)g).getCode();
136           }
137 
138           public void setCooked(Persistent g, Object cooked)
139               throws AccessPoemException, ValidationPoemException {
140             ((Bookshop)g).setCode((String)cooked);
141           }
142 
143           public Field<String> asField(Persistent g) {
144             return ((Bookshop)g).getCodeField();
145           }
146 
147           public boolean defaultUserEditable() {
148             return false;
149           }
150 
151           public DisplayLevel defaultDisplayLevel() {
152             return DisplayLevel.record;
153           }
154 
155           public int defaultDisplayOrder() {
156             return 1;
157           }
158 
159           public String defaultDescription() {
160             return "The system codename for the shop: must be BOB for blackwell.co.uk, BOLUK for uk.bol.com";
161           }
162 
163           public boolean defaultUnique() {
164             return true;
165           }
166 
167           public Object getRaw_unsafe(Persistent g)
168               throws AccessPoemException {
169             return ((Bookshop)g).getCode_unsafe();
170           }
171 
172           public void setRaw_unsafe(Persistent g, Object raw)
173               throws AccessPoemException {
174             ((Bookshop)g).setCode_unsafe((String)raw);
175           }
176 
177           public Object getRaw(Persistent g)
178               throws AccessPoemException {
179             return ((Bookshop)g).getCode();
180           }
181 
182           public void setRaw(Persistent g, Object raw)
183               throws AccessPoemException {
184             ((Bookshop)g).setCode((String)raw);
185           }
186         });
187 
188     defineColumn(col_displayname =
189         new Column<String>(this, "displayname",
190                    new StringPoemType(false, -1),
191                    DefinitionSource.dsd) { 
192           public Object getCooked(Persistent g)
193               throws AccessPoemException, PoemException {
194             return ((Bookshop)g).getDisplayname();
195           }
196 
197           public void setCooked(Persistent g, Object cooked)
198               throws AccessPoemException, ValidationPoemException {
199             ((Bookshop)g).setDisplayname((String)cooked);
200           }
201 
202           public Field<String> asField(Persistent g) {
203             return ((Bookshop)g).getDisplaynameField();
204           }
205 
206           public DisplayLevel defaultDisplayLevel() {
207             return DisplayLevel.primary;
208           }
209 
210           public Searchability defaultSearchability() {
211             return Searchability.primary;
212           }
213 
214           public String defaultDisplayName() {
215             return "Display name";
216           }
217 
218           public int defaultDisplayOrder() {
219             return 2;
220           }
221 
222           public String defaultDescription() {
223             return "A display name for the bookshop";
224           }
225 
226           public Object getRaw_unsafe(Persistent g)
227               throws AccessPoemException {
228             return ((Bookshop)g).getDisplayname_unsafe();
229           }
230 
231           public void setRaw_unsafe(Persistent g, Object raw)
232               throws AccessPoemException {
233             ((Bookshop)g).setDisplayname_unsafe((String)raw);
234           }
235 
236           public Object getRaw(Persistent g)
237               throws AccessPoemException {
238             return ((Bookshop)g).getDisplayname();
239           }
240 
241           public void setRaw(Persistent g, Object raw)
242               throws AccessPoemException {
243             ((Bookshop)g).setDisplayname((String)raw);
244           }
245         });
246 
247     defineColumn(col_flagfilename =
248         new Column<String>(this, "flagfilename",
249                    new StringPoemType(true, -1),
250                    DefinitionSource.dsd) { 
251           public Object getCooked(Persistent g)
252               throws AccessPoemException, PoemException {
253             return ((Bookshop)g).getFlagfilename();
254           }
255 
256           public void setCooked(Persistent g, Object cooked)
257               throws AccessPoemException, ValidationPoemException {
258             ((Bookshop)g).setFlagfilename((String)cooked);
259           }
260 
261           public Field<String> asField(Persistent g) {
262             return ((Bookshop)g).getFlagfilenameField();
263           }
264 
265           public DisplayLevel defaultDisplayLevel() {
266             return DisplayLevel.record;
267           }
268 
269           public Searchability defaultSearchability() {
270             return Searchability.no;
271           }
272 
273           public String defaultDisplayName() {
274             return "Flag image name";
275           }
276 
277           public int defaultDisplayOrder() {
278             return 3;
279           }
280 
281           public String defaultDescription() {
282             return "The name of a flag image file in bibliomania/html/graphics to be displayed next to the bookshop's stockings";
283           }
284 
285           public Object getRaw_unsafe(Persistent g)
286               throws AccessPoemException {
287             return ((Bookshop)g).getFlagfilename_unsafe();
288           }
289 
290           public void setRaw_unsafe(Persistent g, Object raw)
291               throws AccessPoemException {
292             ((Bookshop)g).setFlagfilename_unsafe((String)raw);
293           }
294 
295           public Object getRaw(Persistent g)
296               throws AccessPoemException {
297             return ((Bookshop)g).getFlagfilename();
298           }
299 
300           public void setRaw(Persistent g, Object raw)
301               throws AccessPoemException {
302             ((Bookshop)g).setFlagfilename((String)raw);
303           }
304         });
305 
306     defineColumn(col_disabled =
307         new Column<Boolean>(this, "disabled",
308                    new BooleanPoemType(false),
309                    DefinitionSource.dsd) { 
310           public Object getCooked(Persistent g)
311               throws AccessPoemException, PoemException {
312             return ((Bookshop)g).getDisabled();
313           }
314 
315           public void setCooked(Persistent g, Object cooked)
316               throws AccessPoemException, ValidationPoemException {
317             ((Bookshop)g).setDisabled((Boolean)cooked);
318           }
319 
320           public Field<Boolean> asField(Persistent g) {
321             return ((Bookshop)g).getDisabledField();
322           }
323 
324           public DisplayLevel defaultDisplayLevel() {
325             return DisplayLevel.summary;
326           }
327 
328           public Searchability defaultSearchability() {
329             return Searchability.no;
330           }
331 
332           public int defaultDisplayOrder() {
333             return 4;
334           }
335 
336           public String defaultDescription() {
337             return "Whether the shop should currently be excluded from searches (takes effect next time server restarted)";
338           }
339 
340           public Object getRaw_unsafe(Persistent g)
341               throws AccessPoemException {
342             return ((Bookshop)g).getDisabled_unsafe();
343           }
344 
345           public void setRaw_unsafe(Persistent g, Object raw)
346               throws AccessPoemException {
347             ((Bookshop)g).setDisabled_unsafe((Boolean)raw);
348           }
349 
350           public Object getRaw(Persistent g)
351               throws AccessPoemException {
352             return ((Bookshop)g).getDisabled();
353           }
354 
355           public void setRaw(Persistent g, Object raw)
356               throws AccessPoemException {
357             ((Bookshop)g).setDisabled((Boolean)raw);
358           }
359         });
360   }
361 
362 
363  /**
364   * Retrieves the <code>Id</code> <code>Column</code> for this 
365   * <code>Bookshop</code> <code>Table</code>.
366   * 
367   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
368   * @return the id <code>Column</code>
369   */
370   public final Column<Integer> getIdColumn() {
371     return col_id;
372   }
373 
374 
375  /**
376   * Retrieves the <code>Code</code> <code>Column</code> for this 
377   * <code>Bookshop</code> <code>Table</code>.
378   * 
379   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
380   * @return the code <code>Column</code>
381   */
382   public final Column<String> getCodeColumn() {
383     return col_code;
384   }
385 
386 
387  /**
388   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
389   * <code>Bookshop</code> <code>Table</code>.
390   * 
391   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
392   * @return the displayname <code>Column</code>
393   */
394   public final Column<String> getDisplaynameColumn() {
395     return col_displayname;
396   }
397 
398 
399  /**
400   * Retrieves the <code>Flagfilename</code> <code>Column</code> for this 
401   * <code>Bookshop</code> <code>Table</code>.
402   * 
403   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
404   * @return the flagfilename <code>Column</code>
405   */
406   public final Column<String> getFlagfilenameColumn() {
407     return col_flagfilename;
408   }
409 
410 
411  /**
412   * Retrieves the <code>Disabled</code> <code>Column</code> for this 
413   * <code>Bookshop</code> <code>Table</code>.
414   * 
415   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
416   * @return the disabled <code>Column</code>
417   */
418   public final Column<Boolean> getDisabledColumn() {
419     return col_disabled;
420   }
421 
422 
423  /**
424   * Retrieve the <code>Bookshop</code> as a <code>Bookshop</code>.
425   *
426   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
427   * @param troid a Table Row Oject ID
428   * @return the <code>Persistent</code> identified by the <code>troid</code>
429   */
430   public Bookshop getBookshopObject(Integer troid) {
431     return (Bookshop)getObject(troid);
432   }
433 
434 
435  /**
436   * Retrieve the <code>Bookshop</code> 
437   * as a <code>Bookshop</code>.
438   *
439   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
440   * @param troid a Table Row Object ID
441   * @return the <code>Persistent</code> identified   */
442   public Bookshop getBookshopObject(int troid) {
443     return (Bookshop)getObject(troid);
444   }
445 
446   protected JdbcPersistent _newPersistent() {
447     return new Bookshop();
448   }
449   public String defaultDescription() {
450     return "An online bookshop";
451   }
452 
453   public String defaultCategory() {
454     return "Comparison Shopper";
455   }
456 
457   public int defaultDisplayOrder() {
458     return 1300;
459   }
460 }
461