1 package org.campware.cream.om; 2 3 4 import java.math.BigDecimal ; 5 import java.sql.Connection ; 6 import java.util.ArrayList ; 7 import java.util.Collections ; 8 import java.util.Date ; 9 import java.util.List ; 10 11 import org.apache.commons.lang.ObjectUtils; 12 import org.apache.turbine.om.Retrievable; 13 import org.apache.torque.TorqueException; 14 import org.apache.torque.om.BaseObject; 15 import org.apache.torque.om.ComboKey; 16 import org.apache.torque.om.DateKey; 17 import org.apache.torque.om.NumberKey; 18 import org.apache.torque.om.ObjectKey; 19 import org.apache.torque.om.SimpleKey; 20 import org.apache.torque.om.StringKey; 21 import org.apache.torque.om.Persistent; 22 import org.apache.torque.util.Criteria; 23 import org.apache.torque.util.Transaction; 24 25 26 34 public abstract class BaseCreamUser extends BaseObject 35 implements org.apache.turbine.om.Retrievable 36 { 37 38 private static final CreamUserPeer peer = 39 new CreamUserPeer(); 40 41 42 43 private int userId; 44 45 46 private String userName; 47 48 49 private String welcome; 50 51 52 private int defaultList = 1000; 53 54 55 private int inboxFid = 1000; 56 57 58 private int outboxFid = 1000; 59 60 61 private int newsSubsFid = 1000; 62 63 64 private int newsletterFid = 1000; 65 66 67 private int onlineSubsFid = 1000; 68 69 70 private int printSubsFid = 1000; 71 72 73 private int serviceFid = 1000; 74 75 76 private int shipmentFid = 1000; 77 78 79 private int paymentFid = 1000; 80 81 82 private int sorderFid = 1000; 83 84 85 private int projectFid = 1000; 86 87 88 private int customerFid = 1000; 89 90 91 private int productFid = 1000; 92 93 94 99 public int getUserId() 100 { 101 return userId; 102 } 103 104 105 110 public void setUserId(int v) 111 { 112 113 if (this.userId != v) 114 { 115 this.userId = v; 116 setModified(true); 117 } 118 119 120 } 121 122 127 public String getUserName() 128 { 129 return userName; 130 } 131 132 133 138 public void setUserName(String v) 139 { 140 141 if (!ObjectUtils.equals(this.userName, v)) 142 { 143 this.userName = v; 144 setModified(true); 145 } 146 147 148 } 149 150 155 public String getWelcome() 156 { 157 return welcome; 158 } 159 160 161 166 public void setWelcome(String v) 167 { 168 169 if (!ObjectUtils.equals(this.welcome, v)) 170 { 171 this.welcome = v; 172 setModified(true); 173 } 174 175 176 } 177 178 183 public int getDefaultList() 184 { 185 return defaultList; 186 } 187 188 189 194 public void setDefaultList(int v) 195 { 196 197 if (this.defaultList != v) 198 { 199 this.defaultList = v; 200 setModified(true); 201 } 202 203 204 } 205 206 211 public int getInboxFid() 212 { 213 return inboxFid; 214 } 215 216 217 222 public void setInboxFid(int v) 223 { 224 225 if (this.inboxFid != v) 226 { 227 this.inboxFid = v; 228 setModified(true); 229 } 230 231 232 } 233 234 239 public int getOutboxFid() 240 { 241 return outboxFid; 242 } 243 244 245 250 public void setOutboxFid(int v) 251 { 252 253 if (this.outboxFid != v) 254 { 255 this.outboxFid = v; 256 setModified(true); 257 } 258 259 260 } 261 262 267 public int getNewsSubsFid() 268 { 269 return newsSubsFid; 270 } 271 272 273 278 public void setNewsSubsFid(int v) 279 { 280 281 if (this.newsSubsFid != v) 282 { 283 this.newsSubsFid = v; 284 setModified(true); 285 } 286 287 288 } 289 290 295 public int getNewsletterFid() 296 { 297 return newsletterFid; 298 } 299 300 301 306 public void setNewsletterFid(int v) 307 { 308 309 if (this.newsletterFid != v) 310 { 311 this.newsletterFid = v; 312 setModified(true); 313 } 314 315 316 } 317 318 323 public int getOnlineSubsFid() 324 { 325 return onlineSubsFid; 326 } 327 328 329 334 public void setOnlineSubsFid(int v) 335 { 336 337 if (this.onlineSubsFid != v) 338 { 339 this.onlineSubsFid = v; 340 setModified(true); 341 } 342 343 344 } 345 346 351 public int getPrintSubsFid() 352 { 353 return printSubsFid; 354 } 355 356 357 362 public void setPrintSubsFid(int v) 363 { 364 365 if (this.printSubsFid != v) 366 { 367 this.printSubsFid = v; 368 setModified(true); 369 } 370 371 372 } 373 374 379 public int getServiceFid() 380 { 381 return serviceFid; 382 } 383 384 385 390 public void setServiceFid(int v) 391 { 392 393 if (this.serviceFid != v) 394 { 395 this.serviceFid = v; 396 setModified(true); 397 } 398 399 400 } 401 402 407 public int getShipmentFid() 408 { 409 return shipmentFid; 410 } 411 412 413 418 public void setShipmentFid(int v) 419 { 420 421 if (this.shipmentFid != v) 422 { 423 this.shipmentFid = v; 424 setModified(true); 425 } 426 427 428 } 429 430 435 public int getPaymentFid() 436 { 437 return paymentFid; 438 } 439 440 441 446 public void setPaymentFid(int v) 447 { 448 449 if (this.paymentFid != v) 450 { 451 this.paymentFid = v; 452 setModified(true); 453 } 454 455 456 } 457 458 463 public int getSorderFid() 464 { 465 return sorderFid; 466 } 467 468 469 474 public void setSorderFid(int v) 475 { 476 477 if (this.sorderFid != v) 478 { 479 this.sorderFid = v; 480 setModified(true); 481 } 482 483 484 } 485 486 491 public int getProjectFid() 492 { 493 return projectFid; 494 } 495 496 497 502 public void setProjectFid(int v) 503 { 504 505 if (this.projectFid != v) 506 { 507 this.projectFid = v; 508 setModified(true); 509 } 510 511 512 } 513 514 519 public int getCustomerFid() 520 { 521 return customerFid; 522 } 523 524 525 530 public void setCustomerFid(int v) 531 { 532 533 if (this.customerFid != v) 534 { 535 this.customerFid = v; 536 setModified(true); 537 } 538 539 540 } 541 542 547 public int getProductFid() 548 { 549 return productFid; 550 } 551 552 553 558 public void setProductFid(int v) 559 { 560 561 if (this.productFid != v) 562 { 563 this.productFid = v; 564 setModified(true); 565 } 566 567 568 } 569 570 571 572 private static List fieldNames = null; 573 574 579 public static synchronized List getFieldNames() 580 { 581 if (fieldNames == null) 582 { 583 fieldNames = new ArrayList (); 584 fieldNames.add("UserId"); 585 fieldNames.add("UserName"); 586 fieldNames.add("Welcome"); 587 fieldNames.add("DefaultList"); 588 fieldNames.add("InboxFid"); 589 fieldNames.add("OutboxFid"); 590 fieldNames.add("NewsSubsFid"); 591 fieldNames.add("NewsletterFid"); 592 fieldNames.add("OnlineSubsFid"); 593 fieldNames.add("PrintSubsFid"); 594 fieldNames.add("ServiceFid"); 595 fieldNames.add("ShipmentFid"); 596 fieldNames.add("PaymentFid"); 597 fieldNames.add("SorderFid"); 598 fieldNames.add("ProjectFid"); 599 fieldNames.add("CustomerFid"); 600 fieldNames.add("ProductFid"); 601 fieldNames = Collections.unmodifiableList(fieldNames); 602 } 603 return fieldNames; 604 } 605 606 612 public Object getByName(String name) 613 { 614 if (name.equals("UserId")) 615 { 616 return new Integer (getUserId()); 617 } 618 if (name.equals("UserName")) 619 { 620 return getUserName(); 621 } 622 if (name.equals("Welcome")) 623 { 624 return getWelcome(); 625 } 626 if (name.equals("DefaultList")) 627 { 628 return new Integer (getDefaultList()); 629 } 630 if (name.equals("InboxFid")) 631 { 632 return new Integer (getInboxFid()); 633 } 634 if (name.equals("OutboxFid")) 635 { 636 return new Integer (getOutboxFid()); 637 } 638 if (name.equals("NewsSubsFid")) 639 { 640 return new Integer (getNewsSubsFid()); 641 } 642 if (name.equals("NewsletterFid")) 643 { 644 return new Integer (getNewsletterFid()); 645 } 646 if (name.equals("OnlineSubsFid")) 647 { 648 return new Integer (getOnlineSubsFid()); 649 } 650 if (name.equals("PrintSubsFid")) 651 { 652 return new Integer (getPrintSubsFid()); 653 } 654 if (name.equals("ServiceFid")) 655 { 656 return new Integer (getServiceFid()); 657 } 658 if (name.equals("ShipmentFid")) 659 { 660 return new Integer (getShipmentFid()); 661 } 662 if (name.equals("PaymentFid")) 663 { 664 return new Integer (getPaymentFid()); 665 } 666 if (name.equals("SorderFid")) 667 { 668 return new Integer (getSorderFid()); 669 } 670 if (name.equals("ProjectFid")) 671 { 672 return new Integer (getProjectFid()); 673 } 674 if (name.equals("CustomerFid")) 675 { 676 return new Integer (getCustomerFid()); 677 } 678 if (name.equals("ProductFid")) 679 { 680 return new Integer (getProductFid()); 681 } 682 return null; 683 } 684 685 693 public Object getByPeerName(String name) 694 { 695 if (name.equals(CreamUserPeer.USER_ID)) 696 { 697 return new Integer (getUserId()); 698 } 699 if (name.equals(CreamUserPeer.LOGIN_NAME)) 700 { 701 return getUserName(); 702 } 703 if (name.equals(CreamUserPeer.WELCOME)) 704 { 705 return getWelcome(); 706 } 707 if (name.equals(CreamUserPeer.DEFAULT_LIST)) 708 { 709 return new Integer (getDefaultList()); 710 } 711 if (name.equals(CreamUserPeer.INBOX_FID)) 712 { 713 return new Integer (getInboxFid()); 714 } 715 if (name.equals(CreamUserPeer.OUTBOX_FID)) 716 { 717 return new Integer (getOutboxFid()); 718 } 719 if (name.equals(CreamUserPeer.NEWS_SUBS_FID)) 720 { 721 return new Integer (getNewsSubsFid()); 722 } 723 if (name.equals(CreamUserPeer.NEWSLETTER_FID)) 724 { 725 return new Integer (getNewsletterFid()); 726 } 727 if (name.equals(CreamUserPeer.ONLINE_SUBS_FID)) 728 { 729 return new Integer (getOnlineSubsFid()); 730 } 731 if (name.equals(CreamUserPeer.PRINT_SUBS_FID)) 732 { 733 return new Integer (getPrintSubsFid()); 734 } 735 if (name.equals(CreamUserPeer.SERVICE_FID)) 736 { 737 return new Integer (getServiceFid()); 738 } 739 if (name.equals(CreamUserPeer.SHIPMENT_FID)) 740 { 741 return new Integer (getShipmentFid()); 742 } 743 if (name.equals(CreamUserPeer.PAYMENT_FID)) 744 { 745 return new Integer (getPaymentFid()); 746 } 747 if (name.equals(CreamUserPeer.SORDER_FID)) 748 { 749 return new Integer (getSorderFid()); 750 } 751 if (name.equals(CreamUserPeer.PROJECT_FID)) 752 { 753 return new Integer (getProjectFid()); 754 } 755 if (name.equals(CreamUserPeer.CUSTOMER_FID)) 756 { 757 return new Integer (getCustomerFid()); 758 } 759 if (name.equals(CreamUserPeer.PRODUCT_FID)) 760 { 761 return new Integer (getProductFid()); 762 } 763 return null; 764 } 765 766 773 public Object getByPosition(int pos) 774 { 775 if (pos == 0) 776 { 777 return new Integer (getUserId()); 778 } 779 if (pos == 1) 780 { 781 return getUserName(); 782 } 783 if (pos == 2) 784 { 785 return getWelcome(); 786 } 787 if (pos == 3) 788 { 789 return new Integer (getDefaultList()); 790 } 791 if (pos == 4) 792 { 793 return new Integer (getInboxFid()); 794 } 795 if (pos == 5) 796 { 797 return new Integer (getOutboxFid()); 798 } 799 if (pos == 6) 800 { 801 return new Integer (getNewsSubsFid()); 802 } 803 if (pos == 7) 804 { 805 return new Integer (getNewsletterFid()); 806 } 807 if (pos == 8) 808 { 809 return new Integer (getOnlineSubsFid()); 810 } 811 if (pos == 9) 812 { 813 return new Integer (getPrintSubsFid()); 814 } 815 if (pos == 10) 816 { 817 return new Integer (getServiceFid()); 818 } 819 if (pos == 11) 820 { 821 return new Integer (getShipmentFid()); 822 } 823 if (pos == 12) 824 { 825 return new Integer (getPaymentFid()); 826 } 827 if (pos == 13) 828 { 829 return new Integer (getSorderFid()); 830 } 831 if (pos == 14) 832 { 833 return new Integer (getProjectFid()); 834 } 835 if (pos == 15) 836 { 837 return new Integer (getCustomerFid()); 838 } 839 if (pos == 16) 840 { 841 return new Integer (getProductFid()); 842 } 843 return null; 844 } 845 846 852 public void save() throws Exception  853 { 854 save(CreamUserPeer.getMapBuilder() 855 .getDatabaseMap().getName()); 856 } 857 858 868 public void save(String dbName) throws TorqueException 869 { 870 Connection con = null; 871 try 872 { 873 con = Transaction.begin(dbName); 874 save(con); 875 Transaction.commit(con); 876 } 877 catch(TorqueException e) 878 { 879 Transaction.safeRollback(con); 880 throw e; 881 } 882 } 883 884 886 private boolean alreadyInSave = false; 887 897 public void save(Connection con) throws TorqueException 898 { 899 if (!alreadyInSave) 900 { 901 alreadyInSave = true; 902 903 904 905 if (isModified()) 907 { 908 if (isNew()) 909 { 910 CreamUserPeer.doInsert((CreamUser) this, con); 911 setNew(false); 912 } 913 else 914 { 915 CreamUserPeer.doUpdate((CreamUser) this, con); 916 } 917 } 918 919 alreadyInSave = false; 920 } 921 } 922 923 924 929 public void setPrimaryKey(ObjectKey key) 930 931 { 932 setUserId(((NumberKey) key).intValue()); 933 } 934 935 940 public void setPrimaryKey(String key) 941 { 942 setUserId(Integer.parseInt(key)); 943 } 944 945 946 950 public ObjectKey getPrimaryKey() 951 { 952 return SimpleKey.keyFor(getUserId()); 953 } 954 955 959 public String getQueryKey() 960 { 961 if (getPrimaryKey() == null) 962 { 963 return ""; 964 } 965 else 966 { 967 return getPrimaryKey().toString(); 968 } 969 } 970 971 975 public void setQueryKey(String key) 976 throws TorqueException 977 { 978 setPrimaryKey(key); 979 } 980 981 987 public CreamUser copy() throws TorqueException 988 { 989 return copyInto(new CreamUser()); 990 } 991 992 protected CreamUser copyInto(CreamUser copyObj) throws TorqueException 993 { 994 copyObj.setUserId(userId); 995 copyObj.setUserName(userName); 996 copyObj.setWelcome(welcome); 997 copyObj.setDefaultList(defaultList); 998 copyObj.setInboxFid(inboxFid); 999 copyObj.setOutboxFid(outboxFid); 1000 copyObj.setNewsSubsFid(newsSubsFid); 1001 copyObj.setNewsletterFid(newsletterFid); 1002 copyObj.setOnlineSubsFid(onlineSubsFid); 1003 copyObj.setPrintSubsFid(printSubsFid); 1004 copyObj.setServiceFid(serviceFid); 1005 copyObj.setShipmentFid(shipmentFid); 1006 copyObj.setPaymentFid(paymentFid); 1007 copyObj.setSorderFid(sorderFid); 1008 copyObj.setProjectFid(projectFid); 1009 copyObj.setCustomerFid(customerFid); 1010 copyObj.setProductFid(productFid); 1011 1012 copyObj.setUserId( 0); 1013 1014 return copyObj; 1015 } 1016 1017 1023 public CreamUserPeer getPeer() 1024 { 1025 return peer; 1026 } 1027 1028 public String toString() 1029 { 1030 StringBuffer str = new StringBuffer (); 1031 str.append("CreamUser:\n"); 1032 str.append("UserId = ") 1033 .append(getUserId()) 1034 .append("\n"); 1035 str.append("UserName = ") 1036 .append(getUserName()) 1037 .append("\n"); 1038 str.append("Welcome = ") 1039 .append(getWelcome()) 1040 .append("\n"); 1041 str.append("DefaultList = ") 1042 .append(getDefaultList()) 1043 .append("\n"); 1044 str.append("InboxFid = ") 1045 .append(getInboxFid()) 1046 .append("\n"); 1047 str.append("OutboxFid = ") 1048 .append(getOutboxFid()) 1049 .append("\n"); 1050 str.append("NewsSubsFid = ") 1051 .append(getNewsSubsFid()) 1052 .append("\n"); 1053 str.append("NewsletterFid = ") 1054 .append(getNewsletterFid()) 1055 .append("\n"); 1056 str.append("OnlineSubsFid = ") 1057 .append(getOnlineSubsFid()) 1058 .append("\n"); 1059 str.append("PrintSubsFid = ") 1060 .append(getPrintSubsFid()) 1061 .append("\n"); 1062 str.append("ServiceFid = ") 1063 .append(getServiceFid()) 1064 .append("\n"); 1065 str.append("ShipmentFid = ") 1066 .append(getShipmentFid()) 1067 .append("\n"); 1068 str.append("PaymentFid = ") 1069 .append(getPaymentFid()) 1070 .append("\n"); 1071 str.append("SorderFid = ") 1072 .append(getSorderFid()) 1073 .append("\n"); 1074 str.append("ProjectFid = ") 1075 .append(getProjectFid()) 1076 .append("\n"); 1077 str.append("CustomerFid = ") 1078 .append(getCustomerFid()) 1079 .append("\n"); 1080 str.append("ProductFid = ") 1081 .append(getProductFid()) 1082 .append("\n"); 1083 return(str.toString()); 1084 } 1085} 1086
| Popular Tags
|