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.util.Collections; 7 import java.util.Enumeration; 8 import java.util.List; 9 import org.melati.poem.AccessPoemException; 10 import org.melati.poem.CachedSelection; 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.ValidationPoemException; 16 import org.melati.poem.util.EmptyEnumeration; 17 import org.paneris.bibliomania.BibliomaniaDatabaseTables; 18 import org.paneris.bibliomania.Book; 19 import org.paneris.bibliomania.BookFormat; 20 import org.paneris.bibliomania.Download; 21 import org.paneris.bibliomania.Product; 22 import org.paneris.bibliomania.ProductAssociation; 23 import org.paneris.bibliomania.ProductTable; 24 import org.paneris.bibliomania.Publisher; 25 import org.paneris.bibliomania.ShopOrderItem; 26 import org.paneris.bibliomania.SupplierProduct; 27 28 29 /** 30 * Melati POEM generated abstract base class for a <code>Persistent</code> 31 * <code>Product</code> Object. 32 * 33 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 34 */ 35 public abstract class ProductBase extends JdbcPersistent { 36 37 38 /** 39 * Retrieves the Database object. 40 * 41 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 42 * @return the database 43 */ 44 public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { 45 return (BibliomaniaDatabaseTables)getDatabase(); 46 } 47 48 49 /** 50 * Retrieves the <code>ProductTable</code> table 51 * which this <code>Persistent</code> is from. 52 * 53 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 54 * @return the ProductTable 55 */ 56 @SuppressWarnings("unchecked") 57 public ProductTable<Product> getProductTable() { 58 return (ProductTable<Product>)getTable(); 59 } 60 61 @SuppressWarnings("unchecked") 62 private ProductTable<Product> _getProductTable() { 63 return (ProductTable<Product>)getTable(); 64 } 65 66 // Fields in this table 67 /** 68 * id 69 */ 70 protected Integer id; 71 /** 72 * book - The book to be sold 73 */ 74 protected Integer book; 75 /** 76 * publisher - The publisher for this product 77 */ 78 protected Integer publisher; 79 /** 80 * download - The download object for this product (if any) 81 */ 82 protected Integer download; 83 /** 84 * Product Name - A name for this product if different to the Book title 85 */ 86 protected String name; 87 /** 88 * Description - Additional blurb about the product 89 */ 90 protected String description; 91 /** 92 * Retail Price - Price payable by the customer, including discounts, 93 * excluding delivery 94 */ 95 protected Double price; 96 /** 97 * List Price - The normal selling price of the product, not including 98 * delivery 99 */ 100 protected Double listprice; 101 /** 102 * ISBN - The ISBN number of this product (if any) 103 */ 104 protected String ISBN; 105 /** 106 * Picture - A jacket cover image or similar 107 */ 108 protected String picture; 109 /** 110 * Deleted? 111 */ 112 protected Boolean deleted; 113 /** 114 * format - The type of the product 115 */ 116 protected Integer format; 117 118 119 /** 120 * Retrieves the <code>Id</code> value, without locking, 121 * for this <code>Product</code> <code>Persistent</code>. 122 * 123 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 124 * @return the Integer id 125 */ 126 public Integer getId_unsafe() { 127 return id; 128 } 129 130 131 /** 132 * Sets the <code>Id</code> value directly, without checking, 133 * for this Product <code>Persistent</code>. 134 * 135 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 136 * @param cooked the pre-validated value to set 137 */ 138 public void setId_unsafe(Integer cooked) { 139 id = cooked; 140 } 141 142 /** 143 * Retrieves the Id value, with locking, for this 144 * <code>Product</code> <code>Persistent</code>. 145 * 146 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 147 * @throws AccessPoemException 148 * if the current <code>AccessToken</code> 149 * does not confer write access rights 150 * @return the value of the field <code>Id</code> for this 151 * <code>Product</code> <code>Persistent</code> 152 */ 153 154 public Integer getId() 155 throws AccessPoemException { 156 readLock(); 157 return getId_unsafe(); 158 } 159 160 161 /** 162 * Sets the <code>Id</code> value, with checking, for this 163 * <code>Product</code> <code>Persistent</code>. 164 * 165 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 166 * @param cooked a validated <code>int</code> 167 * @throws AccessPoemException 168 * if the current <code>AccessToken</code> 169 * does not confer write access rights 170 * @throws ValidationPoemException 171 * if the value is not valid 172 */ 173 public void setId(Integer cooked) 174 throws AccessPoemException, ValidationPoemException { 175 _getProductTable().getIdColumn(). 176 getType().assertValidCooked(cooked); 177 writeLock(); 178 setId_unsafe(cooked); 179 } 180 181 /** 182 * Sets the <code>Id</code> value, with checking, for this 183 * <code>Product</code> <code>Persistent</code>. 184 * 185 * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 186 * @param cooked a validated <code>int</code> 187 * @throws AccessPoemException 188 * if the current <code>AccessToken</code> 189 * does not confer write access rights 190 * @throws ValidationPoemException 191 * if the value is not valid 192 */ 193 194 public final void setId(int cooked) 195 throws AccessPoemException, ValidationPoemException { 196 setId(new Integer(cooked)); 197 } 198 199 200 /** 201 * Retrieves the <code>Id</code> value as a <code>Field</code> 202 * from this <code>Product</code> <code>Persistent</code>. 203 * 204 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 205 * @throws AccessPoemException 206 * if the current <code>AccessToken</code> 207 * does not confer write access rights 208 * @return the Integer id 209 */ 210 public Field<Integer> getIdField() throws AccessPoemException { 211 Column<Integer> c = _getProductTable().getIdColumn(); 212 return new Field<Integer>((Integer)c.getRaw(this), c); 213 } 214 215 216 /** 217 * Retrieves the <code>Book</code> value, without locking, 218 * for this <code>Product</code> <code>Persistent</code>. 219 * 220 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 221 * @return the Integer book 222 */ 223 public Integer getBook_unsafe() { 224 return book; 225 } 226 227 228 /** 229 * Sets the <code>Book</code> value directly, without checking, 230 * for this Product <code>Persistent</code>. 231 * 232 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 233 * @param cooked the pre-validated value to set 234 */ 235 public void setBook_unsafe(Integer cooked) { 236 book = cooked; 237 } 238 239 /** 240 * Retrieves the Table Row Object ID. 241 * 242 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 243 * @throws AccessPoemException 244 * if the current <code>AccessToken</code> 245 * does not confer read access rights 246 * @return the TROID as an <code>Integer</code> 247 */ 248 249 public Integer getBookTroid() 250 throws AccessPoemException { 251 readLock(); 252 return getBook_unsafe(); 253 } 254 255 256 /** 257 * Sets the Table Row Object ID. 258 * 259 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 260 * @param raw a Table Row Object Id 261 * @throws AccessPoemException 262 * if the current <code>AccessToken</code> 263 * does not confer write access rights 264 */ 265 public void setBookTroid(Integer raw) 266 throws AccessPoemException { 267 setBook(raw == null ? null : 268 (Book)getBibliomaniaDatabaseTables().getBookTable().getBookObject(raw)); 269 } 270 271 272 /** 273 * Retrieves the <code>Book</code> object referred to. 274 * 275 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 276 * @throws AccessPoemException 277 * if the current <code>AccessToken</code> 278 * does not confer read access rights 279 * @throws NoSuchRowPoemException 280 * if the <code>Persistent</code> has yet to be allocated a TROID 281 * @return the <code>Book</code> as a <code>Book</code> 282 */ 283 public Book getBook() 284 throws AccessPoemException, NoSuchRowPoemException { 285 Integer troid = getBookTroid(); 286 return troid == null ? null : 287 (Book)getBibliomaniaDatabaseTables().getBookTable().getBookObject(troid); 288 } 289 290 291 /** 292 * Set the Book. 293 * 294 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 295 * @param cooked a validated <code>Book</code> 296 * @throws AccessPoemException 297 * if the current <code>AccessToken</code> 298 * does not confer write access rights 299 */ 300 public void setBook(Book cooked) 301 throws AccessPoemException { 302 _getProductTable(). 303 getBookColumn(). 304 getType().assertValidCooked(cooked); 305 writeLock(); 306 if (cooked == null) 307 setBook_unsafe(null); 308 else { 309 cooked.existenceLock(); 310 setBook_unsafe(cooked.troid()); 311 } 312 } 313 314 315 /** 316 * Retrieves the <code>Book</code> value as a <code>Field</code> 317 * from this <code>Product</code> <code>Persistent</code>. 318 * 319 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 320 * @throws AccessPoemException 321 * if the current <code>AccessToken</code> 322 * does not confer write access rights 323 * @return the Integer book 324 */ 325 public Field<Integer> getBookField() throws AccessPoemException { 326 Column<Integer> c = _getProductTable().getBookColumn(); 327 return new Field<Integer>((Integer)c.getRaw(this), c); 328 } 329 330 331 /** 332 * Retrieves the <code>Publisher</code> value, without locking, 333 * for this <code>Product</code> <code>Persistent</code>. 334 * 335 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 336 * @return the Integer publisher 337 */ 338 public Integer getPublisher_unsafe() { 339 return publisher; 340 } 341 342 343 /** 344 * Sets the <code>Publisher</code> value directly, without checking, 345 * for this Product <code>Persistent</code>. 346 * 347 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 348 * @param cooked the pre-validated value to set 349 */ 350 public void setPublisher_unsafe(Integer cooked) { 351 publisher = cooked; 352 } 353 354 /** 355 * Retrieves the Table Row Object ID. 356 * 357 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 358 * @throws AccessPoemException 359 * if the current <code>AccessToken</code> 360 * does not confer read access rights 361 * @return the TROID as an <code>Integer</code> 362 */ 363 364 public Integer getPublisherTroid() 365 throws AccessPoemException { 366 readLock(); 367 return getPublisher_unsafe(); 368 } 369 370 371 /** 372 * Sets the Table Row Object ID. 373 * 374 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 375 * @param raw a Table Row Object Id 376 * @throws AccessPoemException 377 * if the current <code>AccessToken</code> 378 * does not confer write access rights 379 */ 380 public void setPublisherTroid(Integer raw) 381 throws AccessPoemException { 382 setPublisher(raw == null ? null : 383 getBibliomaniaDatabaseTables().getPublisherTable().getPublisherObject(raw)); 384 } 385 386 387 /** 388 * Retrieves the <code>Publisher</code> object referred to. 389 * 390 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 391 * @throws AccessPoemException 392 * if the current <code>AccessToken</code> 393 * does not confer read access rights 394 * @throws NoSuchRowPoemException 395 * if the <code>Persistent</code> has yet to be allocated a TROID 396 * @return the <code>Publisher</code> as a <code>Publisher</code> 397 */ 398 public Publisher getPublisher() 399 throws AccessPoemException, NoSuchRowPoemException { 400 Integer troid = getPublisherTroid(); 401 return troid == null ? null : 402 getBibliomaniaDatabaseTables().getPublisherTable().getPublisherObject(troid); 403 } 404 405 406 /** 407 * Set the Publisher. 408 * 409 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 410 * @param cooked a validated <code>Publisher</code> 411 * @throws AccessPoemException 412 * if the current <code>AccessToken</code> 413 * does not confer write access rights 414 */ 415 public void setPublisher(Publisher cooked) 416 throws AccessPoemException { 417 _getProductTable(). 418 getPublisherColumn(). 419 getType().assertValidCooked(cooked); 420 writeLock(); 421 if (cooked == null) 422 setPublisher_unsafe(null); 423 else { 424 cooked.existenceLock(); 425 setPublisher_unsafe(cooked.troid()); 426 } 427 } 428 429 430 /** 431 * Retrieves the <code>Publisher</code> value as a <code>Field</code> 432 * from this <code>Product</code> <code>Persistent</code>. 433 * 434 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 435 * @throws AccessPoemException 436 * if the current <code>AccessToken</code> 437 * does not confer write access rights 438 * @return the Integer publisher 439 */ 440 public Field<Integer> getPublisherField() throws AccessPoemException { 441 Column<Integer> c = _getProductTable().getPublisherColumn(); 442 return new Field<Integer>((Integer)c.getRaw(this), c); 443 } 444 445 446 /** 447 * Retrieves the <code>Download</code> value, without locking, 448 * for this <code>Product</code> <code>Persistent</code>. 449 * 450 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 451 * @return the Integer download 452 */ 453 public Integer getDownload_unsafe() { 454 return download; 455 } 456 457 458 /** 459 * Sets the <code>Download</code> value directly, without checking, 460 * for this Product <code>Persistent</code>. 461 * 462 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 463 * @param cooked the pre-validated value to set 464 */ 465 public void setDownload_unsafe(Integer cooked) { 466 download = cooked; 467 } 468 469 /** 470 * Retrieves the Table Row Object ID. 471 * 472 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 473 * @throws AccessPoemException 474 * if the current <code>AccessToken</code> 475 * does not confer read access rights 476 * @return the TROID as an <code>Integer</code> 477 */ 478 479 public Integer getDownloadTroid() 480 throws AccessPoemException { 481 readLock(); 482 return getDownload_unsafe(); 483 } 484 485 486 /** 487 * Sets the Table Row Object ID. 488 * 489 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 490 * @param raw a Table Row Object Id 491 * @throws AccessPoemException 492 * if the current <code>AccessToken</code> 493 * does not confer write access rights 494 */ 495 public void setDownloadTroid(Integer raw) 496 throws AccessPoemException { 497 setDownload(raw == null ? null : 498 getBibliomaniaDatabaseTables().getDownloadTable().getDownloadObject(raw)); 499 } 500 501 502 /** 503 * Retrieves the <code>Download</code> object referred to. 504 * 505 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 506 * @throws AccessPoemException 507 * if the current <code>AccessToken</code> 508 * does not confer read access rights 509 * @throws NoSuchRowPoemException 510 * if the <code>Persistent</code> has yet to be allocated a TROID 511 * @return the <code>Download</code> as a <code>Download</code> 512 */ 513 public Download getDownload() 514 throws AccessPoemException, NoSuchRowPoemException { 515 Integer troid = getDownloadTroid(); 516 return troid == null ? null : 517 getBibliomaniaDatabaseTables().getDownloadTable().getDownloadObject(troid); 518 } 519 520 521 /** 522 * Set the Download. 523 * 524 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 525 * @param cooked a validated <code>Download</code> 526 * @throws AccessPoemException 527 * if the current <code>AccessToken</code> 528 * does not confer write access rights 529 */ 530 public void setDownload(Download cooked) 531 throws AccessPoemException { 532 _getProductTable(). 533 getDownloadColumn(). 534 getType().assertValidCooked(cooked); 535 writeLock(); 536 if (cooked == null) 537 setDownload_unsafe(null); 538 else { 539 cooked.existenceLock(); 540 setDownload_unsafe(cooked.troid()); 541 } 542 } 543 544 545 /** 546 * Retrieves the <code>Download</code> value as a <code>Field</code> 547 * from this <code>Product</code> <code>Persistent</code>. 548 * 549 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 550 * @throws AccessPoemException 551 * if the current <code>AccessToken</code> 552 * does not confer write access rights 553 * @return the Integer download 554 */ 555 public Field<Integer> getDownloadField() throws AccessPoemException { 556 Column<Integer> c = _getProductTable().getDownloadColumn(); 557 return new Field<Integer>((Integer)c.getRaw(this), c); 558 } 559 560 561 /** 562 * Retrieves the <code>Name</code> value, without locking, 563 * for this <code>Product</code> <code>Persistent</code>. 564 * 565 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 566 * @return the String name 567 */ 568 public String getName_unsafe() { 569 return name; 570 } 571 572 573 /** 574 * Sets the <code>Name</code> value directly, without checking, 575 * for this Product <code>Persistent</code>. 576 * 577 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 578 * @param cooked the pre-validated value to set 579 */ 580 public void setName_unsafe(String cooked) { 581 name = cooked; 582 } 583 584 /** 585 * Retrieves the Name value, with locking, for this 586 * <code>Product</code> <code>Persistent</code>. 587 * Field description: 588 * A name for this product if different to the Book title 589 * 590 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 591 * @throws AccessPoemException 592 * if the current <code>AccessToken</code> 593 * does not confer write access rights 594 * @return the value of the field <code>Name</code> for this 595 * <code>Product</code> <code>Persistent</code> 596 */ 597 598 public String getName() 599 throws AccessPoemException { 600 readLock(); 601 return getName_unsafe(); 602 } 603 604 605 /** 606 * Sets the <code>Name</code> value, with checking, for this 607 * <code>Product</code> <code>Persistent</code>. 608 * Field description: 609 * A name for this product if different to the Book title 610 * 611 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 612 * @param cooked a validated <code>int</code> 613 * @throws AccessPoemException 614 * if the current <code>AccessToken</code> 615 * does not confer write access rights 616 * @throws ValidationPoemException 617 * if the value is not valid 618 */ 619 public void setName(String cooked) 620 throws AccessPoemException, ValidationPoemException { 621 _getProductTable().getNameColumn(). 622 getType().assertValidCooked(cooked); 623 writeLock(); 624 setName_unsafe(cooked); 625 } 626 627 628 /** 629 * Retrieves the <code>Name</code> value as a <code>Field</code> 630 * from this <code>Product</code> <code>Persistent</code>. 631 * 632 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 633 * @throws AccessPoemException 634 * if the current <code>AccessToken</code> 635 * does not confer write access rights 636 * @return the String name 637 */ 638 public Field<String> getNameField() throws AccessPoemException { 639 Column<String> c = _getProductTable().getNameColumn(); 640 return new Field<String>((String)c.getRaw(this), c); 641 } 642 643 644 /** 645 * Retrieves the <code>Description</code> value, without locking, 646 * for this <code>Product</code> <code>Persistent</code>. 647 * 648 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 649 * @return the String description 650 */ 651 public String getDescription_unsafe() { 652 return description; 653 } 654 655 656 /** 657 * Sets the <code>Description</code> value directly, without checking, 658 * for this Product <code>Persistent</code>. 659 * 660 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 661 * @param cooked the pre-validated value to set 662 */ 663 public void setDescription_unsafe(String cooked) { 664 description = cooked; 665 } 666 667 /** 668 * Retrieves the Description value, with locking, for this 669 * <code>Product</code> <code>Persistent</code>. 670 * Field description: 671 * Additional blurb about the product 672 * 673 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 674 * @throws AccessPoemException 675 * if the current <code>AccessToken</code> 676 * does not confer write access rights 677 * @return the value of the field <code>Description</code> for this 678 * <code>Product</code> <code>Persistent</code> 679 */ 680 681 public String getDescription() 682 throws AccessPoemException { 683 readLock(); 684 return getDescription_unsafe(); 685 } 686 687 688 /** 689 * Sets the <code>Description</code> value, with checking, for this 690 * <code>Product</code> <code>Persistent</code>. 691 * Field description: 692 * Additional blurb about the product 693 * 694 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 695 * @param cooked a validated <code>int</code> 696 * @throws AccessPoemException 697 * if the current <code>AccessToken</code> 698 * does not confer write access rights 699 * @throws ValidationPoemException 700 * if the value is not valid 701 */ 702 public void setDescription(String cooked) 703 throws AccessPoemException, ValidationPoemException { 704 _getProductTable().getDescriptionColumn(). 705 getType().assertValidCooked(cooked); 706 writeLock(); 707 setDescription_unsafe(cooked); 708 } 709 710 711 /** 712 * Retrieves the <code>Description</code> value as a <code>Field</code> 713 * from this <code>Product</code> <code>Persistent</code>. 714 * 715 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 716 * @throws AccessPoemException 717 * if the current <code>AccessToken</code> 718 * does not confer write access rights 719 * @return the String description 720 */ 721 public Field<String> getDescriptionField() throws AccessPoemException { 722 Column<String> c = _getProductTable().getDescriptionColumn(); 723 return new Field<String>((String)c.getRaw(this), c); 724 } 725 726 727 /** 728 * Retrieves the <code>Price</code> value, without locking, 729 * for this <code>Product</code> <code>Persistent</code>. 730 * 731 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 732 * @return the Double price 733 */ 734 public Double getPrice_unsafe() { 735 return price; 736 } 737 738 739 /** 740 * Sets the <code>Price</code> value directly, without checking, 741 * for this Product <code>Persistent</code>. 742 * 743 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 744 * @param cooked the pre-validated value to set 745 */ 746 public void setPrice_unsafe(Double cooked) { 747 price = cooked; 748 } 749 750 /** 751 * Retrieves the Price value, with locking, for this 752 * <code>Product</code> <code>Persistent</code>. 753 * Field description: 754 * Price payable by the customer, including discounts, excluding delivery 755 * 756 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 757 * @throws AccessPoemException 758 * if the current <code>AccessToken</code> 759 * does not confer write access rights 760 * @return the value of the field <code>Price</code> for this 761 * <code>Product</code> <code>Persistent</code> 762 */ 763 764 public Double getPrice() 765 throws AccessPoemException { 766 readLock(); 767 return getPrice_unsafe(); 768 } 769 770 771 /** 772 * Sets the <code>Price</code> value, with checking, for this 773 * <code>Product</code> <code>Persistent</code>. 774 * Field description: 775 * Price payable by the customer, including discounts, excluding delivery 776 * 777 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 778 * @param cooked a validated <code>int</code> 779 * @throws AccessPoemException 780 * if the current <code>AccessToken</code> 781 * does not confer write access rights 782 * @throws ValidationPoemException 783 * if the value is not valid 784 */ 785 public void setPrice(Double cooked) 786 throws AccessPoemException, ValidationPoemException { 787 _getProductTable().getPriceColumn(). 788 getType().assertValidCooked(cooked); 789 writeLock(); 790 setPrice_unsafe(cooked); 791 } 792 793 /** 794 * Sets the <code>Price</code> value, with checking, for this <code>Product</code> <code>Persistent</code>. 795 * Field description: 796 * Price payable by the customer, including discounts, excluding delivery 797 * 798 * 799 * Generated by org.melati.poem.prepro.DoubleFieldDef#generateBaseMethods 800 * @param cooked a validated <code>int</code> 801 * @throws AccessPoemException 802 * if the current <code>AccessToken</code> 803 * does not confer write access rights 804 * @throws ValidationPoemException 805 * if the value is not valid 806 */ 807 808 public final void setPrice(double cooked) 809 throws AccessPoemException, ValidationPoemException { 810 setPrice(new Double(cooked)); 811 } 812 813 814 /** 815 * Retrieves the <code>Price</code> value as a <code>Field</code> 816 * from this <code>Product</code> <code>Persistent</code>. 817 * 818 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 819 * @throws AccessPoemException 820 * if the current <code>AccessToken</code> 821 * does not confer write access rights 822 * @return the Double price 823 */ 824 public Field<Double> getPriceField() throws AccessPoemException { 825 Column<Double> c = _getProductTable().getPriceColumn(); 826 return new Field<Double>((Double)c.getRaw(this), c); 827 } 828 829 830 /** 831 * Retrieves the <code>Listprice</code> value, without locking, 832 * for this <code>Product</code> <code>Persistent</code>. 833 * 834 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 835 * @return the Double listprice 836 */ 837 public Double getListprice_unsafe() { 838 return listprice; 839 } 840 841 842 /** 843 * Sets the <code>Listprice</code> value directly, without checking, 844 * for this Product <code>Persistent</code>. 845 * 846 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 847 * @param cooked the pre-validated value to set 848 */ 849 public void setListprice_unsafe(Double cooked) { 850 listprice = cooked; 851 } 852 853 /** 854 * Retrieves the Listprice value, with locking, for this 855 * <code>Product</code> <code>Persistent</code>. 856 * Field description: 857 * The normal selling price of the product, not including delivery 858 * 859 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 860 * @throws AccessPoemException 861 * if the current <code>AccessToken</code> 862 * does not confer write access rights 863 * @return the value of the field <code>Listprice</code> for this 864 * <code>Product</code> <code>Persistent</code> 865 */ 866 867 public Double getListprice() 868 throws AccessPoemException { 869 readLock(); 870 return getListprice_unsafe(); 871 } 872 873 874 /** 875 * Sets the <code>Listprice</code> value, with checking, for this 876 * <code>Product</code> <code>Persistent</code>. 877 * Field description: 878 * The normal selling price of the product, not including delivery 879 * 880 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 881 * @param cooked a validated <code>int</code> 882 * @throws AccessPoemException 883 * if the current <code>AccessToken</code> 884 * does not confer write access rights 885 * @throws ValidationPoemException 886 * if the value is not valid 887 */ 888 public void setListprice(Double cooked) 889 throws AccessPoemException, ValidationPoemException { 890 _getProductTable().getListpriceColumn(). 891 getType().assertValidCooked(cooked); 892 writeLock(); 893 setListprice_unsafe(cooked); 894 } 895 896 /** 897 * Sets the <code>Listprice</code> value, with checking, for this <code>Product</code> <code>Persistent</code>. 898 * Field description: 899 * The normal selling price of the product, not including delivery 900 * 901 * 902 * Generated by org.melati.poem.prepro.DoubleFieldDef#generateBaseMethods 903 * @param cooked a validated <code>int</code> 904 * @throws AccessPoemException 905 * if the current <code>AccessToken</code> 906 * does not confer write access rights 907 * @throws ValidationPoemException 908 * if the value is not valid 909 */ 910 911 public final void setListprice(double cooked) 912 throws AccessPoemException, ValidationPoemException { 913 setListprice(new Double(cooked)); 914 } 915 916 917 /** 918 * Retrieves the <code>Listprice</code> value as a <code>Field</code> 919 * from this <code>Product</code> <code>Persistent</code>. 920 * 921 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 922 * @throws AccessPoemException 923 * if the current <code>AccessToken</code> 924 * does not confer write access rights 925 * @return the Double listprice 926 */ 927 public Field<Double> getListpriceField() throws AccessPoemException { 928 Column<Double> c = _getProductTable().getListpriceColumn(); 929 return new Field<Double>((Double)c.getRaw(this), c); 930 } 931 932 933 /** 934 * Retrieves the <code>ISBN</code> value, without locking, 935 * for this <code>Product</code> <code>Persistent</code>. 936 * 937 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 938 * @return the String ISBN 939 */ 940 public String getISBN_unsafe() { 941 return ISBN; 942 } 943 944 945 /** 946 * Sets the <code>ISBN</code> value directly, without checking, 947 * for this Product <code>Persistent</code>. 948 * 949 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 950 * @param cooked the pre-validated value to set 951 */ 952 public void setISBN_unsafe(String cooked) { 953 ISBN = cooked; 954 } 955 956 /** 957 * Retrieves the ISBN value, with locking, for this 958 * <code>Product</code> <code>Persistent</code>. 959 * Field description: 960 * The ISBN number of this product (if any) 961 * 962 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 963 * @throws AccessPoemException 964 * if the current <code>AccessToken</code> 965 * does not confer write access rights 966 * @return the value of the field <code>ISBN</code> for this 967 * <code>Product</code> <code>Persistent</code> 968 */ 969 970 public String getISBN() 971 throws AccessPoemException { 972 readLock(); 973 return getISBN_unsafe(); 974 } 975 976 977 /** 978 * Sets the <code>ISBN</code> value, with checking, for this 979 * <code>Product</code> <code>Persistent</code>. 980 * Field description: 981 * The ISBN number of this product (if any) 982 * 983 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 984 * @param cooked a validated <code>int</code> 985 * @throws AccessPoemException 986 * if the current <code>AccessToken</code> 987 * does not confer write access rights 988 * @throws ValidationPoemException 989 * if the value is not valid 990 */ 991 public void setISBN(String cooked) 992 throws AccessPoemException, ValidationPoemException { 993 _getProductTable().getISBNColumn(). 994 getType().assertValidCooked(cooked); 995 writeLock(); 996 setISBN_unsafe(cooked); 997 } 998 999 1000 /** 1001 * Retrieves the <code>ISBN</code> value as a <code>Field</code> 1002 * from this <code>Product</code> <code>Persistent</code>. 1003 * 1004 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 1005 * @throws AccessPoemException 1006 * if the current <code>AccessToken</code> 1007 * does not confer write access rights 1008 * @return the String ISBN 1009 */ 1010 public Field<String> getISBNField() throws AccessPoemException { 1011 Column<String> c = _getProductTable().getISBNColumn(); 1012 return new Field<String>((String)c.getRaw(this), c); 1013 } 1014 1015 1016 /** 1017 * Retrieves the <code>Picture</code> value, without locking, 1018 * for this <code>Product</code> <code>Persistent</code>. 1019 * 1020 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 1021 * @return the String picture 1022 */ 1023 public String getPicture_unsafe() { 1024 return picture; 1025 } 1026 1027 1028 /** 1029 * Sets the <code>Picture</code> value directly, without checking, 1030 * for this Product <code>Persistent</code>. 1031 * 1032 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 1033 * @param cooked the pre-validated value to set 1034 */ 1035 public void setPicture_unsafe(String cooked) { 1036 picture = cooked; 1037 } 1038 1039 /** 1040 * Retrieves the Picture value, with locking, for this 1041 * <code>Product</code> <code>Persistent</code>. 1042 * Field description: 1043 * A jacket cover image or similar 1044 * 1045 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 1046 * @throws AccessPoemException 1047 * if the current <code>AccessToken</code> 1048 * does not confer write access rights 1049 * @return the value of the field <code>Picture</code> for this 1050 * <code>Product</code> <code>Persistent</code> 1051 */ 1052 1053 public String getPicture() 1054 throws AccessPoemException { 1055 readLock(); 1056 return getPicture_unsafe(); 1057 } 1058 1059 1060 /** 1061 * Sets the <code>Picture</code> value, with checking, for this 1062 * <code>Product</code> <code>Persistent</code>. 1063 * Field description: 1064 * A jacket cover image or similar 1065 * 1066 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 1067 * @param cooked a validated <code>int</code> 1068 * @throws AccessPoemException 1069 * if the current <code>AccessToken</code> 1070 * does not confer write access rights 1071 * @throws ValidationPoemException 1072 * if the value is not valid 1073 */ 1074 public void setPicture(String cooked) 1075 throws AccessPoemException, ValidationPoemException { 1076 _getProductTable().getPictureColumn(). 1077 getType().assertValidCooked(cooked); 1078 writeLock(); 1079 setPicture_unsafe(cooked); 1080 } 1081 1082 1083 /** 1084 * Retrieves the <code>Picture</code> value as a <code>Field</code> 1085 * from this <code>Product</code> <code>Persistent</code>. 1086 * 1087 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 1088 * @throws AccessPoemException 1089 * if the current <code>AccessToken</code> 1090 * does not confer write access rights 1091 * @return the String picture 1092 */ 1093 public Field<String> getPictureField() throws AccessPoemException { 1094 Column<String> c = _getProductTable().getPictureColumn(); 1095 return new Field<String>((String)c.getRaw(this), c); 1096 } 1097 1098 1099 /** 1100 * Retrieves the <code>Deleted</code> value, without locking, 1101 * for this <code>Product</code> <code>Persistent</code>. 1102 * 1103 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 1104 * @return the Boolean deleted 1105 */ 1106 public Boolean getDeleted_unsafe() { 1107 return deleted; 1108 } 1109 1110 1111 /** 1112 * Sets the <code>Deleted</code> value directly, without checking, 1113 * for this Product <code>Persistent</code>. 1114 * 1115 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 1116 * @param cooked the pre-validated value to set 1117 */ 1118 public void setDeleted_unsafe(Boolean cooked) { 1119 deleted = cooked; 1120 } 1121 1122 /** 1123 * Retrieves the Deleted value, with locking, for this 1124 * <code>Product</code> <code>Persistent</code>. 1125 * 1126 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 1127 * @throws AccessPoemException 1128 * if the current <code>AccessToken</code> 1129 * does not confer write access rights 1130 * @return the value of the field <code>Deleted</code> for this 1131 * <code>Product</code> <code>Persistent</code> 1132 */ 1133 1134 public Boolean getDeleted() 1135 throws AccessPoemException { 1136 readLock(); 1137 return getDeleted_unsafe(); 1138 } 1139 1140 1141 /** 1142 * Sets the <code>Deleted</code> value, with checking, for this 1143 * <code>Product</code> <code>Persistent</code>. 1144 * 1145 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 1146 * @param cooked a validated <code>int</code> 1147 * @throws AccessPoemException 1148 * if the current <code>AccessToken</code> 1149 * does not confer write access rights 1150 * @throws ValidationPoemException 1151 * if the value is not valid 1152 */ 1153 public void setDeleted(Boolean cooked) 1154 throws AccessPoemException, ValidationPoemException { 1155 _getProductTable().getDeletedColumn(). 1156 getType().assertValidCooked(cooked); 1157 writeLock(); 1158 setDeleted_unsafe(cooked); 1159 } 1160 1161 /** 1162 * Sets the <code>Deleted</code> value, with checking, 1163 * from a <code>boolean</code>, for this 1164 * <code>Product</code> <code>Persistent</code>. 1165 * 1166 * Generated by org.melati.poem.prepro.BooleanFieldDef#generateBaseMethods 1167 * @param cooked a <code>boolean</code> 1168 * @throws AccessPoemException 1169 * if the current <code>AccessToken</code> 1170 * does not confer write access rights 1171 * @throws ValidationPoemException 1172 * if the value is not valid 1173 */ 1174 1175 public final void setDeleted(boolean cooked) 1176 throws AccessPoemException, ValidationPoemException { 1177 setDeleted(cooked ? Boolean.TRUE : Boolean.FALSE); 1178 } 1179 1180 1181 /** 1182 * Retrieves the <code>Deleted</code> value as a <code>Field</code> 1183 * from this <code>Product</code> <code>Persistent</code>. 1184 * 1185 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 1186 * @throws AccessPoemException 1187 * if the current <code>AccessToken</code> 1188 * does not confer write access rights 1189 * @return the Boolean deleted 1190 */ 1191 public Field<Boolean> getDeletedField() throws AccessPoemException { 1192 Column<Boolean> c = _getProductTable().getDeletedColumn(); 1193 return new Field<Boolean>((Boolean)c.getRaw(this), c); 1194 } 1195 1196 1197 /** 1198 * Retrieves the <code>Format</code> value, without locking, 1199 * for this <code>Product</code> <code>Persistent</code>. 1200 * 1201 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 1202 * @return the Integer format 1203 */ 1204 public Integer getFormat_unsafe() { 1205 return format; 1206 } 1207 1208 1209 /** 1210 * Sets the <code>Format</code> value directly, without checking, 1211 * for this Product <code>Persistent</code>. 1212 * 1213 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 1214 * @param cooked the pre-validated value to set 1215 */ 1216 public void setFormat_unsafe(Integer cooked) { 1217 format = cooked; 1218 } 1219 1220 /** 1221 * Retrieves the Table Row Object ID. 1222 * 1223 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 1224 * @throws AccessPoemException 1225 * if the current <code>AccessToken</code> 1226 * does not confer read access rights 1227 * @return the TROID as an <code>Integer</code> 1228 */ 1229 1230 public Integer getFormatTroid() 1231 throws AccessPoemException { 1232 readLock(); 1233 return getFormat_unsafe(); 1234 } 1235 1236 1237 /** 1238 * Sets the Table Row Object ID. 1239 * 1240 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 1241 * @param raw a Table Row Object Id 1242 * @throws AccessPoemException 1243 * if the current <code>AccessToken</code> 1244 * does not confer write access rights 1245 */ 1246 public void setFormatTroid(Integer raw) 1247 throws AccessPoemException { 1248 setFormat(raw == null ? null : 1249 getBibliomaniaDatabaseTables().getBookFormatTable().getBookFormatObject(raw)); 1250 } 1251 1252 1253 /** 1254 * Retrieves the <code>Format</code> object referred to. 1255 * 1256 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 1257 * @throws AccessPoemException 1258 * if the current <code>AccessToken</code> 1259 * does not confer read access rights 1260 * @throws NoSuchRowPoemException 1261 * if the <code>Persistent</code> has yet to be allocated a TROID 1262 * @return the <code>Format</code> as a <code>BookFormat</code> 1263 */ 1264 public BookFormat getFormat() 1265 throws AccessPoemException, NoSuchRowPoemException { 1266 Integer troid = getFormatTroid(); 1267 return troid == null ? null : 1268 getBibliomaniaDatabaseTables().getBookFormatTable().getBookFormatObject(troid); 1269 } 1270 1271 1272 /** 1273 * Set the Format. 1274 * 1275 * Generated by org.melati.poem.prepro.ReferenceFieldDef#generateBaseMethods 1276 * @param cooked a validated <code>BookFormat</code> 1277 * @throws AccessPoemException 1278 * if the current <code>AccessToken</code> 1279 * does not confer write access rights 1280 */ 1281 public void setFormat(BookFormat cooked) 1282 throws AccessPoemException { 1283 _getProductTable(). 1284 getFormatColumn(). 1285 getType().assertValidCooked(cooked); 1286 writeLock(); 1287 if (cooked == null) 1288 setFormat_unsafe(null); 1289 else { 1290 cooked.existenceLock(); 1291 setFormat_unsafe(cooked.troid()); 1292 } 1293 } 1294 1295 1296 /** 1297 * Retrieves the <code>Format</code> value as a <code>Field</code> 1298 * from this <code>Product</code> <code>Persistent</code>. 1299 * 1300 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 1301 * @throws AccessPoemException 1302 * if the current <code>AccessToken</code> 1303 * does not confer write access rights 1304 * @return the Integer format 1305 */ 1306 public Field<Integer> getFormatField() throws AccessPoemException { 1307 Column<Integer> c = _getProductTable().getFormatColumn(); 1308 return new Field<Integer>((Integer)c.getRaw(this), c); 1309 } 1310 1311 private CachedSelection<ProductAssociation> productProductAssociations = null; 1312 /** References to this Product in the ProductAssociation table via its product field.*/ 1313 @SuppressWarnings("unchecked") 1314 public Enumeration<ProductAssociation> getProductProductAssociations() { 1315 if (getTroid() == null) 1316 return new EmptyEnumeration<ProductAssociation>(); 1317 else { 1318 if (productProductAssociations == null) 1319 productProductAssociations = 1320 getBibliomaniaDatabaseTables().getProductAssociationTable().getProductColumn().cachedSelectionWhereEq(getTroid()); 1321 return productProductAssociations.objects(); 1322 } 1323 } 1324 1325 1326 /** References to this Product in the ProductAssociation table via its product field, as a List.*/ 1327 public List<ProductAssociation> getProductProductAssociationList() { 1328 return Collections.list(getProductProductAssociations()); 1329 } 1330 1331 1332 1333 private CachedSelection<SupplierProduct> productSupplierProducts = null; 1334 /** References to this Product in the SupplierProduct table via its product field.*/ 1335 @SuppressWarnings("unchecked") 1336 public Enumeration<SupplierProduct> getProductSupplierProducts() { 1337 if (getTroid() == null) 1338 return new EmptyEnumeration<SupplierProduct>(); 1339 else { 1340 if (productSupplierProducts == null) 1341 productSupplierProducts = 1342 getBibliomaniaDatabaseTables().getSupplierProductTable().getProductColumn().cachedSelectionWhereEq(getTroid()); 1343 return productSupplierProducts.objects(); 1344 } 1345 } 1346 1347 1348 /** References to this Product in the SupplierProduct table via its product field, as a List.*/ 1349 public List<SupplierProduct> getProductSupplierProductList() { 1350 return Collections.list(getProductSupplierProducts()); 1351 } 1352 1353 1354 1355 private CachedSelection<ShopOrderItem> productShopOrderItems = null; 1356 /** References to this Product in the ShopOrderItem table via its product field.*/ 1357 @SuppressWarnings("unchecked") 1358 public Enumeration<ShopOrderItem> getProductShopOrderItems() { 1359 if (getTroid() == null) 1360 return new EmptyEnumeration<ShopOrderItem>(); 1361 else { 1362 if (productShopOrderItems == null) 1363 productShopOrderItems = 1364 getBibliomaniaDatabaseTables().getShopOrderItemTable().getProductColumn().cachedSelectionWhereEq(getTroid()); 1365 return productShopOrderItems.objects(); 1366 } 1367 } 1368 1369 1370 /** References to this Product in the ShopOrderItem table via its product field, as a List.*/ 1371 public List<ShopOrderItem> getProductShopOrderItemList() { 1372 return Collections.list(getProductShopOrderItems()); 1373 } 1374 1375 1376 1377 } 1378