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