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.BookFormat;
18  import org.paneris.bibliomania.BookFormatTable;
19  import org.paneris.bibliomania.BookStocking;
20  import org.paneris.bibliomania.Product;
21  
22  
23  /**
24   * Melati POEM generated abstract base class for a <code>Persistent</code> 
25   * <code>BookFormat</code> Object.
26   *
27   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
28   */
29  public abstract class BookFormatBase 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>BookFormatTable</code> table 
45    * which this <code>Persistent</code> is from.
46    * 
47    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
48    * @return the BookFormatTable
49    */
50    @SuppressWarnings("unchecked")
51    public BookFormatTable<BookFormat> getBookFormatTable() {
52      return (BookFormatTable<BookFormat>)getTable();
53    }
54  
55    @SuppressWarnings("unchecked")
56    private BookFormatTable<BookFormat> _getBookFormatTable() {
57      return (BookFormatTable<BookFormat>)getTable();
58    }
59  
60    // Fields in this table 
61   /**
62    * id 
63    */
64    protected Integer id;
65   /**
66    * Display name - A name for the format 
67    */
68    protected String displayname;
69   /**
70    * Description regexp - A regular expression pattern for matching the 
71    * different ways bookshops describe the format 
72    */
73    protected String descriptionregexp;
74  
75  
76   /**
77    * Retrieves the <code>Id</code> value, without locking, 
78    * for this <code>BookFormat</code> <code>Persistent</code>.
79    *
80    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
81    * @return the Integer id
82    */
83    public Integer getId_unsafe() {
84      return id;
85    }
86  
87  
88   /**
89    * Sets the <code>Id</code> value directly, without checking, 
90    * for this BookFormat <code>Persistent</code>.
91    * 
92    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
93    * @param cooked  the pre-validated value to set
94    */
95    public void setId_unsafe(Integer cooked) {
96      id = cooked;
97    }
98  
99   /**
100   * Retrieves the Id value, with locking, for this 
101   * <code>BookFormat</code> <code>Persistent</code>.
102   * 
103   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
104   * @throws AccessPoemException 
105   *         if the current <code>AccessToken</code> 
106   *         does not confer write access rights 
107   * @return the value of the field <code>Id</code> for this 
108   *         <code>BookFormat</code> <code>Persistent</code>  
109   */
110 
111   public Integer getId()
112       throws AccessPoemException {
113     readLock();
114     return getId_unsafe();
115   }
116 
117 
118  /**
119   * Sets the <code>Id</code> value, with checking, for this 
120   * <code>BookFormat</code> <code>Persistent</code>.
121   * 
122   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
123   * @param cooked  a validated <code>int</code> 
124   * @throws AccessPoemException 
125   *         if the current <code>AccessToken</code> 
126   *         does not confer write access rights
127   * @throws ValidationPoemException 
128   *         if the value is not valid
129   */
130   public void setId(Integer cooked)
131       throws AccessPoemException, ValidationPoemException {
132     _getBookFormatTable().getIdColumn().
133       getType().assertValidCooked(cooked);
134     writeLock();
135     setId_unsafe(cooked);
136   }
137 
138  /**
139   * Sets the <code>Id</code> value, with checking, for this 
140   * <code>BookFormat</code> <code>Persistent</code>.
141   * 
142   * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
143   * @param cooked  a validated <code>int</code>
144   * @throws AccessPoemException 
145   *         if the current <code>AccessToken</code> 
146   *         does not confer write access rights
147   * @throws ValidationPoemException 
148   *         if the value is not valid
149   */
150 
151   public final void setId(int cooked)
152       throws AccessPoemException, ValidationPoemException {
153     setId(new Integer(cooked));
154   }
155 
156 
157  /**
158   * Retrieves the <code>Id</code> value as a <code>Field</code>
159   * from this <code>BookFormat</code> <code>Persistent</code>.
160   * 
161   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
162   * @throws AccessPoemException 
163   *         if the current <code>AccessToken</code> 
164   *         does not confer write access rights
165   * @return the Integer id
166   */
167   public Field<Integer> getIdField() throws AccessPoemException {
168     Column<Integer> c = _getBookFormatTable().getIdColumn();
169     return new Field<Integer>((Integer)c.getRaw(this), c);
170   }
171 
172 
173  /**
174   * Retrieves the <code>Displayname</code> value, without locking, 
175   * for this <code>BookFormat</code> <code>Persistent</code>.
176   *
177   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
178   * @return the String displayname
179   */
180   public String getDisplayname_unsafe() {
181     return displayname;
182   }
183 
184 
185  /**
186   * Sets the <code>Displayname</code> value directly, without checking, 
187   * for this BookFormat <code>Persistent</code>.
188   * 
189   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
190   * @param cooked  the pre-validated value to set
191   */
192   public void setDisplayname_unsafe(String cooked) {
193     displayname = cooked;
194   }
195 
196  /**
197   * Retrieves the Displayname value, with locking, for this 
198   * <code>BookFormat</code> <code>Persistent</code>.
199   * Field description: 
200   *   A name for the format 
201   * 
202   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
203   * @throws AccessPoemException 
204   *         if the current <code>AccessToken</code> 
205   *         does not confer write access rights 
206   * @return the value of the field <code>Displayname</code> for this 
207   *         <code>BookFormat</code> <code>Persistent</code>  
208   */
209 
210   public String getDisplayname()
211       throws AccessPoemException {
212     readLock();
213     return getDisplayname_unsafe();
214   }
215 
216 
217  /**
218   * Sets the <code>Displayname</code> value, with checking, for this 
219   * <code>BookFormat</code> <code>Persistent</code>.
220   * Field description: 
221   *   A name for the format 
222   * 
223   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
224   * @param cooked  a validated <code>int</code> 
225   * @throws AccessPoemException 
226   *         if the current <code>AccessToken</code> 
227   *         does not confer write access rights
228   * @throws ValidationPoemException 
229   *         if the value is not valid
230   */
231   public void setDisplayname(String cooked)
232       throws AccessPoemException, ValidationPoemException {
233     _getBookFormatTable().getDisplaynameColumn().
234       getType().assertValidCooked(cooked);
235     writeLock();
236     setDisplayname_unsafe(cooked);
237   }
238 
239 
240  /**
241   * Retrieves the <code>Displayname</code> value as a <code>Field</code>
242   * from this <code>BookFormat</code> <code>Persistent</code>.
243   * 
244   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
245   * @throws AccessPoemException 
246   *         if the current <code>AccessToken</code> 
247   *         does not confer write access rights
248   * @return the String displayname
249   */
250   public Field<String> getDisplaynameField() throws AccessPoemException {
251     Column<String> c = _getBookFormatTable().getDisplaynameColumn();
252     return new Field<String>((String)c.getRaw(this), c);
253   }
254 
255 
256  /**
257   * Retrieves the <code>Descriptionregexp</code> value, without locking, 
258   * for this <code>BookFormat</code> <code>Persistent</code>.
259   *
260   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
261   * @return the String descriptionregexp
262   */
263   public String getDescriptionregexp_unsafe() {
264     return descriptionregexp;
265   }
266 
267 
268  /**
269   * Sets the <code>Descriptionregexp</code> value directly, without checking, 
270   * for this BookFormat <code>Persistent</code>.
271   * 
272   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
273   * @param cooked  the pre-validated value to set
274   */
275   public void setDescriptionregexp_unsafe(String cooked) {
276     descriptionregexp = cooked;
277   }
278 
279  /**
280   * Retrieves the Descriptionregexp value, with locking, for this 
281   * <code>BookFormat</code> <code>Persistent</code>.
282   * Field description: 
283   *   A regular expression pattern for matching the different ways bookshops 
284   *   describe the format 
285   * 
286   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
287   * @throws AccessPoemException 
288   *         if the current <code>AccessToken</code> 
289   *         does not confer write access rights 
290   * @return the value of the field <code>Descriptionregexp</code> for this 
291   *         <code>BookFormat</code> <code>Persistent</code>  
292   */
293 
294   public String getDescriptionregexp()
295       throws AccessPoemException {
296     readLock();
297     return getDescriptionregexp_unsafe();
298   }
299 
300 
301  /**
302   * Sets the <code>Descriptionregexp</code> value, with checking, for this 
303   * <code>BookFormat</code> <code>Persistent</code>.
304   * Field description: 
305   *   A regular expression pattern for matching the different ways bookshops 
306   *   describe the format 
307   * 
308   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
309   * @param cooked  a validated <code>int</code> 
310   * @throws AccessPoemException 
311   *         if the current <code>AccessToken</code> 
312   *         does not confer write access rights
313   * @throws ValidationPoemException 
314   *         if the value is not valid
315   */
316   public void setDescriptionregexp(String cooked)
317       throws AccessPoemException, ValidationPoemException {
318     _getBookFormatTable().getDescriptionregexpColumn().
319       getType().assertValidCooked(cooked);
320     writeLock();
321     setDescriptionregexp_unsafe(cooked);
322   }
323 
324 
325  /**
326   * Retrieves the <code>Descriptionregexp</code> value as a <code>Field</code>
327   * from this <code>BookFormat</code> <code>Persistent</code>.
328   * 
329   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
330   * @throws AccessPoemException 
331   *         if the current <code>AccessToken</code> 
332   *         does not confer write access rights
333   * @return the String descriptionregexp
334   */
335   public Field<String> getDescriptionregexpField() throws AccessPoemException {
336     Column<String> c = _getBookFormatTable().getDescriptionregexpColumn();
337     return new Field<String>((String)c.getRaw(this), c);
338   }
339 
340   private CachedSelection<Product> formatProducts = null;
341   /** References to this BookFormat in the Product table via its format field.*/
342   @SuppressWarnings("unchecked")
343   public Enumeration<Product> getFormatProducts() {
344     if (getTroid() == null)
345       return new EmptyEnumeration<Product>();
346     else {
347       if (formatProducts == null)
348         formatProducts =
349           getBibliomaniaDatabaseTables().getProductTable().getFormatColumn().cachedSelectionWhereEq(getTroid());
350       return formatProducts.objects();
351     }
352   }
353 
354 
355   /** References to this BookFormat in the Product table via its format field, as a List.*/
356   public List<Product> getFormatProductList() {
357     return Collections.list(getFormatProducts());
358   }
359 
360 
361 
362   private CachedSelection<BookStocking> formatcodeBookStockings = null;
363   /** References to this BookFormat in the BookStocking table via its formatcode field.*/
364   @SuppressWarnings("unchecked")
365   public Enumeration<BookStocking> getFormatcodeBookStockings() {
366     if (getTroid() == null)
367       return new EmptyEnumeration<BookStocking>();
368     else {
369       if (formatcodeBookStockings == null)
370         formatcodeBookStockings =
371           getBibliomaniaDatabaseTables().getBookStockingTable().getFormatcodeColumn().cachedSelectionWhereEq(getTroid());
372       return formatcodeBookStockings.objects();
373     }
374   }
375 
376 
377   /** References to this BookFormat in the BookStocking table via its formatcode field, as a List.*/
378   public List<BookStocking> getFormatcodeBookStockingList() {
379     return Collections.list(getFormatcodeBookStockings());
380   }
381 
382 
383 
384 }
385