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 java.util.Collections;
8   import java.util.Enumeration;
9   import java.util.List;
10  import org.melati.poem.AccessPoemException;
11  import org.melati.poem.CachedSelection;
12  import org.melati.poem.Column;
13  import org.melati.poem.Field;
14  import org.melati.poem.JdbcPersistent;
15  import org.melati.poem.ValidationPoemException;
16  import org.melati.poem.util.EmptyEnumeration;
17  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
18  import org.paneris.bibliomania.Campaign;
19  import org.paneris.bibliomania.CampaignTable;
20  import org.paneris.bibliomania.CampaignUser;
21  
22  
23  /**
24   * Melati POEM generated abstract base class for a <code>Persistent</code> 
25   * <code>Campaign</code> Object.
26   *
27   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
28   */
29  public abstract class CampaignBase extends JdbcPersistent {
30  
31  
32   /**
33    * Retrieves the Database object.
34    * 
35    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
36    * @return the database
37    */
38    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
39      return (BibliomaniaDatabaseTables)getDatabase();
40    }
41  
42  
43   /**
44    * Retrieves the  <code>CampaignTable</code> table 
45    * which this <code>Persistent</code> is from.
46    * 
47    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
48    * @return the CampaignTable
49    */
50    @SuppressWarnings("unchecked")
51    public CampaignTable<Campaign> getCampaignTable() {
52      return (CampaignTable<Campaign>)getTable();
53    }
54  
55    @SuppressWarnings("unchecked")
56    private CampaignTable<Campaign> _getCampaignTable() {
57      return (CampaignTable<Campaign>)getTable();
58    }
59  
60    // Fields in this table 
61   /**
62    * id 
63    */
64    protected Integer id;
65   /**
66    * Display name - The Campaign's name 
67    */
68    protected String displayname;
69   /**
70    * Date Created - When this Campaign was created 
71    */
72    protected Timestamp created;
73   /**
74    * Date Last Run - When the users in this his Campaign were last emailed 
75    */
76    protected Timestamp lastrun;
77   /**
78    * Output - The file containing the output from the last run 
79    */
80    protected String output;
81   /**
82    * comment - Any comments on this Campaign 
83    */
84    protected String comment;
85   /**
86    * template - A template for the email to be sent 
87    */
88    protected String template;
89  
90  
91   /**
92    * Retrieves the <code>Id</code> value, without locking, 
93    * for this <code>Campaign</code> <code>Persistent</code>.
94    *
95    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
96    * @return the Integer id
97    */
98    public Integer getId_unsafe() {
99      return id;
100   }
101 
102 
103  /**
104   * Sets the <code>Id</code> value directly, without checking, 
105   * for this Campaign <code>Persistent</code>.
106   * 
107   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
108   * @param cooked  the pre-validated value to set
109   */
110   public void setId_unsafe(Integer cooked) {
111     id = cooked;
112   }
113 
114  /**
115   * Retrieves the Id value, with locking, for this 
116   * <code>Campaign</code> <code>Persistent</code>.
117   * 
118   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
119   * @throws AccessPoemException 
120   *         if the current <code>AccessToken</code> 
121   *         does not confer write access rights 
122   * @return the value of the field <code>Id</code> for this 
123   *         <code>Campaign</code> <code>Persistent</code>  
124   */
125 
126   public Integer getId()
127       throws AccessPoemException {
128     readLock();
129     return getId_unsafe();
130   }
131 
132 
133  /**
134   * Sets the <code>Id</code> value, with checking, for this 
135   * <code>Campaign</code> <code>Persistent</code>.
136   * 
137   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
138   * @param cooked  a validated <code>int</code> 
139   * @throws AccessPoemException 
140   *         if the current <code>AccessToken</code> 
141   *         does not confer write access rights
142   * @throws ValidationPoemException 
143   *         if the value is not valid
144   */
145   public void setId(Integer cooked)
146       throws AccessPoemException, ValidationPoemException {
147     _getCampaignTable().getIdColumn().
148       getType().assertValidCooked(cooked);
149     writeLock();
150     setId_unsafe(cooked);
151   }
152 
153  /**
154   * Sets the <code>Id</code> value, with checking, for this 
155   * <code>Campaign</code> <code>Persistent</code>.
156   * 
157   * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
158   * @param cooked  a validated <code>int</code>
159   * @throws AccessPoemException 
160   *         if the current <code>AccessToken</code> 
161   *         does not confer write access rights
162   * @throws ValidationPoemException 
163   *         if the value is not valid
164   */
165 
166   public final void setId(int cooked)
167       throws AccessPoemException, ValidationPoemException {
168     setId(new Integer(cooked));
169   }
170 
171 
172  /**
173   * Retrieves the <code>Id</code> value as a <code>Field</code>
174   * from this <code>Campaign</code> <code>Persistent</code>.
175   * 
176   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
177   * @throws AccessPoemException 
178   *         if the current <code>AccessToken</code> 
179   *         does not confer write access rights
180   * @return the Integer id
181   */
182   public Field<Integer> getIdField() throws AccessPoemException {
183     Column<Integer> c = _getCampaignTable().getIdColumn();
184     return new Field<Integer>((Integer)c.getRaw(this), c);
185   }
186 
187 
188  /**
189   * Retrieves the <code>Displayname</code> value, without locking, 
190   * for this <code>Campaign</code> <code>Persistent</code>.
191   *
192   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
193   * @return the String displayname
194   */
195   public String getDisplayname_unsafe() {
196     return displayname;
197   }
198 
199 
200  /**
201   * Sets the <code>Displayname</code> value directly, without checking, 
202   * for this Campaign <code>Persistent</code>.
203   * 
204   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
205   * @param cooked  the pre-validated value to set
206   */
207   public void setDisplayname_unsafe(String cooked) {
208     displayname = cooked;
209   }
210 
211  /**
212   * Retrieves the Displayname value, with locking, for this 
213   * <code>Campaign</code> <code>Persistent</code>.
214   * Field description: 
215   *   The Campaign's name 
216   * 
217   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
218   * @throws AccessPoemException 
219   *         if the current <code>AccessToken</code> 
220   *         does not confer write access rights 
221   * @return the value of the field <code>Displayname</code> for this 
222   *         <code>Campaign</code> <code>Persistent</code>  
223   */
224 
225   public String getDisplayname()
226       throws AccessPoemException {
227     readLock();
228     return getDisplayname_unsafe();
229   }
230 
231 
232  /**
233   * Sets the <code>Displayname</code> value, with checking, for this 
234   * <code>Campaign</code> <code>Persistent</code>.
235   * Field description: 
236   *   The Campaign's name 
237   * 
238   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
239   * @param cooked  a validated <code>int</code> 
240   * @throws AccessPoemException 
241   *         if the current <code>AccessToken</code> 
242   *         does not confer write access rights
243   * @throws ValidationPoemException 
244   *         if the value is not valid
245   */
246   public void setDisplayname(String cooked)
247       throws AccessPoemException, ValidationPoemException {
248     _getCampaignTable().getDisplaynameColumn().
249       getType().assertValidCooked(cooked);
250     writeLock();
251     setDisplayname_unsafe(cooked);
252   }
253 
254 
255  /**
256   * Retrieves the <code>Displayname</code> value as a <code>Field</code>
257   * from this <code>Campaign</code> <code>Persistent</code>.
258   * 
259   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
260   * @throws AccessPoemException 
261   *         if the current <code>AccessToken</code> 
262   *         does not confer write access rights
263   * @return the String displayname
264   */
265   public Field<String> getDisplaynameField() throws AccessPoemException {
266     Column<String> c = _getCampaignTable().getDisplaynameColumn();
267     return new Field<String>((String)c.getRaw(this), c);
268   }
269 
270 
271  /**
272   * Retrieves the <code>Created</code> value, without locking, 
273   * for this <code>Campaign</code> <code>Persistent</code>.
274   *
275   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
276   * @return the Timestamp created
277   */
278   public Timestamp getCreated_unsafe() {
279     return created;
280   }
281 
282 
283  /**
284   * Sets the <code>Created</code> value directly, without checking, 
285   * for this Campaign <code>Persistent</code>.
286   * 
287   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
288   * @param cooked  the pre-validated value to set
289   */
290   public void setCreated_unsafe(Timestamp cooked) {
291     created = cooked;
292   }
293 
294  /**
295   * Retrieves the Created value, with locking, for this 
296   * <code>Campaign</code> <code>Persistent</code>.
297   * Field description: 
298   *   When this Campaign was created 
299   * 
300   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
301   * @throws AccessPoemException 
302   *         if the current <code>AccessToken</code> 
303   *         does not confer write access rights 
304   * @return the value of the field <code>Created</code> for this 
305   *         <code>Campaign</code> <code>Persistent</code>  
306   */
307 
308   public Timestamp getCreated()
309       throws AccessPoemException {
310     readLock();
311     return getCreated_unsafe();
312   }
313 
314 
315  /**
316   * Sets the <code>Created</code> value, with checking, for this 
317   * <code>Campaign</code> <code>Persistent</code>.
318   * Field description: 
319   *   When this Campaign was created 
320   * 
321   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
322   * @param cooked  a validated <code>int</code> 
323   * @throws AccessPoemException 
324   *         if the current <code>AccessToken</code> 
325   *         does not confer write access rights
326   * @throws ValidationPoemException 
327   *         if the value is not valid
328   */
329   public void setCreated(Timestamp cooked)
330       throws AccessPoemException, ValidationPoemException {
331     _getCampaignTable().getCreatedColumn().
332       getType().assertValidCooked(cooked);
333     writeLock();
334     setCreated_unsafe(cooked);
335   }
336 
337 
338  /**
339   * Retrieves the <code>Created</code> value as a <code>Field</code>
340   * from this <code>Campaign</code> <code>Persistent</code>.
341   * 
342   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
343   * @throws AccessPoemException 
344   *         if the current <code>AccessToken</code> 
345   *         does not confer write access rights
346   * @return the Timestamp created
347   */
348   public Field<Timestamp> getCreatedField() throws AccessPoemException {
349     Column<Timestamp> c = _getCampaignTable().getCreatedColumn();
350     return new Field<Timestamp>((Timestamp)c.getRaw(this), c);
351   }
352 
353 
354  /**
355   * Retrieves the <code>Lastrun</code> value, without locking, 
356   * for this <code>Campaign</code> <code>Persistent</code>.
357   *
358   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
359   * @return the Timestamp lastrun
360   */
361   public Timestamp getLastrun_unsafe() {
362     return lastrun;
363   }
364 
365 
366  /**
367   * Sets the <code>Lastrun</code> value directly, without checking, 
368   * for this Campaign <code>Persistent</code>.
369   * 
370   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
371   * @param cooked  the pre-validated value to set
372   */
373   public void setLastrun_unsafe(Timestamp cooked) {
374     lastrun = cooked;
375   }
376 
377  /**
378   * Retrieves the Lastrun value, with locking, for this 
379   * <code>Campaign</code> <code>Persistent</code>.
380   * Field description: 
381   *   When the users in this his Campaign were last emailed 
382   * 
383   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
384   * @throws AccessPoemException 
385   *         if the current <code>AccessToken</code> 
386   *         does not confer write access rights 
387   * @return the value of the field <code>Lastrun</code> for this 
388   *         <code>Campaign</code> <code>Persistent</code>  
389   */
390 
391   public Timestamp getLastrun()
392       throws AccessPoemException {
393     readLock();
394     return getLastrun_unsafe();
395   }
396 
397 
398  /**
399   * Sets the <code>Lastrun</code> value, with checking, for this 
400   * <code>Campaign</code> <code>Persistent</code>.
401   * Field description: 
402   *   When the users in this his Campaign were last emailed 
403   * 
404   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
405   * @param cooked  a validated <code>int</code> 
406   * @throws AccessPoemException 
407   *         if the current <code>AccessToken</code> 
408   *         does not confer write access rights
409   * @throws ValidationPoemException 
410   *         if the value is not valid
411   */
412   public void setLastrun(Timestamp cooked)
413       throws AccessPoemException, ValidationPoemException {
414     _getCampaignTable().getLastrunColumn().
415       getType().assertValidCooked(cooked);
416     writeLock();
417     setLastrun_unsafe(cooked);
418   }
419 
420 
421  /**
422   * Retrieves the <code>Lastrun</code> value as a <code>Field</code>
423   * from this <code>Campaign</code> <code>Persistent</code>.
424   * 
425   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
426   * @throws AccessPoemException 
427   *         if the current <code>AccessToken</code> 
428   *         does not confer write access rights
429   * @return the Timestamp lastrun
430   */
431   public Field<Timestamp> getLastrunField() throws AccessPoemException {
432     Column<Timestamp> c = _getCampaignTable().getLastrunColumn();
433     return new Field<Timestamp>((Timestamp)c.getRaw(this), c);
434   }
435 
436 
437  /**
438   * Retrieves the <code>Output</code> value, without locking, 
439   * for this <code>Campaign</code> <code>Persistent</code>.
440   *
441   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
442   * @return the String output
443   */
444   public String getOutput_unsafe() {
445     return output;
446   }
447 
448 
449  /**
450   * Sets the <code>Output</code> value directly, without checking, 
451   * for this Campaign <code>Persistent</code>.
452   * 
453   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
454   * @param cooked  the pre-validated value to set
455   */
456   public void setOutput_unsafe(String cooked) {
457     output = cooked;
458   }
459 
460  /**
461   * Retrieves the Output value, with locking, for this 
462   * <code>Campaign</code> <code>Persistent</code>.
463   * Field description: 
464   *   The file containing the output from the last run 
465   * 
466   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
467   * @throws AccessPoemException 
468   *         if the current <code>AccessToken</code> 
469   *         does not confer write access rights 
470   * @return the value of the field <code>Output</code> for this 
471   *         <code>Campaign</code> <code>Persistent</code>  
472   */
473 
474   public String getOutput()
475       throws AccessPoemException {
476     readLock();
477     return getOutput_unsafe();
478   }
479 
480 
481  /**
482   * Sets the <code>Output</code> value, with checking, for this 
483   * <code>Campaign</code> <code>Persistent</code>.
484   * Field description: 
485   *   The file containing the output from the last run 
486   * 
487   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
488   * @param cooked  a validated <code>int</code> 
489   * @throws AccessPoemException 
490   *         if the current <code>AccessToken</code> 
491   *         does not confer write access rights
492   * @throws ValidationPoemException 
493   *         if the value is not valid
494   */
495   public void setOutput(String cooked)
496       throws AccessPoemException, ValidationPoemException {
497     _getCampaignTable().getOutputColumn().
498       getType().assertValidCooked(cooked);
499     writeLock();
500     setOutput_unsafe(cooked);
501   }
502 
503 
504  /**
505   * Retrieves the <code>Output</code> value as a <code>Field</code>
506   * from this <code>Campaign</code> <code>Persistent</code>.
507   * 
508   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
509   * @throws AccessPoemException 
510   *         if the current <code>AccessToken</code> 
511   *         does not confer write access rights
512   * @return the String output
513   */
514   public Field<String> getOutputField() throws AccessPoemException {
515     Column<String> c = _getCampaignTable().getOutputColumn();
516     return new Field<String>((String)c.getRaw(this), c);
517   }
518 
519 
520  /**
521   * Retrieves the <code>Comment</code> value, without locking, 
522   * for this <code>Campaign</code> <code>Persistent</code>.
523   *
524   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
525   * @return the String comment
526   */
527   public String getComment_unsafe() {
528     return comment;
529   }
530 
531 
532  /**
533   * Sets the <code>Comment</code> value directly, without checking, 
534   * for this Campaign <code>Persistent</code>.
535   * 
536   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
537   * @param cooked  the pre-validated value to set
538   */
539   public void setComment_unsafe(String cooked) {
540     comment = cooked;
541   }
542 
543  /**
544   * Retrieves the Comment value, with locking, for this 
545   * <code>Campaign</code> <code>Persistent</code>.
546   * Field description: 
547   *   Any comments on this Campaign 
548   * 
549   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
550   * @throws AccessPoemException 
551   *         if the current <code>AccessToken</code> 
552   *         does not confer write access rights 
553   * @return the value of the field <code>Comment</code> for this 
554   *         <code>Campaign</code> <code>Persistent</code>  
555   */
556 
557   public String getComment()
558       throws AccessPoemException {
559     readLock();
560     return getComment_unsafe();
561   }
562 
563 
564  /**
565   * Sets the <code>Comment</code> value, with checking, for this 
566   * <code>Campaign</code> <code>Persistent</code>.
567   * Field description: 
568   *   Any comments on this Campaign 
569   * 
570   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
571   * @param cooked  a validated <code>int</code> 
572   * @throws AccessPoemException 
573   *         if the current <code>AccessToken</code> 
574   *         does not confer write access rights
575   * @throws ValidationPoemException 
576   *         if the value is not valid
577   */
578   public void setComment(String cooked)
579       throws AccessPoemException, ValidationPoemException {
580     _getCampaignTable().getCommentColumn().
581       getType().assertValidCooked(cooked);
582     writeLock();
583     setComment_unsafe(cooked);
584   }
585 
586 
587  /**
588   * Retrieves the <code>Comment</code> value as a <code>Field</code>
589   * from this <code>Campaign</code> <code>Persistent</code>.
590   * 
591   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
592   * @throws AccessPoemException 
593   *         if the current <code>AccessToken</code> 
594   *         does not confer write access rights
595   * @return the String comment
596   */
597   public Field<String> getCommentField() throws AccessPoemException {
598     Column<String> c = _getCampaignTable().getCommentColumn();
599     return new Field<String>((String)c.getRaw(this), c);
600   }
601 
602 
603  /**
604   * Retrieves the <code>Template</code> value, without locking, 
605   * for this <code>Campaign</code> <code>Persistent</code>.
606   *
607   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
608   * @return the String template
609   */
610   public String getTemplate_unsafe() {
611     return template;
612   }
613 
614 
615  /**
616   * Sets the <code>Template</code> value directly, without checking, 
617   * for this Campaign <code>Persistent</code>.
618   * 
619   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
620   * @param cooked  the pre-validated value to set
621   */
622   public void setTemplate_unsafe(String cooked) {
623     template = cooked;
624   }
625 
626  /**
627   * Retrieves the Template value, with locking, for this 
628   * <code>Campaign</code> <code>Persistent</code>.
629   * Field description: 
630   *   A template for the email to be sent 
631   * 
632   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
633   * @throws AccessPoemException 
634   *         if the current <code>AccessToken</code> 
635   *         does not confer write access rights 
636   * @return the value of the field <code>Template</code> for this 
637   *         <code>Campaign</code> <code>Persistent</code>  
638   */
639 
640   public String getTemplate()
641       throws AccessPoemException {
642     readLock();
643     return getTemplate_unsafe();
644   }
645 
646 
647  /**
648   * Sets the <code>Template</code> value, with checking, for this 
649   * <code>Campaign</code> <code>Persistent</code>.
650   * Field description: 
651   *   A template for the email to be sent 
652   * 
653   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
654   * @param cooked  a validated <code>int</code> 
655   * @throws AccessPoemException 
656   *         if the current <code>AccessToken</code> 
657   *         does not confer write access rights
658   * @throws ValidationPoemException 
659   *         if the value is not valid
660   */
661   public void setTemplate(String cooked)
662       throws AccessPoemException, ValidationPoemException {
663     _getCampaignTable().getTemplateColumn().
664       getType().assertValidCooked(cooked);
665     writeLock();
666     setTemplate_unsafe(cooked);
667   }
668 
669 
670  /**
671   * Retrieves the <code>Template</code> value as a <code>Field</code>
672   * from this <code>Campaign</code> <code>Persistent</code>.
673   * 
674   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
675   * @throws AccessPoemException 
676   *         if the current <code>AccessToken</code> 
677   *         does not confer write access rights
678   * @return the String template
679   */
680   public Field<String> getTemplateField() throws AccessPoemException {
681     Column<String> c = _getCampaignTable().getTemplateColumn();
682     return new Field<String>((String)c.getRaw(this), c);
683   }
684 
685   private CachedSelection<CampaignUser> campaignCampaignUsers = null;
686   /** References to this Campaign in the CampaignUser table via its campaign field.*/
687   @SuppressWarnings("unchecked")
688   public Enumeration<CampaignUser> getCampaignCampaignUsers() {
689     if (getTroid() == null)
690       return new EmptyEnumeration<CampaignUser>();
691     else {
692       if (campaignCampaignUsers == null)
693         campaignCampaignUsers =
694           getBibliomaniaDatabaseTables().getCampaignUserTable().getCampaignColumn().cachedSelectionWhereEq(getTroid());
695       return campaignCampaignUsers.objects();
696     }
697   }
698 
699 
700   /** References to this Campaign in the CampaignUser table via its campaign field, as a List.*/
701   public List<CampaignUser> getCampaignCampaignUserList() {
702     return Collections.list(getCampaignCampaignUsers());
703   }
704 
705 
706 
707 }
708