| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| DownloadEventBase |
|
| 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 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.Download; | |
| 15 | import org.paneris.bibliomania.DownloadEvent; | |
| 16 | import org.paneris.bibliomania.DownloadEventTable; | |
| 17 | import org.paneris.bibliomania.User; | |
| 18 | ||
| 19 | ||
| 20 | /** | |
| 21 | * Melati POEM generated abstract base class for a <code>Persistent</code> | |
| 22 | * <code>DownloadEvent</code> Object. | |
| 23 | * | |
| 24 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 25 | */ | |
| 26 | 0 | public abstract class DownloadEventBase 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>DownloadEventTable</code> table | |
| 42 | * which this <code>Persistent</code> is from. | |
| 43 | * | |
| 44 | * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava | |
| 45 | * @return the DownloadEventTable | |
| 46 | */ | |
| 47 | @SuppressWarnings("unchecked") | |
| 48 | public DownloadEventTable<DownloadEvent> getDownloadEventTable() { | |
| 49 | 0 | return (DownloadEventTable<DownloadEvent>)getTable(); |
| 50 | } | |
| 51 | ||
| 52 | @SuppressWarnings("unchecked") | |
| 53 | private DownloadEventTable<DownloadEvent> _getDownloadEventTable() { | |
| 54 | 0 | return (DownloadEventTable<DownloadEvent>)getTable(); |
| 55 | } | |
| 56 | ||
| 57 | // Fields in this table | |
| 58 | /** | |
| 59 | * id | |
| 60 | */ | |
| 61 | protected Integer id; | |
| 62 | /** | |
| 63 | * User | |
| 64 | */ | |
| 65 | protected Integer user; | |
| 66 | /** | |
| 67 | * Download - The name of the file downloaded | |
| 68 | */ | |
| 69 | protected Integer document; | |
| 70 | /** | |
| 71 | * Date - The date and time the file was downloaded | |
| 72 | */ | |
| 73 | protected Timestamp date; | |
| 74 | ||
| 75 | ||
| 76 | /** | |
| 77 | * Retrieves the <code>Id</code> value, without locking, | |
| 78 | * for this <code>DownloadEvent</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 DownloadEvent <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 | 0 | id = cooked; |
| 97 | 0 | } |
| 98 | ||
| 99 | /** | |
| 100 | * Retrieves the Id value, with locking, for this | |
| 101 | * <code>DownloadEvent</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>DownloadEvent</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>DownloadEvent</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 | _getDownloadEventTable().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>DownloadEvent</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>DownloadEvent</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 = _getDownloadEventTable().getIdColumn(); |
| 169 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 170 | } | |
| 171 | ||
| 172 | ||
| 173 | /** | |
| 174 | * Retrieves the <code>User</code> value, without locking, | |
| 175 | * for this <code>DownloadEvent</code> <code>Persistent</code>. | |
| 176 | * | |
| 177 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 178 | * @return the Integer user | |
| 179 | */ | |
| 180 | public Integer getUser_unsafe() { | |
| 181 | 0 | return user; |
| 182 | } | |
| 183 | ||
| 184 | ||
| 185 | /** | |
| 186 | * Sets the <code>User</code> value directly, without checking, | |
| 187 | * for this DownloadEvent <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 setUser_unsafe(Integer cooked) { | |
| 193 | 0 | user = cooked; |
| 194 | 0 | } |
| 195 | ||
| 196 | /** | |
| 197 | * Retrieves the Table Row Object ID. | |
| 198 | * | |
| 199 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 200 | * @throws AccessPoemException | |
| 201 | * if the current <code>AccessToken</code> | |
| 202 | * does not confer read access rights | |
| 203 | * @return the TROID as an <code>Integer</code> | |
| 204 | */ | |
| 205 | ||
| 206 | public Integer getUserTroid() | |
| 207 | throws AccessPoemException { | |
| 208 | 0 | readLock(); |
| 209 | 0 | return getUser_unsafe(); |
| 210 | } | |
| 211 | ||
| 212 | ||
| 213 | /** | |
| 214 | * Sets the Table Row Object ID. | |
| 215 | * | |
| 216 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 217 | * @param raw a Table Row Object Id | |
| 218 | * @throws AccessPoemException | |
| 219 | * if the current <code>AccessToken</code> | |
| 220 | * does not confer write access rights | |
| 221 | */ | |
| 222 | public void setUserTroid(Integer raw) | |
| 223 | throws AccessPoemException { | |
| 224 | 0 | setUser(raw == null ? null : |
| 225 | (User)getBibliomaniaDatabaseTables().getUserTable().getUserObject(raw)); | |
| 226 | 0 | } |
| 227 | ||
| 228 | ||
| 229 | /** | |
| 230 | * Retrieves the <code>User</code> object referred to. | |
| 231 | * | |
| 232 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 233 | * @throws AccessPoemException | |
| 234 | * if the current <code>AccessToken</code> | |
| 235 | * does not confer read access rights | |
| 236 | * @throws NoSuchRowPoemException | |
| 237 | * if the <code>Persistent</code> has yet to be allocated a TROID | |
| 238 | * @return the <code>User</code> as a <code>User</code> | |
| 239 | */ | |
| 240 | public User getUser() | |
| 241 | throws AccessPoemException, NoSuchRowPoemException { | |
| 242 | 0 | Integer troid = getUserTroid(); |
| 243 | 0 | return troid == null ? null : |
| 244 | (User)getBibliomaniaDatabaseTables().getUserTable().getUserObject(troid); | |
| 245 | } | |
| 246 | ||
| 247 | ||
| 248 | /** | |
| 249 | * Set the User. | |
| 250 | * | |
| 251 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 252 | * @param cooked a validated <code>User</code> | |
| 253 | * @throws AccessPoemException | |
| 254 | * if the current <code>AccessToken</code> | |
| 255 | * does not confer write access rights | |
| 256 | */ | |
| 257 | public void setUser(User cooked) | |
| 258 | throws AccessPoemException { | |
| 259 | 0 | _getDownloadEventTable(). |
| 260 | getUserColumn(). | |
| 261 | getType().assertValidCooked(cooked); | |
| 262 | 0 | writeLock(); |
| 263 | 0 | if (cooked == null) |
| 264 | 0 | setUser_unsafe(null); |
| 265 | else { | |
| 266 | 0 | cooked.existenceLock(); |
| 267 | 0 | setUser_unsafe(cooked.troid()); |
| 268 | } | |
| 269 | 0 | } |
| 270 | ||
| 271 | ||
| 272 | /** | |
| 273 | * Retrieves the <code>User</code> value as a <code>Field</code> | |
| 274 | * from this <code>DownloadEvent</code> <code>Persistent</code>. | |
| 275 | * | |
| 276 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 277 | * @throws AccessPoemException | |
| 278 | * if the current <code>AccessToken</code> | |
| 279 | * does not confer write access rights | |
| 280 | * @return the Integer user | |
| 281 | */ | |
| 282 | public Field<Integer> getUserField() throws AccessPoemException { | |
| 283 | 0 | Column<Integer> c = _getDownloadEventTable().getUserColumn(); |
| 284 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 285 | } | |
| 286 | ||
| 287 | ||
| 288 | /** | |
| 289 | * Retrieves the <code>Document</code> value, without locking, | |
| 290 | * for this <code>DownloadEvent</code> <code>Persistent</code>. | |
| 291 | * | |
| 292 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 293 | * @return the Integer document | |
| 294 | */ | |
| 295 | public Integer getDocument_unsafe() { | |
| 296 | 0 | return document; |
| 297 | } | |
| 298 | ||
| 299 | ||
| 300 | /** | |
| 301 | * Sets the <code>Document</code> value directly, without checking, | |
| 302 | * for this DownloadEvent <code>Persistent</code>. | |
| 303 | * | |
| 304 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 305 | * @param cooked the pre-validated value to set | |
| 306 | */ | |
| 307 | public void setDocument_unsafe(Integer cooked) { | |
| 308 | 0 | document = cooked; |
| 309 | 0 | } |
| 310 | ||
| 311 | /** | |
| 312 | * Retrieves the Table Row Object ID. | |
| 313 | * | |
| 314 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 315 | * @throws AccessPoemException | |
| 316 | * if the current <code>AccessToken</code> | |
| 317 | * does not confer read access rights | |
| 318 | * @return the TROID as an <code>Integer</code> | |
| 319 | */ | |
| 320 | ||
| 321 | public Integer getDocumentTroid() | |
| 322 | throws AccessPoemException { | |
| 323 | 0 | readLock(); |
| 324 | 0 | return getDocument_unsafe(); |
| 325 | } | |
| 326 | ||
| 327 | ||
| 328 | /** | |
| 329 | * Sets the Table Row Object ID. | |
| 330 | * | |
| 331 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 332 | * @param raw a Table Row Object Id | |
| 333 | * @throws AccessPoemException | |
| 334 | * if the current <code>AccessToken</code> | |
| 335 | * does not confer write access rights | |
| 336 | */ | |
| 337 | public void setDocumentTroid(Integer raw) | |
| 338 | throws AccessPoemException { | |
| 339 | 0 | setDocument(raw == null ? null : |
| 340 | getBibliomaniaDatabaseTables().getDownloadTable().getDownloadObject(raw)); | |
| 341 | 0 | } |
| 342 | ||
| 343 | ||
| 344 | /** | |
| 345 | * Retrieves the <code>Document</code> object referred to. | |
| 346 | * | |
| 347 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 348 | * @throws AccessPoemException | |
| 349 | * if the current <code>AccessToken</code> | |
| 350 | * does not confer read access rights | |
| 351 | * @throws NoSuchRowPoemException | |
| 352 | * if the <code>Persistent</code> has yet to be allocated a TROID | |
| 353 | * @return the <code>Document</code> as a <code>Download</code> | |
| 354 | */ | |
| 355 | public Download getDocument() | |
| 356 | throws AccessPoemException, NoSuchRowPoemException { | |
| 357 | 0 | Integer troid = getDocumentTroid(); |
| 358 | 0 | return troid == null ? null : |
| 359 | getBibliomaniaDatabaseTables().getDownloadTable().getDownloadObject(troid); | |
| 360 | } | |
| 361 | ||
| 362 | ||
| 363 | /** | |
| 364 | * Set the Document. | |
| 365 | * | |
| 366 | * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods | |
| 367 | * @param cooked a validated <code>Download</code> | |
| 368 | * @throws AccessPoemException | |
| 369 | * if the current <code>AccessToken</code> | |
| 370 | * does not confer write access rights | |
| 371 | */ | |
| 372 | public void setDocument(Download cooked) | |
| 373 | throws AccessPoemException { | |
| 374 | 0 | _getDownloadEventTable(). |
| 375 | getDocumentColumn(). | |
| 376 | getType().assertValidCooked(cooked); | |
| 377 | 0 | writeLock(); |
| 378 | 0 | if (cooked == null) |
| 379 | 0 | setDocument_unsafe(null); |
| 380 | else { | |
| 381 | 0 | cooked.existenceLock(); |
| 382 | 0 | setDocument_unsafe(cooked.troid()); |
| 383 | } | |
| 384 | 0 | } |
| 385 | ||
| 386 | ||
| 387 | /** | |
| 388 | * Retrieves the <code>Document</code> value as a <code>Field</code> | |
| 389 | * from this <code>DownloadEvent</code> <code>Persistent</code>. | |
| 390 | * | |
| 391 | * see org.melati.poem.prepro.FieldDef#generateFieldCreator | |
| 392 | * @throws AccessPoemException | |
| 393 | * if the current <code>AccessToken</code> | |
| 394 | * does not confer write access rights | |
| 395 | * @return the Integer document | |
| 396 | */ | |
| 397 | public Field<Integer> getDocumentField() throws AccessPoemException { | |
| 398 | 0 | Column<Integer> c = _getDownloadEventTable().getDocumentColumn(); |
| 399 | 0 | return new Field<Integer>((Integer)c.getRaw(this), c); |
| 400 | } | |
| 401 | ||
| 402 | ||
| 403 | /** | |
| 404 | * Retrieves the <code>Date</code> value, without locking, | |
| 405 | * for this <code>DownloadEvent</code> <code>Persistent</code>. | |
| 406 | * | |
| 407 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 408 | * @return the Timestamp date | |
| 409 | */ | |
| 410 | public Timestamp getDate_unsafe() { | |
| 411 | 0 | return date; |
| 412 | } | |
| 413 | ||
| 414 | ||
| 415 | /** | |
| 416 | * Sets the <code>Date</code> value directly, without checking, | |
| 417 | * for this DownloadEvent <code>Persistent</code>. | |
| 418 | * | |
| 419 | * see org.melati.poem.prepro.FieldDef#generateBaseMethods | |
| 420 | * @param cooked the pre-validated value to set | |
| 421 | */ | |
| 422 | public void setDate_unsafe(Timestamp cooked) { | |
| 423 | 0 | date = cooked; |
| 424 | 0 | } |
| 425 | ||
| 426 | /** | |
| 427 | * Retrieves the Date value, with locking, for this | |
| 428 | * <code>DownloadEvent</code> <code>Persistent</code>. | |
| 429 | * Field description: | |
| 430 | * The date and time the file was downloaded | |
| 431 | * | |
| 432 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 433 | * @throws AccessPoemException | |
| 434 | * if the current <code>AccessToken</code> | |
| 435 | * does not confer write access rights | |
| 436 | * @return the value of the field <code>Date</code> for this | |
| 437 | * <code>DownloadEvent</code> <code>Persistent</code> | |
| 438 | */ | |
| 439 | ||
| 440 | public Timestamp getDate() | |
| 441 | throws AccessPoemException { | |
| 442 | 0 | readLock(); |
| 443 | 0 | return getDate_unsafe(); |
| 444 | } | |
| 445 | ||
| 446 | ||
| 447 | /** | |
| 448 | * Sets the <code>Date</code> value, with checking, for this | |
| 449 | * <code>DownloadEvent</code> <code>Persistent</code>. | |
| 450 | * Field description: | |
| 451 | * The date and time the file was downloaded | |
| 452 | * | |
| 453 | * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods | |
| 454 | * @param cooked a validated <code>int</code> | |
| 455 | * @throws AccessPoemException | |
| 456 | * if the current <code>AccessToken</code> | |
| 457 | * does not confer write access rights | |
| 458 | * @throws ValidationPoemException | |
| 459 | * if the value is not valid | |
| 460 | */ | |
| 461 | public void setDate(Timestamp cooked) | |
| 462 | throws AccessPoemException, ValidationPoemException { | |
| 463 | 0 | _getDownloadEventTable().getDateColumn(). |
| 464 | getType().assertValidCooked(cooked); | |
| 465 | 0 | writeLock(); |
| 466 | 0 | setDate_unsafe(cooked); |
| 467 | 0 | } |
| 468 | ||
| 469 | ||
| 470 | /** | |
| 471 | * Retrieves the <code>Date</code> value as a <code>Field</code> | |
| 472 | * from this <code>DownloadEvent</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 Timestamp date | |
| 479 | */ | |
| 480 | public Field<Timestamp> getDateField() throws AccessPoemException { | |
| 481 | 0 | Column<Timestamp> c = _getDownloadEventTable().getDateColumn(); |
| 482 | 0 | return new Field<Timestamp>((Timestamp)c.getRaw(this), c); |
| 483 | } | |
| 484 | ||
| 485 | } | |
| 486 |