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