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.IntegerPoemType;
14  import org.melati.poem.JdbcPersistent;
15  import org.melati.poem.LongPoemType;
16  import org.melati.poem.Persistent;
17  import org.melati.poem.PoemException;
18  import org.melati.poem.ReferencePoemType;
19  import org.melati.poem.Searchability;
20  import org.melati.poem.StandardIntegrityFix;
21  import org.melati.poem.StringPoemType;
22  import org.melati.poem.TimestampPoemType;
23  import org.melati.poem.TroidPoemType;
24  import org.melati.poem.ValidationPoemException;
25  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
26  import org.paneris.bibliomania.Book;
27  import org.paneris.bibliomania.Chapter;
28  import org.paneris.bibliomania.UnitTable;
29  
30  
31  /**
32   * Melati POEM generated base class for <code>Table</code> <code>Chapter</code>.
33   *
34   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
35   */
36  
37  public class ChapterTableBase<T extends Chapter> extends UnitTable<T> {
38  
39    private Column<Integer> col_id = null;
40    private Column<Integer> col_book = null;
41    private Column<Integer> col_sequence = null;
42    private Column<Long> col_textid = null;
43    private Column<Timestamp> col_indexdate = null;
44    private Column<String> col_title = null;
45    private Column<String> col_longtitle = null;
46    private Column<String> col_filename = null;
47    private Column<String> col_part = null;
48  
49   /**
50    * Constructor. 
51    * 
52    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
53    * @param database          the POEM database we are using
54    * @param name              the name of this <code>Table</code>
55    * @param definitionSource  which definition is being used
56    * @throws PoemException    if anything goes wrong
57    */
58  
59    public ChapterTableBase(
60        Database database, String name,
61        DefinitionSource definitionSource) throws PoemException {
62      super(database, name, definitionSource);
63    }
64  
65  
66   /**
67    * Get the database tables.
68    *
69    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
70    * @return the database tables
71    */
72    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
73      return (BibliomaniaDatabaseTables)getDatabase();
74    }
75  
76  
77   /**
78    * Initialise this table by defining its columns.
79    *
80    * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
81    */
82    public void init() throws PoemException {
83      super.init();
84      defineColumn(col_id =
85          new Column<Integer>(this, "id",
86                     new TroidPoemType(),
87                     DefinitionSource.dsd) { 
88            public Object getCooked(Persistent g)
89                throws AccessPoemException, PoemException {
90              return ((Chapter)g).getId();
91            }
92  
93            public void setCooked(Persistent g, Object cooked)
94                throws AccessPoemException, ValidationPoemException {
95              ((Chapter)g).setId((Integer)cooked);
96            }
97  
98            public Field<Integer> asField(Persistent g) {
99              return ((Chapter)g).getIdField();
100           }
101 
102           public boolean defaultUserEditable() {
103             return false;
104           }
105 
106           public boolean defaultUserCreateable() {
107             return false;
108           }
109 
110           public int defaultDisplayOrder() {
111             return 0;
112           }
113 
114           public Object getRaw_unsafe(Persistent g)
115               throws AccessPoemException {
116             return ((Chapter)g).getId_unsafe();
117           }
118 
119           public void setRaw_unsafe(Persistent g, Object raw)
120               throws AccessPoemException {
121             ((Chapter)g).setId_unsafe((Integer)raw);
122           }
123 
124           public Object getRaw(Persistent g)
125               throws AccessPoemException {
126             return ((Chapter)g).getId();
127           }
128 
129           public void setRaw(Persistent g, Object raw)
130               throws AccessPoemException {
131             ((Chapter)g).setId((Integer)raw);
132           }
133         });
134 
135     defineColumn(col_book =
136         new Column<Integer>(this, "book",
137                    new ReferencePoemType(getBibliomaniaDatabaseTables().
138                                              getBookTable(), false),
139                    DefinitionSource.dsd) { 
140           public Object getCooked(Persistent g)
141               throws AccessPoemException, PoemException {
142             return ((Chapter)g).getBook();
143           }
144 
145           public void setCooked(Persistent g, Object cooked)
146               throws AccessPoemException, ValidationPoemException {
147             ((Chapter)g).setBook((Book)cooked);
148           }
149 
150           public Field<Integer> asField(Persistent g) {
151             return ((Chapter)g).getBookField();
152           }
153 
154           public Searchability defaultSearchability() {
155             return Searchability.primary;
156           }
157 
158           public Integer defaultDisplayOrderPriority() {
159             return new Integer(0);
160           }
161 
162           public int defaultDisplayOrder() {
163             return 1;
164           }
165 
166           public String defaultDescription() {
167             return "The book to which the chapter belongs";
168           }
169 
170           public boolean defaultIndexed() {
171             return true;
172           }
173 
174           public Object getRaw_unsafe(Persistent g)
175               throws AccessPoemException {
176             return ((Chapter)g).getBook_unsafe();
177           }
178 
179           public void setRaw_unsafe(Persistent g, Object raw)
180               throws AccessPoemException {
181             ((Chapter)g).setBook_unsafe((Integer)raw);
182           }
183 
184           public Object getRaw(Persistent g)
185               throws AccessPoemException {
186             return ((Chapter)g).getBookTroid();
187           }
188 
189           public void setRaw(Persistent g, Object raw)
190               throws AccessPoemException {
191             ((Chapter)g).setBookTroid((Integer)raw);
192           }
193 
194           public StandardIntegrityFix defaultIntegrityFix() {
195             return StandardIntegrityFix.delete;
196           }
197         });
198 
199     defineColumn(col_sequence =
200         new Column<Integer>(this, "sequence",
201                    new IntegerPoemType(false),
202                    DefinitionSource.dsd) { 
203           public Object getCooked(Persistent g)
204               throws AccessPoemException, PoemException {
205             return ((Chapter)g).getSequence();
206           }
207 
208           public void setCooked(Persistent g, Object cooked)
209               throws AccessPoemException, ValidationPoemException {
210             ((Chapter)g).setSequence((Integer)cooked);
211           }
212 
213           public Field<Integer> asField(Persistent g) {
214             return ((Chapter)g).getSequenceField();
215           }
216 
217           public DisplayLevel defaultDisplayLevel() {
218             return DisplayLevel.record;
219           }
220 
221           public Searchability defaultSearchability() {
222             return Searchability.no;
223           }
224 
225           public Integer defaultDisplayOrderPriority() {
226             return new Integer(1);
227           }
228 
229           public int defaultDisplayOrder() {
230             return 2;
231           }
232 
233           public String defaultDescription() {
234             return "The number of the chapter";
235           }
236 
237           public boolean defaultIndexed() {
238             return true;
239           }
240 
241           public Object getRaw_unsafe(Persistent g)
242               throws AccessPoemException {
243             return ((Chapter)g).getSequence_unsafe();
244           }
245 
246           public void setRaw_unsafe(Persistent g, Object raw)
247               throws AccessPoemException {
248             ((Chapter)g).setSequence_unsafe((Integer)raw);
249           }
250 
251           public Object getRaw(Persistent g)
252               throws AccessPoemException {
253             return ((Chapter)g).getSequence();
254           }
255 
256           public void setRaw(Persistent g, Object raw)
257               throws AccessPoemException {
258             ((Chapter)g).setSequence((Integer)raw);
259           }
260         });
261 
262     defineColumn(col_textid =
263         new Column<Long>(this, "textid",
264                    new LongPoemType(true),
265                    DefinitionSource.dsd) { 
266           public Object getCooked(Persistent g)
267               throws AccessPoemException, PoemException {
268             return ((Chapter)g).getTextid();
269           }
270 
271           public void setCooked(Persistent g, Object cooked)
272               throws AccessPoemException, ValidationPoemException {
273             ((Chapter)g).setTextid((Long)cooked);
274           }
275 
276           public Field<Long> asField(Persistent g) {
277             return ((Chapter)g).getTextidField();
278           }
279 
280           public boolean defaultUserEditable() {
281             return false;
282           }
283 
284           public boolean defaultUserCreateable() {
285             return false;
286           }
287 
288           public DisplayLevel defaultDisplayLevel() {
289             return DisplayLevel.record;
290           }
291 
292           public Searchability defaultSearchability() {
293             return Searchability.no;
294           }
295 
296           public String defaultDisplayName() {
297             return "FTI text id";
298           }
299 
300           public int defaultDisplayOrder() {
301             return 3;
302           }
303 
304           public String defaultDescription() {
305             return "A key under which the chapter is free-text-indexed, combining section, author, book and sequence";
306           }
307 
308           public boolean defaultUnique() {
309             return true;
310           }
311 
312           public Object getRaw_unsafe(Persistent g)
313               throws AccessPoemException {
314             return ((Chapter)g).getTextid_unsafe();
315           }
316 
317           public void setRaw_unsafe(Persistent g, Object raw)
318               throws AccessPoemException {
319             ((Chapter)g).setTextid_unsafe((Long)raw);
320           }
321 
322           public Object getRaw(Persistent g)
323               throws AccessPoemException {
324             return ((Chapter)g).getTextid();
325           }
326 
327           public void setRaw(Persistent g, Object raw)
328               throws AccessPoemException {
329             ((Chapter)g).setTextid((Long)raw);
330           }
331         });
332 
333     defineColumn(col_indexdate =
334         new Column<Timestamp>(this, "indexdate",
335                    new TimestampPoemType(true),
336                    DefinitionSource.dsd) { 
337           public Object getCooked(Persistent g)
338               throws AccessPoemException, PoemException {
339             return ((Chapter)g).getIndexdate();
340           }
341 
342           public void setCooked(Persistent g, Object cooked)
343               throws AccessPoemException, ValidationPoemException {
344             ((Chapter)g).setIndexdate((Timestamp)cooked);
345           }
346 
347           public Field<Timestamp> asField(Persistent g) {
348             return ((Chapter)g).getIndexdateField();
349           }
350 
351           public boolean defaultUserEditable() {
352             return false;
353           }
354 
355           public boolean defaultUserCreateable() {
356             return false;
357           }
358 
359           public DisplayLevel defaultDisplayLevel() {
360             return DisplayLevel.record;
361           }
362 
363           public Searchability defaultSearchability() {
364             return Searchability.no;
365           }
366 
367           public String defaultDisplayName() {
368             return "FTI index date";
369           }
370 
371           public int defaultDisplayOrder() {
372             return 4;
373           }
374 
375           public String defaultDescription() {
376             return "When the chapter was free-text-indexed";
377           }
378 
379           public Object getRaw_unsafe(Persistent g)
380               throws AccessPoemException {
381             return ((Chapter)g).getIndexdate_unsafe();
382           }
383 
384           public void setRaw_unsafe(Persistent g, Object raw)
385               throws AccessPoemException {
386             ((Chapter)g).setIndexdate_unsafe((Timestamp)raw);
387           }
388 
389           public Object getRaw(Persistent g)
390               throws AccessPoemException {
391             return ((Chapter)g).getIndexdate();
392           }
393 
394           public void setRaw(Persistent g, Object raw)
395               throws AccessPoemException {
396             ((Chapter)g).setIndexdate((Timestamp)raw);
397           }
398         });
399 
400     defineColumn(col_title =
401         new Column<String>(this, "title",
402                    new StringPoemType(false, -1),
403                    DefinitionSource.dsd) { 
404           public Object getCooked(Persistent g)
405               throws AccessPoemException, PoemException {
406             return ((Chapter)g).getTitle();
407           }
408 
409           public void setCooked(Persistent g, Object cooked)
410               throws AccessPoemException, ValidationPoemException {
411             ((Chapter)g).setTitle((String)cooked);
412           }
413 
414           public Field<String> asField(Persistent g) {
415             return ((Chapter)g).getTitleField();
416           }
417 
418           public DisplayLevel defaultDisplayLevel() {
419             return DisplayLevel.primary;
420           }
421 
422           public int defaultDisplayOrder() {
423             return 5;
424           }
425 
426           public String defaultDescription() {
427             return "The short title of the chapter (e.g. `Chapter 10')";
428           }
429 
430           public Object getRaw_unsafe(Persistent g)
431               throws AccessPoemException {
432             return ((Chapter)g).getTitle_unsafe();
433           }
434 
435           public void setRaw_unsafe(Persistent g, Object raw)
436               throws AccessPoemException {
437             ((Chapter)g).setTitle_unsafe((String)raw);
438           }
439 
440           public Object getRaw(Persistent g)
441               throws AccessPoemException {
442             return ((Chapter)g).getTitle();
443           }
444 
445           public void setRaw(Persistent g, Object raw)
446               throws AccessPoemException {
447             ((Chapter)g).setTitle((String)raw);
448           }
449         });
450 
451     defineColumn(col_longtitle =
452         new Column<String>(this, "longtitle",
453                    new StringPoemType(true, -1),
454                    DefinitionSource.dsd) { 
455           public Object getCooked(Persistent g)
456               throws AccessPoemException, PoemException {
457             return ((Chapter)g).getLongtitle();
458           }
459 
460           public void setCooked(Persistent g, Object cooked)
461               throws AccessPoemException, ValidationPoemException {
462             ((Chapter)g).setLongtitle((String)cooked);
463           }
464 
465           public Field<String> asField(Persistent g) {
466             return ((Chapter)g).getLongtitleField();
467           }
468 
469           public DisplayLevel defaultDisplayLevel() {
470             return DisplayLevel.record;
471           }
472 
473           public String defaultDisplayName() {
474             return "Long title";
475           }
476 
477           public int defaultDisplayOrder() {
478             return 6;
479           }
480 
481           public String defaultDescription() {
482             return "The long title of the chapter (e.g. `In which Pip ...')";
483           }
484 
485           public Object getRaw_unsafe(Persistent g)
486               throws AccessPoemException {
487             return ((Chapter)g).getLongtitle_unsafe();
488           }
489 
490           public void setRaw_unsafe(Persistent g, Object raw)
491               throws AccessPoemException {
492             ((Chapter)g).setLongtitle_unsafe((String)raw);
493           }
494 
495           public Object getRaw(Persistent g)
496               throws AccessPoemException {
497             return ((Chapter)g).getLongtitle();
498           }
499 
500           public void setRaw(Persistent g, Object raw)
501               throws AccessPoemException {
502             ((Chapter)g).setLongtitle((String)raw);
503           }
504         });
505 
506     defineColumn(col_filename =
507         new Column<String>(this, "filename",
508                    new StringPoemType(false, -1),
509                    DefinitionSource.dsd) { 
510           public Object getCooked(Persistent g)
511               throws AccessPoemException, PoemException {
512             return ((Chapter)g).getFilename();
513           }
514 
515           public void setCooked(Persistent g, Object cooked)
516               throws AccessPoemException, ValidationPoemException {
517             ((Chapter)g).setFilename((String)cooked);
518           }
519 
520           public Field<String> asField(Persistent g) {
521             return ((Chapter)g).getFilenameField();
522           }
523 
524           public DisplayLevel defaultDisplayLevel() {
525             return DisplayLevel.record;
526           }
527 
528           public Searchability defaultSearchability() {
529             return Searchability.no;
530           }
531 
532           public int defaultDisplayOrder() {
533             return 7;
534           }
535 
536           public String defaultDescription() {
537             return "The filename of the chapter in the local filesystem, relative to `Path'";
538           }
539 
540           public Object getRaw_unsafe(Persistent g)
541               throws AccessPoemException {
542             return ((Chapter)g).getFilename_unsafe();
543           }
544 
545           public void setRaw_unsafe(Persistent g, Object raw)
546               throws AccessPoemException {
547             ((Chapter)g).setFilename_unsafe((String)raw);
548           }
549 
550           public Object getRaw(Persistent g)
551               throws AccessPoemException {
552             return ((Chapter)g).getFilename();
553           }
554 
555           public void setRaw(Persistent g, Object raw)
556               throws AccessPoemException {
557             ((Chapter)g).setFilename((String)raw);
558           }
559         });
560 
561     defineColumn(col_part =
562         new Column<String>(this, "part",
563                    new StringPoemType(true, -1),
564                    DefinitionSource.dsd) { 
565           public Object getCooked(Persistent g)
566               throws AccessPoemException, PoemException {
567             return ((Chapter)g).getPart();
568           }
569 
570           public void setCooked(Persistent g, Object cooked)
571               throws AccessPoemException, ValidationPoemException {
572             ((Chapter)g).setPart((String)cooked);
573           }
574 
575           public Field<String> asField(Persistent g) {
576             return ((Chapter)g).getPartField();
577           }
578 
579           public int defaultDisplayOrder() {
580             return 8;
581           }
582 
583           public Object getRaw_unsafe(Persistent g)
584               throws AccessPoemException {
585             return ((Chapter)g).getPart_unsafe();
586           }
587 
588           public void setRaw_unsafe(Persistent g, Object raw)
589               throws AccessPoemException {
590             ((Chapter)g).setPart_unsafe((String)raw);
591           }
592 
593           public Object getRaw(Persistent g)
594               throws AccessPoemException {
595             return ((Chapter)g).getPart();
596           }
597 
598           public void setRaw(Persistent g, Object raw)
599               throws AccessPoemException {
600             ((Chapter)g).setPart((String)raw);
601           }
602         });
603   }
604 
605 
606  /**
607   * Retrieves the <code>Id</code> <code>Column</code> for this 
608   * <code>Chapter</code> <code>Table</code>.
609   * 
610   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
611   * @return the id <code>Column</code>
612   */
613   public final Column<Integer> getIdColumn() {
614     return col_id;
615   }
616 
617 
618  /**
619   * Retrieves the <code>Book</code> <code>Column</code> for this 
620   * <code>Chapter</code> <code>Table</code>.
621   * 
622   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
623   * @return the book <code>Column</code>
624   */
625   public final Column<Integer> getBookColumn() {
626     return col_book;
627   }
628 
629 
630  /**
631   * Retrieves the <code>Sequence</code> <code>Column</code> for this 
632   * <code>Chapter</code> <code>Table</code>.
633   * 
634   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
635   * @return the sequence <code>Column</code>
636   */
637   public final Column<Integer> getSequenceColumn() {
638     return col_sequence;
639   }
640 
641 
642  /**
643   * Retrieves the <code>Textid</code> <code>Column</code> for this 
644   * <code>Chapter</code> <code>Table</code>.
645   * 
646   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
647   * @return the textid <code>Column</code>
648   */
649   public final Column<Long> getTextidColumn() {
650     return col_textid;
651   }
652 
653 
654  /**
655   * Retrieves the <code>Indexdate</code> <code>Column</code> for this 
656   * <code>Chapter</code> <code>Table</code>.
657   * 
658   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
659   * @return the indexdate <code>Column</code>
660   */
661   public final Column<Timestamp> getIndexdateColumn() {
662     return col_indexdate;
663   }
664 
665 
666  /**
667   * Retrieves the <code>Title</code> <code>Column</code> for this 
668   * <code>Chapter</code> <code>Table</code>.
669   * 
670   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
671   * @return the title <code>Column</code>
672   */
673   public final Column<String> getTitleColumn() {
674     return col_title;
675   }
676 
677 
678  /**
679   * Retrieves the <code>Longtitle</code> <code>Column</code> for this 
680   * <code>Chapter</code> <code>Table</code>.
681   * 
682   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
683   * @return the longtitle <code>Column</code>
684   */
685   public final Column<String> getLongtitleColumn() {
686     return col_longtitle;
687   }
688 
689 
690  /**
691   * Retrieves the <code>Filename</code> <code>Column</code> for this 
692   * <code>Chapter</code> <code>Table</code>.
693   * 
694   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
695   * @return the filename <code>Column</code>
696   */
697   public final Column<String> getFilenameColumn() {
698     return col_filename;
699   }
700 
701 
702  /**
703   * Retrieves the <code>Part</code> <code>Column</code> for this 
704   * <code>Chapter</code> <code>Table</code>.
705   * 
706   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
707   * @return the part <code>Column</code>
708   */
709   public final Column<String> getPartColumn() {
710     return col_part;
711   }
712 
713 
714  /**
715   * Retrieve the <code>Chapter</code> as a <code>Chapter</code>.
716   *
717   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
718   * @param troid a Table Row Oject ID
719   * @return the <code>Persistent</code> identified by the <code>troid</code>
720   */
721   public Chapter getChapterObject(Integer troid) {
722     return (Chapter)getObject(troid);
723   }
724 
725 
726  /**
727   * Retrieve the <code>Chapter</code> 
728   * as a <code>Chapter</code>.
729   *
730   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
731   * @param troid a Table Row Object ID
732   * @return the <code>Persistent</code> identified   */
733   public Chapter getChapterObject(int troid) {
734     return (Chapter)getObject(troid);
735   }
736 
737   protected JdbcPersistent _newPersistent() {
738     return new Chapter();
739   }
740   public String defaultDescription() {
741     return "A part of a book or other work";
742   }
743 
744   public int defaultDisplayOrder() {
745     return 500;
746   }
747 }
748