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.Country;
18  import org.paneris.bibliomania.DeliveryCharge;
19  import org.paneris.bibliomania.DeliveryChargeBand;
20  import org.paneris.bibliomania.DeliveryChargeBandTable;
21  
22  
23  /**
24   * Melati POEM generated abstract base class for a <code>Persistent</code> 
25   * <code>DeliveryChargeBand</code> Object.
26   *
27   * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
28   */
29  public abstract class DeliveryChargeBandBase 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>DeliveryChargeBandTable</code> table 
45    * which this <code>Persistent</code> is from.
46    * 
47    * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
48    * @return the DeliveryChargeBandTable
49    */
50    @SuppressWarnings("unchecked")
51    public DeliveryChargeBandTable<DeliveryChargeBand> getDeliveryChargeBandTable() {
52      return (DeliveryChargeBandTable<DeliveryChargeBand>)getTable();
53    }
54  
55    @SuppressWarnings("unchecked")
56    private DeliveryChargeBandTable<DeliveryChargeBand> _getDeliveryChargeBandTable() {
57      return (DeliveryChargeBandTable<DeliveryChargeBand>)getTable();
58    }
59  
60    // Fields in this table 
61   /**
62    * id 
63    */
64    protected Integer id;
65   /**
66    * Band name - The name of the band 
67    */
68    protected String name;
69  
70  
71   /**
72    * Retrieves the <code>Id</code> value, without locking, 
73    * for this <code>DeliveryChargeBand</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 DeliveryChargeBand <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>DeliveryChargeBand</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>DeliveryChargeBand</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>DeliveryChargeBand</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     _getDeliveryChargeBandTable().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>DeliveryChargeBand</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>DeliveryChargeBand</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 = _getDeliveryChargeBandTable().getIdColumn();
164     return new Field<Integer>((Integer)c.getRaw(this), c);
165   }
166 
167 
168  /**
169   * Retrieves the <code>Name</code> value, without locking, 
170   * for this <code>DeliveryChargeBand</code> <code>Persistent</code>.
171   *
172   * see org.melati.poem.prepro.FieldDef#generateBaseMethods 
173   * @return the String name
174   */
175   public String getName_unsafe() {
176     return name;
177   }
178 
179 
180  /**
181   * Sets the <code>Name</code> value directly, without checking, 
182   * for this DeliveryChargeBand <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 setName_unsafe(String cooked) {
188     name = cooked;
189   }
190 
191  /**
192   * Retrieves the Name value, with locking, for this 
193   * <code>DeliveryChargeBand</code> <code>Persistent</code>.
194   * Field description: 
195   *   The name of the band 
196   * 
197   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
198   * @throws AccessPoemException 
199   *         if the current <code>AccessToken</code> 
200   *         does not confer write access rights 
201   * @return the value of the field <code>Name</code> for this 
202   *         <code>DeliveryChargeBand</code> <code>Persistent</code>  
203   */
204 
205   public String getName()
206       throws AccessPoemException {
207     readLock();
208     return getName_unsafe();
209   }
210 
211 
212  /**
213   * Sets the <code>Name</code> value, with checking, for this 
214   * <code>DeliveryChargeBand</code> <code>Persistent</code>.
215   * Field description: 
216   *   The name of the band 
217   * 
218   * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
219   * @param cooked  a validated <code>int</code> 
220   * @throws AccessPoemException 
221   *         if the current <code>AccessToken</code> 
222   *         does not confer write access rights
223   * @throws ValidationPoemException 
224   *         if the value is not valid
225   */
226   public void setName(String cooked)
227       throws AccessPoemException, ValidationPoemException {
228     _getDeliveryChargeBandTable().getNameColumn().
229       getType().assertValidCooked(cooked);
230     writeLock();
231     setName_unsafe(cooked);
232   }
233 
234 
235  /**
236   * Retrieves the <code>Name</code> value as a <code>Field</code>
237   * from this <code>DeliveryChargeBand</code> <code>Persistent</code>.
238   * 
239   * see org.melati.poem.prepro.FieldDef#generateFieldCreator 
240   * @throws AccessPoemException 
241   *         if the current <code>AccessToken</code> 
242   *         does not confer write access rights
243   * @return the String name
244   */
245   public Field<String> getNameField() throws AccessPoemException {
246     Column<String> c = _getDeliveryChargeBandTable().getNameColumn();
247     return new Field<String>((String)c.getRaw(this), c);
248   }
249 
250   private CachedSelection<DeliveryCharge> bandDeliveryCharges = null;
251   /** References to this DeliveryChargeBand in the DeliveryCharge table via its band field.*/
252   @SuppressWarnings("unchecked")
253   public Enumeration<DeliveryCharge> getBandDeliveryCharges() {
254     if (getTroid() == null)
255       return new EmptyEnumeration<DeliveryCharge>();
256     else {
257       if (bandDeliveryCharges == null)
258         bandDeliveryCharges =
259           getBibliomaniaDatabaseTables().getDeliveryChargeTable().getBandColumn().cachedSelectionWhereEq(getTroid());
260       return bandDeliveryCharges.objects();
261     }
262   }
263 
264 
265   /** References to this DeliveryChargeBand in the DeliveryCharge table via its band field, as a List.*/
266   public List<DeliveryCharge> getBandDeliveryChargeList() {
267     return Collections.list(getBandDeliveryCharges());
268   }
269 
270 
271 
272   private CachedSelection<Country> deliverychargeCountrys = null;
273   /** References to this DeliveryChargeBand in the Country table via its deliverycharge field.*/
274   @SuppressWarnings("unchecked")
275   public Enumeration<Country> getDeliverychargeCountrys() {
276     if (getTroid() == null)
277       return new EmptyEnumeration<Country>();
278     else {
279       if (deliverychargeCountrys == null)
280         deliverychargeCountrys =
281           getBibliomaniaDatabaseTables().getCountryTable().getDeliverychargeColumn().cachedSelectionWhereEq(getTroid());
282       return deliverychargeCountrys.objects();
283     }
284   }
285 
286 
287   /** References to this DeliveryChargeBand in the Country table via its deliverycharge field, as a List.*/
288   public List<Country> getDeliverychargeCountryList() {
289     return Collections.list(getDeliverychargeCountrys());
290   }
291 
292 
293 
294 }
295