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.sql.Timestamp;
7   import org.melati.poem.AccessPoemException;
8   import org.melati.poem.Column;
9   import org.melati.poem.Database;
10  import org.melati.poem.DefinitionSource;
11  import org.melati.poem.DeletedPoemType;
12  import org.melati.poem.DisplayLevel;
13  import org.melati.poem.Field;
14  import org.melati.poem.Persistent;
15  import org.melati.poem.PoemException;
16  import org.melati.poem.ReferencePoemType;
17  import org.melati.poem.Searchability;
18  import org.melati.poem.StringPoemType;
19  import org.melati.poem.TimestampPoemType;
20  import org.melati.poem.ValidationPoemException;
21  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
22  import org.paneris.bibliomania.BibliomaniaTable;
23  // FIXME extended table 
24  import org.paneris.bibliomania.Board;
25  import org.paneris.bibliomania.Layout;
26  import org.paneris.bibliomania.Unit;
27  
28  
29  /**
30   * Melati POEM generated base class for <code>Table</code> <code>Unit</code>.
31   *
32   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
33   */
34  
35  public class UnitTableBase<T extends Unit> extends BibliomaniaTable<T> {
36  
37    private Column<String> col_path = null;
38    private Column<Boolean> col_deleted = null;
39    private Column<Timestamp> col_lastencached = null;
40    private Column<Integer> col_layout = null;
41    private Column<Integer> col_messageboard = null;
42  
43   /**
44    * Constructor. 
45    * 
46    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
47    * @param database          the POEM database we are using
48    * @param name              the name of this <code>Table</code>
49    * @param definitionSource  which definition is being used
50    * @throws PoemException    if anything goes wrong
51    */
52  
53    public UnitTableBase(
54        Database database, String name,
55        DefinitionSource definitionSource) throws PoemException {
56      super(database, name, definitionSource);
57    }
58  
59  
60   /**
61    * Get the database tables.
62    *
63    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
64    * @return the database tables
65    */
66    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
67      return (BibliomaniaDatabaseTables)getDatabase();
68    }
69  
70  
71   /**
72    * Initialise this table by defining its columns.
73    *
74    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
75    */
76    public void init() throws PoemException {
77      super.init();
78      defineColumn(col_path =
79          new Column<String>(this, "path",
80                     new StringPoemType(false, -1),
81                     DefinitionSource.dsd) { 
82            public Object getCooked(Persistent g)
83                throws AccessPoemException, PoemException {
84              return ((Unit)g).getPath();
85            }
86  
87            public void setCooked(Persistent g, Object cooked)
88                throws AccessPoemException, ValidationPoemException {
89              ((Unit)g).setPath((String)cooked);
90            }
91  
92            public Field<String> asField(Persistent g) {
93              return ((Unit)g).getPathField();
94            }
95  
96            public DisplayLevel defaultDisplayLevel() {
97              return DisplayLevel.record;
98            }
99  
100           public int defaultDisplayOrder() {
101             return 0;
102           }
103 
104           public String defaultDescription() {
105             return "The path to this unit in the local filesystem, relative to the application's workspace";
106           }
107 
108           public Object getRaw_unsafe(Persistent g)
109               throws AccessPoemException {
110             return ((Unit)g).getPath_unsafe();
111           }
112 
113           public void setRaw_unsafe(Persistent g, Object raw)
114               throws AccessPoemException {
115             ((Unit)g).setPath_unsafe((String)raw);
116           }
117 
118           public Object getRaw(Persistent g)
119               throws AccessPoemException {
120             return ((Unit)g).getPath();
121           }
122 
123           public void setRaw(Persistent g, Object raw)
124               throws AccessPoemException {
125             ((Unit)g).setPath((String)raw);
126           }
127         });
128 
129     defineColumn(col_deleted =
130         new Column<Boolean>(this, "deleted",
131                    new DeletedPoemType(),
132                    DefinitionSource.dsd) { 
133           public Object getCooked(Persistent g)
134               throws AccessPoemException, PoemException {
135             return ((Unit)g).getDeleted();
136           }
137 
138           public void setCooked(Persistent g, Object cooked)
139               throws AccessPoemException, ValidationPoemException {
140             ((Unit)g).setDeleted((Boolean)cooked);
141           }
142 
143           public Field<Boolean> asField(Persistent g) {
144             return ((Unit)g).getDeletedField();
145           }
146 
147           public DisplayLevel defaultDisplayLevel() {
148             return DisplayLevel.record;
149           }
150 
151           public Searchability defaultSearchability() {
152             return Searchability.no;
153           }
154 
155           public int defaultDisplayOrder() {
156             return 1;
157           }
158 
159           public String defaultDescription() {
160             return "Whether or not to include this Unit";
161           }
162 
163           public boolean defaultIndexed() {
164             return true;
165           }
166 
167           public Object getRaw_unsafe(Persistent g)
168               throws AccessPoemException {
169             return ((Unit)g).getDeleted_unsafe();
170           }
171 
172           public void setRaw_unsafe(Persistent g, Object raw)
173               throws AccessPoemException {
174             ((Unit)g).setDeleted_unsafe((Boolean)raw);
175           }
176 
177           public Object getRaw(Persistent g)
178               throws AccessPoemException {
179             return ((Unit)g).getDeleted();
180           }
181 
182           public void setRaw(Persistent g, Object raw)
183               throws AccessPoemException {
184             ((Unit)g).setDeleted((Boolean)raw);
185           }
186         });
187 
188     defineColumn(col_lastencached =
189         new Column<Timestamp>(this, "lastencached",
190                    new TimestampPoemType(true),
191                    DefinitionSource.dsd) { 
192           public Object getCooked(Persistent g)
193               throws AccessPoemException, PoemException {
194             return ((Unit)g).getLastencached();
195           }
196 
197           public void setCooked(Persistent g, Object cooked)
198               throws AccessPoemException, ValidationPoemException {
199             ((Unit)g).setLastencached((Timestamp)cooked);
200           }
201 
202           public Field<Timestamp> asField(Persistent g) {
203             return ((Unit)g).getLastencachedField();
204           }
205 
206           public DisplayLevel defaultDisplayLevel() {
207             return DisplayLevel.record;
208           }
209 
210           public String defaultDisplayName() {
211             return "Last encached";
212           }
213 
214           public int defaultDisplayOrder() {
215             return 1000;
216           }
217 
218           public String defaultDescription() {
219             return "When the unit was encached; cleared when the unit is updated";
220           }
221 
222           public Object getRaw_unsafe(Persistent g)
223               throws AccessPoemException {
224             return ((Unit)g).getLastencached_unsafe();
225           }
226 
227           public void setRaw_unsafe(Persistent g, Object raw)
228               throws AccessPoemException {
229             ((Unit)g).setLastencached_unsafe((Timestamp)raw);
230           }
231 
232           public Object getRaw(Persistent g)
233               throws AccessPoemException {
234             return ((Unit)g).getLastencached();
235           }
236 
237           public void setRaw(Persistent g, Object raw)
238               throws AccessPoemException {
239             ((Unit)g).setLastencached((Timestamp)raw);
240           }
241         });
242 
243     defineColumn(col_layout =
244         new Column<Integer>(this, "layout",
245                    new ReferencePoemType(getBibliomaniaDatabaseTables().
246                                              getLayoutTable(), true),
247                    DefinitionSource.dsd) { 
248           public Object getCooked(Persistent g)
249               throws AccessPoemException, PoemException {
250             return ((Unit)g).getLayout();
251           }
252 
253           public void setCooked(Persistent g, Object cooked)
254               throws AccessPoemException, ValidationPoemException {
255             ((Unit)g).setLayout((Layout)cooked);
256           }
257 
258           public Field<Integer> asField(Persistent g) {
259             return ((Unit)g).getLayoutField();
260           }
261 
262           public DisplayLevel defaultDisplayLevel() {
263             return DisplayLevel.record;
264           }
265 
266           public int defaultDisplayOrder() {
267             return 1001;
268           }
269 
270           public String defaultDescription() {
271             return "The name of the layout for this Unit";
272           }
273 
274           public Object getRaw_unsafe(Persistent g)
275               throws AccessPoemException {
276             return ((Unit)g).getLayout_unsafe();
277           }
278 
279           public void setRaw_unsafe(Persistent g, Object raw)
280               throws AccessPoemException {
281             ((Unit)g).setLayout_unsafe((Integer)raw);
282           }
283 
284           public Object getRaw(Persistent g)
285               throws AccessPoemException {
286             return ((Unit)g).getLayoutTroid();
287           }
288 
289           public void setRaw(Persistent g, Object raw)
290               throws AccessPoemException {
291             ((Unit)g).setLayoutTroid((Integer)raw);
292           }
293         });
294 
295     defineColumn(col_messageboard =
296         new Column<Integer>(this, "messageboard",
297                    new ReferencePoemType(getBibliomaniaDatabaseTables().
298                                              getBoardTable(), true),
299                    DefinitionSource.dsd) { 
300           public Object getCooked(Persistent g)
301               throws AccessPoemException, PoemException {
302             return ((Unit)g).getMessageboard();
303           }
304 
305           public void setCooked(Persistent g, Object cooked)
306               throws AccessPoemException, ValidationPoemException {
307             ((Unit)g).setMessageboard((Board)cooked);
308           }
309 
310           public Field<Integer> asField(Persistent g) {
311             return ((Unit)g).getMessageboardField();
312           }
313 
314           public DisplayLevel defaultDisplayLevel() {
315             return DisplayLevel.record;
316           }
317 
318           public Searchability defaultSearchability() {
319             return Searchability.no;
320           }
321 
322           public int defaultDisplayOrder() {
323             return 1002;
324           }
325 
326           public String defaultDescription() {
327             return "A messageboard on which this unit can be discussed";
328           }
329 
330           public String defaultRenderinfo() {
331             return "SelectionWindow";
332           }
333 
334           public Object getRaw_unsafe(Persistent g)
335               throws AccessPoemException {
336             return ((Unit)g).getMessageboard_unsafe();
337           }
338 
339           public void setRaw_unsafe(Persistent g, Object raw)
340               throws AccessPoemException {
341             ((Unit)g).setMessageboard_unsafe((Integer)raw);
342           }
343 
344           public Object getRaw(Persistent g)
345               throws AccessPoemException {
346             return ((Unit)g).getMessageboardTroid();
347           }
348 
349           public void setRaw(Persistent g, Object raw)
350               throws AccessPoemException {
351             ((Unit)g).setMessageboardTroid((Integer)raw);
352           }
353         });
354   }
355 
356 
357  /**
358   * Retrieves the <code>Path</code> <code>Column</code> for this 
359   * <code>Unit</code> <code>Table</code>.
360   * 
361   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
362   * @return the path <code>Column</code>
363   */
364   public final Column<String> getPathColumn() {
365     return col_path;
366   }
367 
368 
369  /**
370   * Retrieves the <code>Deleted</code> <code>Column</code> for this 
371   * <code>Unit</code> <code>Table</code>.
372   * 
373   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
374   * @return the deleted <code>Column</code>
375   */
376   public final Column<Boolean> getDeletedColumn() {
377     return col_deleted;
378   }
379 
380 
381  /**
382   * Retrieves the <code>Lastencached</code> <code>Column</code> for this 
383   * <code>Unit</code> <code>Table</code>.
384   * 
385   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
386   * @return the lastencached <code>Column</code>
387   */
388   public final Column<Timestamp> getLastencachedColumn() {
389     return col_lastencached;
390   }
391 
392 
393  /**
394   * Retrieves the <code>Layout</code> <code>Column</code> for this 
395   * <code>Unit</code> <code>Table</code>.
396   * 
397   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
398   * @return the layout <code>Column</code>
399   */
400   public final Column<Integer> getLayoutColumn() {
401     return col_layout;
402   }
403 
404 
405  /**
406   * Retrieves the <code>Messageboard</code> <code>Column</code> for this 
407   * <code>Unit</code> <code>Table</code>.
408   * 
409   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
410   * @return the messageboard <code>Column</code>
411   */
412   public final Column<Integer> getMessageboardColumn() {
413     return col_messageboard;
414   }
415 
416 
417  /**
418   * Retrieve the <code>Unit</code> as a <code>Unit</code>.
419   *
420   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
421   * @param troid a Table Row Oject ID
422   * @return the <code>Persistent</code> identified by the <code>troid</code>
423   */
424   public Unit getUnitObject(Integer troid) {
425     return (Unit)getObject(troid);
426   }
427 
428 
429  /**
430   * Retrieve the <code>Unit</code> 
431   * as a <code>Unit</code>.
432   *
433   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
434   * @param troid a Table Row Object ID
435   * @return the <code>Persistent</code> identified   */
436   public Unit getUnitObject(int troid) {
437     return (Unit)getObject(troid);
438   }
439   public int defaultDisplayOrder() {
440     return 3;
441   }
442 }
443