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.util.Collections;
7   import java.util.Enumeration;
8   import java.util.List;
9   import org.melati.poem.AccessPoemException;
10  import org.melati.poem.CachedSelection;
11  import org.melati.poem.Column;
12  import org.melati.poem.Field;
13  import org.melati.poem.JdbcPersistent;
14  import org.melati.poem.ValidationPoemException;
15  import org.melati.poem.util.EmptyEnumeration;
16  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
17  import org.paneris.bibliomania.Product;
18  import org.paneris.bibliomania.Publisher;
19  import org.paneris.bibliomania.PublisherTable;
20  
21  
22  /**
23   * Melati POEM generated abstract base class for a <code>Persistent</code> 
24   * <code>Publisher</code> Object.
25   *
26   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
27   */
28  public abstract class PublisherBase extends JdbcPersistent {
29  
30  
31   /**
32    * Retrieves the Database object.
33    * 
34    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
35    * @return the database
36    */
37    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
38      return (BibliomaniaDatabaseTables)getDatabase();
39    }
40  
41  
42   /**
43    * Retrieves the  <code>PublisherTable</code> table 
44    * which this <code>Persistent</code> is from.
45    * 
46    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
47    * @return the PublisherTable
48    */
49    @SuppressWarnings("unchecked")
50    public PublisherTable<Publisher> getPublisherTable() {
51      return (PublisherTable<Publisher>)getTable();
52    }
53  
54    @SuppressWarnings("unchecked")
55    private PublisherTable<Publisher> _getPublisherTable() {
56      return (PublisherTable<Publisher>)getTable();
57    }
58  
59    // Fields in this table 
60   /**
61    * id 
62    */
63    protected Integer id;
64   /**
65    * Name - The full name of the Publisher 
66    */
67    protected String name;
68   /**
69    * Address - A postal address for the Publisher 
70    */
71    protected String address;
72   /**
73    * Contact Name - The person who will deal with queries 
74    */
75    protected String contact;
76   /**
77    * email - An email address used to contact this Publisher 
78    */
79    protected String email;
80   /**
81    * website - The website for this Publisher, if they have one 
82    */
83    protected String website;
84  
85  
86   /**
87    * Retrieves the <code>Id</code> value, without locking, 
88    * for this <code>Publisher</code> <code>Persistent</code>.
89    *
90    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
91    * @return the Integer id
92    */
93    public Integer getId_unsafe() {
94      return id;
95    }
96  
97  
98   /**
99    * Sets the <code>Id</code> value directly, without checking, 
100   * for this Publisher <code>Persistent</code>.
101   * 
102   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
103   * @param cooked  the pre-validated value to set
104   */
105   public void setId_unsafe(Integer cooked) {
106     id = cooked;
107   }
108 
109  /**
110   * Retrieves the Id value, with locking, for this 
111   * <code>Publisher</code> <code>Persistent</code>.
112   * 
113   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
114   * @throws AccessPoemException 
115   *         if the current <code>AccessToken</code> 
116   *         does not confer write access rights 
117   * @return the value of the field <code>Id</code> for this 
118   *         <code>Publisher</code> <code>Persistent</code>  
119   */
120 
121   public Integer getId()
122       throws AccessPoemException {
123     readLock();
124     return getId_unsafe();
125   }
126 
127 
128  /**
129   * Sets the <code>Id</code> value, with checking, for this 
130   * <code>Publisher</code> <code>Persistent</code>.
131   * 
132   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
133   * @param cooked  a validated <code>int</code> 
134   * @throws AccessPoemException 
135   *         if the current <code>AccessToken</code> 
136   *         does not confer write access rights
137   * @throws ValidationPoemException 
138   *         if the value is not valid
139   */
140   public void setId(Integer cooked)
141       throws AccessPoemException, ValidationPoemException {
142     _getPublisherTable().getIdColumn().
143       getType().assertValidCooked(cooked);
144     writeLock();
145     setId_unsafe(cooked);
146   }
147 
148  /**
149   * Sets the <code>Id</code> value, with checking, for this 
150   * <code>Publisher</code> <code>Persistent</code>.
151   * 
152   * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
153   * @param cooked  a validated <code>int</code>
154   * @throws AccessPoemException 
155   *         if the current <code>AccessToken</code> 
156   *         does not confer write access rights
157   * @throws ValidationPoemException 
158   *         if the value is not valid
159   */
160 
161   public final void setId(int cooked)
162       throws AccessPoemException, ValidationPoemException {
163     setId(new Integer(cooked));
164   }
165 
166 
167  /**
168   * Retrieves the <code>Id</code> value as a <code>Field</code>
169   * from this <code>Publisher</code> <code>Persistent</code>.
170   * 
171   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
172   * @throws AccessPoemException 
173   *         if the current <code>AccessToken</code> 
174   *         does not confer write access rights
175   * @return the Integer id
176   */
177   public Field<Integer> getIdField() throws AccessPoemException {
178     Column<Integer> c = _getPublisherTable().getIdColumn();
179     return new Field<Integer>((Integer)c.getRaw(this), c);
180   }
181 
182 
183  /**
184   * Retrieves the <code>Name</code> value, without locking, 
185   * for this <code>Publisher</code> <code>Persistent</code>.
186   *
187   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
188   * @return the String name
189   */
190   public String getName_unsafe() {
191     return name;
192   }
193 
194 
195  /**
196   * Sets the <code>Name</code> value directly, without checking, 
197   * for this Publisher <code>Persistent</code>.
198   * 
199   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
200   * @param cooked  the pre-validated value to set
201   */
202   public void setName_unsafe(String cooked) {
203     name = cooked;
204   }
205 
206  /**
207   * Retrieves the Name value, with locking, for this 
208   * <code>Publisher</code> <code>Persistent</code>.
209   * Field description: 
210   *   The full name of the Publisher 
211   * 
212   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
213   * @throws AccessPoemException 
214   *         if the current <code>AccessToken</code> 
215   *         does not confer write access rights 
216   * @return the value of the field <code>Name</code> for this 
217   *         <code>Publisher</code> <code>Persistent</code>  
218   */
219 
220   public String getName()
221       throws AccessPoemException {
222     readLock();
223     return getName_unsafe();
224   }
225 
226 
227  /**
228   * Sets the <code>Name</code> value, with checking, for this 
229   * <code>Publisher</code> <code>Persistent</code>.
230   * Field description: 
231   *   The full name of the Publisher 
232   * 
233   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
234   * @param cooked  a validated <code>int</code> 
235   * @throws AccessPoemException 
236   *         if the current <code>AccessToken</code> 
237   *         does not confer write access rights
238   * @throws ValidationPoemException 
239   *         if the value is not valid
240   */
241   public void setName(String cooked)
242       throws AccessPoemException, ValidationPoemException {
243     _getPublisherTable().getNameColumn().
244       getType().assertValidCooked(cooked);
245     writeLock();
246     setName_unsafe(cooked);
247   }
248 
249 
250  /**
251   * Retrieves the <code>Name</code> value as a <code>Field</code>
252   * from this <code>Publisher</code> <code>Persistent</code>.
253   * 
254   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
255   * @throws AccessPoemException 
256   *         if the current <code>AccessToken</code> 
257   *         does not confer write access rights
258   * @return the String name
259   */
260   public Field<String> getNameField() throws AccessPoemException {
261     Column<String> c = _getPublisherTable().getNameColumn();
262     return new Field<String>((String)c.getRaw(this), c);
263   }
264 
265 
266  /**
267   * Retrieves the <code>Address</code> value, without locking, 
268   * for this <code>Publisher</code> <code>Persistent</code>.
269   *
270   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
271   * @return the String address
272   */
273   public String getAddress_unsafe() {
274     return address;
275   }
276 
277 
278  /**
279   * Sets the <code>Address</code> value directly, without checking, 
280   * for this Publisher <code>Persistent</code>.
281   * 
282   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
283   * @param cooked  the pre-validated value to set
284   */
285   public void setAddress_unsafe(String cooked) {
286     address = cooked;
287   }
288 
289  /**
290   * Retrieves the Address value, with locking, for this 
291   * <code>Publisher</code> <code>Persistent</code>.
292   * Field description: 
293   *   A postal address for the Publisher 
294   * 
295   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
296   * @throws AccessPoemException 
297   *         if the current <code>AccessToken</code> 
298   *         does not confer write access rights 
299   * @return the value of the field <code>Address</code> for this 
300   *         <code>Publisher</code> <code>Persistent</code>  
301   */
302 
303   public String getAddress()
304       throws AccessPoemException {
305     readLock();
306     return getAddress_unsafe();
307   }
308 
309 
310  /**
311   * Sets the <code>Address</code> value, with checking, for this 
312   * <code>Publisher</code> <code>Persistent</code>.
313   * Field description: 
314   *   A postal address for the Publisher 
315   * 
316   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
317   * @param cooked  a validated <code>int</code> 
318   * @throws AccessPoemException 
319   *         if the current <code>AccessToken</code> 
320   *         does not confer write access rights
321   * @throws ValidationPoemException 
322   *         if the value is not valid
323   */
324   public void setAddress(String cooked)
325       throws AccessPoemException, ValidationPoemException {
326     _getPublisherTable().getAddressColumn().
327       getType().assertValidCooked(cooked);
328     writeLock();
329     setAddress_unsafe(cooked);
330   }
331 
332 
333  /**
334   * Retrieves the <code>Address</code> value as a <code>Field</code>
335   * from this <code>Publisher</code> <code>Persistent</code>.
336   * 
337   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
338   * @throws AccessPoemException 
339   *         if the current <code>AccessToken</code> 
340   *         does not confer write access rights
341   * @return the String address
342   */
343   public Field<String> getAddressField() throws AccessPoemException {
344     Column<String> c = _getPublisherTable().getAddressColumn();
345     return new Field<String>((String)c.getRaw(this), c);
346   }
347 
348 
349  /**
350   * Retrieves the <code>Contact</code> value, without locking, 
351   * for this <code>Publisher</code> <code>Persistent</code>.
352   *
353   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
354   * @return the String contact
355   */
356   public String getContact_unsafe() {
357     return contact;
358   }
359 
360 
361  /**
362   * Sets the <code>Contact</code> value directly, without checking, 
363   * for this Publisher <code>Persistent</code>.
364   * 
365   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
366   * @param cooked  the pre-validated value to set
367   */
368   public void setContact_unsafe(String cooked) {
369     contact = cooked;
370   }
371 
372  /**
373   * Retrieves the Contact value, with locking, for this 
374   * <code>Publisher</code> <code>Persistent</code>.
375   * Field description: 
376   *   The person who will deal with queries 
377   * 
378   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
379   * @throws AccessPoemException 
380   *         if the current <code>AccessToken</code> 
381   *         does not confer write access rights 
382   * @return the value of the field <code>Contact</code> for this 
383   *         <code>Publisher</code> <code>Persistent</code>  
384   */
385 
386   public String getContact()
387       throws AccessPoemException {
388     readLock();
389     return getContact_unsafe();
390   }
391 
392 
393  /**
394   * Sets the <code>Contact</code> value, with checking, for this 
395   * <code>Publisher</code> <code>Persistent</code>.
396   * Field description: 
397   *   The person who will deal with queries 
398   * 
399   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
400   * @param cooked  a validated <code>int</code> 
401   * @throws AccessPoemException 
402   *         if the current <code>AccessToken</code> 
403   *         does not confer write access rights
404   * @throws ValidationPoemException 
405   *         if the value is not valid
406   */
407   public void setContact(String cooked)
408       throws AccessPoemException, ValidationPoemException {
409     _getPublisherTable().getContactColumn().
410       getType().assertValidCooked(cooked);
411     writeLock();
412     setContact_unsafe(cooked);
413   }
414 
415 
416  /**
417   * Retrieves the <code>Contact</code> value as a <code>Field</code>
418   * from this <code>Publisher</code> <code>Persistent</code>.
419   * 
420   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
421   * @throws AccessPoemException 
422   *         if the current <code>AccessToken</code> 
423   *         does not confer write access rights
424   * @return the String contact
425   */
426   public Field<String> getContactField() throws AccessPoemException {
427     Column<String> c = _getPublisherTable().getContactColumn();
428     return new Field<String>((String)c.getRaw(this), c);
429   }
430 
431 
432  /**
433   * Retrieves the <code>Email</code> value, without locking, 
434   * for this <code>Publisher</code> <code>Persistent</code>.
435   *
436   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
437   * @return the String email
438   */
439   public String getEmail_unsafe() {
440     return email;
441   }
442 
443 
444  /**
445   * Sets the <code>Email</code> value directly, without checking, 
446   * for this Publisher <code>Persistent</code>.
447   * 
448   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
449   * @param cooked  the pre-validated value to set
450   */
451   public void setEmail_unsafe(String cooked) {
452     email = cooked;
453   }
454 
455  /**
456   * Retrieves the Email value, with locking, for this 
457   * <code>Publisher</code> <code>Persistent</code>.
458   * Field description: 
459   *   An email address used to contact this Publisher 
460   * 
461   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
462   * @throws AccessPoemException 
463   *         if the current <code>AccessToken</code> 
464   *         does not confer write access rights 
465   * @return the value of the field <code>Email</code> for this 
466   *         <code>Publisher</code> <code>Persistent</code>  
467   */
468 
469   public String getEmail()
470       throws AccessPoemException {
471     readLock();
472     return getEmail_unsafe();
473   }
474 
475 
476  /**
477   * Sets the <code>Email</code> value, with checking, for this 
478   * <code>Publisher</code> <code>Persistent</code>.
479   * Field description: 
480   *   An email address used to contact this Publisher 
481   * 
482   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
483   * @param cooked  a validated <code>int</code> 
484   * @throws AccessPoemException 
485   *         if the current <code>AccessToken</code> 
486   *         does not confer write access rights
487   * @throws ValidationPoemException 
488   *         if the value is not valid
489   */
490   public void setEmail(String cooked)
491       throws AccessPoemException, ValidationPoemException {
492     _getPublisherTable().getEmailColumn().
493       getType().assertValidCooked(cooked);
494     writeLock();
495     setEmail_unsafe(cooked);
496   }
497 
498 
499  /**
500   * Retrieves the <code>Email</code> value as a <code>Field</code>
501   * from this <code>Publisher</code> <code>Persistent</code>.
502   * 
503   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
504   * @throws AccessPoemException 
505   *         if the current <code>AccessToken</code> 
506   *         does not confer write access rights
507   * @return the String email
508   */
509   public Field<String> getEmailField() throws AccessPoemException {
510     Column<String> c = _getPublisherTable().getEmailColumn();
511     return new Field<String>((String)c.getRaw(this), c);
512   }
513 
514 
515  /**
516   * Retrieves the <code>Website</code> value, without locking, 
517   * for this <code>Publisher</code> <code>Persistent</code>.
518   *
519   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
520   * @return the String website
521   */
522   public String getWebsite_unsafe() {
523     return website;
524   }
525 
526 
527  /**
528   * Sets the <code>Website</code> value directly, without checking, 
529   * for this Publisher <code>Persistent</code>.
530   * 
531   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
532   * @param cooked  the pre-validated value to set
533   */
534   public void setWebsite_unsafe(String cooked) {
535     website = cooked;
536   }
537 
538  /**
539   * Retrieves the Website value, with locking, for this 
540   * <code>Publisher</code> <code>Persistent</code>.
541   * Field description: 
542   *   The website for this Publisher, if they have one 
543   * 
544   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
545   * @throws AccessPoemException 
546   *         if the current <code>AccessToken</code> 
547   *         does not confer write access rights 
548   * @return the value of the field <code>Website</code> for this 
549   *         <code>Publisher</code> <code>Persistent</code>  
550   */
551 
552   public String getWebsite()
553       throws AccessPoemException {
554     readLock();
555     return getWebsite_unsafe();
556   }
557 
558 
559  /**
560   * Sets the <code>Website</code> value, with checking, for this 
561   * <code>Publisher</code> <code>Persistent</code>.
562   * Field description: 
563   *   The website for this Publisher, if they have one 
564   * 
565   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
566   * @param cooked  a validated <code>int</code> 
567   * @throws AccessPoemException 
568   *         if the current <code>AccessToken</code> 
569   *         does not confer write access rights
570   * @throws ValidationPoemException 
571   *         if the value is not valid
572   */
573   public void setWebsite(String cooked)
574       throws AccessPoemException, ValidationPoemException {
575     _getPublisherTable().getWebsiteColumn().
576       getType().assertValidCooked(cooked);
577     writeLock();
578     setWebsite_unsafe(cooked);
579   }
580 
581 
582  /**
583   * Retrieves the <code>Website</code> value as a <code>Field</code>
584   * from this <code>Publisher</code> <code>Persistent</code>.
585   * 
586   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
587   * @throws AccessPoemException 
588   *         if the current <code>AccessToken</code> 
589   *         does not confer write access rights
590   * @return the String website
591   */
592   public Field<String> getWebsiteField() throws AccessPoemException {
593     Column<String> c = _getPublisherTable().getWebsiteColumn();
594     return new Field<String>((String)c.getRaw(this), c);
595   }
596 
597   private CachedSelection<Product> publisherProducts = null;
598   /** References to this Publisher in the Product table via its publisher field.*/
599   @SuppressWarnings("unchecked")
600   public Enumeration<Product> getPublisherProducts() {
601     if (getTroid() == null)
602       return new EmptyEnumeration<Product>();
603     else {
604       if (publisherProducts == null)
605         publisherProducts =
606           getBibliomaniaDatabaseTables().getProductTable().getPublisherColumn().cachedSelectionWhereEq(getTroid());
607       return publisherProducts.objects();
608     }
609   }
610 
611 
612   /** References to this Publisher in the Product table via its publisher field, as a List.*/
613   public List<Product> getPublisherProductList() {
614     return Collections.list(getPublisherProducts());
615   }
616 
617 
618 
619 }
620