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.Link;
22  import org.paneris.melati.site.model.LinkType;
23  import org.paneris.melati.site.model.Page;
24  import org.paneris.melati.site.model.SiteDatabaseTables;
25  import org.paneris.melati.site.model.SiteTable;
26  
27  
28  /**
29   * Melati POEM generated base class for 
30  <code>Table</code> <code>Link</code>.
31   *
32   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
33   */
34  
35  public class LinkTableBase extends SiteTable {
36  
37    private Column col_id = null;
38    private Column col_page = null;
39    private Column col_type = null;
40    private Column col_url = null;
41    private Column col_displayname = null;
42    private Column col_displayorder = null;
43  
44   /**
45    * Constructor. 
46    * 
47    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
48    * @param database          the POEM database we are using
49    * @param name              the name of this <code>Table</code>
50    * @param definitionSource  which definition is being used
51    * @throws PoemException    if anything goes wrong
52    */
53  
54    public LinkTableBase(
55        Database database, String name,
56        DefinitionSource definitionSource) throws PoemException {
57      super(database, name, definitionSource);
58    }
59  
60  
61   /**
62    * Get the database tables.
63    *
64    * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
65    * @return the database tables
66    */
67    public SiteDatabaseTables getSiteDatabaseTables() {
68      return (SiteDatabaseTables)getDatabase();
69    }
70  
71    public void init() throws PoemException {
72      super.init();
73      defineColumn(col_id =
74          new Column(this, "id",
75                     new TroidPoemType(),
76                     DefinitionSource.dsd) { 
77            public Object getCooked(Persistent g)
78                throws AccessPoemException, PoemException {
79              return ((Link)g).getId();
80            }
81  
82            public void setCooked(Persistent g, Object cooked)
83                throws AccessPoemException, ValidationPoemException {
84              ((Link)g).setId((Integer)cooked);
85            }
86  
87            public Field asField(Persistent g) {
88              return ((Link)g).getIdField();
89            }
90  
91            protected boolean defaultUserEditable() {
92              return false;
93            }
94  
95            protected boolean defaultUserCreateable() {
96              return false;
97            }
98  
99            protected DisplayLevel defaultDisplayLevel() {
100             return DisplayLevel.record;
101           }
102 
103           protected int defaultDisplayOrder() {
104             return 0;
105           }
106 
107           public Object getRaw_unsafe(Persistent g)
108               throws AccessPoemException {
109             return ((Link)g).getId_unsafe();
110           }
111 
112           public void setRaw_unsafe(Persistent g, Object raw)
113               throws AccessPoemException {
114             ((Link)g).setId_unsafe((Integer)raw);
115           }
116 
117           public Object getRaw(Persistent g)
118               throws AccessPoemException {
119             return ((Link)g).getId();
120           }
121 
122           public void setRaw(Persistent g, Object raw)
123               throws AccessPoemException {
124             ((Link)g).setId((Integer)raw);
125           }
126         });
127 
128     defineColumn(col_page =
129         new Column(this, "page",
130                    new ReferencePoemType(getSiteDatabaseTables().
131                                              getPageTable(), false),
132                    DefinitionSource.dsd) { 
133           public Object getCooked(Persistent g)
134               throws AccessPoemException, PoemException {
135             return ((Link)g).getPage();
136           }
137 
138           public void setCooked(Persistent g, Object cooked)
139               throws AccessPoemException, ValidationPoemException {
140             ((Link)g).setPage((Page)cooked);
141           }
142 
143           public Field asField(Persistent g) {
144             return ((Link)g).getPageField();
145           }
146 
147           protected Searchability defaultSearchability() {
148             return Searchability.primary;
149           }
150 
151           protected Integer defaultDisplayOrderPriority() {
152             return new Integer(1);
153           }
154 
155           protected int defaultDisplayOrder() {
156             return 1;
157           }
158 
159           protected String defaultDescription() {
160             return "The page to which the link is relevant";
161           }
162 
163           protected boolean defaultIndexed() {
164             return true;
165           }
166 
167           protected String defaultRenderinfo() {
168             return "SelectionWindow";
169           }
170 
171           public Object getRaw_unsafe(Persistent g)
172               throws AccessPoemException {
173             return ((Link)g).getPage_unsafe();
174           }
175 
176           public void setRaw_unsafe(Persistent g, Object raw)
177               throws AccessPoemException {
178             ((Link)g).setPage_unsafe((Integer)raw);
179           }
180 
181           public Object getRaw(Persistent g)
182               throws AccessPoemException {
183             return ((Link)g).getPageTroid();
184           }
185 
186           public void setRaw(Persistent g, Object raw)
187               throws AccessPoemException {
188             ((Link)g).setPageTroid((Integer)raw);
189           }
190 
191           public StandardIntegrityFix defaultIntegrityFix() {
192             return StandardIntegrityFix.delete;
193           }
194         });
195 
196     defineColumn(col_type =
197         new Column(this, "type",
198                    new ReferencePoemType(getSiteDatabaseTables().
199                                              getLinkTypeTable(), false),
200                    DefinitionSource.dsd) { 
201           public Object getCooked(Persistent g)
202               throws AccessPoemException, PoemException {
203             return ((Link)g).getType();
204           }
205 
206           public void setCooked(Persistent g, Object cooked)
207               throws AccessPoemException, ValidationPoemException {
208             ((Link)g).setType((LinkType)cooked);
209           }
210 
211           public Field asField(Persistent g) {
212             return ((Link)g).getTypeField();
213           }
214 
215           protected int defaultDisplayOrder() {
216             return 2;
217           }
218 
219           protected String defaultDescription() {
220             return "The type of this link";
221           }
222 
223           public Object getRaw_unsafe(Persistent g)
224               throws AccessPoemException {
225             return ((Link)g).getType_unsafe();
226           }
227 
228           public void setRaw_unsafe(Persistent g, Object raw)
229               throws AccessPoemException {
230             ((Link)g).setType_unsafe((Integer)raw);
231           }
232 
233           public Object getRaw(Persistent g)
234               throws AccessPoemException {
235             return ((Link)g).getTypeTroid();
236           }
237 
238           public void setRaw(Persistent g, Object raw)
239               throws AccessPoemException {
240             ((Link)g).setTypeTroid((Integer)raw);
241           }
242         });
243 
244     defineColumn(col_url =
245         new Column(this, "url",
246                    new StringPoemType(false, -1),
247                    DefinitionSource.dsd) { 
248           public Object getCooked(Persistent g)
249               throws AccessPoemException, PoemException {
250             return ((Link)g).getUrl();
251           }
252 
253           public void setCooked(Persistent g, Object cooked)
254               throws AccessPoemException, ValidationPoemException {
255             ((Link)g).setUrl((String)cooked);
256           }
257 
258           public Field asField(Persistent g) {
259             return ((Link)g).getUrlField();
260           }
261 
262           protected String defaultDisplayName() {
263             return "URL";
264           }
265 
266           protected int defaultDisplayOrder() {
267             return 3;
268           }
269 
270           protected String defaultDescription() {
271             return "The full URL for the site's front page";
272           }
273 
274           public Object getRaw_unsafe(Persistent g)
275               throws AccessPoemException {
276             return ((Link)g).getUrl_unsafe();
277           }
278 
279           public void setRaw_unsafe(Persistent g, Object raw)
280               throws AccessPoemException {
281             ((Link)g).setUrl_unsafe((String)raw);
282           }
283 
284           public Object getRaw(Persistent g)
285               throws AccessPoemException {
286             return ((Link)g).getUrl();
287           }
288 
289           public void setRaw(Persistent g, Object raw)
290               throws AccessPoemException {
291             ((Link)g).setUrl((String)raw);
292           }
293         });
294 
295     defineColumn(col_displayname =
296         new Column(this, "displayname",
297                    new StringPoemType(false, -1),
298                    DefinitionSource.dsd) { 
299           public Object getCooked(Persistent g)
300               throws AccessPoemException, PoemException {
301             return ((Link)g).getDisplayname();
302           }
303 
304           public void setCooked(Persistent g, Object cooked)
305               throws AccessPoemException, ValidationPoemException {
306             ((Link)g).setDisplayname((String)cooked);
307           }
308 
309           public Field asField(Persistent g) {
310             return ((Link)g).getDisplaynameField();
311           }
312 
313           protected DisplayLevel defaultDisplayLevel() {
314             return DisplayLevel.primary;
315           }
316 
317           protected String defaultDisplayName() {
318             return "Display name";
319           }
320 
321           protected int defaultDisplayOrder() {
322             return 4;
323           }
324 
325           protected String defaultDescription() {
326             return "The site's name";
327           }
328 
329           public Object getRaw_unsafe(Persistent g)
330               throws AccessPoemException {
331             return ((Link)g).getDisplayname_unsafe();
332           }
333 
334           public void setRaw_unsafe(Persistent g, Object raw)
335               throws AccessPoemException {
336             ((Link)g).setDisplayname_unsafe((String)raw);
337           }
338 
339           public Object getRaw(Persistent g)
340               throws AccessPoemException {
341             return ((Link)g).getDisplayname();
342           }
343 
344           public void setRaw(Persistent g, Object raw)
345               throws AccessPoemException {
346             ((Link)g).setDisplayname((String)raw);
347           }
348         });
349 
350     defineColumn(col_displayorder =
351         new Column(this, "displayorder",
352                    new IntegerPoemType(false),
353                    DefinitionSource.dsd) { 
354           public Object getCooked(Persistent g)
355               throws AccessPoemException, PoemException {
356             return ((Link)g).getDisplayorder();
357           }
358 
359           public void setCooked(Persistent g, Object cooked)
360               throws AccessPoemException, ValidationPoemException {
361             ((Link)g).setDisplayorder((Integer)cooked);
362           }
363 
364           public Field asField(Persistent g) {
365             return ((Link)g).getDisplayorderField();
366           }
367 
368           protected Integer defaultDisplayOrderPriority() {
369             return new Integer(0);
370           }
371 
372           protected int defaultDisplayOrder() {
373             return 5;
374           }
375 
376           public Object getRaw_unsafe(Persistent g)
377               throws AccessPoemException {
378             return ((Link)g).getDisplayorder_unsafe();
379           }
380 
381           public void setRaw_unsafe(Persistent g, Object raw)
382               throws AccessPoemException {
383             ((Link)g).setDisplayorder_unsafe((Integer)raw);
384           }
385 
386           public Object getRaw(Persistent g)
387               throws AccessPoemException {
388             return ((Link)g).getDisplayorder();
389           }
390 
391           public void setRaw(Persistent g, Object raw)
392               throws AccessPoemException {
393             ((Link)g).setDisplayorder((Integer)raw);
394           }
395         });
396   }
397 
398 
399  /**
400   * Retrieves the <code>Id</code> <code>Column</code> for this 
401   * <code>Link</code> <code>Table</code>.
402   * 
403   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
404   * @return the id <code>Column</code>
405   */
406   public final Column getIdColumn() {
407     return col_id;
408   }
409 
410 
411  /**
412   * Retrieves the <code>Page</code> <code>Column</code> for this 
413   * <code>Link</code> <code>Table</code>.
414   * 
415   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
416   * @return the page <code>Column</code>
417   */
418   public final Column getPageColumn() {
419     return col_page;
420   }
421 
422 
423  /**
424   * Retrieves the <code>Type</code> <code>Column</code> for this 
425   * <code>Link</code> <code>Table</code>.
426   * 
427   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
428   * @return the type <code>Column</code>
429   */
430   public final Column getTypeColumn() {
431     return col_type;
432   }
433 
434 
435  /**
436   * Retrieves the <code>Url</code> <code>Column</code> for this 
437   * <code>Link</code> <code>Table</code>.
438   * 
439   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
440   * @return the url <code>Column</code>
441   */
442   public final Column getUrlColumn() {
443     return col_url;
444   }
445 
446 
447  /**
448   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
449   * <code>Link</code> <code>Table</code>.
450   * 
451   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
452   * @return the displayname <code>Column</code>
453   */
454   public final Column getDisplaynameColumn() {
455     return col_displayname;
456   }
457 
458 
459  /**
460   * Retrieves the <code>Displayorder</code> <code>Column</code> for this 
461   * <code>Link</code> <code>Table</code>.
462   * 
463   * @see org.melati.poem.prepro.FieldDef#generateColAccessor 
464   * @return the displayorder <code>Column</code>
465   */
466   public final Column getDisplayorderColumn() {
467     return col_displayorder;
468   }
469 
470 
471  /**
472   * Retrieve the <code>Link</code> as a <code>Link</code>.
473   *
474   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
475   * @param troid a Table Row Oject ID
476   * @return the <code>Persistent</code> identified by the <code>troid</code>
477   */
478   public Link getLinkObject(Integer troid) {
479     return (Link)getObject(troid);
480   }
481 
482 
483  /**
484   * Retrieve the <code>Link</code> 
485   * as a <code>Link</code>.
486   *
487   * @see org.melati.poem.prepro.TableDef#generateTableBaseJava 
488   * @param troid a Table Row Object ID
489   * @return the <code>Persistent</code> identified   */
490   public Link getLinkObject(int troid) {
491     return (Link)getObject(troid);
492   }
493 
494   protected JdbcPersistent _newPersistent() {
495     return new Link();
496   }
497   protected String defaultDisplayName() {
498     return "Link";
499   }
500 
501   protected String defaultDescription() {
502     return "A link";
503   }
504 
505   protected String defaultCategory() {
506     return "Data";
507   }
508 
509   protected int defaultDisplayOrder() {
510     return 700;
511   }
512 }
513