View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.paneris.melati.site.model.generated;
4   
5   import java.sql.Timestamp;
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.DeletedPoemType;
12  import org.melati.poem.DisplayLevel;
13  import org.melati.poem.Field;
14  import org.melati.poem.IntegerPoemType;
15  import org.melati.poem.JdbcPersistent;
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.StringPoemType;
21  import org.melati.poem.TimestampPoemType;
22  import org.melati.poem.TroidPoemType;
23  import org.melati.poem.ValidationPoemException;
24  import org.paneris.melati.site.model.Page;
25  import org.paneris.melati.site.model.SiteDatabaseTables;
26  import org.paneris.melati.site.model.SiteTable;
27  import org.paneris.melati.site.model.Style;
28  import org.paneris.melati.site.model.Template;
29  
30  
31  /**
32   * Melati POEM generated base class for 
33  <code>Table</code> <code>Page</code>.
34   *
35   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
36   */
37  
38  public class PageTableBase extends SiteTable {
39  
40    private Column col_id = null;
41    private Column col_name = null;
42    private Column col_displayname = null;
43    private Column col_displayorder = null;
44    private Column col_display = null;
45    private Column col_deleted = null;
46    private Column col_lastencached = null;
47    private Column col_parent = null;
48    private Column col_template = null;
49    private Column col_style = null;
50  
51   /**
52    * Constructor. 
53    * 
54    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
55    * @param database          the POEM database we are using
56    * @param name              the name of this <code>Table</code>
57    * @param definitionSource  which definition is being used
58    * @throws PoemException    if anything goes wrong
59    */
60  
61    public PageTableBase(
62        Database database, String name,
63        DefinitionSource definitionSource) throws PoemException {
64      super(database, name, definitionSource);
65    }
66  
67  
68   /**
69    * Get the database tables.
70    *
71    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
72    * @return the database tables
73    */
74    public SiteDatabaseTables getSiteDatabaseTables() {
75      return (SiteDatabaseTables)getDatabase();
76    }
77  
78    public void init() throws PoemException {
79      super.init();
80      defineColumn(col_id =
81          new Column(this, "id",
82                     new TroidPoemType(),
83                     DefinitionSource.dsd) { 
84            public Object getCooked(Persistent g)
85                throws AccessPoemException, PoemException {
86              return ((Page)g).getId();
87            }
88  
89            public void setCooked(Persistent g, Object cooked)
90                throws AccessPoemException, ValidationPoemException {
91              ((Page)g).setId((Integer)cooked);
92            }
93  
94            public Field asField(Persistent g) {
95              return ((Page)g).getIdField();
96            }
97  
98            protected boolean defaultUserEditable() {
99              return false;
100           }
101 
102           protected boolean defaultUserCreateable() {
103             return false;
104           }
105 
106           protected DisplayLevel defaultDisplayLevel() {
107             return DisplayLevel.record;
108           }
109 
110           protected Searchability defaultSearchability() {
111             return Searchability.no;
112           }
113 
114           protected int defaultDisplayOrder() {
115             return 0;
116           }
117 
118           public Object getRaw_unsafe(Persistent g)
119               throws AccessPoemException {
120             return ((Page)g).getId_unsafe();
121           }
122 
123           public void setRaw_unsafe(Persistent g, Object raw)
124               throws AccessPoemException {
125             ((Page)g).setId_unsafe((Integer)raw);
126           }
127 
128           public Object getRaw(Persistent g)
129               throws AccessPoemException {
130             return ((Page)g).getId();
131           }
132 
133           public void setRaw(Persistent g, Object raw)
134               throws AccessPoemException {
135             ((Page)g).setId((Integer)raw);
136           }
137         });
138 
139     defineColumn(col_name =
140         new Column(this, "name",
141                    new StringPoemType(false, -1),
142                    DefinitionSource.dsd) { 
143           public Object getCooked(Persistent g)
144               throws AccessPoemException, PoemException {
145             return ((Page)g).getName();
146           }
147 
148           public void setCooked(Persistent g, Object cooked)
149               throws AccessPoemException, ValidationPoemException {
150             ((Page)g).setName((String)cooked);
151           }
152 
153           public Field asField(Persistent g) {
154             return ((Page)g).getNameField();
155           }
156 
157           protected DisplayLevel defaultDisplayLevel() {
158             return DisplayLevel.record;
159           }
160 
161           protected int defaultDisplayOrder() {
162             return 1;
163           }
164 
165           protected String defaultDescription() {
166             return "A file system name, no spaces or special characters";
167           }
168 
169           public Object getRaw_unsafe(Persistent g)
170               throws AccessPoemException {
171             return ((Page)g).getName_unsafe();
172           }
173 
174           public void setRaw_unsafe(Persistent g, Object raw)
175               throws AccessPoemException {
176             ((Page)g).setName_unsafe((String)raw);
177           }
178 
179           public Object getRaw(Persistent g)
180               throws AccessPoemException {
181             return ((Page)g).getName();
182           }
183 
184           public void setRaw(Persistent g, Object raw)
185               throws AccessPoemException {
186             ((Page)g).setName((String)raw);
187           }
188         });
189 
190     defineColumn(col_displayname =
191         new Column(this, "displayname",
192                    new StringPoemType(false, -1),
193                    DefinitionSource.dsd) { 
194           public Object getCooked(Persistent g)
195               throws AccessPoemException, PoemException {
196             return ((Page)g).getDisplayname();
197           }
198 
199           public void setCooked(Persistent g, Object cooked)
200               throws AccessPoemException, ValidationPoemException {
201             ((Page)g).setDisplayname((String)cooked);
202           }
203 
204           public Field asField(Persistent g) {
205             return ((Page)g).getDisplaynameField();
206           }
207 
208           protected DisplayLevel defaultDisplayLevel() {
209             return DisplayLevel.primary;
210           }
211 
212           protected Searchability defaultSearchability() {
213             return Searchability.primary;
214           }
215 
216           protected String defaultDisplayName() {
217             return "Display Name";
218           }
219 
220           protected int defaultDisplayOrder() {
221             return 2;
222           }
223 
224           protected String defaultDescription() {
225             return "The full name used in the TITLE.";
226           }
227 
228           protected boolean defaultUnique() {
229             return true;
230           }
231 
232           protected int defaultWidth() {
233             return 20;
234           }
235 
236           public Object getRaw_unsafe(Persistent g)
237               throws AccessPoemException {
238             return ((Page)g).getDisplayname_unsafe();
239           }
240 
241           public void setRaw_unsafe(Persistent g, Object raw)
242               throws AccessPoemException {
243             ((Page)g).setDisplayname_unsafe((String)raw);
244           }
245 
246           public Object getRaw(Persistent g)
247               throws AccessPoemException {
248             return ((Page)g).getDisplayname();
249           }
250 
251           public void setRaw(Persistent g, Object raw)
252               throws AccessPoemException {
253             ((Page)g).setDisplayname((String)raw);
254           }
255         });
256 
257     defineColumn(col_displayorder =
258         new Column(this, "displayorder",
259                    new IntegerPoemType(false),
260                    DefinitionSource.dsd) { 
261           public Object getCooked(Persistent g)
262               throws AccessPoemException, PoemException {
263             return ((Page)g).getDisplayorder();
264           }
265 
266           public void setCooked(Persistent g, Object cooked)
267               throws AccessPoemException, ValidationPoemException {
268             ((Page)g).setDisplayorder((Integer)cooked);
269           }
270 
271           public Field asField(Persistent g) {
272             return ((Page)g).getDisplayorderField();
273           }
274 
275           protected DisplayLevel defaultDisplayLevel() {
276             return DisplayLevel.record;
277           }
278 
279           protected Integer defaultDisplayOrderPriority() {
280             return new Integer(0);
281           }
282 
283           protected String defaultDisplayName() {
284             return "Display order";
285           }
286 
287           protected int defaultDisplayOrder() {
288             return 3;
289           }
290 
291           protected String defaultDescription() {
292             return "A rank determining where the page appears in a list";
293           }
294 
295           public Object getRaw_unsafe(Persistent g)
296               throws AccessPoemException {
297             return ((Page)g).getDisplayorder_unsafe();
298           }
299 
300           public void setRaw_unsafe(Persistent g, Object raw)
301               throws AccessPoemException {
302             ((Page)g).setDisplayorder_unsafe((Integer)raw);
303           }
304 
305           public Object getRaw(Persistent g)
306               throws AccessPoemException {
307             return ((Page)g).getDisplayorder();
308           }
309 
310           public void setRaw(Persistent g, Object raw)
311               throws AccessPoemException {
312             ((Page)g).setDisplayorder((Integer)raw);
313           }
314         });
315 
316     defineColumn(col_display =
317         new Column(this, "display",
318                    new BooleanPoemType(false),
319                    DefinitionSource.dsd) { 
320           public Object getCooked(Persistent g)
321               throws AccessPoemException, PoemException {
322             return ((Page)g).getDisplay();
323           }
324 
325           public void setCooked(Persistent g, Object cooked)
326               throws AccessPoemException, ValidationPoemException {
327             ((Page)g).setDisplay((Boolean)cooked);
328           }
329 
330           public Field asField(Persistent g) {
331             return ((Page)g).getDisplayField();
332           }
333 
334           protected DisplayLevel defaultDisplayLevel() {
335             return DisplayLevel.record;
336           }
337 
338           protected Searchability defaultSearchability() {
339             return Searchability.yes;
340           }
341 
342           protected int defaultDisplayOrder() {
343             return 4;
344           }
345 
346           protected String defaultDescription() {
347             return "Whether to display this page";
348           }
349 
350           protected boolean defaultIndexed() {
351             return true;
352           }
353 
354           public Object getRaw_unsafe(Persistent g)
355               throws AccessPoemException {
356             return ((Page)g).getDisplay_unsafe();
357           }
358 
359           public void setRaw_unsafe(Persistent g, Object raw)
360               throws AccessPoemException {
361             ((Page)g).setDisplay_unsafe((Boolean)raw);
362           }
363 
364           public Object getRaw(Persistent g)
365               throws AccessPoemException {
366             return ((Page)g).getDisplay();
367           }
368 
369           public void setRaw(Persistent g, Object raw)
370               throws AccessPoemException {
371             ((Page)g).setDisplay((Boolean)raw);
372           }
373         });
374 
375     defineColumn(col_deleted =
376         new Column(this, "deleted",
377                    new DeletedPoemType(),
378                    DefinitionSource.dsd) { 
379           public Object getCooked(Persistent g)
380               throws AccessPoemException, PoemException {
381             return ((Page)g).getDeleted();
382           }
383 
384           public void setCooked(Persistent g, Object cooked)
385               throws AccessPoemException, ValidationPoemException {
386             ((Page)g).setDeleted((Boolean)cooked);
387           }
388 
389           public Field asField(Persistent g) {
390             return ((Page)g).getDeletedField();
391           }
392 
393           protected DisplayLevel defaultDisplayLevel() {
394             return DisplayLevel.detail;
395           }
396 
397           protected Searchability defaultSearchability() {
398             return Searchability.no;
399           }
400 
401           protected int defaultDisplayOrder() {
402             return 5;
403           }
404 
405           protected String defaultDescription() {
406             return "Soft delete";
407           }
408 
409           protected boolean defaultIndexed() {
410             return true;
411           }
412 
413           public Object getRaw_unsafe(Persistent g)
414               throws AccessPoemException {
415             return ((Page)g).getDeleted_unsafe();
416           }
417 
418           public void setRaw_unsafe(Persistent g, Object raw)
419               throws AccessPoemException {
420             ((Page)g).setDeleted_unsafe((Boolean)raw);
421           }
422 
423           public Object getRaw(Persistent g)
424               throws AccessPoemException {
425             return ((Page)g).getDeleted();
426           }
427 
428           public void setRaw(Persistent g, Object raw)
429               throws AccessPoemException {
430             ((Page)g).setDeleted((Boolean)raw);
431           }
432         });
433 
434     defineColumn(col_lastencached =
435         new Column(this, "lastencached",
436                    new TimestampPoemType(true),
437                    DefinitionSource.dsd) { 
438           public Object getCooked(Persistent g)
439               throws AccessPoemException, PoemException {
440             return ((Page)g).getLastencached();
441           }
442 
443           public void setCooked(Persistent g, Object cooked)
444               throws AccessPoemException, ValidationPoemException {
445             ((Page)g).setLastencached((Timestamp)cooked);
446           }
447 
448           public Field asField(Persistent g) {
449             return ((Page)g).getLastencachedField();
450           }
451 
452           protected DisplayLevel defaultDisplayLevel() {
453             return DisplayLevel.record;
454           }
455 
456           protected String defaultDisplayName() {
457             return "Last encached";
458           }
459 
460           protected int defaultDisplayOrder() {
461             return 1000;
462           }
463 
464           protected String defaultDescription() {
465             return "When the page was encached; cleared when the page is updated";
466           }
467 
468           public Object getRaw_unsafe(Persistent g)
469               throws AccessPoemException {
470             return ((Page)g).getLastencached_unsafe();
471           }
472 
473           public void setRaw_unsafe(Persistent g, Object raw)
474               throws AccessPoemException {
475             ((Page)g).setLastencached_unsafe((Timestamp)raw);
476           }
477 
478           public Object getRaw(Persistent g)
479               throws AccessPoemException {
480             return ((Page)g).getLastencached();
481           }
482 
483           public void setRaw(Persistent g, Object raw)
484               throws AccessPoemException {
485             ((Page)g).setLastencached((Timestamp)raw);
486           }
487         });
488 
489     defineColumn(col_parent =
490         new Column(this, "parent",
491                    new ReferencePoemType(getSiteDatabaseTables().
492                                              getPageTable(), true),
493                    DefinitionSource.dsd) { 
494           public Object getCooked(Persistent g)
495               throws AccessPoemException, PoemException {
496             return ((Page)g).getParent();
497           }
498 
499           public void setCooked(Persistent g, Object cooked)
500               throws AccessPoemException, ValidationPoemException {
501             ((Page)g).setParent((Page)cooked);
502           }
503 
504           public Field asField(Persistent g) {
505             return ((Page)g).getParentField();
506           }
507 
508           protected DisplayLevel defaultDisplayLevel() {
509             return DisplayLevel.summary;
510           }
511 
512           protected Searchability defaultSearchability() {
513             return Searchability.yes;
514           }
515 
516           protected int defaultDisplayOrder() {
517             return 1001;
518           }
519 
520           protected String defaultDescription() {
521             return "The parent page (empty for Home). ";
522           }
523 
524           public Object getRaw_unsafe(Persistent g)
525               throws AccessPoemException {
526             return ((Page)g).getParent_unsafe();
527           }
528 
529           public void setRaw_unsafe(Persistent g, Object raw)
530               throws AccessPoemException {
531             ((Page)g).setParent_unsafe((Integer)raw);
532           }
533 
534           public Object getRaw(Persistent g)
535               throws AccessPoemException {
536             return ((Page)g).getParentTroid();
537           }
538 
539           public void setRaw(Persistent g, Object raw)
540               throws AccessPoemException {
541             ((Page)g).setParentTroid((Integer)raw);
542           }
543         });
544 
545     defineColumn(col_template =
546         new Column(this, "template",
547                    new ReferencePoemType(getSiteDatabaseTables().
548                                              getTemplateTable(), true),
549                    DefinitionSource.dsd) { 
550           public Object getCooked(Persistent g)
551               throws AccessPoemException, PoemException {
552             return ((Page)g).getTemplate();
553           }
554 
555           public void setCooked(Persistent g, Object cooked)
556               throws AccessPoemException, ValidationPoemException {
557             ((Page)g).setTemplate((Template)cooked);
558           }
559 
560           public Field asField(Persistent g) {
561             return ((Page)g).getTemplateField();
562           }
563 
564           protected DisplayLevel defaultDisplayLevel() {
565             return DisplayLevel.record;
566           }
567 
568           protected int defaultDisplayOrder() {
569             return 1002;
570           }
571 
572           protected String defaultDescription() {
573             return "The name of the layout for this page";
574           }
575 
576           public Object getRaw_unsafe(Persistent g)
577               throws AccessPoemException {
578             return ((Page)g).getTemplate_unsafe();
579           }
580 
581           public void setRaw_unsafe(Persistent g, Object raw)
582               throws AccessPoemException {
583             ((Page)g).setTemplate_unsafe((Integer)raw);
584           }
585 
586           public Object getRaw(Persistent g)
587               throws AccessPoemException {
588             return ((Page)g).getTemplateTroid();
589           }
590 
591           public void setRaw(Persistent g, Object raw)
592               throws AccessPoemException {
593             ((Page)g).setTemplateTroid((Integer)raw);
594           }
595         });
596 
597     defineColumn(col_style =
598         new Column(this, "style",
599                    new ReferencePoemType(getSiteDatabaseTables().
600                                              getStyleTable(), true),
601                    DefinitionSource.dsd) { 
602           public Object getCooked(Persistent g)
603               throws AccessPoemException, PoemException {
604             return ((Page)g).getStyle();
605           }
606 
607           public void setCooked(Persistent g, Object cooked)
608               throws AccessPoemException, ValidationPoemException {
609             ((Page)g).setStyle((Style)cooked);
610           }
611 
612           public Field asField(Persistent g) {
613             return ((Page)g).getStyleField();
614           }
615 
616           protected DisplayLevel defaultDisplayLevel() {
617             return DisplayLevel.record;
618           }
619 
620           protected int defaultDisplayOrder() {
621             return 1003;
622           }
623 
624           protected String defaultDescription() {
625             return "The name of the CSS class for this page";
626           }
627 
628           public Object getRaw_unsafe(Persistent g)
629               throws AccessPoemException {
630             return ((Page)g).getStyle_unsafe();
631           }
632 
633           public void setRaw_unsafe(Persistent g, Object raw)
634               throws AccessPoemException {
635             ((Page)g).setStyle_unsafe((Integer)raw);
636           }
637 
638           public Object getRaw(Persistent g)
639               throws AccessPoemException {
640             return ((Page)g).getStyleTroid();
641           }
642 
643           public void setRaw(Persistent g, Object raw)
644               throws AccessPoemException {
645             ((Page)g).setStyleTroid((Integer)raw);
646           }
647         });
648   }
649 
650 
651  /**
652   * Retrieves the <code>Id</code> <code>Column</code> for this 
653   * <code>Page</code> <code>Table</code>.
654   * 
655   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
656   * @return the id <code>Column</code>
657   */
658   public final Column getIdColumn() {
659     return col_id;
660   }
661 
662 
663  /**
664   * Retrieves the <code>Name</code> <code>Column</code> for this 
665   * <code>Page</code> <code>Table</code>.
666   * 
667   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
668   * @return the name <code>Column</code>
669   */
670   public final Column getNameColumn() {
671     return col_name;
672   }
673 
674 
675  /**
676   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
677   * <code>Page</code> <code>Table</code>.
678   * 
679   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
680   * @return the displayname <code>Column</code>
681   */
682   public final Column getDisplaynameColumn() {
683     return col_displayname;
684   }
685 
686 
687  /**
688   * Retrieves the <code>Displayorder</code> <code>Column</code> for this 
689   * <code>Page</code> <code>Table</code>.
690   * 
691   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
692   * @return the displayorder <code>Column</code>
693   */
694   public final Column getDisplayorderColumn() {
695     return col_displayorder;
696   }
697 
698 
699  /**
700   * Retrieves the <code>Display</code> <code>Column</code> for this 
701   * <code>Page</code> <code>Table</code>.
702   * 
703   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
704   * @return the display <code>Column</code>
705   */
706   public final Column getDisplayColumn() {
707     return col_display;
708   }
709 
710 
711  /**
712   * Retrieves the <code>Deleted</code> <code>Column</code> for this 
713   * <code>Page</code> <code>Table</code>.
714   * 
715   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
716   * @return the deleted <code>Column</code>
717   */
718   public final Column getDeletedColumn() {
719     return col_deleted;
720   }
721 
722 
723  /**
724   * Retrieves the <code>Lastencached</code> <code>Column</code> for this 
725   * <code>Page</code> <code>Table</code>.
726   * 
727   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
728   * @return the lastencached <code>Column</code>
729   */
730   public final Column getLastencachedColumn() {
731     return col_lastencached;
732   }
733 
734 
735  /**
736   * Retrieves the <code>Parent</code> <code>Column</code> for this 
737   * <code>Page</code> <code>Table</code>.
738   * 
739   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
740   * @return the parent <code>Column</code>
741   */
742   public final Column getParentColumn() {
743     return col_parent;
744   }
745 
746 
747  /**
748   * Retrieves the <code>Template</code> <code>Column</code> for this 
749   * <code>Page</code> <code>Table</code>.
750   * 
751   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
752   * @return the template <code>Column</code>
753   */
754   public final Column getTemplateColumn() {
755     return col_template;
756   }
757 
758 
759  /**
760   * Retrieves the <code>Style</code> <code>Column</code> for this 
761   * <code>Page</code> <code>Table</code>.
762   * 
763   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
764   * @return the style <code>Column</code>
765   */
766   public final Column getStyleColumn() {
767     return col_style;
768   }
769 
770 
771  /**
772   * Retrieve the <code>Page</code> as a <code>Page</code>.
773   *
774   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
775   * @param troid a Table Row Oject ID
776   * @return the <code>Persistent</code> identified by the <code>troid</code>
777   */
778   public Page getPageObject(Integer troid) {
779     return (Page)getObject(troid);
780   }
781 
782 
783  /**
784   * Retrieve the <code>Page</code> 
785   * as a <code>Page</code>.
786   *
787   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
788   * @param troid a Table Row Object ID
789   * @return the <code>Persistent</code> identified   */
790   public Page getPageObject(int troid) {
791     return (Page)getObject(troid);
792   }
793 
794   protected JdbcPersistent _newPersistent() {
795     return new Page();
796   }
797   protected String defaultDescription() {
798     return "A Page";
799   }
800 
801   protected boolean defaultRememberAllTroids() {
802     return true;
803   }
804 
805   protected String defaultCategory() {
806     return "Data";
807   }
808 
809   protected int defaultDisplayOrder() {
810     return 200;
811   }
812 }
813