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 org.melati.poem.AccessPoemException;
6   import org.melati.poem.Column;
7   import org.melati.poem.Database;
8   import org.melati.poem.DefinitionSource;
9   import org.melati.poem.DisplayLevel;
10  import org.melati.poem.Field;
11  import org.melati.poem.IntegerPoemType;
12  import org.melati.poem.JdbcPersistent;
13  import org.melati.poem.Persistent;
14  import org.melati.poem.PoemException;
15  import org.melati.poem.ReferencePoemType;
16  import org.melati.poem.Searchability;
17  import org.melati.poem.StandardIntegrityFix;
18  import org.melati.poem.StringPoemType;
19  import org.melati.poem.TroidPoemType;
20  import org.melati.poem.ValidationPoemException;
21  import org.paneris.melati.site.model.Div;
22  import org.paneris.melati.site.model.Page;
23  import org.paneris.melati.site.model.SiteDatabaseTables;
24  import org.paneris.melati.site.model.SiteTable;
25  import org.paneris.melati.site.model.Style;
26  import org.paneris.melati.site.model.UploadedImage;
27  
28  
29  /**
30   * Melati POEM generated base class for 
31  <code>Table</code> <code>Div</code>.
32   *
33   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
34   */
35  
36  public class DivTableBase extends SiteTable {
37  
38    private Column col_id = null;
39    private Column col_page = null;
40    private Column col_displayorder = null;
41    private Column col_style = null;
42    private Column col_title = null;
43    private Column col_content = null;
44    private Column col_image = null;
45  
46   /**
47    * Constructor. 
48    * 
49    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
50    * @param database          the POEM database we are using
51    * @param name              the name of this <code>Table</code>
52    * @param definitionSource  which definition is being used
53    * @throws PoemException    if anything goes wrong
54    */
55  
56    public DivTableBase(
57        Database database, String name,
58        DefinitionSource definitionSource) throws PoemException {
59      super(database, name, definitionSource);
60    }
61  
62  
63   /**
64    * Get the database tables.
65    *
66    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
67    * @return the database tables
68    */
69    public SiteDatabaseTables getSiteDatabaseTables() {
70      return (SiteDatabaseTables)getDatabase();
71    }
72  
73    public void init() throws PoemException {
74      super.init();
75      defineColumn(col_id =
76          new Column(this, "id",
77                     new TroidPoemType(),
78                     DefinitionSource.dsd) { 
79            public Object getCooked(Persistent g)
80                throws AccessPoemException, PoemException {
81              return ((Div)g).getId();
82            }
83  
84            public void setCooked(Persistent g, Object cooked)
85                throws AccessPoemException, ValidationPoemException {
86              ((Div)g).setId((Integer)cooked);
87            }
88  
89            public Field asField(Persistent g) {
90              return ((Div)g).getIdField();
91            }
92  
93            protected boolean defaultUserEditable() {
94              return false;
95            }
96  
97            protected boolean defaultUserCreateable() {
98              return false;
99            }
100 
101           protected DisplayLevel defaultDisplayLevel() {
102             return DisplayLevel.record;
103           }
104 
105           protected int defaultDisplayOrder() {
106             return 0;
107           }
108 
109           public Object getRaw_unsafe(Persistent g)
110               throws AccessPoemException {
111             return ((Div)g).getId_unsafe();
112           }
113 
114           public void setRaw_unsafe(Persistent g, Object raw)
115               throws AccessPoemException {
116             ((Div)g).setId_unsafe((Integer)raw);
117           }
118 
119           public Object getRaw(Persistent g)
120               throws AccessPoemException {
121             return ((Div)g).getId();
122           }
123 
124           public void setRaw(Persistent g, Object raw)
125               throws AccessPoemException {
126             ((Div)g).setId((Integer)raw);
127           }
128         });
129 
130     defineColumn(col_page =
131         new Column(this, "page",
132                    new ReferencePoemType(getSiteDatabaseTables().
133                                              getPageTable(), true),
134                    DefinitionSource.dsd) { 
135           public Object getCooked(Persistent g)
136               throws AccessPoemException, PoemException {
137             return ((Div)g).getPage();
138           }
139 
140           public void setCooked(Persistent g, Object cooked)
141               throws AccessPoemException, ValidationPoemException {
142             ((Div)g).setPage((Page)cooked);
143           }
144 
145           public Field asField(Persistent g) {
146             return ((Div)g).getPageField();
147           }
148 
149           protected DisplayLevel defaultDisplayLevel() {
150             return DisplayLevel.summary;
151           }
152 
153           protected int defaultDisplayOrder() {
154             return 1;
155           }
156 
157           protected String defaultDescription() {
158             return "The Page to which this fragment belongs";
159           }
160 
161           public Object getRaw_unsafe(Persistent g)
162               throws AccessPoemException {
163             return ((Div)g).getPage_unsafe();
164           }
165 
166           public void setRaw_unsafe(Persistent g, Object raw)
167               throws AccessPoemException {
168             ((Div)g).setPage_unsafe((Integer)raw);
169           }
170 
171           public Object getRaw(Persistent g)
172               throws AccessPoemException {
173             return ((Div)g).getPageTroid();
174           }
175 
176           public void setRaw(Persistent g, Object raw)
177               throws AccessPoemException {
178             ((Div)g).setPageTroid((Integer)raw);
179           }
180         });
181 
182     defineColumn(col_displayorder =
183         new Column(this, "displayorder",
184                    new IntegerPoemType(false),
185                    DefinitionSource.dsd) { 
186           public Object getCooked(Persistent g)
187               throws AccessPoemException, PoemException {
188             return ((Div)g).getDisplayorder();
189           }
190 
191           public void setCooked(Persistent g, Object cooked)
192               throws AccessPoemException, ValidationPoemException {
193             ((Div)g).setDisplayorder((Integer)cooked);
194           }
195 
196           public Field asField(Persistent g) {
197             return ((Div)g).getDisplayorderField();
198           }
199 
200           protected DisplayLevel defaultDisplayLevel() {
201             return DisplayLevel.record;
202           }
203 
204           protected Integer defaultDisplayOrderPriority() {
205             return new Integer(0);
206           }
207 
208           protected String defaultDisplayName() {
209             return "Display order";
210           }
211 
212           protected int defaultDisplayOrder() {
213             return 2;
214           }
215 
216           protected String defaultDescription() {
217             return "A rank determining where the div appears in a page";
218           }
219 
220           public Object getRaw_unsafe(Persistent g)
221               throws AccessPoemException {
222             return ((Div)g).getDisplayorder_unsafe();
223           }
224 
225           public void setRaw_unsafe(Persistent g, Object raw)
226               throws AccessPoemException {
227             ((Div)g).setDisplayorder_unsafe((Integer)raw);
228           }
229 
230           public Object getRaw(Persistent g)
231               throws AccessPoemException {
232             return ((Div)g).getDisplayorder();
233           }
234 
235           public void setRaw(Persistent g, Object raw)
236               throws AccessPoemException {
237             ((Div)g).setDisplayorder((Integer)raw);
238           }
239         });
240 
241     defineColumn(col_style =
242         new Column(this, "style",
243                    new ReferencePoemType(getSiteDatabaseTables().
244                                              getStyleTable(), true),
245                    DefinitionSource.dsd) { 
246           public Object getCooked(Persistent g)
247               throws AccessPoemException, PoemException {
248             return ((Div)g).getStyle();
249           }
250 
251           public void setCooked(Persistent g, Object cooked)
252               throws AccessPoemException, ValidationPoemException {
253             ((Div)g).setStyle((Style)cooked);
254           }
255 
256           public Field asField(Persistent g) {
257             return ((Div)g).getStyleField();
258           }
259 
260           protected DisplayLevel defaultDisplayLevel() {
261             return DisplayLevel.summary;
262           }
263 
264           protected Searchability defaultSearchability() {
265             return Searchability.primary;
266           }
267 
268           protected Integer defaultDisplayOrderPriority() {
269             return new Integer(1);
270           }
271 
272           protected int defaultDisplayOrder() {
273             return 3;
274           }
275 
276           protected String defaultDescription() {
277             return "The name of the CSS class for this DIV";
278           }
279 
280           public Object getRaw_unsafe(Persistent g)
281               throws AccessPoemException {
282             return ((Div)g).getStyle_unsafe();
283           }
284 
285           public void setRaw_unsafe(Persistent g, Object raw)
286               throws AccessPoemException {
287             ((Div)g).setStyle_unsafe((Integer)raw);
288           }
289 
290           public Object getRaw(Persistent g)
291               throws AccessPoemException {
292             return ((Div)g).getStyleTroid();
293           }
294 
295           public void setRaw(Persistent g, Object raw)
296               throws AccessPoemException {
297             ((Div)g).setStyleTroid((Integer)raw);
298           }
299         });
300 
301     defineColumn(col_title =
302         new Column(this, "title",
303                    new StringPoemType(true, -1),
304                    DefinitionSource.dsd) { 
305           public Object getCooked(Persistent g)
306               throws AccessPoemException, PoemException {
307             return ((Div)g).getTitle();
308           }
309 
310           public void setCooked(Persistent g, Object cooked)
311               throws AccessPoemException, ValidationPoemException {
312             ((Div)g).setTitle((String)cooked);
313           }
314 
315           public Field asField(Persistent g) {
316             return ((Div)g).getTitleField();
317           }
318 
319           protected DisplayLevel defaultDisplayLevel() {
320             return DisplayLevel.primary;
321           }
322 
323           protected int defaultDisplayOrder() {
324             return 4;
325           }
326 
327           protected String defaultDescription() {
328             return "The HTML title";
329           }
330 
331           protected int defaultWidth() {
332             return 60;
333           }
334 
335           public Object getRaw_unsafe(Persistent g)
336               throws AccessPoemException {
337             return ((Div)g).getTitle_unsafe();
338           }
339 
340           public void setRaw_unsafe(Persistent g, Object raw)
341               throws AccessPoemException {
342             ((Div)g).setTitle_unsafe((String)raw);
343           }
344 
345           public Object getRaw(Persistent g)
346               throws AccessPoemException {
347             return ((Div)g).getTitle();
348           }
349 
350           public void setRaw(Persistent g, Object raw)
351               throws AccessPoemException {
352             ((Div)g).setTitle((String)raw);
353           }
354         });
355 
356     defineColumn(col_content =
357         new Column(this, "content",
358                    new StringPoemType(true, -1),
359                    DefinitionSource.dsd) { 
360           public Object getCooked(Persistent g)
361               throws AccessPoemException, PoemException {
362             return ((Div)g).getContent();
363           }
364 
365           public void setCooked(Persistent g, Object cooked)
366               throws AccessPoemException, ValidationPoemException {
367             ((Div)g).setContent((String)cooked);
368           }
369 
370           public Field asField(Persistent g) {
371             return ((Div)g).getContentField();
372           }
373 
374           protected DisplayLevel defaultDisplayLevel() {
375             return DisplayLevel.record;
376           }
377 
378           protected int defaultDisplayOrder() {
379             return 5;
380           }
381 
382           protected String defaultDescription() {
383             return "The HTML content";
384           }
385 
386           protected int defaultWidth() {
387             return 60;
388           }
389 
390           protected int defaultHeight() {
391             return 20;
392           }
393 
394           public Object getRaw_unsafe(Persistent g)
395               throws AccessPoemException {
396             return ((Div)g).getContent_unsafe();
397           }
398 
399           public void setRaw_unsafe(Persistent g, Object raw)
400               throws AccessPoemException {
401             ((Div)g).setContent_unsafe((String)raw);
402           }
403 
404           public Object getRaw(Persistent g)
405               throws AccessPoemException {
406             return ((Div)g).getContent();
407           }
408 
409           public void setRaw(Persistent g, Object raw)
410               throws AccessPoemException {
411             ((Div)g).setContent((String)raw);
412           }
413         });
414 
415     defineColumn(col_image =
416         new Column(this, "image",
417                    new ReferencePoemType(getSiteDatabaseTables().
418                                              getUploadedImageTable(), true),
419                    DefinitionSource.dsd) { 
420           public Object getCooked(Persistent g)
421               throws AccessPoemException, PoemException {
422             return ((Div)g).getImage();
423           }
424 
425           public void setCooked(Persistent g, Object cooked)
426               throws AccessPoemException, ValidationPoemException {
427             ((Div)g).setImage((UploadedImage)cooked);
428           }
429 
430           public Field asField(Persistent g) {
431             return ((Div)g).getImageField();
432           }
433 
434           protected DisplayLevel defaultDisplayLevel() {
435             return DisplayLevel.record;
436           }
437 
438           protected Searchability defaultSearchability() {
439             return Searchability.no;
440           }
441 
442           protected String defaultDisplayName() {
443             return "Image";
444           }
445 
446           protected int defaultDisplayOrder() {
447             return 3;
448           }
449 
450           protected String defaultDescription() {
451             return "Image associated with this div";
452           }
453 
454           protected int defaultWidth() {
455             return 1;
456           }
457 
458           protected int defaultHeight() {
459             return 1;
460           }
461 
462           public Object getRaw_unsafe(Persistent g)
463               throws AccessPoemException {
464             return ((Div)g).getImage_unsafe();
465           }
466 
467           public void setRaw_unsafe(Persistent g, Object raw)
468               throws AccessPoemException {
469             ((Div)g).setImage_unsafe((Integer)raw);
470           }
471 
472           public Object getRaw(Persistent g)
473               throws AccessPoemException {
474             return ((Div)g).getImageTroid();
475           }
476 
477           public void setRaw(Persistent g, Object raw)
478               throws AccessPoemException {
479             ((Div)g).setImageTroid((Integer)raw);
480           }
481 
482           public StandardIntegrityFix defaultIntegrityFix() {
483             return StandardIntegrityFix.clear;
484           }
485         });
486   }
487 
488 
489  /**
490   * Retrieves the <code>Id</code> <code>Column</code> for this 
491   * <code>Div</code> <code>Table</code>.
492   * 
493   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
494   * @return the id <code>Column</code>
495   */
496   public final Column getIdColumn() {
497     return col_id;
498   }
499 
500 
501  /**
502   * Retrieves the <code>Page</code> <code>Column</code> for this 
503   * <code>Div</code> <code>Table</code>.
504   * 
505   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
506   * @return the page <code>Column</code>
507   */
508   public final Column getPageColumn() {
509     return col_page;
510   }
511 
512 
513  /**
514   * Retrieves the <code>Displayorder</code> <code>Column</code> for this 
515   * <code>Div</code> <code>Table</code>.
516   * 
517   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
518   * @return the displayorder <code>Column</code>
519   */
520   public final Column getDisplayorderColumn() {
521     return col_displayorder;
522   }
523 
524 
525  /**
526   * Retrieves the <code>Style</code> <code>Column</code> for this 
527   * <code>Div</code> <code>Table</code>.
528   * 
529   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
530   * @return the style <code>Column</code>
531   */
532   public final Column getStyleColumn() {
533     return col_style;
534   }
535 
536 
537  /**
538   * Retrieves the <code>Title</code> <code>Column</code> for this 
539   * <code>Div</code> <code>Table</code>.
540   * 
541   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
542   * @return the title <code>Column</code>
543   */
544   public final Column getTitleColumn() {
545     return col_title;
546   }
547 
548 
549  /**
550   * Retrieves the <code>Content</code> <code>Column</code> for this 
551   * <code>Div</code> <code>Table</code>.
552   * 
553   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
554   * @return the content <code>Column</code>
555   */
556   public final Column getContentColumn() {
557     return col_content;
558   }
559 
560 
561  /**
562   * Retrieves the <code>Image</code> <code>Column</code> for this 
563   * <code>Div</code> <code>Table</code>.
564   * 
565   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
566   * @return the image <code>Column</code>
567   */
568   public final Column getImageColumn() {
569     return col_image;
570   }
571 
572 
573  /**
574   * Retrieve the <code>Div</code> as a <code>Div</code>.
575   *
576   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
577   * @param troid a Table Row Oject ID
578   * @return the <code>Persistent</code> identified by the <code>troid</code>
579   */
580   public Div getDivObject(Integer troid) {
581     return (Div)getObject(troid);
582   }
583 
584 
585  /**
586   * Retrieve the <code>Div</code> 
587   * as a <code>Div</code>.
588   *
589   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
590   * @param troid a Table Row Object ID
591   * @return the <code>Persistent</code> identified   */
592   public Div getDivObject(int troid) {
593     return (Div)getObject(troid);
594   }
595 
596   protected JdbcPersistent _newPersistent() {
597     return new Div();
598   }
599   protected String defaultDescription() {
600     return "An HTML fragment";
601   }
602 
603   protected boolean defaultRememberAllTroids() {
604     return true;
605   }
606 
607   protected String defaultCategory() {
608     return "Data";
609   }
610 
611   protected int defaultDisplayOrder() {
612     return 550;
613   }
614 }
615