1 // Do not edit this file! It was generated by Melati POEM's DSD preprocessor.
2
3 package org.melati.example.contacts.generated;
4
5
6 import java.sql.Date;
7 import org.melati.example.contacts.Contact;
8 import org.melati.example.contacts.ContactTable;
9 import org.melati.example.contacts.ContactsDatabaseTables;
10 import org.melati.poem.AccessPoemException;
11 import org.melati.poem.Column;
12 import org.melati.poem.Field;
13 import org.melati.poem.JdbcPersistent;
14 import org.melati.poem.NoSuchRowPoemException;
15 import org.melati.poem.User;
16 import org.melati.poem.ValidationPoemException;
17
18
19 /**
20 * Melati POEM generated abstract base class for a <code>Persistent</code>
21 * <code>Contact</code> Object.
22 *
23 * @see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
24 */
25 public abstract class ContactBase 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 ContactsDatabaseTables getContactsDatabaseTables() {
35 return (ContactsDatabaseTables)getDatabase();
36 }
37
38
39 /**
40 * Retrieves the <code>ContactTable</code> table
41 * which this <code>Persistent</code> is from.
42 *
43 * @see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
44 * @return the ContactTable
45 */
46 public ContactTable getContactTable() {
47 return (ContactTable)getTable();
48 }
49
50 private ContactTable _getContactTable() {
51 return (ContactTable)getTable();
52 }
53
54 // Fields in this table
55 /**
56 * id
57 */
58 protected Integer id;
59 /**
60 * name - Contact Name
61 */
62 protected String name;
63 /**
64 * owner - Contact who owns this contact
65 */
66 protected Integer owner;
67 /**
68 * address - Contact Address
69 */
70 protected String address;
71 /**
72 * updates - How many times has this record been updated?
73 */
74 protected Integer updates;
75 /**
76 * lastupdated - When was this last updated?
77 */
78 protected Date lastupdated;
79 /**
80 * lastupdateuser - Who last updated this?
81 */
82 protected Integer lastupdateuser;
83
84
85 /**
86 * Retrieves the <code>Id</code> value, without locking,
87 * for this <code>Contact</code> <code>Persistent</code>.
88 *
89 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
90 * @return the Integer id
91 */
92 public Integer getId_unsafe() {
93 return id;
94 }
95
96
97 /**
98 * Sets the <code>Id</code> value directly, without checking,
99 * for this Contact <code>Persistent</code>.
100 *
101 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
102 * @param cooked the pre-validated value to set
103 */
104 public void setId_unsafe(Integer cooked) {
105 id = cooked;
106 }
107
108 /**
109 * Retrieves the Id value, with locking, for this
110 * <code>Contact</code> <code>Persistent</code>.
111 *
112 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
113 * @throws AccessPoemException
114 * if the current <code>AccessToken</code>
115 * does not confer write access rights
116 * @return the value of the field <code>Id</code> for this
117 * <code>Contact</code> <code>Persistent</code>
118 */
119
120 public Integer getId()
121 throws AccessPoemException {
122 readLock();
123 return getId_unsafe();
124 }
125
126
127 /**
128 * Sets the <code>Id</code> value, with checking, for this
129 * <code>Contact</code> <code>Persistent</code>.
130 *
131 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
132 * @param cooked a validated <code>int</code>
133 * @throws AccessPoemException
134 * if the current <code>AccessToken</code>
135 * does not confer write access rights
136 * @throws ValidationPoemException
137 * if the value is not valid
138 */
139 public void setId(Integer cooked)
140 throws AccessPoemException, ValidationPoemException {
141 _getContactTable().getIdColumn().
142 getType().assertValidCooked(cooked);
143 writeLock();
144 setId_unsafe(cooked);
145 }
146
147 /**
148 * Sets the <code>Id</code> value, with checking, for this
149 * <code>Contact</code> <code>Persistent</code>.
150 *
151 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
152 * @param cooked a validated <code>int</code>
153 * @throws AccessPoemException
154 * if the current <code>AccessToken</code>
155 * does not confer write access rights
156 * @throws ValidationPoemException
157 * if the value is not valid
158 */
159
160 public final void setId(int cooked)
161 throws AccessPoemException, ValidationPoemException {
162 setId(new Integer(cooked));
163 }
164
165
166 /**
167 * Retrieves the <code>Id</code> value as a <code>Field</code>
168 * from this <code>Contact</code> <code>Persistent</code>.
169 *
170 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
171 * @throws AccessPoemException
172 * if the current <code>AccessToken</code>
173 * does not confer write access rights
174 * @return the Integer id
175 */
176 public Field getIdField() throws AccessPoemException {
177 Column c = _getContactTable().getIdColumn();
178 return new Field(c.getRaw(this), c);
179 }
180
181
182 /**
183 * Retrieves the <code>Name</code> value, without locking,
184 * for this <code>Contact</code> <code>Persistent</code>.
185 *
186 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
187 * @return the String name
188 */
189 public String getName_unsafe() {
190 return name;
191 }
192
193
194 /**
195 * Sets the <code>Name</code> value directly, without checking,
196 * for this Contact <code>Persistent</code>.
197 *
198 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
199 * @param cooked the pre-validated value to set
200 */
201 public void setName_unsafe(String cooked) {
202 name = cooked;
203 }
204
205 /**
206 * Retrieves the Name value, with locking, for this
207 * <code>Contact</code> <code>Persistent</code>.
208 * Field description:
209 * Contact Name
210 *
211 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
212 * @throws AccessPoemException
213 * if the current <code>AccessToken</code>
214 * does not confer write access rights
215 * @return the value of the field <code>Name</code> for this
216 * <code>Contact</code> <code>Persistent</code>
217 */
218
219 public String getName()
220 throws AccessPoemException {
221 readLock();
222 return getName_unsafe();
223 }
224
225
226 /**
227 * Sets the <code>Name</code> value, with checking, for this
228 * <code>Contact</code> <code>Persistent</code>.
229 * Field description:
230 * Contact Name
231 *
232 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
233 * @param cooked a validated <code>int</code>
234 * @throws AccessPoemException
235 * if the current <code>AccessToken</code>
236 * does not confer write access rights
237 * @throws ValidationPoemException
238 * if the value is not valid
239 */
240 public void setName(String cooked)
241 throws AccessPoemException, ValidationPoemException {
242 _getContactTable().getNameColumn().
243 getType().assertValidCooked(cooked);
244 writeLock();
245 setName_unsafe(cooked);
246 }
247
248
249 /**
250 * Retrieves the <code>Name</code> value as a <code>Field</code>
251 * from this <code>Contact</code> <code>Persistent</code>.
252 *
253 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
254 * @throws AccessPoemException
255 * if the current <code>AccessToken</code>
256 * does not confer write access rights
257 * @return the String name
258 */
259 public Field getNameField() throws AccessPoemException {
260 Column c = _getContactTable().getNameColumn();
261 return new Field(c.getRaw(this), c);
262 }
263
264
265 /**
266 * Retrieves the <code>Owner</code> value, without locking,
267 * for this <code>Contact</code> <code>Persistent</code>.
268 *
269 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
270 * @return the Integer owner
271 */
272 public Integer getOwner_unsafe() {
273 return owner;
274 }
275
276
277 /**
278 * Sets the <code>Owner</code> value directly, without checking,
279 * for this Contact <code>Persistent</code>.
280 *
281 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
282 * @param cooked the pre-validated value to set
283 */
284 public void setOwner_unsafe(Integer cooked) {
285 owner = cooked;
286 }
287
288 /**
289 * Retrieves the Table Row Object ID.
290 *
291 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
292 * @throws AccessPoemException
293 * if the current <code>AccessToken</code>
294 * does not confer read access rights
295 * @return the TROID as an <code>Integer</code>
296 */
297
298 public Integer getOwnerTroid()
299 throws AccessPoemException {
300 readLock();
301 return getOwner_unsafe();
302 }
303
304
305 /**
306 * Sets the Table Row Object ID.
307 *
308 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
309 * @param raw a Table Row Object Id
310 * @throws AccessPoemException
311 * if the current <code>AccessToken</code>
312 * does not confer write access rights
313 */
314 public void setOwnerTroid(Integer raw)
315 throws AccessPoemException {
316 setOwner(raw == null ? null :
317 getContactsDatabaseTables().getContactTable().getContactObject(raw));
318 }
319
320
321 /**
322 * Retrieves the <code>Owner</code> object referred to.
323 *
324 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
325 * @throws AccessPoemException
326 * if the current <code>AccessToken</code>
327 * does not confer read access rights
328 * @throws NoSuchRowPoemException
329 * if the <code>Persistent</code> has yet to be allocated a TROID
330 * @return the <code>Owner</code> as a <code>Contact</code>
331 */
332 public Contact getOwner()
333 throws AccessPoemException, NoSuchRowPoemException {
334 Integer troid = getOwnerTroid();
335 return troid == null ? null :
336 getContactsDatabaseTables().getContactTable().getContactObject(troid);
337 }
338
339
340 /**
341 * Set the Owner.
342 *
343 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
344 * @param cooked a validated <code>Contact</code>
345 * @throws AccessPoemException
346 * if the current <code>AccessToken</code>
347 * does not confer write access rights
348 */
349 public void setOwner(Contact cooked)
350 throws AccessPoemException {
351 _getContactTable().
352 getOwnerColumn().
353 getType().assertValidCooked(cooked);
354 writeLock();
355 if (cooked == null)
356 setOwner_unsafe(null);
357 else {
358 cooked.existenceLock();
359 setOwner_unsafe(cooked.troid());
360 }
361 }
362
363
364 /**
365 * Retrieves the <code>Owner</code> value as a <code>Field</code>
366 * from this <code>Contact</code> <code>Persistent</code>.
367 *
368 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
369 * @throws AccessPoemException
370 * if the current <code>AccessToken</code>
371 * does not confer write access rights
372 * @return the Integer owner
373 */
374 public Field getOwnerField() throws AccessPoemException {
375 Column c = _getContactTable().getOwnerColumn();
376 return new Field(c.getRaw(this), c);
377 }
378
379
380 /**
381 * Retrieves the <code>Address</code> value, without locking,
382 * for this <code>Contact</code> <code>Persistent</code>.
383 *
384 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
385 * @return the String address
386 */
387 public String getAddress_unsafe() {
388 return address;
389 }
390
391
392 /**
393 * Sets the <code>Address</code> value directly, without checking,
394 * for this Contact <code>Persistent</code>.
395 *
396 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
397 * @param cooked the pre-validated value to set
398 */
399 public void setAddress_unsafe(String cooked) {
400 address = cooked;
401 }
402
403 /**
404 * Retrieves the Address value, with locking, for this
405 * <code>Contact</code> <code>Persistent</code>.
406 * Field description:
407 * Contact Address
408 *
409 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
410 * @throws AccessPoemException
411 * if the current <code>AccessToken</code>
412 * does not confer write access rights
413 * @return the value of the field <code>Address</code> for this
414 * <code>Contact</code> <code>Persistent</code>
415 */
416
417 public String getAddress()
418 throws AccessPoemException {
419 readLock();
420 return getAddress_unsafe();
421 }
422
423
424 /**
425 * Sets the <code>Address</code> value, with checking, for this
426 * <code>Contact</code> <code>Persistent</code>.
427 * Field description:
428 * Contact Address
429 *
430 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
431 * @param cooked a validated <code>int</code>
432 * @throws AccessPoemException
433 * if the current <code>AccessToken</code>
434 * does not confer write access rights
435 * @throws ValidationPoemException
436 * if the value is not valid
437 */
438 public void setAddress(String cooked)
439 throws AccessPoemException, ValidationPoemException {
440 _getContactTable().getAddressColumn().
441 getType().assertValidCooked(cooked);
442 writeLock();
443 setAddress_unsafe(cooked);
444 }
445
446
447 /**
448 * Retrieves the <code>Address</code> value as a <code>Field</code>
449 * from this <code>Contact</code> <code>Persistent</code>.
450 *
451 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
452 * @throws AccessPoemException
453 * if the current <code>AccessToken</code>
454 * does not confer write access rights
455 * @return the String address
456 */
457 public Field getAddressField() throws AccessPoemException {
458 Column c = _getContactTable().getAddressColumn();
459 return new Field(c.getRaw(this), c);
460 }
461
462
463 /**
464 * Retrieves the <code>Updates</code> value, without locking,
465 * for this <code>Contact</code> <code>Persistent</code>.
466 *
467 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
468 * @return the Integer updates
469 */
470 public Integer getUpdates_unsafe() {
471 return updates;
472 }
473
474
475 /**
476 * Sets the <code>Updates</code> value directly, without checking,
477 * for this Contact <code>Persistent</code>.
478 *
479 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
480 * @param cooked the pre-validated value to set
481 */
482 public void setUpdates_unsafe(Integer cooked) {
483 updates = cooked;
484 }
485
486 /**
487 * Retrieves the Updates value, with locking, for this
488 * <code>Contact</code> <code>Persistent</code>.
489 * Field description:
490 * How many times has this record been updated?
491 *
492 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
493 * @throws AccessPoemException
494 * if the current <code>AccessToken</code>
495 * does not confer write access rights
496 * @return the value of the field <code>Updates</code> for this
497 * <code>Contact</code> <code>Persistent</code>
498 */
499
500 public Integer getUpdates()
501 throws AccessPoemException {
502 readLock();
503 return getUpdates_unsafe();
504 }
505
506
507 /**
508 * Sets the <code>Updates</code> value, with checking, for this
509 * <code>Contact</code> <code>Persistent</code>.
510 * Field description:
511 * How many times has this record been updated?
512 *
513 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
514 * @param cooked a validated <code>int</code>
515 * @throws AccessPoemException
516 * if the current <code>AccessToken</code>
517 * does not confer write access rights
518 * @throws ValidationPoemException
519 * if the value is not valid
520 */
521 public void setUpdates(Integer cooked)
522 throws AccessPoemException, ValidationPoemException {
523 _getContactTable().getUpdatesColumn().
524 getType().assertValidCooked(cooked);
525 writeLock();
526 setUpdates_unsafe(cooked);
527 }
528
529 /**
530 * Sets the <code>Updates</code> value, with checking, for this
531 * <code>Contact</code> <code>Persistent</code>.
532 * Field description:
533 * How many times has this record been updated?
534 *
535 *
536 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
537 * @param cooked a validated <code>int</code>
538 * @throws AccessPoemException
539 * if the current <code>AccessToken</code>
540 * does not confer write access rights
541 * @throws ValidationPoemException
542 * if the value is not valid
543 */
544
545 public final void setUpdates(int cooked)
546 throws AccessPoemException, ValidationPoemException {
547 setUpdates(new Integer(cooked));
548 }
549
550
551 /**
552 * Retrieves the <code>Updates</code> value as a <code>Field</code>
553 * from this <code>Contact</code> <code>Persistent</code>.
554 *
555 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
556 * @throws AccessPoemException
557 * if the current <code>AccessToken</code>
558 * does not confer write access rights
559 * @return the Integer updates
560 */
561 public Field getUpdatesField() throws AccessPoemException {
562 Column c = _getContactTable().getUpdatesColumn();
563 return new Field(c.getRaw(this), c);
564 }
565
566
567 /**
568 * Retrieves the <code>Lastupdated</code> value, without locking,
569 * for this <code>Contact</code> <code>Persistent</code>.
570 *
571 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
572 * @return the Date lastupdated
573 */
574 public Date getLastupdated_unsafe() {
575 return lastupdated;
576 }
577
578
579 /**
580 * Sets the <code>Lastupdated</code> value directly, without checking,
581 * for this Contact <code>Persistent</code>.
582 *
583 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
584 * @param cooked the pre-validated value to set
585 */
586 public void setLastupdated_unsafe(Date cooked) {
587 lastupdated = cooked;
588 }
589
590 /**
591 * Retrieves the Lastupdated value, with locking, for this
592 * <code>Contact</code> <code>Persistent</code>.
593 * Field description:
594 * When was this last updated?
595 *
596 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
597 * @throws AccessPoemException
598 * if the current <code>AccessToken</code>
599 * does not confer write access rights
600 * @return the value of the field <code>Lastupdated</code> for this
601 * <code>Contact</code> <code>Persistent</code>
602 */
603
604 public Date getLastupdated()
605 throws AccessPoemException {
606 readLock();
607 return getLastupdated_unsafe();
608 }
609
610
611 /**
612 * Sets the <code>Lastupdated</code> value, with checking, for this
613 * <code>Contact</code> <code>Persistent</code>.
614 * Field description:
615 * When was this last updated?
616 *
617 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
618 * @param cooked a validated <code>int</code>
619 * @throws AccessPoemException
620 * if the current <code>AccessToken</code>
621 * does not confer write access rights
622 * @throws ValidationPoemException
623 * if the value is not valid
624 */
625 public void setLastupdated(Date cooked)
626 throws AccessPoemException, ValidationPoemException {
627 _getContactTable().getLastupdatedColumn().
628 getType().assertValidCooked(cooked);
629 writeLock();
630 setLastupdated_unsafe(cooked);
631 }
632
633
634 /**
635 * Retrieves the <code>Lastupdated</code> value as a <code>Field</code>
636 * from this <code>Contact</code> <code>Persistent</code>.
637 *
638 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
639 * @throws AccessPoemException
640 * if the current <code>AccessToken</code>
641 * does not confer write access rights
642 * @return the Date lastupdated
643 */
644 public Field getLastupdatedField() throws AccessPoemException {
645 Column c = _getContactTable().getLastupdatedColumn();
646 return new Field(c.getRaw(this), c);
647 }
648
649
650 /**
651 * Retrieves the <code>Lastupdateuser</code> value, without locking,
652 * for this <code>Contact</code> <code>Persistent</code>.
653 *
654 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
655 * @return the Integer lastupdateuser
656 */
657 public Integer getLastupdateuser_unsafe() {
658 return lastupdateuser;
659 }
660
661
662 /**
663 * Sets the <code>Lastupdateuser</code> value directly, without checking,
664 * for this Contact <code>Persistent</code>.
665 *
666 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
667 * @param cooked the pre-validated value to set
668 */
669 public void setLastupdateuser_unsafe(Integer cooked) {
670 lastupdateuser = cooked;
671 }
672
673 /**
674 * Retrieves the Table Row Object ID.
675 *
676 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
677 * @throws AccessPoemException
678 * if the current <code>AccessToken</code>
679 * does not confer read access rights
680 * @return the TROID as an <code>Integer</code>
681 */
682
683 public Integer getLastupdateuserTroid()
684 throws AccessPoemException {
685 readLock();
686 return getLastupdateuser_unsafe();
687 }
688
689
690 /**
691 * Sets the Table Row Object ID.
692 *
693 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
694 * @param raw a Table Row Object Id
695 * @throws AccessPoemException
696 * if the current <code>AccessToken</code>
697 * does not confer write access rights
698 */
699 public void setLastupdateuserTroid(Integer raw)
700 throws AccessPoemException {
701 setLastupdateuser(raw == null ? null :
702 getContactsDatabaseTables().getUserTable().getUserObject(raw));
703 }
704
705
706 /**
707 * Retrieves the <code>Lastupdateuser</code> object referred to.
708 *
709 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
710 * @throws AccessPoemException
711 * if the current <code>AccessToken</code>
712 * does not confer read access rights
713 * @throws NoSuchRowPoemException
714 * if the <code>Persistent</code> has yet to be allocated a TROID
715 * @return the <code>Lastupdateuser</code> as a <code>User</code>
716 */
717 public User getLastupdateuser()
718 throws AccessPoemException, NoSuchRowPoemException {
719 Integer troid = getLastupdateuserTroid();
720 return troid == null ? null :
721 getContactsDatabaseTables().getUserTable().getUserObject(troid);
722 }
723
724
725 /**
726 * Set the Lastupdateuser.
727 *
728 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
729 * @param cooked a validated <code>User</code>
730 * @throws AccessPoemException
731 * if the current <code>AccessToken</code>
732 * does not confer write access rights
733 */
734 public void setLastupdateuser(User cooked)
735 throws AccessPoemException {
736 _getContactTable().
737 getLastupdateuserColumn().
738 getType().assertValidCooked(cooked);
739 writeLock();
740 if (cooked == null)
741 setLastupdateuser_unsafe(null);
742 else {
743 cooked.existenceLock();
744 setLastupdateuser_unsafe(cooked.troid());
745 }
746 }
747
748
749 /**
750 * Retrieves the <code>Lastupdateuser</code> value as a <code>Field</code>
751 * from this <code>Contact</code> <code>Persistent</code>.
752 *
753 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
754 * @throws AccessPoemException
755 * if the current <code>AccessToken</code>
756 * does not confer write access rights
757 * @return the Integer lastupdateuser
758 */
759 public Field getLastupdateuserField() throws AccessPoemException {
760 Column c = _getContactTable().getLastupdateuserColumn();
761 return new Field(c.getRaw(this), c);
762 }
763 }
764