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.ValidationPoemException; 15 import org.melati.poem.util.EmptyEnumeration; 16 import org.paneris.bibliomania.BibliomaniaDatabaseTables; 17 import org.paneris.bibliomania.DeliveryCharge; 18 import org.paneris.bibliomania.ShopOrderItem; 19 import org.paneris.bibliomania.Supplier; 20 import org.paneris.bibliomania.SupplierProduct; 21 import org.paneris.bibliomania.SupplierTable; 22 23 24 /** 25 * Melati POEM generated abstract base class for a <code>Persistent</code> 26 * <code>Supplier</code> Object. 27 * 28 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 29 */ 30 public abstract class SupplierBase extends JdbcPersistent { 31 32 33 /** 34 * Retrieves the Database object. 35 * 36 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 37 * @return the database 38 */ 39 public BibliomaniaDatabaseTables getBibliomaniaDatabaseTables() { 40 return (BibliomaniaDatabaseTables)getDatabase(); 41 } 42 43 44 /** 45 * Retrieves the <code>SupplierTable</code> table 46 * which this <code>Persistent</code> is from. 47 * 48 * see org.melati.poem.prepro.TableDef#generatePersistentBaseJava 49 * @return the SupplierTable 50 */ 51 @SuppressWarnings("unchecked") 52 public SupplierTable<Supplier> getSupplierTable() { 53 return (SupplierTable<Supplier>)getTable(); 54 } 55 56 @SuppressWarnings("unchecked") 57 private SupplierTable<Supplier> _getSupplierTable() { 58 return (SupplierTable<Supplier>)getTable(); 59 } 60 61 // Fields in this table 62 /** 63 * id 64 */ 65 protected Integer id; 66 /** 67 * Name - The full name of the Supplier 68 */ 69 protected String name; 70 /** 71 * Address - A postal address for the Supplier 72 */ 73 protected String address; 74 /** 75 * Contact Name - The person who will deal with queries 76 */ 77 protected String contact; 78 /** 79 * email - An email address used to submit orders to this Supplier 80 */ 81 protected String email; 82 /** 83 * Website - The website for this supplier, if they have one 84 */ 85 protected String website; 86 /** 87 * location - The Location of this supplier (eg London) 88 */ 89 protected String location; 90 91 92 /** 93 * Retrieves the <code>Id</code> value, without locking, 94 * for this <code>Supplier</code> <code>Persistent</code>. 95 * 96 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 97 * @return the Integer id 98 */ 99 public Integer getId_unsafe() { 100 return id; 101 } 102 103 104 /** 105 * Sets the <code>Id</code> value directly, without checking, 106 * for this Supplier <code>Persistent</code>. 107 * 108 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 109 * @param cooked the pre-validated value to set 110 */ 111 public void setId_unsafe(Integer cooked) { 112 id = cooked; 113 } 114 115 /** 116 * Retrieves the Id value, with locking, for this 117 * <code>Supplier</code> <code>Persistent</code>. 118 * 119 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 120 * @throws AccessPoemException 121 * if the current <code>AccessToken</code> 122 * does not confer write access rights 123 * @return the value of the field <code>Id</code> for this 124 * <code>Supplier</code> <code>Persistent</code> 125 */ 126 127 public Integer getId() 128 throws AccessPoemException { 129 readLock(); 130 return getId_unsafe(); 131 } 132 133 134 /** 135 * Sets the <code>Id</code> value, with checking, for this 136 * <code>Supplier</code> <code>Persistent</code>. 137 * 138 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 139 * @param cooked a validated <code>int</code> 140 * @throws AccessPoemException 141 * if the current <code>AccessToken</code> 142 * does not confer write access rights 143 * @throws ValidationPoemException 144 * if the value is not valid 145 */ 146 public void setId(Integer cooked) 147 throws AccessPoemException, ValidationPoemException { 148 _getSupplierTable().getIdColumn(). 149 getType().assertValidCooked(cooked); 150 writeLock(); 151 setId_unsafe(cooked); 152 } 153 154 /** 155 * Sets the <code>Id</code> value, with checking, for this 156 * <code>Supplier</code> <code>Persistent</code>. 157 * 158 * Generated by org.melati.poem.prepro.IntegerFieldDef#generateBaseMethods 159 * @param cooked a validated <code>int</code> 160 * @throws AccessPoemException 161 * if the current <code>AccessToken</code> 162 * does not confer write access rights 163 * @throws ValidationPoemException 164 * if the value is not valid 165 */ 166 167 public final void setId(int cooked) 168 throws AccessPoemException, ValidationPoemException { 169 setId(new Integer(cooked)); 170 } 171 172 173 /** 174 * Retrieves the <code>Id</code> value as a <code>Field</code> 175 * from this <code>Supplier</code> <code>Persistent</code>. 176 * 177 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 178 * @throws AccessPoemException 179 * if the current <code>AccessToken</code> 180 * does not confer write access rights 181 * @return the Integer id 182 */ 183 public Field<Integer> getIdField() throws AccessPoemException { 184 Column<Integer> c = _getSupplierTable().getIdColumn(); 185 return new Field<Integer>((Integer)c.getRaw(this), c); 186 } 187 188 189 /** 190 * Retrieves the <code>Name</code> value, without locking, 191 * for this <code>Supplier</code> <code>Persistent</code>. 192 * 193 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 194 * @return the String name 195 */ 196 public String getName_unsafe() { 197 return name; 198 } 199 200 201 /** 202 * Sets the <code>Name</code> value directly, without checking, 203 * for this Supplier <code>Persistent</code>. 204 * 205 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 206 * @param cooked the pre-validated value to set 207 */ 208 public void setName_unsafe(String cooked) { 209 name = cooked; 210 } 211 212 /** 213 * Retrieves the Name value, with locking, for this 214 * <code>Supplier</code> <code>Persistent</code>. 215 * Field description: 216 * The full name of the Supplier 217 * 218 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 219 * @throws AccessPoemException 220 * if the current <code>AccessToken</code> 221 * does not confer write access rights 222 * @return the value of the field <code>Name</code> for this 223 * <code>Supplier</code> <code>Persistent</code> 224 */ 225 226 public String getName() 227 throws AccessPoemException { 228 readLock(); 229 return getName_unsafe(); 230 } 231 232 233 /** 234 * Sets the <code>Name</code> value, with checking, for this 235 * <code>Supplier</code> <code>Persistent</code>. 236 * Field description: 237 * The full name of the Supplier 238 * 239 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 240 * @param cooked a validated <code>int</code> 241 * @throws AccessPoemException 242 * if the current <code>AccessToken</code> 243 * does not confer write access rights 244 * @throws ValidationPoemException 245 * if the value is not valid 246 */ 247 public void setName(String cooked) 248 throws AccessPoemException, ValidationPoemException { 249 _getSupplierTable().getNameColumn(). 250 getType().assertValidCooked(cooked); 251 writeLock(); 252 setName_unsafe(cooked); 253 } 254 255 256 /** 257 * Retrieves the <code>Name</code> value as a <code>Field</code> 258 * from this <code>Supplier</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 String name 265 */ 266 public Field<String> getNameField() throws AccessPoemException { 267 Column<String> c = _getSupplierTable().getNameColumn(); 268 return new Field<String>((String)c.getRaw(this), c); 269 } 270 271 272 /** 273 * Retrieves the <code>Address</code> value, without locking, 274 * for this <code>Supplier</code> <code>Persistent</code>. 275 * 276 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 277 * @return the String address 278 */ 279 public String getAddress_unsafe() { 280 return address; 281 } 282 283 284 /** 285 * Sets the <code>Address</code> value directly, without checking, 286 * for this Supplier <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 setAddress_unsafe(String cooked) { 292 address = cooked; 293 } 294 295 /** 296 * Retrieves the Address value, with locking, for this 297 * <code>Supplier</code> <code>Persistent</code>. 298 * Field description: 299 * A postal address for the Supplier 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>Address</code> for this 306 * <code>Supplier</code> <code>Persistent</code> 307 */ 308 309 public String getAddress() 310 throws AccessPoemException { 311 readLock(); 312 return getAddress_unsafe(); 313 } 314 315 316 /** 317 * Sets the <code>Address</code> value, with checking, for this 318 * <code>Supplier</code> <code>Persistent</code>. 319 * Field description: 320 * A postal address for the Supplier 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 setAddress(String cooked) 331 throws AccessPoemException, ValidationPoemException { 332 _getSupplierTable().getAddressColumn(). 333 getType().assertValidCooked(cooked); 334 writeLock(); 335 setAddress_unsafe(cooked); 336 } 337 338 339 /** 340 * Retrieves the <code>Address</code> value as a <code>Field</code> 341 * from this <code>Supplier</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 String address 348 */ 349 public Field<String> getAddressField() throws AccessPoemException { 350 Column<String> c = _getSupplierTable().getAddressColumn(); 351 return new Field<String>((String)c.getRaw(this), c); 352 } 353 354 355 /** 356 * Retrieves the <code>Contact</code> value, without locking, 357 * for this <code>Supplier</code> <code>Persistent</code>. 358 * 359 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 360 * @return the String contact 361 */ 362 public String getContact_unsafe() { 363 return contact; 364 } 365 366 367 /** 368 * Sets the <code>Contact</code> value directly, without checking, 369 * for this Supplier <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 setContact_unsafe(String cooked) { 375 contact = cooked; 376 } 377 378 /** 379 * Retrieves the Contact value, with locking, for this 380 * <code>Supplier</code> <code>Persistent</code>. 381 * Field description: 382 * The person who will deal with queries 383 * 384 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 385 * @throws AccessPoemException 386 * if the current <code>AccessToken</code> 387 * does not confer write access rights 388 * @return the value of the field <code>Contact</code> for this 389 * <code>Supplier</code> <code>Persistent</code> 390 */ 391 392 public String getContact() 393 throws AccessPoemException { 394 readLock(); 395 return getContact_unsafe(); 396 } 397 398 399 /** 400 * Sets the <code>Contact</code> value, with checking, for this 401 * <code>Supplier</code> <code>Persistent</code>. 402 * Field description: 403 * The person who will deal with queries 404 * 405 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 406 * @param cooked a validated <code>int</code> 407 * @throws AccessPoemException 408 * if the current <code>AccessToken</code> 409 * does not confer write access rights 410 * @throws ValidationPoemException 411 * if the value is not valid 412 */ 413 public void setContact(String cooked) 414 throws AccessPoemException, ValidationPoemException { 415 _getSupplierTable().getContactColumn(). 416 getType().assertValidCooked(cooked); 417 writeLock(); 418 setContact_unsafe(cooked); 419 } 420 421 422 /** 423 * Retrieves the <code>Contact</code> value as a <code>Field</code> 424 * from this <code>Supplier</code> <code>Persistent</code>. 425 * 426 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 427 * @throws AccessPoemException 428 * if the current <code>AccessToken</code> 429 * does not confer write access rights 430 * @return the String contact 431 */ 432 public Field<String> getContactField() throws AccessPoemException { 433 Column<String> c = _getSupplierTable().getContactColumn(); 434 return new Field<String>((String)c.getRaw(this), c); 435 } 436 437 438 /** 439 * Retrieves the <code>Email</code> value, without locking, 440 * for this <code>Supplier</code> <code>Persistent</code>. 441 * 442 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 443 * @return the String email 444 */ 445 public String getEmail_unsafe() { 446 return email; 447 } 448 449 450 /** 451 * Sets the <code>Email</code> value directly, without checking, 452 * for this Supplier <code>Persistent</code>. 453 * 454 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 455 * @param cooked the pre-validated value to set 456 */ 457 public void setEmail_unsafe(String cooked) { 458 email = cooked; 459 } 460 461 /** 462 * Retrieves the Email value, with locking, for this 463 * <code>Supplier</code> <code>Persistent</code>. 464 * Field description: 465 * An email address used to submit orders to this Supplier 466 * 467 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 468 * @throws AccessPoemException 469 * if the current <code>AccessToken</code> 470 * does not confer write access rights 471 * @return the value of the field <code>Email</code> for this 472 * <code>Supplier</code> <code>Persistent</code> 473 */ 474 475 public String getEmail() 476 throws AccessPoemException { 477 readLock(); 478 return getEmail_unsafe(); 479 } 480 481 482 /** 483 * Sets the <code>Email</code> value, with checking, for this 484 * <code>Supplier</code> <code>Persistent</code>. 485 * Field description: 486 * An email address used to submit orders to this Supplier 487 * 488 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 489 * @param cooked a validated <code>int</code> 490 * @throws AccessPoemException 491 * if the current <code>AccessToken</code> 492 * does not confer write access rights 493 * @throws ValidationPoemException 494 * if the value is not valid 495 */ 496 public void setEmail(String cooked) 497 throws AccessPoemException, ValidationPoemException { 498 _getSupplierTable().getEmailColumn(). 499 getType().assertValidCooked(cooked); 500 writeLock(); 501 setEmail_unsafe(cooked); 502 } 503 504 505 /** 506 * Retrieves the <code>Email</code> value as a <code>Field</code> 507 * from this <code>Supplier</code> <code>Persistent</code>. 508 * 509 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 510 * @throws AccessPoemException 511 * if the current <code>AccessToken</code> 512 * does not confer write access rights 513 * @return the String email 514 */ 515 public Field<String> getEmailField() throws AccessPoemException { 516 Column<String> c = _getSupplierTable().getEmailColumn(); 517 return new Field<String>((String)c.getRaw(this), c); 518 } 519 520 521 /** 522 * Retrieves the <code>Website</code> value, without locking, 523 * for this <code>Supplier</code> <code>Persistent</code>. 524 * 525 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 526 * @return the String website 527 */ 528 public String getWebsite_unsafe() { 529 return website; 530 } 531 532 533 /** 534 * Sets the <code>Website</code> value directly, without checking, 535 * for this Supplier <code>Persistent</code>. 536 * 537 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 538 * @param cooked the pre-validated value to set 539 */ 540 public void setWebsite_unsafe(String cooked) { 541 website = cooked; 542 } 543 544 /** 545 * Retrieves the Website value, with locking, for this 546 * <code>Supplier</code> <code>Persistent</code>. 547 * Field description: 548 * The website for this supplier, if they have one 549 * 550 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 551 * @throws AccessPoemException 552 * if the current <code>AccessToken</code> 553 * does not confer write access rights 554 * @return the value of the field <code>Website</code> for this 555 * <code>Supplier</code> <code>Persistent</code> 556 */ 557 558 public String getWebsite() 559 throws AccessPoemException { 560 readLock(); 561 return getWebsite_unsafe(); 562 } 563 564 565 /** 566 * Sets the <code>Website</code> value, with checking, for this 567 * <code>Supplier</code> <code>Persistent</code>. 568 * Field description: 569 * The website for this supplier, if they have one 570 * 571 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 572 * @param cooked a validated <code>int</code> 573 * @throws AccessPoemException 574 * if the current <code>AccessToken</code> 575 * does not confer write access rights 576 * @throws ValidationPoemException 577 * if the value is not valid 578 */ 579 public void setWebsite(String cooked) 580 throws AccessPoemException, ValidationPoemException { 581 _getSupplierTable().getWebsiteColumn(). 582 getType().assertValidCooked(cooked); 583 writeLock(); 584 setWebsite_unsafe(cooked); 585 } 586 587 588 /** 589 * Retrieves the <code>Website</code> value as a <code>Field</code> 590 * from this <code>Supplier</code> <code>Persistent</code>. 591 * 592 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 593 * @throws AccessPoemException 594 * if the current <code>AccessToken</code> 595 * does not confer write access rights 596 * @return the String website 597 */ 598 public Field<String> getWebsiteField() throws AccessPoemException { 599 Column<String> c = _getSupplierTable().getWebsiteColumn(); 600 return new Field<String>((String)c.getRaw(this), c); 601 } 602 603 604 /** 605 * Retrieves the <code>Location</code> value, without locking, 606 * for this <code>Supplier</code> <code>Persistent</code>. 607 * 608 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 609 * @return the String location 610 */ 611 public String getLocation_unsafe() { 612 return location; 613 } 614 615 616 /** 617 * Sets the <code>Location</code> value directly, without checking, 618 * for this Supplier <code>Persistent</code>. 619 * 620 * see org.melati.poem.prepro.FieldDef#generateBaseMethods 621 * @param cooked the pre-validated value to set 622 */ 623 public void setLocation_unsafe(String cooked) { 624 location = cooked; 625 } 626 627 /** 628 * Retrieves the Location value, with locking, for this 629 * <code>Supplier</code> <code>Persistent</code>. 630 * Field description: 631 * The Location of this supplier (eg London) 632 * 633 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 634 * @throws AccessPoemException 635 * if the current <code>AccessToken</code> 636 * does not confer write access rights 637 * @return the value of the field <code>Location</code> for this 638 * <code>Supplier</code> <code>Persistent</code> 639 */ 640 641 public String getLocation() 642 throws AccessPoemException { 643 readLock(); 644 return getLocation_unsafe(); 645 } 646 647 648 /** 649 * Sets the <code>Location</code> value, with checking, for this 650 * <code>Supplier</code> <code>Persistent</code>. 651 * Field description: 652 * The Location of this supplier (eg London) 653 * 654 * Generated by org.melati.poem.prepro.AtomFieldDef#generateBaseMethods 655 * @param cooked a validated <code>int</code> 656 * @throws AccessPoemException 657 * if the current <code>AccessToken</code> 658 * does not confer write access rights 659 * @throws ValidationPoemException 660 * if the value is not valid 661 */ 662 public void setLocation(String cooked) 663 throws AccessPoemException, ValidationPoemException { 664 _getSupplierTable().getLocationColumn(). 665 getType().assertValidCooked(cooked); 666 writeLock(); 667 setLocation_unsafe(cooked); 668 } 669 670 671 /** 672 * Retrieves the <code>Location</code> value as a <code>Field</code> 673 * from this <code>Supplier</code> <code>Persistent</code>. 674 * 675 * see org.melati.poem.prepro.FieldDef#generateFieldCreator 676 * @throws AccessPoemException 677 * if the current <code>AccessToken</code> 678 * does not confer write access rights 679 * @return the String location 680 */ 681 public Field<String> getLocationField() throws AccessPoemException { 682 Column<String> c = _getSupplierTable().getLocationColumn(); 683 return new Field<String>((String)c.getRaw(this), c); 684 } 685 686 private CachedSelection<DeliveryCharge> supplierDeliveryCharges = null; 687 /** References to this Supplier in the DeliveryCharge table via its supplier field.*/ 688 @SuppressWarnings("unchecked") 689 public Enumeration<DeliveryCharge> getSupplierDeliveryCharges() { 690 if (getTroid() == null) 691 return new EmptyEnumeration<DeliveryCharge>(); 692 else { 693 if (supplierDeliveryCharges == null) 694 supplierDeliveryCharges = 695 getBibliomaniaDatabaseTables().getDeliveryChargeTable().getSupplierColumn().cachedSelectionWhereEq(getTroid()); 696 return supplierDeliveryCharges.objects(); 697 } 698 } 699 700 701 /** References to this Supplier in the DeliveryCharge table via its supplier field, as a List.*/ 702 public List<DeliveryCharge> getSupplierDeliveryChargeList() { 703 return Collections.list(getSupplierDeliveryCharges()); 704 } 705 706 707 708 private CachedSelection<SupplierProduct> supplierSupplierProducts = null; 709 /** References to this Supplier in the SupplierProduct table via its supplier field.*/ 710 @SuppressWarnings("unchecked") 711 public Enumeration<SupplierProduct> getSupplierSupplierProducts() { 712 if (getTroid() == null) 713 return new EmptyEnumeration<SupplierProduct>(); 714 else { 715 if (supplierSupplierProducts == null) 716 supplierSupplierProducts = 717 getBibliomaniaDatabaseTables().getSupplierProductTable().getSupplierColumn().cachedSelectionWhereEq(getTroid()); 718 return supplierSupplierProducts.objects(); 719 } 720 } 721 722 723 /** References to this Supplier in the SupplierProduct table via its supplier field, as a List.*/ 724 public List<SupplierProduct> getSupplierSupplierProductList() { 725 return Collections.list(getSupplierSupplierProducts()); 726 } 727 728 729 730 private CachedSelection<ShopOrderItem> supplierShopOrderItems = null; 731 /** References to this Supplier in the ShopOrderItem table via its supplier field.*/ 732 @SuppressWarnings("unchecked") 733 public Enumeration<ShopOrderItem> getSupplierShopOrderItems() { 734 if (getTroid() == null) 735 return new EmptyEnumeration<ShopOrderItem>(); 736 else { 737 if (supplierShopOrderItems == null) 738 supplierShopOrderItems = 739 getBibliomaniaDatabaseTables().getShopOrderItemTable().getSupplierColumn().cachedSelectionWhereEq(getTroid()); 740 return supplierShopOrderItems.objects(); 741 } 742 } 743 744 745 /** References to this Supplier in the ShopOrderItem table via its supplier field, as a List.*/ 746 public List<ShopOrderItem> getSupplierShopOrderItemList() { 747 return Collections.list(getSupplierShopOrderItems()); 748 } 749 750 751 752 } 753