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 org.melati.poem.AccessPoemException;
7   import org.melati.poem.Column;
8   import org.melati.poem.Field;
9   import org.melati.poem.JdbcPersistent;
10  import org.melati.poem.NoSuchRowPoemException;
11  import org.melati.poem.ValidationPoemException;
12  import org.paneris.bibliomania.BibliomaniaDatabaseTables;
13  import org.paneris.bibliomania.Product;
14  import org.paneris.bibliomania.Supplier;
15  import org.paneris.bibliomania.SupplierProduct;
16  import org.paneris.bibliomania.SupplierProductTable;
17  
18  
19  /**
20   * Melati POEM generated abstract base class for a <code>Persistent</code> 
21   * <code>SupplierProduct</code> Object.
22   *
23   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
24   */
25  public abstract class SupplierProductBase extends JdbcPersistent {
26  
27  
28   /**
29    * Retrieves the Database object.
30    * 
31    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
32    * @return the database
33    */
34    public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() {
35      return (BibliomaniaDatabaseTables)getDatabase();
36    }
37  
38  
39   /**
40    * Retrieves the  <code>SupplierProductTable</code> table 
41    * which this <code>Persistent</code> is from.
42    * 
43    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
44    * @return the SupplierProductTable
45    */
46    @SuppressWarnings("unchecked")
47    public SupplierProductTable<SupplierProduct> getSupplierProductTable() {
48      return (SupplierProductTable<SupplierProduct>)getTable();
49    }
50  
51    @SuppressWarnings("unchecked")
52    private SupplierProductTable<SupplierProduct> _getSupplierProductTable() {
53      return (SupplierProductTable<SupplierProduct>)getTable();
54    }
55  
56    // Fields in this table 
57   /**
58    * id 
59    */
60    protected Integer id;
61   /**
62    * Supplier - A supplier for this product 
63    */
64    protected Integer supplier;
65   /**
66    * Product - A product for this supplier 
67    */
68    protected Integer product;
69  
70  
71   /**
72    * Retrieves the <code>Id</code> value, without locking, 
73    * for this <code>SupplierProduct</code> <code>Persistent</code>.
74    *
75    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
76    * @return the Integer id
77    */
78    public Integer getId_unsafe() {
79      return id;
80    }
81  
82  
83   /**
84    * Sets the <code>Id</code> value directly, without checking, 
85    * for this SupplierProduct <code>Persistent</code>.
86    * 
87    * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
88    * @param cooked  the pre-validated value to set
89    */
90    public void setId_unsafe(Integer cooked) {
91      id = cooked;
92    }
93  
94   /**
95    * Retrieves the Id value, with locking, for this 
96    * <code>SupplierProduct</code> <code>Persistent</code>.
97    * 
98    * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
99    * @throws AccessPoemException 
100   *         if the current <code>AccessToken</code> 
101   *         does not confer write access rights 
102   * @return the value of the field <code>Id</code> for this 
103   *         <code>SupplierProduct</code> <code>Persistent</code>  
104   */
105 
106   public Integer getId()
107       throws AccessPoemException {
108     readLock();
109     return getId_unsafe();
110   }
111 
112 
113  /**
114   * Sets the <code>Id</code> value, with checking, for this 
115   * <code>SupplierProduct</code> <code>Persistent</code>.
116   * 
117   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
118   * @param cooked  a validated <code>int</code> 
119   * @throws AccessPoemException 
120   *         if the current <code>AccessToken</code> 
121   *         does not confer write access rights
122   * @throws ValidationPoemException 
123   *         if the value is not valid
124   */
125   public void setId(Integer cooked)
126       throws AccessPoemException, ValidationPoemException {
127     _getSupplierProductTable().getIdColumn().
128       getType().assertValidCooked(cooked);
129     writeLock();
130     setId_unsafe(cooked);
131   }
132 
133  /**
134   * Sets the <code>Id</code> value, with checking, for this 
135   * <code>SupplierProduct</code> <code>Persistent</code>.
136   * 
137   * Generated by org.melati.poem.prepro.IntegerFieldDef#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 
146   public final void setId(int cooked)
147       throws AccessPoemException, ValidationPoemException {
148     setId(new Integer(cooked));
149   }
150 
151 
152  /**
153   * Retrieves the <code>Id</code> value as a <code>Field</code>
154   * from this <code>SupplierProduct</code> <code>Persistent</code>.
155   * 
156   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
157   * @throws AccessPoemException 
158   *         if the current <code>AccessToken</code> 
159   *         does not confer write access rights
160   * @return the Integer id
161   */
162   public Field<Integer> getIdField() throws AccessPoemException {
163     Column<Integer> c = _getSupplierProductTable().getIdColumn();
164     return new Field<Integer>((Integer)c.getRaw(this), c);
165   }
166 
167 
168  /**
169   * Retrieves the <code>Supplier</code> value, without locking, 
170   * for this <code>SupplierProduct</code> <code>Persistent</code>.
171   *
172   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
173   * @return the Integer supplier
174   */
175   public Integer getSupplier_unsafe() {
176     return supplier;
177   }
178 
179 
180  /**
181   * Sets the <code>Supplier</code> value directly, without checking, 
182   * for this SupplierProduct <code>Persistent</code>.
183   * 
184   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
185   * @param cooked  the pre-validated value to set
186   */
187   public void setSupplier_unsafe(Integer cooked) {
188     supplier = cooked;
189   }
190 
191  /**
192   * Retrieves the Table Row Object ID. 
193   *
194   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
195   * @throws AccessPoemException  
196   *         if the current <code>AccessToken</code> 
197   *         does not confer read access rights 
198   * @return the TROID as an <code>Integer</code> 
199   */
200 
201   public Integer getSupplierTroid()
202       throws AccessPoemException {
203     readLock();
204     return getSupplier_unsafe();
205   }
206 
207 
208  /**
209   * Sets the Table Row Object ID. 
210   * 
211   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
212   * @param raw  a Table Row Object Id 
213   * @throws AccessPoemException  
214   *         if the current <code>AccessToken</code> 
215   *         does not confer write access rights
216   */
217   public void setSupplierTroid(Integer raw)
218       throws AccessPoemException {
219     setSupplier(raw == null ? null : 
220         getBibliomaniaDatabaseTables().getSupplierTable().getSupplierObject(raw));
221   }
222 
223 
224  /**
225   * Retrieves the <code>Supplier</code> object referred to.
226   *  
227   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
228   * @throws AccessPoemException  
229   *         if the current <code>AccessToken</code> 
230   *         does not confer read access rights 
231   * @throws NoSuchRowPoemException  
232   *         if the <code>Persistent</code> has yet to be allocated a TROID 
233   * @return the <code>Supplier</code> as a <code>Supplier</code> 
234   */
235   public Supplier getSupplier()
236       throws AccessPoemException, NoSuchRowPoemException {
237     Integer troid = getSupplierTroid();
238     return troid == null ? null :
239         getBibliomaniaDatabaseTables().getSupplierTable().getSupplierObject(troid);
240   }
241 
242 
243  /**
244   * Set the Supplier.
245   * 
246   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
247   * @param cooked  a validated <code>Supplier</code>
248   * @throws AccessPoemException  
249   *         if the current <code>AccessToken</code> 
250   *         does not confer write access rights 
251   */
252   public void setSupplier(Supplier cooked)
253       throws AccessPoemException {
254     _getSupplierProductTable().
255       getSupplierColumn().
256         getType().assertValidCooked(cooked);
257     writeLock();
258     if (cooked == null)
259       setSupplier_unsafe(null);
260     else {
261       cooked.existenceLock();
262       setSupplier_unsafe(cooked.troid());
263     }
264   }
265 
266 
267  /**
268   * Retrieves the <code>Supplier</code> value as a <code>Field</code>
269   * from this <code>SupplierProduct</code> <code>Persistent</code>.
270   * 
271   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
272   * @throws AccessPoemException 
273   *         if the current <code>AccessToken</code> 
274   *         does not confer write access rights
275   * @return the Integer supplier
276   */
277   public Field<Integer> getSupplierField() throws AccessPoemException {
278     Column<Integer> c = _getSupplierProductTable().getSupplierColumn();
279     return new Field<Integer>((Integer)c.getRaw(this), c);
280   }
281 
282 
283  /**
284   * Retrieves the <code>Product</code> value, without locking, 
285   * for this <code>SupplierProduct</code> <code>Persistent</code>.
286   *
287   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
288   * @return the Integer product
289   */
290   public Integer getProduct_unsafe() {
291     return product;
292   }
293 
294 
295  /**
296   * Sets the <code>Product</code> value directly, without checking, 
297   * for this SupplierProduct <code>Persistent</code>.
298   * 
299   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
300   * @param cooked  the pre-validated value to set
301   */
302   public void setProduct_unsafe(Integer cooked) {
303     product = cooked;
304   }
305 
306  /**
307   * Retrieves the Table Row Object ID. 
308   *
309   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
310   * @throws AccessPoemException  
311   *         if the current <code>AccessToken</code> 
312   *         does not confer read access rights 
313   * @return the TROID as an <code>Integer</code> 
314   */
315 
316   public Integer getProductTroid()
317       throws AccessPoemException {
318     readLock();
319     return getProduct_unsafe();
320   }
321 
322 
323  /**
324   * Sets the Table Row Object ID. 
325   * 
326   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
327   * @param raw  a Table Row Object Id 
328   * @throws AccessPoemException  
329   *         if the current <code>AccessToken</code> 
330   *         does not confer write access rights
331   */
332   public void setProductTroid(Integer raw)
333       throws AccessPoemException {
334     setProduct(raw == null ? null : 
335         getBibliomaniaDatabaseTables().getProductTable().getProductObject(raw));
336   }
337 
338 
339  /**
340   * Retrieves the <code>Product</code> object referred to.
341   *  
342   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
343   * @throws AccessPoemException  
344   *         if the current <code>AccessToken</code> 
345   *         does not confer read access rights 
346   * @throws NoSuchRowPoemException  
347   *         if the <code>Persistent</code> has yet to be allocated a TROID 
348   * @return the <code>Product</code> as a <code>Product</code> 
349   */
350   public Product getProduct()
351       throws AccessPoemException, NoSuchRowPoemException {
352     Integer troid = getProductTroid();
353     return troid == null ? null :
354         getBibliomaniaDatabaseTables().getProductTable().getProductObject(troid);
355   }
356 
357 
358  /**
359   * Set the Product.
360   * 
361   * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
362   * @param cooked  a validated <code>Product</code>
363   * @throws AccessPoemException  
364   *         if the current <code>AccessToken</code> 
365   *         does not confer write access rights 
366   */
367   public void setProduct(Product cooked)
368       throws AccessPoemException {
369     _getSupplierProductTable().
370       getProductColumn().
371         getType().assertValidCooked(cooked);
372     writeLock();
373     if (cooked == null)
374       setProduct_unsafe(null);
375     else {
376       cooked.existenceLock();
377       setProduct_unsafe(cooked.troid());
378     }
379   }
380 
381 
382  /**
383   * Retrieves the <code>Product</code> value as a <code>Field</code>
384   * from this <code>SupplierProduct</code> <code>Persistent</code>.
385   * 
386   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
387   * @throws AccessPoemException 
388   *         if the current <code>AccessToken</code> 
389   *         does not confer write access rights
390   * @return the Integer product
391   */
392   public Field<Integer> getProductField() throws AccessPoemException {
393     Column<Integer> c = _getSupplierProductTable().getProductColumn();
394     return new Field<Integer>((Integer)c.getRaw(this), c);
395   }
396 
397 }
398