View Javadoc

1   // Do not edit this file!  It was generated by Melati POEM's DSD preprocessor.
2   
3   package org.melati.example.odmg.generated;
4   
5   
6   import org.melati.example.odmg.ChildTable;
7   import org.melati.example.odmg.OdmgDatabaseTables;
8   import org.melati.example.odmg.Parent;
9   import org.melati.poem.AccessPoemException;
10  import org.melati.poem.Column;
11  import org.melati.poem.Field;
12  import org.melati.poem.JdbcPersistent;
13  import org.melati.poem.NoSuchRowPoemException;
14  import org.melati.poem.ValidationPoemException;
15  
16  
17  /**
18   * Melati POEM generated abstract base class for a <code>Persistent</code> 
19   * <code>Child</code> Object.
20   *
21   * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
22   */
23  public abstract class ChildBase extends JdbcPersistent {
24  
25  
26   /**
27    * Retrieves the Database object.
28    * 
29    * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
30    * @return the database
31    */
32    public OdmgDatabaseTables getOdmgDatabaseTables() {
33      return (OdmgDatabaseTables)getDatabase();
34    }
35  
36  
37   /**
38    * Retrieves the  <code>ChildTable</code> table 
39    * which this <code>Persistent</code> is from.
40    * 
41    * @generator org.melati.poem.prepro.TableDef#generatePersistentBaseJava 
42    * @return the ChildTable
43    */
44    public ChildTable getChildTable() {
45      return (ChildTable)getTable();
46    }
47  
48    private ChildTable _getChildTable() {
49      return (ChildTable)getTable();
50    }
51  
52    // Fields in this table 
53   /**
54    * id 
55    */
56    protected Integer id;
57   /**
58    * name 
59    */
60    protected String name;
61   /**
62    * parent 
63    */
64    protected Integer parent;
65  
66  
67   /**
68    * Retrieves the <code>Id</code> value, without locking, 
69    * for this <code>Child</code> <code>Persistent</code>.
70    *
71    * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 
72    * @return the Integer id
73    */
74    public Integer getId_unsafe() {
75      return id;
76    }
77  
78  
79   /**
80    * Sets the <code>Id</code> value directly, without checking, 
81    * for this Child <code>Persistent</code>.
82    * 
83    * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 
84    * @param cooked  the pre-validated value to set
85    */
86    public void setId_unsafe(Integer cooked) {
87      id = cooked;
88    }
89  
90   /**
91    * Retrieves the Id value, with locking, for this 
92    * <code>Child</code> <code>Persistent</code>.
93    * 
94    * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
95    * @throws AccessPoemException 
96    *         if the current <code>AccessToken</code> 
97    *         does not confer write access rights 
98    * @return the value of the field <code>Id</code> for this 
99    *         <code>Child</code> <code>Persistent</code>  
100   */
101 
102   public Integer getId()
103       throws AccessPoemException {
104     readLock();
105     return getId_unsafe();
106   }
107 
108 
109  /**
110   * Sets the <code>Id</code> value, with checking, for this 
111   * <code>Child</code> <code>Persistent</code>.
112   * 
113   * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
114   * @param cooked  a validated <code>int</code> 
115   * @throws AccessPoemException 
116   *         if the current <code>AccessToken</code> 
117   *         does not confer write access rights
118   * @throws ValidationPoemException 
119   *         if the value is not valid
120   */
121   public void setId(Integer cooked)
122       throws AccessPoemException, ValidationPoemException {
123     _getChildTable().getIdColumn().
124       getType().assertValidCooked(cooked);
125     writeLock();
126     setId_unsafe(cooked);
127   }
128 
129  /**
130   * Sets the <code>Id</code> value, with checking, for this 
131   * <code>Child</code> <code>Persistent</code>.
132   * 
133   * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 
134   * @param cooked  a validated <code>int</code>
135   * @throws AccessPoemException 
136   *         if the current <code>AccessToken</code> 
137   *         does not confer write access rights
138   * @throws ValidationPoemException 
139   *         if the value is not valid
140   */
141 
142   public final void setId(int cooked)
143       throws AccessPoemException, ValidationPoemException {
144     setId(new Integer(cooked));
145   }
146 
147 
148  /**
149   * Retrieves the <code>Id</code> value as a <code>Field</code>
150   * from this <code>Child</code> <code>Persistent</code>.
151   * 
152   * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 
153   * @throws AccessPoemException 
154   *         if the current <code>AccessToken</code> 
155   *         does not confer write access rights
156   * @return the Integer id
157   */
158   public Field getIdField() throws AccessPoemException {
159     Column c = _getChildTable().getIdColumn();
160     return new Field(c.getRaw(this), c);
161   }
162 
163 
164  /**
165   * Retrieves the <code>Name</code> value, without locking, 
166   * for this <code>Child</code> <code>Persistent</code>.
167   *
168   * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 
169   * @return the String name
170   */
171   public String getName_unsafe() {
172     return name;
173   }
174 
175 
176  /**
177   * Sets the <code>Name</code> value directly, without checking, 
178   * for this Child <code>Persistent</code>.
179   * 
180   * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 
181   * @param cooked  the pre-validated value to set
182   */
183   public void setName_unsafe(String cooked) {
184     name = cooked;
185   }
186 
187  /**
188   * Retrieves the Name value, with locking, for this 
189   * <code>Child</code> <code>Persistent</code>.
190   * 
191   * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 
192   * @throws AccessPoemException 
193   *         if the current <code>AccessToken</code> 
194   *         does not confer write access rights 
195   * @return the value of the field <code>Name</code> for this 
196   *         <code>Child</code> <code>Persistent</code>  
197   */
198 
199   public String getName()
200       throws AccessPoemException {
201     readLock();
202     return getName_unsafe();
203   }
204 
205 
206  /**
207   * Sets the <code>Name</code> value, with checking, for this 
208   * <code>Child</code> <code>Persistent</code>.
209   * 
210   * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods  
211   * @param cooked  a validated <code>int</code> 
212   * @throws AccessPoemException 
213   *         if the current <code>AccessToken</code> 
214   *         does not confer write access rights
215   * @throws ValidationPoemException 
216   *         if the value is not valid
217   */
218   public void setName(String cooked)
219       throws AccessPoemException, ValidationPoemException {
220     _getChildTable().getNameColumn().
221       getType().assertValidCooked(cooked);
222     writeLock();
223     setName_unsafe(cooked);
224   }
225 
226 
227  /**
228   * Retrieves the <code>Name</code> value as a <code>Field</code>
229   * from this <code>Child</code> <code>Persistent</code>.
230   * 
231   * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 
232   * @throws AccessPoemException 
233   *         if the current <code>AccessToken</code> 
234   *         does not confer write access rights
235   * @return the String name
236   */
237   public Field getNameField() throws AccessPoemException {
238     Column c = _getChildTable().getNameColumn();
239     return new Field(c.getRaw(this), c);
240   }
241 
242 
243  /**
244   * Retrieves the <code>Parent</code> value, without locking, 
245   * for this <code>Child</code> <code>Persistent</code>.
246   *
247   * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 
248   * @return the Integer parent
249   */
250   public Integer getParent_unsafe() {
251     return parent;
252   }
253 
254 
255  /**
256   * Sets the <code>Parent</code> value directly, without checking, 
257   * for this Child <code>Persistent</code>.
258   * 
259   * @generator org.melati.poem.prepro.FieldDef#generateBaseMethods 
260   * @param cooked  the pre-validated value to set
261   */
262   public void setParent_unsafe(Integer cooked) {
263     parent = cooked;
264   }
265 
266  /**
267   * Retrieves the Table Row Object ID. 
268   *
269   * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
270   * @throws AccessPoemException  
271   *         if the current <code>AccessToken</code> 
272   *         does not confer read access rights 
273   * @return the TROID as an <code>Integer</code> 
274   */
275 
276   public Integer getParentTroid()
277       throws AccessPoemException {
278     readLock();
279     return getParent_unsafe();
280   }
281 
282 
283  /**
284   * Sets the Table Row Object ID. 
285   * 
286   * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
287   * @param raw  a Table Row Object Id 
288   * @throws AccessPoemException  
289   *         if the current <code>AccessToken</code> 
290   *         does not confer write access rights
291   */
292   public void setParentTroid(Integer raw)
293       throws AccessPoemException {
294     setParent(raw == null ? null : 
295         getOdmgDatabaseTables().getParentTable().getParentObject(raw));
296   }
297 
298 
299  /**
300   * Retrieves the <code>Parent</code> object referred to.
301   *  
302   * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
303   * @throws AccessPoemException  
304   *         if the current <code>AccessToken</code> 
305   *         does not confer read access rights 
306   * @throws NoSuchRowPoemException  
307   *         if the <code>Persistent</code> has yet to be allocated a TROID 
308   * @return the <code>Parent</code> as a <code>Parent</code> 
309   */
310   public Parent getParent()
311       throws AccessPoemException, NoSuchRowPoemException {
312     Integer troid = getParentTroid();
313     return troid == null ? null :
314         getOdmgDatabaseTables().getParentTable().getParentObject(troid);
315   }
316 
317 
318  /**
319   * Set the Parent.
320   * 
321   * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 
322   * @param cooked  a validated <code>Parent</code>
323   * @throws AccessPoemException  
324   *         if the current <code>AccessToken</code> 
325   *         does not confer write access rights 
326   */
327   public void setParent(Parent cooked)
328       throws AccessPoemException {
329     _getChildTable().
330       getParentColumn().
331         getType().assertValidCooked(cooked);
332     writeLock();
333     if (cooked == null)
334       setParent_unsafe(null);
335     else {
336       cooked.existenceLock();
337       setParent_unsafe(cooked.troid());
338     }
339   }
340 
341 
342  /**
343   * Retrieves the <code>Parent</code> value as a <code>Field</code>
344   * from this <code>Child</code> <code>Persistent</code>.
345   * 
346   * @generator org.melati.poem.prepro.FieldDef#generateFieldCreator 
347   * @throws AccessPoemException 
348   *         if the current <code>AccessToken</code> 
349   *         does not confer write access rights
350   * @return the Integer parent
351   */
352   public Field getParentField() throws AccessPoemException {
353     Column c = _getChildTable().getParentColumn();
354     return new Field(c.getRaw(this), c);
355   }
356 }
357