1 // Do not edit this file! It was generated by Melati POEM's DSD preprocessor.
2
3 package org.paneris.melati.site.model.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.melati.site.model.LinkTable;
13 import org.paneris.melati.site.model.LinkType;
14 import org.paneris.melati.site.model.Page;
15 import org.paneris.melati.site.model.SiteDatabaseTables;
16
17
18 /**
19 * Melati POEM generated abstract base class for a <code>Persistent</code>
20 * <code>Link</code> Object.
21 *
22 * @see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
23 */
24 public abstract class LinkBase extends JdbcPersistent {
25
26
27 /**
28 * Retrieves the Database object.
29 *
30 * @see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
31 * @return the database
32 */
33 public SiteDatabaseTables getSiteDatabaseTables() {
34 return (SiteDatabaseTables)getDatabase();
35 }
36
37
38 /**
39 * Retrieves the <code>LinkTable</code> table
40 * which this <code>Persistent</code> is from.
41 *
42 * @see org.melati.poem.prepro.TableDef#generatePersistentBaseJava
43 * @return the LinkTable
44 */
45 public LinkTable getLinkTable() {
46 return (LinkTable)getTable();
47 }
48
49 private LinkTable _getLinkTable() {
50 return (LinkTable)getTable();
51 }
52
53 // Fields in this table
54 /**
55 * id
56 */
57 protected Integer id;
58 /**
59 * page - The page to which the link is relevant
60 */
61 protected Integer page;
62 /**
63 * type - The type of this link
64 */
65 protected Integer type;
66 /**
67 * URL - The full URL for the site's front page
68 */
69 protected String url;
70 /**
71 * Display name - The site's name
72 */
73 protected String displayname;
74 /**
75 * displayorder
76 */
77 protected Integer displayorder;
78
79
80 /**
81 * Retrieves the <code>Id</code> value, without locking,
82 * for this <code>Link</code> <code>Persistent</code>.
83 *
84 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
85 * @return the Integer id
86 */
87 public Integer getId_unsafe() {
88 return id;
89 }
90
91
92 /**
93 * Sets the <code>Id</code> value directly, without checking,
94 * for this Link <code>Persistent</code>.
95 *
96 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
97 * @param cooked the pre-validated value to set
98 */
99 public void setId_unsafe(Integer cooked) {
100 id = cooked;
101 }
102
103 /**
104 * Retrieves the Id value, with locking, for this
105 * <code>Link</code> <code>Persistent</code>.
106 *
107 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
108 * @throws AccessPoemException
109 * if the current <code>AccessToken</code>
110 * does not confer write access rights
111 * @return the value of the field <code>Id</code> for this
112 * <code>Link</code> <code>Persistent</code>
113 */
114
115 public Integer getId()
116 throws AccessPoemException {
117 readLock();
118 return getId_unsafe();
119 }
120
121
122 /**
123 * Sets the <code>Id</code> value, with checking, for this
124 * <code>Link</code> <code>Persistent</code>.
125 *
126 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
127 * @param cooked a validated <code>int</code>
128 * @throws AccessPoemException
129 * if the current <code>AccessToken</code>
130 * does not confer write access rights
131 * @throws ValidationPoemException
132 * if the value is not valid
133 */
134 public void setId(Integer cooked)
135 throws AccessPoemException, ValidationPoemException {
136 _getLinkTable().getIdColumn().
137 getType().assertValidCooked(cooked);
138 writeLock();
139 setId_unsafe(cooked);
140 }
141
142 /**
143 * Sets the <code>Id</code> value, with checking, for this
144 * <code>Link</code> <code>Persistent</code>.
145 *
146 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
147 * @param cooked a validated <code>int</code>
148 * @throws AccessPoemException
149 * if the current <code>AccessToken</code>
150 * does not confer write access rights
151 * @throws ValidationPoemException
152 * if the value is not valid
153 */
154
155 public final void setId(int cooked)
156 throws AccessPoemException, ValidationPoemException {
157 setId(new Integer(cooked));
158 }
159
160
161 /**
162 * Retrieves the <code>Id</code> value as a <code>Field</code>
163 * from this <code>Link</code> <code>Persistent</code>.
164 *
165 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
166 * @throws AccessPoemException
167 * if the current <code>AccessToken</code>
168 * does not confer write access rights
169 * @return the Integer id
170 */
171 public Field getIdField() throws AccessPoemException {
172 Column c = _getLinkTable().getIdColumn();
173 return new Field(c.getRaw(this), c);
174 }
175
176
177 /**
178 * Retrieves the <code>Page</code> value, without locking,
179 * for this <code>Link</code> <code>Persistent</code>.
180 *
181 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
182 * @return the Integer page
183 */
184 public Integer getPage_unsafe() {
185 return page;
186 }
187
188
189 /**
190 * Sets the <code>Page</code> value directly, without checking,
191 * for this Link <code>Persistent</code>.
192 *
193 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
194 * @param cooked the pre-validated value to set
195 */
196 public void setPage_unsafe(Integer cooked) {
197 page = cooked;
198 }
199
200 /**
201 * Retrieves the Table Row Object ID.
202 *
203 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
204 * @throws AccessPoemException
205 * if the current <code>AccessToken</code>
206 * does not confer read access rights
207 * @return the TROID as an <code>Integer</code>
208 */
209
210 public Integer getPageTroid()
211 throws AccessPoemException {
212 readLock();
213 return getPage_unsafe();
214 }
215
216
217 /**
218 * Sets the Table Row Object ID.
219 *
220 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
221 * @param raw a Table Row Object Id
222 * @throws AccessPoemException
223 * if the current <code>AccessToken</code>
224 * does not confer write access rights
225 */
226 public void setPageTroid(Integer raw)
227 throws AccessPoemException {
228 setPage(raw == null ? null :
229 getSiteDatabaseTables().getPageTable().getPageObject(raw));
230 }
231
232
233 /**
234 * Retrieves the <code>Page</code> object referred to.
235 *
236 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
237 * @throws AccessPoemException
238 * if the current <code>AccessToken</code>
239 * does not confer read access rights
240 * @throws NoSuchRowPoemException
241 * if the <code>Persistent</code> has yet to be allocated a TROID
242 * @return the <code>Page</code> as a <code>Page</code>
243 */
244 public Page getPage()
245 throws AccessPoemException, NoSuchRowPoemException {
246 Integer troid = getPageTroid();
247 return troid == null ? null :
248 getSiteDatabaseTables().getPageTable().getPageObject(troid);
249 }
250
251
252 /**
253 * Set the Page.
254 *
255 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
256 * @param cooked a validated <code>Page</code>
257 * @throws AccessPoemException
258 * if the current <code>AccessToken</code>
259 * does not confer write access rights
260 */
261 public void setPage(Page cooked)
262 throws AccessPoemException {
263 _getLinkTable().
264 getPageColumn().
265 getType().assertValidCooked(cooked);
266 writeLock();
267 if (cooked == null)
268 setPage_unsafe(null);
269 else {
270 cooked.existenceLock();
271 setPage_unsafe(cooked.troid());
272 }
273 }
274
275
276 /**
277 * Retrieves the <code>Page</code> value as a <code>Field</code>
278 * from this <code>Link</code> <code>Persistent</code>.
279 *
280 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
281 * @throws AccessPoemException
282 * if the current <code>AccessToken</code>
283 * does not confer write access rights
284 * @return the Integer page
285 */
286 public Field getPageField() throws AccessPoemException {
287 Column c = _getLinkTable().getPageColumn();
288 return new Field(c.getRaw(this), c);
289 }
290
291
292 /**
293 * Retrieves the <code>Type</code> value, without locking,
294 * for this <code>Link</code> <code>Persistent</code>.
295 *
296 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
297 * @return the Integer type
298 */
299 public Integer getType_unsafe() {
300 return type;
301 }
302
303
304 /**
305 * Sets the <code>Type</code> value directly, without checking,
306 * for this Link <code>Persistent</code>.
307 *
308 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
309 * @param cooked the pre-validated value to set
310 */
311 public void setType_unsafe(Integer cooked) {
312 type = cooked;
313 }
314
315 /**
316 * Retrieves the Table Row Object ID.
317 *
318 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
319 * @throws AccessPoemException
320 * if the current <code>AccessToken</code>
321 * does not confer read access rights
322 * @return the TROID as an <code>Integer</code>
323 */
324
325 public Integer getTypeTroid()
326 throws AccessPoemException {
327 readLock();
328 return getType_unsafe();
329 }
330
331
332 /**
333 * Sets the Table Row Object ID.
334 *
335 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
336 * @param raw a Table Row Object Id
337 * @throws AccessPoemException
338 * if the current <code>AccessToken</code>
339 * does not confer write access rights
340 */
341 public void setTypeTroid(Integer raw)
342 throws AccessPoemException {
343 setType(raw == null ? null :
344 getSiteDatabaseTables().getLinkTypeTable().getLinkTypeObject(raw));
345 }
346
347
348 /**
349 * Retrieves the <code>Type</code> object referred to.
350 *
351 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
352 * @throws AccessPoemException
353 * if the current <code>AccessToken</code>
354 * does not confer read access rights
355 * @throws NoSuchRowPoemException
356 * if the <code>Persistent</code> has yet to be allocated a TROID
357 * @return the <code>Type</code> as a <code>LinkType</code>
358 */
359 public LinkType getType()
360 throws AccessPoemException, NoSuchRowPoemException {
361 Integer troid = getTypeTroid();
362 return troid == null ? null :
363 getSiteDatabaseTables().getLinkTypeTable().getLinkTypeObject(troid);
364 }
365
366
367 /**
368 * Set the Type.
369 *
370 * @generator org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods
371 * @param cooked a validated <code>LinkType</code>
372 * @throws AccessPoemException
373 * if the current <code>AccessToken</code>
374 * does not confer write access rights
375 */
376 public void setType(LinkType cooked)
377 throws AccessPoemException {
378 _getLinkTable().
379 getTypeColumn().
380 getType().assertValidCooked(cooked);
381 writeLock();
382 if (cooked == null)
383 setType_unsafe(null);
384 else {
385 cooked.existenceLock();
386 setType_unsafe(cooked.troid());
387 }
388 }
389
390
391 /**
392 * Retrieves the <code>Type</code> value as a <code>Field</code>
393 * from this <code>Link</code> <code>Persistent</code>.
394 *
395 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
396 * @throws AccessPoemException
397 * if the current <code>AccessToken</code>
398 * does not confer write access rights
399 * @return the Integer type
400 */
401 public Field getTypeField() throws AccessPoemException {
402 Column c = _getLinkTable().getTypeColumn();
403 return new Field(c.getRaw(this), c);
404 }
405
406
407 /**
408 * Retrieves the <code>Url</code> value, without locking,
409 * for this <code>Link</code> <code>Persistent</code>.
410 *
411 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
412 * @return the String url
413 */
414 public String getUrl_unsafe() {
415 return url;
416 }
417
418
419 /**
420 * Sets the <code>Url</code> value directly, without checking,
421 * for this Link <code>Persistent</code>.
422 *
423 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
424 * @param cooked the pre-validated value to set
425 */
426 public void setUrl_unsafe(String cooked) {
427 url = cooked;
428 }
429
430 /**
431 * Retrieves the Url value, with locking, for this
432 * <code>Link</code> <code>Persistent</code>.
433 * Field description:
434 * The full URL for the site's front page
435 *
436 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
437 * @throws AccessPoemException
438 * if the current <code>AccessToken</code>
439 * does not confer write access rights
440 * @return the value of the field <code>Url</code> for this
441 * <code>Link</code> <code>Persistent</code>
442 */
443
444 public String getUrl()
445 throws AccessPoemException {
446 readLock();
447 return getUrl_unsafe();
448 }
449
450
451 /**
452 * Sets the <code>Url</code> value, with checking, for this
453 * <code>Link</code> <code>Persistent</code>.
454 * Field description:
455 * The full URL for the site's front page
456 *
457 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
458 * @param cooked a validated <code>int</code>
459 * @throws AccessPoemException
460 * if the current <code>AccessToken</code>
461 * does not confer write access rights
462 * @throws ValidationPoemException
463 * if the value is not valid
464 */
465 public void setUrl(String cooked)
466 throws AccessPoemException, ValidationPoemException {
467 _getLinkTable().getUrlColumn().
468 getType().assertValidCooked(cooked);
469 writeLock();
470 setUrl_unsafe(cooked);
471 }
472
473
474 /**
475 * Retrieves the <code>Url</code> value as a <code>Field</code>
476 * from this <code>Link</code> <code>Persistent</code>.
477 *
478 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
479 * @throws AccessPoemException
480 * if the current <code>AccessToken</code>
481 * does not confer write access rights
482 * @return the String url
483 */
484 public Field getUrlField() throws AccessPoemException {
485 Column c = _getLinkTable().getUrlColumn();
486 return new Field(c.getRaw(this), c);
487 }
488
489
490 /**
491 * Retrieves the <code>Displayname</code> value, without locking,
492 * for this <code>Link</code> <code>Persistent</code>.
493 *
494 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
495 * @return the String displayname
496 */
497 public String getDisplayname_unsafe() {
498 return displayname;
499 }
500
501
502 /**
503 * Sets the <code>Displayname</code> value directly, without checking,
504 * for this Link <code>Persistent</code>.
505 *
506 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
507 * @param cooked the pre-validated value to set
508 */
509 public void setDisplayname_unsafe(String cooked) {
510 displayname = cooked;
511 }
512
513 /**
514 * Retrieves the Displayname value, with locking, for this
515 * <code>Link</code> <code>Persistent</code>.
516 * Field description:
517 * The site's name
518 *
519 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
520 * @throws AccessPoemException
521 * if the current <code>AccessToken</code>
522 * does not confer write access rights
523 * @return the value of the field <code>Displayname</code> for this
524 * <code>Link</code> <code>Persistent</code>
525 */
526
527 public String getDisplayname()
528 throws AccessPoemException {
529 readLock();
530 return getDisplayname_unsafe();
531 }
532
533
534 /**
535 * Sets the <code>Displayname</code> value, with checking, for this
536 * <code>Link</code> <code>Persistent</code>.
537 * Field description:
538 * The site's name
539 *
540 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
541 * @param cooked a validated <code>int</code>
542 * @throws AccessPoemException
543 * if the current <code>AccessToken</code>
544 * does not confer write access rights
545 * @throws ValidationPoemException
546 * if the value is not valid
547 */
548 public void setDisplayname(String cooked)
549 throws AccessPoemException, ValidationPoemException {
550 _getLinkTable().getDisplaynameColumn().
551 getType().assertValidCooked(cooked);
552 writeLock();
553 setDisplayname_unsafe(cooked);
554 }
555
556
557 /**
558 * Retrieves the <code>Displayname</code> value as a <code>Field</code>
559 * from this <code>Link</code> <code>Persistent</code>.
560 *
561 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
562 * @throws AccessPoemException
563 * if the current <code>AccessToken</code>
564 * does not confer write access rights
565 * @return the String displayname
566 */
567 public Field getDisplaynameField() throws AccessPoemException {
568 Column c = _getLinkTable().getDisplaynameColumn();
569 return new Field(c.getRaw(this), c);
570 }
571
572
573 /**
574 * Retrieves the <code>Displayorder</code> value, without locking,
575 * for this <code>Link</code> <code>Persistent</code>.
576 *
577 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
578 * @return the Integer displayorder
579 */
580 public Integer getDisplayorder_unsafe() {
581 return displayorder;
582 }
583
584
585 /**
586 * Sets the <code>Displayorder</code> value directly, without checking,
587 * for this Link <code>Persistent</code>.
588 *
589 * @see org.melati.poem.prepro.FieldDef#generateBaseMethods
590 * @param cooked the pre-validated value to set
591 */
592 public void setDisplayorder_unsafe(Integer cooked) {
593 displayorder = cooked;
594 }
595
596 /**
597 * Retrieves the Displayorder value, with locking, for this
598 * <code>Link</code> <code>Persistent</code>.
599 *
600 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
601 * @throws AccessPoemException
602 * if the current <code>AccessToken</code>
603 * does not confer write access rights
604 * @return the value of the field <code>Displayorder</code> for this
605 * <code>Link</code> <code>Persistent</code>
606 */
607
608 public Integer getDisplayorder()
609 throws AccessPoemException {
610 readLock();
611 return getDisplayorder_unsafe();
612 }
613
614
615 /**
616 * Sets the <code>Displayorder</code> value, with checking, for this
617 * <code>Link</code> <code>Persistent</code>.
618 *
619 * @generator org.melati.poem.prepro.AtomFieldDef#generateBaseMethods
620 * @param cooked a validated <code>int</code>
621 * @throws AccessPoemException
622 * if the current <code>AccessToken</code>
623 * does not confer write access rights
624 * @throws ValidationPoemException
625 * if the value is not valid
626 */
627 public void setDisplayorder(Integer cooked)
628 throws AccessPoemException, ValidationPoemException {
629 _getLinkTable().getDisplayorderColumn().
630 getType().assertValidCooked(cooked);
631 writeLock();
632 setDisplayorder_unsafe(cooked);
633 }
634
635 /**
636 * Sets the <code>Displayorder</code> value, with checking, for this
637 * <code>Link</code> <code>Persistent</code>.
638 *
639 * @generator org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods
640 * @param cooked a validated <code>int</code>
641 * @throws AccessPoemException
642 * if the current <code>AccessToken</code>
643 * does not confer write access rights
644 * @throws ValidationPoemException
645 * if the value is not valid
646 */
647
648 public final void setDisplayorder(int cooked)
649 throws AccessPoemException, ValidationPoemException {
650 setDisplayorder(new Integer(cooked));
651 }
652
653
654 /**
655 * Retrieves the <code>Displayorder</code> value as a <code>Field</code>
656 * from this <code>Link</code> <code>Persistent</code>.
657 *
658 * @see org.melati.poem.prepro.FieldDef#generateFieldCreator
659 * @throws AccessPoemException
660 * if the current <code>AccessToken</code>
661 * does not confer write access rights
662 * @return the Integer displayorder
663 */
664 public Field getDisplayorderField() throws AccessPoemException {
665 Column c = _getLinkTable().getDisplayorderColumn();
666 return new Field(c.getRaw(this), c);
667 }
668 }
669