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.Searchability;
17  import org.melati.poem.StringPoemType;
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.Campaign;
24  
25  
26  /**
27   * Melati POEM generated base class for <code>Table</code> <code>Campaign</code>.
28   *
29   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
30   */
31  
32  public class CampaignTableBase<T extends Campaign> extends BibliomaniaTable<T> {
33  
34    private Column<Integer> col_id = null;
35    private Column<String> col_displayname = null;
36    private Column<Timestamp> col_created = null;
37    private Column<Timestamp> col_lastrun = null;
38    private Column<String> col_output = null;
39    private Column<String> col_comment = null;
40    private Column<String> col_template = 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 CampaignTableBase(
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 ((Campaign)g).getId();
84            }
85  
86            public void setCooked(Persistent g, Object cooked)
87                throws AccessPoemException, ValidationPoemException {
88              ((Campaign)g).setId((Integer)cooked);
89            }
90  
91            public Field<Integer> asField(Persistent g) {
92              return ((Campaign)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 int defaultDisplayOrder() {
108             return 0;
109           }
110 
111           public Object getRaw_unsafe(Persistent g)
112               throws AccessPoemException {
113             return ((Campaign)g).getId_unsafe();
114           }
115 
116           public void setRaw_unsafe(Persistent g, Object raw)
117               throws AccessPoemException {
118             ((Campaign)g).setId_unsafe((Integer)raw);
119           }
120 
121           public Object getRaw(Persistent g)
122               throws AccessPoemException {
123             return ((Campaign)g).getId();
124           }
125 
126           public void setRaw(Persistent g, Object raw)
127               throws AccessPoemException {
128             ((Campaign)g).setId((Integer)raw);
129           }
130         });
131 
132     defineColumn(col_displayname =
133         new Column<String>(this, "displayname",
134                    new StringPoemType(false, -1),
135                    DefinitionSource.dsd) { 
136           public Object getCooked(Persistent g)
137               throws AccessPoemException, PoemException {
138             return ((Campaign)g).getDisplayname();
139           }
140 
141           public void setCooked(Persistent g, Object cooked)
142               throws AccessPoemException, ValidationPoemException {
143             ((Campaign)g).setDisplayname((String)cooked);
144           }
145 
146           public Field<String> asField(Persistent g) {
147             return ((Campaign)g).getDisplaynameField();
148           }
149 
150           public DisplayLevel defaultDisplayLevel() {
151             return DisplayLevel.primary;
152           }
153 
154           public Searchability defaultSearchability() {
155             return Searchability.primary;
156           }
157 
158           public String defaultDisplayName() {
159             return "Display name";
160           }
161 
162           public int defaultDisplayOrder() {
163             return 1;
164           }
165 
166           public String defaultDescription() {
167             return "The Campaign's name";
168           }
169 
170           public Object getRaw_unsafe(Persistent g)
171               throws AccessPoemException {
172             return ((Campaign)g).getDisplayname_unsafe();
173           }
174 
175           public void setRaw_unsafe(Persistent g, Object raw)
176               throws AccessPoemException {
177             ((Campaign)g).setDisplayname_unsafe((String)raw);
178           }
179 
180           public Object getRaw(Persistent g)
181               throws AccessPoemException {
182             return ((Campaign)g).getDisplayname();
183           }
184 
185           public void setRaw(Persistent g, Object raw)
186               throws AccessPoemException {
187             ((Campaign)g).setDisplayname((String)raw);
188           }
189         });
190 
191     defineColumn(col_created =
192         new Column<Timestamp>(this, "created",
193                    new TimestampPoemType(false),
194                    DefinitionSource.dsd) { 
195           public Object getCooked(Persistent g)
196               throws AccessPoemException, PoemException {
197             return ((Campaign)g).getCreated();
198           }
199 
200           public void setCooked(Persistent g, Object cooked)
201               throws AccessPoemException, ValidationPoemException {
202             ((Campaign)g).setCreated((Timestamp)cooked);
203           }
204 
205           public Field<Timestamp> asField(Persistent g) {
206             return ((Campaign)g).getCreatedField();
207           }
208 
209           public DisplayLevel defaultDisplayLevel() {
210             return DisplayLevel.record;
211           }
212 
213           public String defaultDisplayName() {
214             return "Date Created";
215           }
216 
217           public int defaultDisplayOrder() {
218             return 2;
219           }
220 
221           public String defaultDescription() {
222             return "When this Campaign was created";
223           }
224 
225           public Object getRaw_unsafe(Persistent g)
226               throws AccessPoemException {
227             return ((Campaign)g).getCreated_unsafe();
228           }
229 
230           public void setRaw_unsafe(Persistent g, Object raw)
231               throws AccessPoemException {
232             ((Campaign)g).setCreated_unsafe((Timestamp)raw);
233           }
234 
235           public Object getRaw(Persistent g)
236               throws AccessPoemException {
237             return ((Campaign)g).getCreated();
238           }
239 
240           public void setRaw(Persistent g, Object raw)
241               throws AccessPoemException {
242             ((Campaign)g).setCreated((Timestamp)raw);
243           }
244         });
245 
246     defineColumn(col_lastrun =
247         new Column<Timestamp>(this, "lastrun",
248                    new TimestampPoemType(true),
249                    DefinitionSource.dsd) { 
250           public Object getCooked(Persistent g)
251               throws AccessPoemException, PoemException {
252             return ((Campaign)g).getLastrun();
253           }
254 
255           public void setCooked(Persistent g, Object cooked)
256               throws AccessPoemException, ValidationPoemException {
257             ((Campaign)g).setLastrun((Timestamp)cooked);
258           }
259 
260           public Field<Timestamp> asField(Persistent g) {
261             return ((Campaign)g).getLastrunField();
262           }
263 
264           public DisplayLevel defaultDisplayLevel() {
265             return DisplayLevel.record;
266           }
267 
268           public String defaultDisplayName() {
269             return "Date Last Run";
270           }
271 
272           public int defaultDisplayOrder() {
273             return 3;
274           }
275 
276           public String defaultDescription() {
277             return "When the users in this his Campaign were last emailed";
278           }
279 
280           public Object getRaw_unsafe(Persistent g)
281               throws AccessPoemException {
282             return ((Campaign)g).getLastrun_unsafe();
283           }
284 
285           public void setRaw_unsafe(Persistent g, Object raw)
286               throws AccessPoemException {
287             ((Campaign)g).setLastrun_unsafe((Timestamp)raw);
288           }
289 
290           public Object getRaw(Persistent g)
291               throws AccessPoemException {
292             return ((Campaign)g).getLastrun();
293           }
294 
295           public void setRaw(Persistent g, Object raw)
296               throws AccessPoemException {
297             ((Campaign)g).setLastrun((Timestamp)raw);
298           }
299         });
300 
301     defineColumn(col_output =
302         new Column<String>(this, "output",
303                    new StringPoemType(false, -1),
304                    DefinitionSource.dsd) { 
305           public Object getCooked(Persistent g)
306               throws AccessPoemException, PoemException {
307             return ((Campaign)g).getOutput();
308           }
309 
310           public void setCooked(Persistent g, Object cooked)
311               throws AccessPoemException, ValidationPoemException {
312             ((Campaign)g).setOutput((String)cooked);
313           }
314 
315           public Field<String> asField(Persistent g) {
316             return ((Campaign)g).getOutputField();
317           }
318 
319           public DisplayLevel defaultDisplayLevel() {
320             return DisplayLevel.record;
321           }
322 
323           public Searchability defaultSearchability() {
324             return Searchability.yes;
325           }
326 
327           public String defaultDisplayName() {
328             return "Output";
329           }
330 
331           public int defaultDisplayOrder() {
332             return 4;
333           }
334 
335           public String defaultDescription() {
336             return "The file containing the output from the last run";
337           }
338 
339           public Object getRaw_unsafe(Persistent g)
340               throws AccessPoemException {
341             return ((Campaign)g).getOutput_unsafe();
342           }
343 
344           public void setRaw_unsafe(Persistent g, Object raw)
345               throws AccessPoemException {
346             ((Campaign)g).setOutput_unsafe((String)raw);
347           }
348 
349           public Object getRaw(Persistent g)
350               throws AccessPoemException {
351             return ((Campaign)g).getOutput();
352           }
353 
354           public void setRaw(Persistent g, Object raw)
355               throws AccessPoemException {
356             ((Campaign)g).setOutput((String)raw);
357           }
358         });
359 
360     defineColumn(col_comment =
361         new Column<String>(this, "comment",
362                    new StringPoemType(true, -1),
363                    DefinitionSource.dsd) { 
364           public Object getCooked(Persistent g)
365               throws AccessPoemException, PoemException {
366             return ((Campaign)g).getComment();
367           }
368 
369           public void setCooked(Persistent g, Object cooked)
370               throws AccessPoemException, ValidationPoemException {
371             ((Campaign)g).setComment((String)cooked);
372           }
373 
374           public Field<String> asField(Persistent g) {
375             return ((Campaign)g).getCommentField();
376           }
377 
378           public DisplayLevel defaultDisplayLevel() {
379             return DisplayLevel.record;
380           }
381 
382           public Searchability defaultSearchability() {
383             return Searchability.no;
384           }
385 
386           public int defaultDisplayOrder() {
387             return 5;
388           }
389 
390           public String defaultDescription() {
391             return "Any comments on this Campaign";
392           }
393 
394           public int defaultWidth() {
395             return 60;
396           }
397 
398           public int defaultHeight() {
399             return 10;
400           }
401 
402           public Object getRaw_unsafe(Persistent g)
403               throws AccessPoemException {
404             return ((Campaign)g).getComment_unsafe();
405           }
406 
407           public void setRaw_unsafe(Persistent g, Object raw)
408               throws AccessPoemException {
409             ((Campaign)g).setComment_unsafe((String)raw);
410           }
411 
412           public Object getRaw(Persistent g)
413               throws AccessPoemException {
414             return ((Campaign)g).getComment();
415           }
416 
417           public void setRaw(Persistent g, Object raw)
418               throws AccessPoemException {
419             ((Campaign)g).setComment((String)raw);
420           }
421         });
422 
423     defineColumn(col_template =
424         new Column<String>(this, "template",
425                    new StringPoemType(true, -1),
426                    DefinitionSource.dsd) { 
427           public Object getCooked(Persistent g)
428               throws AccessPoemException, PoemException {
429             return ((Campaign)g).getTemplate();
430           }
431 
432           public void setCooked(Persistent g, Object cooked)
433               throws AccessPoemException, ValidationPoemException {
434             ((Campaign)g).setTemplate((String)cooked);
435           }
436 
437           public Field<String> asField(Persistent g) {
438             return ((Campaign)g).getTemplateField();
439           }
440 
441           public DisplayLevel defaultDisplayLevel() {
442             return DisplayLevel.record;
443           }
444 
445           public Searchability defaultSearchability() {
446             return Searchability.no;
447           }
448 
449           public int defaultDisplayOrder() {
450             return 6;
451           }
452 
453           public String defaultDescription() {
454             return "A template for the email to be sent";
455           }
456 
457           public int defaultWidth() {
458             return 80;
459           }
460 
461           public int defaultHeight() {
462             return 20;
463           }
464 
465           public Object getRaw_unsafe(Persistent g)
466               throws AccessPoemException {
467             return ((Campaign)g).getTemplate_unsafe();
468           }
469 
470           public void setRaw_unsafe(Persistent g, Object raw)
471               throws AccessPoemException {
472             ((Campaign)g).setTemplate_unsafe((String)raw);
473           }
474 
475           public Object getRaw(Persistent g)
476               throws AccessPoemException {
477             return ((Campaign)g).getTemplate();
478           }
479 
480           public void setRaw(Persistent g, Object raw)
481               throws AccessPoemException {
482             ((Campaign)g).setTemplate((String)raw);
483           }
484         });
485   }
486 
487 
488  /**
489   * Retrieves the <code>Id</code> <code>Column</code> for this 
490   * <code>Campaign</code> <code>Table</code>.
491   * 
492   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
493   * @return the id <code>Column</code>
494   */
495   public final Column<Integer> getIdColumn() {
496     return col_id;
497   }
498 
499 
500  /**
501   * Retrieves the <code>Displayname</code> <code>Column</code> for this 
502   * <code>Campaign</code> <code>Table</code>.
503   * 
504   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
505   * @return the displayname <code>Column</code>
506   */
507   public final Column<String> getDisplaynameColumn() {
508     return col_displayname;
509   }
510 
511 
512  /**
513   * Retrieves the <code>Created</code> <code>Column</code> for this 
514   * <code>Campaign</code> <code>Table</code>.
515   * 
516   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
517   * @return the created <code>Column</code>
518   */
519   public final Column<Timestamp> getCreatedColumn() {
520     return col_created;
521   }
522 
523 
524  /**
525   * Retrieves the <code>Lastrun</code> <code>Column</code> for this 
526   * <code>Campaign</code> <code>Table</code>.
527   * 
528   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
529   * @return the lastrun <code>Column</code>
530   */
531   public final Column<Timestamp> getLastrunColumn() {
532     return col_lastrun;
533   }
534 
535 
536  /**
537   * Retrieves the <code>Output</code> <code>Column</code> for this 
538   * <code>Campaign</code> <code>Table</code>.
539   * 
540   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
541   * @return the output <code>Column</code>
542   */
543   public final Column<String> getOutputColumn() {
544     return col_output;
545   }
546 
547 
548  /**
549   * Retrieves the <code>Comment</code> <code>Column</code> for this 
550   * <code>Campaign</code> <code>Table</code>.
551   * 
552   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
553   * @return the comment <code>Column</code>
554   */
555   public final Column<String> getCommentColumn() {
556     return col_comment;
557   }
558 
559 
560  /**
561   * Retrieves the <code>Template</code> <code>Column</code> for this 
562   * <code>Campaign</code> <code>Table</code>.
563   * 
564   * see org.melati.poem.prepro.FieldDef#generateColAccessor 
565   * @return the template <code>Column</code>
566   */
567   public final Column<String> getTemplateColumn() {
568     return col_template;
569   }
570 
571 
572  /**
573   * Retrieve the <code>Campaign</code> as a <code>Campaign</code>.
574   *
575   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
576   * @param troid a Table Row Oject ID
577   * @return the <code>Persistent</code> identified by the <code>troid</code>
578   */
579   public Campaign getCampaignObject(Integer troid) {
580     return (Campaign)getObject(troid);
581   }
582 
583 
584  /**
585   * Retrieve the <code>Campaign</code> 
586   * as a <code>Campaign</code>.
587   *
588   * see org.melati.poem.prepro.TableDef#generateTableBaseJava 
589   * @param troid a Table Row Object ID
590   * @return the <code>Persistent</code> identified   */
591   public Campaign getCampaignObject(int troid) {
592     return (Campaign)getObject(troid);
593   }
594 
595   protected JdbcPersistent _newPersistent() {
596     return new Campaign();
597   }
598   public String defaultDescription() {
599     return "A campaign to send emails to users";
600   }
601 
602   public boolean defaultRememberAllTroids() {
603     return true;
604   }
605 
606   public String defaultCategory() {
607     return "User";
608   }
609 
610   public int defaultDisplayOrder() {
611     return 2100;
612   }
613 }
614