1 // Do not edit this file! It was generated by Melati POEM's DSD preprocessor.
2
3 package org.melati.admin.test.generated;
4
5
6 import org.melati.admin.test.AdminTestDatabaseTables;
7 import org.melati.admin.test.Child;
8 import org.melati.admin.test.ChildTable;
9 import org.melati.admin.test.Parent;
10 import org.melati.admin.test.UploadedImage;
11 import org.melati.poem.AccessPoemException;
12 import org.melati.poem.Column;
13 import org.melati.poem.Field;
14 import org.melati.poem.JdbcPersistent;
15 import org.melati.poem.NoSuchRowPoemException;
16 import org.melati.poem.ValidationPoemException;
17
18
19 /**
20 * Melati POEM generated abstract base class for a <code>Persistent</code>
21 * <code>Child</code> Object.
22 *
23 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
24 */
25 public abstract class ChildBase 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 AdminTestDatabaseTables getAdminTestDatabaseTables() {
35 return (AdminTestDatabaseTables)getDatabase();
36 }
37
38
39 /**
40 * Retrieves the <code>ChildTable</code> table
41 * which this <code>Persistent</code> is from.
42 *
43 * See org.melati.poem.prepro.TableDef#generatePersistentBaseJava
44 * @return the ChildTable
45 */
46 @SuppressWarnings("unchecked")
47 public ChildTable<Child> getChildTable() {
48 return (ChildTable<Child>)getTable();
49 }
50
51 @SuppressWarnings("unchecked")
52 private ChildTable<Child> _getChildTable() {
53 return (ChildTable<Child>)getTable();
54 }
55
56 // Fields in this table
57 /**
58 * id
59 */
60 protected Integer id;
61 /**
62 * parent - The parent
63 */
64 protected Integer parent;
65 /**
66 * name - The name
67 */
68 protected String name;
69 /**
70 * image - The image
71 */
72 protected Integer image;
73 /**
74 * deleted - Whether deleted
75 */
76 protected Boolean deleted;
77
78
79 /**
80 * Retrieves the <code>Id</code> value, without locking,
81 * for this <code>Child</code> <code>Persistent</code>.
82 *
83 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
84 * @return the Integer id
85 */
86 public Integer getId_unsafe() {
87 return id;
88 }
89
90
91 /**
92 * Sets the <code>Id</code> value directly, without checking,
93 * for this Child <code>Persistent</code>.
94 *
95 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
96 * @param cooked the pre-validated value to set
97 */
98 public void setId_unsafe(Integer cooked) {
99 id = cooked;
100 }
101
102 /**
103 * Retrieves the Id value, with locking, for this
104 * <code>Child</code> <code>Persistent</code>.
105 *
106 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
107 * @throws AccessPoemException
108 * if the current <code>AccessToken</code>
109 * does not confer write access rights
110 * @return the value of the field <code>Id</code> for this
111 * <code>Child</code> <code>Persistent</code>
112 */
113
114 public Integer getId()
115 throws AccessPoemException {
116 readLock();
117 return getId_unsafe();
118 }
119
120
121 /**
122 * Sets the <code>Id</code> value, with checking, for this
123 * <code>Child</code> <code>Persistent</code>.
124 *
125 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
126 * @param cooked a validated <code>int</code>
127 * @throws AccessPoemException
128 * if the current <code>AccessToken</code>
129 * does not confer write access rights
130 * @throws ValidationPoemException
131 * if the value is not valid
132 */
133 public void setId(Integer cooked)
134 throws AccessPoemException, ValidationPoemException {
135 _getChildTable().getIdColumn().
136 getType().assertValidCooked(cooked);
137 writeLock();
138 setId_unsafe(cooked);
139 }
140
141 /**
142 * Sets the <code>Id</code> value, with checking, for this
143 * <code>Child</code> <code>Persistent</code>.
144 *
145 * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
146 * @param cooked a validated <code>int</code>
147 * @throws AccessPoemException
148 * if the current <code>AccessToken</code>
149 * does not confer write access rights
150 * @throws ValidationPoemException
151 * if the value is not valid
152 */
153
154 public final void setId(int cooked)
155 throws AccessPoemException, ValidationPoemException {
156 setId(new Integer(cooked));
157 }
158
159
160 /**
161 * Retrieves the <code>Id</code> value as a <code>Field</code>
162 * from this <code>Child</code> <code>Persistent</code>.
163 *
164 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
165 * @throws AccessPoemException
166 * if the current <code>AccessToken</code>
167 * does not confer write access rights
168 * @return the Integer id
169 */
170 public Field<Integer> getIdField() throws AccessPoemException {
171 Column<Integer> c = _getChildTable().getIdColumn();
172 return new Field<Integer>((Integer)c.getRaw(this), c);
173 }
174
175
176 /**
177 * Retrieves the <code>Parent</code> value, without locking,
178 * for this <code>Child</code> <code>Persistent</code>.
179 *
180 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
181 * @return the Integer parent
182 */
183 public Integer getParent_unsafe() {
184 return parent;
185 }
186
187
188 /**
189 * Sets the <code>Parent</code> value directly, without checking,
190 * for this Child <code>Persistent</code>.
191 *
192 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
193 * @param cooked the pre-validated value to set
194 */
195 public void setParent_unsafe(Integer cooked) {
196 parent = cooked;
197 }
198
199 /**
200 * Retrieves the Table Row Object ID.
201 *
202 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
203 * @throws AccessPoemException
204 * if the current <code>AccessToken</code>
205 * does not confer read access rights
206 * @return the TROID as an <code>Integer</code>
207 */
208
209 public Integer getParentTroid()
210 throws AccessPoemException {
211 readLock();
212 return getParent_unsafe();
213 }
214
215
216 /**
217 * Sets the Table Row Object ID.
218 *
219 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
220 * @param raw a Table Row Object Id
221 * @throws AccessPoemException
222 * if the current <code>AccessToken</code>
223 * does not confer write access rights
224 */
225 public void setParentTroid(Integer raw)
226 throws AccessPoemException {
227 setParent(raw == null ? null :
228 getAdminTestDatabaseTables().getParentTable().getParentObject(raw));
229 }
230
231
232 /**
233 * Retrieves the <code>Parent</code> object referred to.
234 *
235 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
236 * @throws AccessPoemException
237 * if the current <code>AccessToken</code>
238 * does not confer read access rights
239 * @throws NoSuchRowPoemException
240 * if the <code>Persistent</code> has yet to be allocated a TROID
241 * @return the <code>Parent</code> as a <code>Parent</code>
242 */
243 public Parent getParent()
244 throws AccessPoemException, NoSuchRowPoemException {
245 Integer troid = getParentTroid();
246 return troid == null ? null :
247 getAdminTestDatabaseTables().getParentTable().getParentObject(troid);
248 }
249
250
251 /**
252 * Set the Parent.
253 *
254 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
255 * @param cooked a validated <code>Parent</code>
256 * @throws AccessPoemException
257 * if the current <code>AccessToken</code>
258 * does not confer write access rights
259 */
260 public void setParent(Parent cooked)
261 throws AccessPoemException {
262 _getChildTable().
263 getParentColumn().
264 getType().assertValidCooked(cooked);
265 writeLock();
266 if (cooked == null)
267 setParent_unsafe(null);
268 else {
269 cooked.existenceLock();
270 setParent_unsafe(cooked.troid());
271 }
272 }
273
274
275 /**
276 * Retrieves the <code>Parent</code> value as a <code>Field</code>
277 * from this <code>Child</code> <code>Persistent</code>.
278 *
279 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
280 * @throws AccessPoemException
281 * if the current <code>AccessToken</code>
282 * does not confer write access rights
283 * @return the Integer parent
284 */
285 public Field<Integer> getParentField() throws AccessPoemException {
286 Column<Integer> c = _getChildTable().getParentColumn();
287 return new Field<Integer>((Integer)c.getRaw(this), c);
288 }
289
290
291 /**
292 * Retrieves the <code>Name</code> value, without locking,
293 * for this <code>Child</code> <code>Persistent</code>.
294 *
295 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
296 * @return the String name
297 */
298 public String getName_unsafe() {
299 return name;
300 }
301
302
303 /**
304 * Sets the <code>Name</code> value directly, without checking,
305 * for this Child <code>Persistent</code>.
306 *
307 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
308 * @param cooked the pre-validated value to set
309 */
310 public void setName_unsafe(String cooked) {
311 name = cooked;
312 }
313
314 /**
315 * Retrieves the Name value, with locking, for this
316 * <code>Child</code> <code>Persistent</code>.
317 * Field description:
318 * The name
319 *
320 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
321 * @throws AccessPoemException
322 * if the current <code>AccessToken</code>
323 * does not confer write access rights
324 * @return the value of the field <code>Name</code> for this
325 * <code>Child</code> <code>Persistent</code>
326 */
327
328 public String getName()
329 throws AccessPoemException {
330 readLock();
331 return getName_unsafe();
332 }
333
334
335 /**
336 * Sets the <code>Name</code> value, with checking, for this
337 * <code>Child</code> <code>Persistent</code>.
338 * Field description:
339 * The name
340 *
341 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
342 * @param cooked a validated <code>int</code>
343 * @throws AccessPoemException
344 * if the current <code>AccessToken</code>
345 * does not confer write access rights
346 * @throws ValidationPoemException
347 * if the value is not valid
348 */
349 public void setName(String cooked)
350 throws AccessPoemException, ValidationPoemException {
351 _getChildTable().getNameColumn().
352 getType().assertValidCooked(cooked);
353 writeLock();
354 setName_unsafe(cooked);
355 }
356
357
358 /**
359 * Retrieves the <code>Name</code> value as a <code>Field</code>
360 * from this <code>Child</code> <code>Persistent</code>.
361 *
362 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
363 * @throws AccessPoemException
364 * if the current <code>AccessToken</code>
365 * does not confer write access rights
366 * @return the String name
367 */
368 public Field<String> getNameField() throws AccessPoemException {
369 Column<String> c = _getChildTable().getNameColumn();
370 return new Field<String>((String)c.getRaw(this), c);
371 }
372
373
374 /**
375 * Retrieves the <code>Image</code> value, without locking,
376 * for this <code>Child</code> <code>Persistent</code>.
377 *
378 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
379 * @return the Integer image
380 */
381 public Integer getImage_unsafe() {
382 return image;
383 }
384
385
386 /**
387 * Sets the <code>Image</code> value directly, without checking,
388 * for this Child <code>Persistent</code>.
389 *
390 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
391 * @param cooked the pre-validated value to set
392 */
393 public void setImage_unsafe(Integer cooked) {
394 image = cooked;
395 }
396
397 /**
398 * Retrieves the Table Row Object ID.
399 *
400 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
401 * @throws AccessPoemException
402 * if the current <code>AccessToken</code>
403 * does not confer read access rights
404 * @return the TROID as an <code>Integer</code>
405 */
406
407 public Integer getImageTroid()
408 throws AccessPoemException {
409 readLock();
410 return getImage_unsafe();
411 }
412
413
414 /**
415 * Sets the Table Row Object ID.
416 *
417 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
418 * @param raw a Table Row Object Id
419 * @throws AccessPoemException
420 * if the current <code>AccessToken</code>
421 * does not confer write access rights
422 */
423 public void setImageTroid(Integer raw)
424 throws AccessPoemException {
425 setImage(raw == null ? null :
426 getAdminTestDatabaseTables().getUploadedImageTable().getUploadedImageObject(raw));
427 }
428
429
430 /**
431 * Retrieves the <code>Image</code> object referred to.
432 *
433 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
434 * @throws AccessPoemException
435 * if the current <code>AccessToken</code>
436 * does not confer read access rights
437 * @throws NoSuchRowPoemException
438 * if the <code>Persistent</code> has yet to be allocated a TROID
439 * @return the <code>Image</code> as a <code>UploadedImage</code>
440 */
441 public UploadedImage getImage()
442 throws AccessPoemException, NoSuchRowPoemException {
443 Integer troid = getImageTroid();
444 return troid == null ? null :
445 getAdminTestDatabaseTables().getUploadedImageTable().getUploadedImageObject(troid);
446 }
447
448
449 /**
450 * Set the Image.
451 *
452 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
453 * @param cooked a validated <code>UploadedImage</code>
454 * @throws AccessPoemException
455 * if the current <code>AccessToken</code>
456 * does not confer write access rights
457 */
458 public void setImage(UploadedImage cooked)
459 throws AccessPoemException {
460 _getChildTable().
461 getImageColumn().
462 getType().assertValidCooked(cooked);
463 writeLock();
464 if (cooked == null)
465 setImage_unsafe(null);
466 else {
467 cooked.existenceLock();
468 setImage_unsafe(cooked.troid());
469 }
470 }
471
472
473 /**
474 * Retrieves the <code>Image</code> value as a <code>Field</code>
475 * from this <code>Child</code> <code>Persistent</code>.
476 *
477 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
478 * @throws AccessPoemException
479 * if the current <code>AccessToken</code>
480 * does not confer write access rights
481 * @return the Integer image
482 */
483 public Field<Integer> getImageField() throws AccessPoemException {
484 Column<Integer> c = _getChildTable().getImageColumn();
485 return new Field<Integer>((Integer)c.getRaw(this), c);
486 }
487
488
489 /**
490 * Retrieves the <code>Deleted</code> value, without locking,
491 * for this <code>Child</code> <code>Persistent</code>.
492 *
493 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
494 * @return the Boolean deleted
495 */
496 public Boolean getDeleted_unsafe() {
497 return deleted;
498 }
499
500
501 /**
502 * Sets the <code>Deleted</code> value directly, without checking,
503 * for this Child <code>Persistent</code>.
504 *
505 * see org.melati.poem.prepro.FieldDef#generateBaseMethods
506 * @param cooked the pre-validated value to set
507 */
508 public void setDeleted_unsafe(Boolean cooked) {
509 deleted = cooked;
510 }
511
512 /**
513 * Retrieves the Deleted value, with locking, for this
514 * <code>Child</code> <code>Persistent</code>.
515 * Field description:
516 * Whether deleted
517 *
518 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
519 * @throws AccessPoemException
520 * if the current <code>AccessToken</code>
521 * does not confer write access rights
522 * @return the value of the field <code>Deleted</code> for this
523 * <code>Child</code> <code>Persistent</code>
524 */
525
526 public Boolean getDeleted()
527 throws AccessPoemException {
528 readLock();
529 return getDeleted_unsafe();
530 }
531
532
533 /**
534 * Sets the <code>Deleted</code> value, with checking, for this
535 * <code>Child</code> <code>Persistent</code>.
536 * Field description:
537 * Whether deleted
538 *
539 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
540 * @param cooked a validated <code>int</code>
541 * @throws AccessPoemException
542 * if the current <code>AccessToken</code>
543 * does not confer write access rights
544 * @throws ValidationPoemException
545 * if the value is not valid
546 */
547 public void setDeleted(Boolean cooked)
548 throws AccessPoemException, ValidationPoemException {
549 _getChildTable().getDeletedColumn().
550 getType().assertValidCooked(cooked);
551 writeLock();
552 setDeleted_unsafe(cooked);
553 }
554
555 /**
556 * Sets the <code>Deleted</code> value, with checking,
557 * from a <code>boolean</code>, for this
558 * <code>Child</code> <code>Persistent</code>.
559 * Field description:
560 * Whether deleted
561 *
562 *
563 * Generated by org.melati.poem.prepro.BooleanFieldDef#generateBaseMethods
564 * @param cooked a <code>boolean</code>
565 * @throws AccessPoemException
566 * if the current <code>AccessToken</code>
567 * does not confer write access rights
568 * @throws ValidationPoemException
569 * if the value is not valid
570 */
571
572 public final void setDeleted(boolean cooked)
573 throws AccessPoemException, ValidationPoemException {
574 setDeleted(cooked ? Boolean.TRUE : Boolean.FALSE);
575 }
576
577
578 /**
579 * Retrieves the <code>Deleted</code> value as a <code>Field</code>
580 * from this <code>Child</code> <code>Persistent</code>.
581 *
582 * see org.melati.poem.prepro.FieldDef#generateFieldCreator
583 * @throws AccessPoemException
584 * if the current <code>AccessToken</code>
585 * does not confer write access rights
586 * @return the Boolean deleted
587 */
588 public Field<Boolean> getDeletedField() throws AccessPoemException {
589 Column<Boolean> c = _getChildTable().getDeletedColumn();
590 return new Field<Boolean>((Boolean)c.getRaw(this), c);
591 }
592
593 }
594