| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| SectionBase |
|
| 1.2142857142857142;1.214 |
| 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 org.melati.poem.AccessPoemException; | |
| 7 | import org.melati.poem.Capability; | |
| 8 | import org.melati.poem.Column; | |
| 9 | import org.melati.poem.Field; | |
| 10 | import org.melati.poem.NoSuchRowPoemException; | |
| 11 | import org.melati.poem.ValidationPoemException; | |
| 12 | import org.paneris.bibliomania.BibliomaniaDatabaseTables; | |
| 13 | import org.paneris.bibliomania.Section; | |
| 14 | import org.paneris.bibliomania.SectionGroup; | |
| 15 | import org.paneris.bibliomania.SectionTable; | |
| 16 | import org.paneris.bibliomania.Unit; | |
| 17 | ||
| 18 | ||
| 19 | /** | |
| 20 | * Melati POEM generated abstract base class for a <code>Persistent</code> | |
| 21 | * <code>Section</code> Object. | |
| 22 | * | |
| 23 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 24 | */ | |
| 25 | 3 | public abstract class SectionBase extends Unit { |
| 26 | ||
| 27 | ||
| 28 | /** | |
| 29 | * Retrieves the Database object. | |
| 30 | * | |
| 31 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 32 | * @return the database | |
| 33 | */ | |
| 34 | public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { | |
| 35 | 35 | return (BibliomaniaDatabaseTables)getDatabase(); |
| 36 | } | |
| 37 | ||
| 38 | ||
| 39 | /** | |
| 40 | * Retrieves the <code>SectionTable</code> table | |
| 41 | * which this <code>Persistent</code> is from. | |
| 42 | * | |
| 43 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 44 | * @return the SectionTable | |
| 45 | */ | |
| 46 | @SuppressWarnings("unchecked") | |
| 47 | public SectionTable<Section> getSectionTable() { | |
| 48 | 0 | return (SectionTable<Section>)getTable(); |
| 49 | } | |
| 50 | ||
| 51 | @SuppressWarnings("unchecked") | |
| 52 | private SectionTable<Section> _getSectionTable() { | |
| 53 | 0 | return (SectionTable<Section>)getTable(); |
| 54 | } | |
| 55 | ||
| 56 | // Fields in this table | |
| 57 | /** | |
| 58 | * id | |
| 59 | */ | |
| 60 | protected Integer id; | |
| 61 | /** | |
| 62 | * Display name - A human-readable name for the section | |
| 63 | */ | |
| 64 | protected String displayname; | |
| 65 | /** | |
| 66 | * group - The group in which the category belongs | |
| 67 | */ | |
| 68 | protected Integer group; | |
| 69 | /** | |
| 70 | * Default `Read content' capability - The capability required for reading | |
| 71 | * books in the section, unless overridden in the book itself | |
| 72 | */ | |
| 73 | protected Integer defaultcanreadcontent; | |
| 74 | ||
| 75 | ||
| 76 | /** | |
| 77 | * Retrieves the <code>Id</code> value, without locking, | |
| 78 | * for this <code>Section</code> <code>Persistent</code>. | |
| 79 | * | |
| 80 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 81 | * @return the Integer id | |
| 82 | */ | |
| 83 | public Integer getId_unsafe() { | |
| 84 | 0 | return id; |
| 85 | } | |
| 86 | ||
| 87 | ||
| 88 | /** | |
| 89 | * Sets the <code>Id</code> value directly, without checking, | |
| 90 | * for this Section <code>Persistent</code>. | |
| 91 | * | |
| 92 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 93 | * @param cooked the pre-validated value to set | |
| 94 | */ | |
| 95 | public void setId_unsafe(Integer cooked) { | |
| 96 | 6 | id = cooked; |
| 97 | 6 | } |
| 98 | ||
| 99 | /** | |
| 100 | * Retrieves the Id value, with locking, for this | |
| 101 | * <code>Section</code> <code>Persistent</code>. | |
| 102 | * | |
| 103 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 104 | * @throws AccessPoemException | |
| 105 | * if the current <code>AccessToken</code> | |
| 106 | * does not confer write access rights | |
| 107 | * @return the value of the field <code>Id</code> for this | |
| 108 | * <code>Section</code> <code>Persistent</code> | |
| 109 | */ | |
| 110 | ||
| 111 | public Integer getId() | |
| 112 | throws AccessPoemException { | |
| 113 | 0 | readLock(); |
| 114 | 0 | return getId_unsafe(); |
| 115 | } | |
| 116 | ||
| 117 | ||
| 118 | /** | |
| 119 | * Sets the <code>Id</code> value, with checking, for this | |
| 120 | * <code>Section</code> <code>Persistent</code>. | |
| 121 | * | |
| 122 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 123 | * @param cooked a validated <code>int</code> | |
| 124 | * @throws AccessPoemException | |
| 125 | * if the current <code>AccessToken</code> | |
| 126 | * does not confer write access rights | |
| 127 | * @throws ValidationPoemException | |
| 128 | * if the value is not valid | |
| 129 | */ | |
| 130 | public void setId(Integer cooked) | |
| 131 | throws AccessPoemException, ValidationPoemException { | |
| 132 | 0 | _getSectionTable().getIdColumn(). |
| 133 | getType().assertValidCooked(cooked); | |
| 134 | 0 | writeLock(); |
| 135 | 0 | setId_unsafe(cooked); |
| 136 | 0 | } |
| 137 | ||
| 138 | /** | |
| 139 | * Sets the <code>Id</code> value, with checking, for this | |
| 140 | * <code>Section</code> <code>Persistent</code>. | |
| 141 | * | |
| 142 | * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods | |
| 143 | * @param cooked a validated <code>int</code> | |
| 144 | * @throws AccessPoemException | |
| 145 | * if the current <code>AccessToken</code> | |
| 146 | * does not confer write access rights | |
| 147 | * @throws ValidationPoemException | |
| 148 | * if the value is not valid | |
| 149 | */ | |
| 150 | ||
| 151 | public final void setId(int cooked) | |
| 152 | throws AccessPoemException, ValidationPoemException { | |
| 153 | 0 | setId(new Integer(cooked)); |
| 154 | 0 | } |
| 155 | ||
| 156 | ||
| 157 | /** | |
| 158 | * Retrieves the <code>Id</code> value as a <code>Field</code> | |
| 159 | * from this <code>Section</code> <code>Persistent</code>. | |
| 160 | * | |
| 161 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 162 | * @throws AccessPoemException | |
| 163 | * if the current <code>AccessToken</code> | |
| 164 | * does not confer write access rights | |
| 165 | * @return the Integer id | |
| 166 | */ | |
| 167 | public Field<Integer> getIdField() throws AccessPoemException { | |
| 168 | 0 | Column<Integer> c = _getSectionTable().getIdColumn(); |
| 169 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 170 | } | |
| 171 | ||
| 172 | ||
| 173 | /** | |
| 174 | * Retrieves the <code>Displayname</code> value, without locking, | |
| 175 | * for this <code>Section</code> <code>Persistent</code>. | |
| 176 | * | |
| 177 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 178 | * @return the String displayname | |
| 179 | */ | |
| 180 | public String getDisplayname_unsafe() { | |
| 181 | 2 | return displayname; |
| 182 | } | |
| 183 | ||
| 184 | ||
| 185 | /** | |
| 186 | * Sets the <code>Displayname</code> value directly, without checking, | |
| 187 | * for this Section <code>Persistent</code>. | |
| 188 | * | |
| 189 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 190 | * @param cooked the pre-validated value to set | |
| 191 | */ | |
| 192 | public void setDisplayname_unsafe(String cooked) { | |
| 193 | 3 | displayname = cooked; |
| 194 | 3 | } |
| 195 | ||
| 196 | /** | |
| 197 | * Retrieves the Displayname value, with locking, for this | |
| 198 | * <code>Section</code> <code>Persistent</code>. | |
| 199 | * Field description: | |
| 200 | * A human-readable name for the section | |
| 201 | * | |
| 202 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 203 | * @throws AccessPoemException | |
| 204 | * if the current <code>AccessToken</code> | |
| 205 | * does not confer write access rights | |
| 206 | * @return the value of the field <code>Displayname</code> for this | |
| 207 | * <code>Section</code> <code>Persistent</code> | |
| 208 | */ | |
| 209 | ||
| 210 | public String getDisplayname() | |
| 211 | throws AccessPoemException { | |
| 212 | 0 | readLock(); |
| 213 | 0 | return getDisplayname_unsafe(); |
| 214 | } | |
| 215 | ||
| 216 | ||
| 217 | /** | |
| 218 | * Sets the <code>Displayname</code> value, with checking, for this | |
| 219 | * <code>Section</code> <code>Persistent</code>. | |
| 220 | * Field description: | |
| 221 | * A human-readable name for the section | |
| 222 | * | |
| 223 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 224 | * @param cooked a validated <code>int</code> | |
| 225 | * @throws AccessPoemException | |
| 226 | * if the current <code>AccessToken</code> | |
| 227 | * does not confer write access rights | |
| 228 | * @throws ValidationPoemException | |
| 229 | * if the value is not valid | |
| 230 | */ | |
| 231 | public void setDisplayname(String cooked) | |
| 232 | throws AccessPoemException, ValidationPoemException { | |
| 233 | 0 | _getSectionTable().getDisplaynameColumn(). |
| 234 | getType().assertValidCooked(cooked); | |
| 235 | 0 | writeLock(); |
| 236 | 0 | setDisplayname_unsafe(cooked); |
| 237 | 0 | } |
| 238 | ||
| 239 | ||
| 240 | /** | |
| 241 | * Retrieves the <code>Displayname</code> value as a <code>Field</code> | |
| 242 | * from this <code>Section</code> <code>Persistent</code>. | |
| 243 | * | |
| 244 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 245 | * @throws AccessPoemException | |
| 246 | * if the current <code>AccessToken</code> | |
| 247 | * does not confer write access rights | |
| 248 | * @return the String displayname | |
| 249 | */ | |
| 250 | public Field<String> getDisplaynameField() throws AccessPoemException { | |
| 251 | 0 | Column<String> c = _getSectionTable().getDisplaynameColumn(); |
| 252 | 0 | return new Field<String>((String)c.getRaw(this), c); |
| 253 | } | |
| 254 | ||
| 255 | ||
| 256 | /** | |
| 257 | * Retrieves the <code>Group</code> value, without locking, | |
| 258 | * for this <code>Section</code> <code>Persistent</code>. | |
| 259 | * | |
| 260 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 261 | * @return the Integer group | |
| 262 | */ | |
| 263 | public Integer getGroup_unsafe() { | |
| 264 | 35 | return group; |
| 265 | } | |
| 266 | ||
| 267 | ||
| 268 | /** | |
| 269 | * Sets the <code>Group</code> value directly, without checking, | |
| 270 | * for this Section <code>Persistent</code>. | |
| 271 | * | |
| 272 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 273 | * @param cooked the pre-validated value to set | |
| 274 | */ | |
| 275 | public void setGroup_unsafe(Integer cooked) { | |
| 276 | 3 | group = cooked; |
| 277 | 3 | } |
| 278 | ||
| 279 | /** | |
| 280 | * Retrieves the Table Row Object ID. | |
| 281 | * | |
| 282 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 283 | * @throws AccessPoemException | |
| 284 | * if the current <code>AccessToken</code> | |
| 285 | * does not confer read access rights | |
| 286 | * @return the TROID as an <code>Integer</code> | |
| 287 | */ | |
| 288 | ||
| 289 | public Integer getGroupTroid() | |
| 290 | throws AccessPoemException { | |
| 291 | 35 | readLock(); |
| 292 | 35 | return getGroup_unsafe(); |
| 293 | } | |
| 294 | ||
| 295 | ||
| 296 | /** | |
| 297 | * Sets the Table Row Object ID. | |
| 298 | * | |
| 299 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 300 | * @param raw a Table Row Object Id | |
| 301 | * @throws AccessPoemException | |
| 302 | * if the current <code>AccessToken</code> | |
| 303 | * does not confer write access rights | |
| 304 | */ | |
| 305 | public void setGroupTroid(Integer raw) | |
| 306 | throws AccessPoemException { | |
| 307 | 0 | setGroup(raw == null ? null : |
| 308 | (SectionGroup)getBibliomaniaDatabaseTables().getSectionGroupTable().getSectionGroupObject(raw)); | |
| 309 | 0 | } |
| 310 | ||
| 311 | ||
| 312 | /** | |
| 313 | * Retrieves the <code>Group</code> object referred to. | |
| 314 | * | |
| 315 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 316 | * @throws AccessPoemException | |
| 317 | * if the current <code>AccessToken</code> | |
| 318 | * does not confer read access rights | |
| 319 | * @throws NoSuchRowPoemException | |
| 320 | * if the <code>Persistent</code> has yet to be allocated a TROID | |
| 321 | * @return the <code>Group</code> as a <code>SectionGroup</code> | |
| 322 | */ | |
| 323 | public SectionGroup getGroup() | |
| 324 | throws AccessPoemException, NoSuchRowPoemException { | |
| 325 | 35 | Integer troid = getGroupTroid(); |
| 326 | 35 | return troid == null ? null : |
| 327 | (SectionGroup)getBibliomaniaDatabaseTables().getSectionGroupTable().getSectionGroupObject(troid); | |
| 328 | } | |
| 329 | ||
| 330 | ||
| 331 | /** | |
| 332 | * Set the Group. | |
| 333 | * | |
| 334 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 335 | * @param cooked a validated <code>SectionGroup</code> | |
| 336 | * @throws AccessPoemException | |
| 337 | * if the current <code>AccessToken</code> | |
| 338 | * does not confer write access rights | |
| 339 | */ | |
| 340 | public void setGroup(SectionGroup cooked) | |
| 341 | throws AccessPoemException { | |
| 342 | 0 | _getSectionTable(). |
| 343 | getGroupColumn(). | |
| 344 | getType().assertValidCooked(cooked); | |
| 345 | 0 | writeLock(); |
| 346 | 0 | if (cooked == null) |
| 347 | 0 | setGroup_unsafe(null); |
| 348 | else { | |
| 349 | 0 | cooked.existenceLock(); |
| 350 | 0 | setGroup_unsafe(cooked.troid()); |
| 351 | } | |
| 352 | 0 | } |
| 353 | ||
| 354 | ||
| 355 | /** | |
| 356 | * Retrieves the <code>Group</code> value as a <code>Field</code> | |
| 357 | * from this <code>Section</code> <code>Persistent</code>. | |
| 358 | * | |
| 359 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 360 | * @throws AccessPoemException | |
| 361 | * if the current <code>AccessToken</code> | |
| 362 | * does not confer write access rights | |
| 363 | * @return the Integer group | |
| 364 | */ | |
| 365 | public Field<Integer> getGroupField() throws AccessPoemException { | |
| 366 | 0 | Column<Integer> c = _getSectionTable().getGroupColumn(); |
| 367 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 368 | } | |
| 369 | ||
| 370 | ||
| 371 | /** | |
| 372 | * Retrieves the <code>Defaultcanreadcontent</code> value, without locking, | |
| 373 | * for this <code>Section</code> <code>Persistent</code>. | |
| 374 | * | |
| 375 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 376 | * @return the Integer defaultcanreadcontent | |
| 377 | */ | |
| 378 | public Integer getDefaultcanreadcontent_unsafe() { | |
| 379 | 3 | return defaultcanreadcontent; |
| 380 | } | |
| 381 | ||
| 382 | ||
| 383 | /** | |
| 384 | * Sets the <code>Defaultcanreadcontent</code> value directly, without checking, | |
| 385 | * for this Section <code>Persistent</code>. | |
| 386 | * | |
| 387 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 388 | * @param cooked the pre-validated value to set | |
| 389 | */ | |
| 390 | public void setDefaultcanreadcontent_unsafe(Integer cooked) { | |
| 391 | 3 | defaultcanreadcontent = cooked; |
| 392 | 3 | } |
| 393 | ||
| 394 | /** | |
| 395 | * Retrieves the Table Row Object ID. | |
| 396 | * | |
| 397 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 398 | * @throws AccessPoemException | |
| 399 | * if the current <code>AccessToken</code> | |
| 400 | * does not confer read access rights | |
| 401 | * @return the TROID as an <code>Integer</code> | |
| 402 | */ | |
| 403 | ||
| 404 | public Integer getDefaultcanreadcontentTroid() | |
| 405 | throws AccessPoemException { | |
| 406 | 3 | readLock(); |
| 407 | 3 | return getDefaultcanreadcontent_unsafe(); |
| 408 | } | |
| 409 | ||
| 410 | ||
| 411 | /** | |
| 412 | * Sets the Table Row Object ID. | |
| 413 | * | |
| 414 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 415 | * @param raw a Table Row Object Id | |
| 416 | * @throws AccessPoemException | |
| 417 | * if the current <code>AccessToken</code> | |
| 418 | * does not confer write access rights | |
| 419 | */ | |
| 420 | public void setDefaultcanreadcontentTroid(Integer raw) | |
| 421 | throws AccessPoemException { | |
| 422 | 0 | setDefaultcanreadcontent(raw == null ? null : |
| 423 | getBibliomaniaDatabaseTables().getCapabilityTable().getCapabilityObject(raw)); | |
| 424 | 0 | } |
| 425 | ||
| 426 | ||
| 427 | /** | |
| 428 | * Retrieves the <code>Defaultcanreadcontent</code> object referred to. | |
| 429 | * | |
| 430 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 431 | * @throws AccessPoemException | |
| 432 | * if the current <code>AccessToken</code> | |
| 433 | * does not confer read access rights | |
| 434 | * @throws NoSuchRowPoemException | |
| 435 | * if the <code>Persistent</code> has yet to be allocated a TROID | |
| 436 | * @return the <code>Defaultcanreadcontent</code> as a <code>Capability</code> | |
| 437 | */ | |
| 438 | public Capability getDefaultcanreadcontent() | |
| 439 | throws AccessPoemException, NoSuchRowPoemException { | |
| 440 | 3 | Integer troid = getDefaultcanreadcontentTroid(); |
| 441 | 3 | return troid == null ? null : |
| 442 | getBibliomaniaDatabaseTables().getCapabilityTable().getCapabilityObject(troid); | |
| 443 | } | |
| 444 | ||
| 445 | ||
| 446 | /** | |
| 447 | * Set the Defaultcanreadcontent. | |
| 448 | * | |
| 449 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 450 | * @param cooked a validated <code>Capability</code> | |
| 451 | * @throws AccessPoemException | |
| 452 | * if the current <code>AccessToken</code> | |
| 453 | * does not confer write access rights | |
| 454 | */ | |
| 455 | public void setDefaultcanreadcontent(Capability cooked) | |
| 456 | throws AccessPoemException { | |
| 457 | 0 | _getSectionTable(). |
| 458 | getDefaultcanreadcontentColumn(). | |
| 459 | getType().assertValidCooked(cooked); | |
| 460 | 0 | writeLock(); |
| 461 | 0 | if (cooked == null) |
| 462 | 0 | setDefaultcanreadcontent_unsafe(null); |
| 463 | else { | |
| 464 | 0 | cooked.existenceLock(); |
| 465 | 0 | setDefaultcanreadcontent_unsafe(cooked.troid()); |
| 466 | } | |
| 467 | 0 | } |
| 468 | ||
| 469 | ||
| 470 | /** | |
| 471 | * Retrieves the <code>Defaultcanreadcontent</code> value as a <code>Field</code> | |
| 472 | * from this <code>Section</code> <code>Persistent</code>. | |
| 473 | * | |
| 474 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 475 | * @throws AccessPoemException | |
| 476 | * if the current <code>AccessToken</code> | |
| 477 | * does not confer write access rights | |
| 478 | * @return the Integer defaultcanreadcontent | |
| 479 | */ | |
| 480 | public Field<Integer> getDefaultcanreadcontentField() throws AccessPoemException { | |
| 481 | 0 | Column<Integer> c = _getSectionTable().getDefaultcanreadcontentColumn(); |
| 482 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 483 | } | |
| 484 | ||
| 485 | } | |
| 486 |