1 package org.campware.cream.om; 2 3 import java.math.BigDecimal ; 4 import java.sql.Connection ; 5 import java.sql.SQLException ; 6 import java.util.ArrayList ; 7 import java.util.Date ; 8 import java.util.Iterator ; 9 import java.util.LinkedList ; 10 import java.util.List ; 11 12 import org.apache.torque.NoRowsException; 13 import org.apache.torque.TooManyRowsException; 14 import org.apache.torque.Torque; 15 import org.apache.torque.TorqueException; 16 import org.apache.torque.map.MapBuilder; 17 import org.apache.torque.map.TableMap; 18 import org.apache.torque.om.DateKey; 19 import org.apache.torque.om.NumberKey; 20 import org.apache.torque.om.StringKey; 21 import org.apache.torque.om.ObjectKey; 22 import org.apache.torque.om.SimpleKey; 23 import org.apache.torque.util.BasePeer; 24 import org.apache.torque.util.Criteria; 25 26 import com.workingdogs.village.DataSetException; 27 import com.workingdogs.village.QueryDataSet; 28 import com.workingdogs.village.Record; 29 30 import org.campware.cream.om.map.*; 32 33 34 35 36 37 38 39 40 46 public abstract class BasePaymentItemPeer 47 extends BasePeer 48 { 49 50 51 public static final String DATABASE_NAME = "cream"; 52 53 54 public static final String TABLE_NAME = "PAYMENT_ITEM"; 55 56 61 public static MapBuilder getMapBuilder() 62 throws TorqueException 63 { 64 return getMapBuilder(PaymentItemMapBuilder.CLASS_NAME); 65 } 66 67 68 public static final String PAYMENT_ITEM_ID; 69 70 public static final String PAYMENT_ID; 71 72 public static final String SORDER_ID; 73 74 public static final String CUSTOMER_ID; 75 76 public static final String PROJECT_ID; 77 78 public static final String PRODUCT_ID; 79 80 public static final String DESCRIPTION; 81 82 public static final String UNIT_PRICE; 83 84 public static final String QUANTITY; 85 86 public static final String CURRENCY_ID; 87 88 public static final String ITEM_CURR_TOTAL; 89 90 public static final String ITEM_TOTAL; 91 92 static 93 { 94 PAYMENT_ITEM_ID = "PAYMENT_ITEM.PAYMENT_ITEM_ID"; 95 PAYMENT_ID = "PAYMENT_ITEM.PAYMENT_ID"; 96 SORDER_ID = "PAYMENT_ITEM.SORDER_ID"; 97 CUSTOMER_ID = "PAYMENT_ITEM.CUSTOMER_ID"; 98 PROJECT_ID = "PAYMENT_ITEM.PROJECT_ID"; 99 PRODUCT_ID = "PAYMENT_ITEM.PRODUCT_ID"; 100 DESCRIPTION = "PAYMENT_ITEM.DESCRIPTION"; 101 UNIT_PRICE = "PAYMENT_ITEM.UNIT_PRICE"; 102 QUANTITY = "PAYMENT_ITEM.QUANTITY"; 103 CURRENCY_ID = "PAYMENT_ITEM.CURRENCY_ID"; 104 ITEM_CURR_TOTAL = "PAYMENT_ITEM.ITEM_CURR_TOTAL"; 105 ITEM_TOTAL = "PAYMENT_ITEM.ITEM_TOTAL"; 106 if (Torque.isInit()) 107 { 108 try 109 { 110 getMapBuilder(PaymentItemMapBuilder.CLASS_NAME); 111 } 112 catch (Exception e) 113 { 114 log.error("Could not initialize Peer", e); 115 } 116 } 117 else 118 { 119 Torque.registerMapBuilder(PaymentItemMapBuilder.CLASS_NAME); 120 } 121 } 122 123 124 public static final int numColumns = 12; 125 126 127 protected static final String CLASSNAME_DEFAULT = 128 "org.campware.cream.om.PaymentItem"; 129 130 131 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT); 132 133 139 private static Class initClass(String className) 140 { 141 Class c = null; 142 try 143 { 144 c = Class.forName(className); 145 } 146 catch (Throwable t) 147 { 148 log.error("A FATAL ERROR has occurred which should not " 149 + "have happened under any circumstance. Please notify " 150 + "the Torque developers <torque-dev@db.apache.org> " 151 + "and give as many details as possible (including the error " 152 + "stack trace).", t); 153 154 if (t instanceof Error ) 156 { 157 throw (Error ) t.fillInStackTrace(); 158 } 159 } 160 return c; 161 } 162 163 173 public static List resultSet2Objects(java.sql.ResultSet results) 174 throws TorqueException 175 { 176 try 177 { 178 QueryDataSet qds = null; 179 List rows = null; 180 try 181 { 182 qds = new QueryDataSet(results); 183 rows = getSelectResults(qds); 184 } 185 finally 186 { 187 if (qds != null) 188 { 189 qds.close(); 190 } 191 } 192 193 return populateObjects(rows); 194 } 195 catch (SQLException e) 196 { 197 throw new TorqueException(e); 198 } 199 catch (DataSetException e) 200 { 201 throw new TorqueException(e); 202 } 203 } 204 205 206 207 214 public static ObjectKey doInsert(Criteria criteria) 215 throws TorqueException 216 { 217 return BasePaymentItemPeer 218 .doInsert(criteria, (Connection ) null); 219 } 220 221 231 public static ObjectKey doInsert(Criteria criteria, Connection con) 232 throws TorqueException 233 { 234 235 setDbName(criteria); 236 237 if (con == null) 238 { 239 return BasePeer.doInsert(criteria); 240 } 241 else 242 { 243 return BasePeer.doInsert(criteria, con); 244 } 245 } 246 247 254 public static void addSelectColumns(Criteria criteria) 255 throws TorqueException 256 { 257 criteria.addSelectColumn(PAYMENT_ITEM_ID); 258 criteria.addSelectColumn(PAYMENT_ID); 259 criteria.addSelectColumn(SORDER_ID); 260 criteria.addSelectColumn(CUSTOMER_ID); 261 criteria.addSelectColumn(PROJECT_ID); 262 criteria.addSelectColumn(PRODUCT_ID); 263 criteria.addSelectColumn(DESCRIPTION); 264 criteria.addSelectColumn(UNIT_PRICE); 265 criteria.addSelectColumn(QUANTITY); 266 criteria.addSelectColumn(CURRENCY_ID); 267 criteria.addSelectColumn(ITEM_CURR_TOTAL); 268 criteria.addSelectColumn(ITEM_TOTAL); 269 } 270 271 280 public static PaymentItem row2Object(Record row, 281 int offset, 282 Class cls) 283 throws TorqueException 284 { 285 try 286 { 287 PaymentItem obj = (PaymentItem) cls.newInstance(); 288 PaymentItemPeer.populateObject(row, offset, obj); 289 obj.setModified(false); 290 obj.setNew(false); 291 292 return obj; 293 } 294 catch (InstantiationException e) 295 { 296 throw new TorqueException(e); 297 } 298 catch (IllegalAccessException e) 299 { 300 throw new TorqueException(e); 301 } 302 } 303 304 313 public static void populateObject(Record row, 314 int offset, 315 PaymentItem obj) 316 throws TorqueException 317 { 318 try 319 { 320 obj.setPaymentItemId(row.getValue(offset + 0).asInt()); 321 obj.setPaymentId(row.getValue(offset + 1).asInt()); 322 obj.setSorderId(row.getValue(offset + 2).asInt()); 323 obj.setCustomerId(row.getValue(offset + 3).asInt()); 324 obj.setProjectId(row.getValue(offset + 4).asInt()); 325 obj.setProductId(row.getValue(offset + 5).asInt()); 326 obj.setDescription(row.getValue(offset + 6).asString()); 327 obj.setUnitPrice(row.getValue(offset + 7).asBigDecimal()); 328 obj.setQuantity(row.getValue(offset + 8).asInt()); 329 obj.setCurrencyId(row.getValue(offset + 9).asInt()); 330 obj.setItemCurrTotal(row.getValue(offset + 10).asBigDecimal()); 331 obj.setItemTotal(row.getValue(offset + 11).asBigDecimal()); 332 } 333 catch (DataSetException e) 334 { 335 throw new TorqueException(e); 336 } 337 } 338 339 347 public static List doSelect(Criteria criteria) throws TorqueException 348 { 349 return populateObjects(doSelectVillageRecords(criteria)); 350 } 351 352 361 public static List doSelect(Criteria criteria, Connection con) 362 throws TorqueException 363 { 364 return populateObjects(doSelectVillageRecords(criteria, con)); 365 } 366 367 377 public static List doSelectVillageRecords(Criteria criteria) 378 throws TorqueException 379 { 380 return BasePaymentItemPeer 381 .doSelectVillageRecords(criteria, (Connection ) null); 382 } 383 384 393 public static List doSelectVillageRecords(Criteria criteria, Connection con) 394 throws TorqueException 395 { 396 if (criteria.getSelectColumns().size() == 0) 397 { 398 addSelectColumns(criteria); 399 } 400 401 402 setDbName(criteria); 403 404 if (con == null) 407 { 408 return BasePeer.doSelect(criteria); 409 } 410 else 411 { 412 return BasePeer.doSelect(criteria, con); 413 } 414 } 415 416 423 public static List populateObjects(List records) 424 throws TorqueException 425 { 426 List results = new ArrayList (records.size()); 427 428 for (int i = 0; i < records.size(); i++) 430 { 431 Record row = (Record) records.get(i); 432 results.add(PaymentItemPeer.row2Object(row, 1, 433 PaymentItemPeer.getOMClass())); 434 } 435 return results; 436 } 437 438 439 447 public static Class getOMClass() 448 throws TorqueException 449 { 450 return CLASS_DEFAULT; 451 } 452 453 461 public static void doUpdate(Criteria criteria) throws TorqueException 462 { 463 BasePaymentItemPeer 464 .doUpdate(criteria, (Connection ) null); 465 } 466 467 478 public static void doUpdate(Criteria criteria, Connection con) 479 throws TorqueException 480 { 481 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2); 482 selectCriteria.put(PAYMENT_ITEM_ID, criteria.remove(PAYMENT_ITEM_ID)); 483 484 setDbName(criteria); 485 486 if (con == null) 487 { 488 BasePeer.doUpdate(selectCriteria, criteria); 489 } 490 else 491 { 492 BasePeer.doUpdate(selectCriteria, criteria, con); 493 } 494 } 495 496 503 public static void doDelete(Criteria criteria) throws TorqueException 504 { 505 PaymentItemPeer 506 .doDelete(criteria, (Connection ) null); 507 } 508 509 519 public static void doDelete(Criteria criteria, Connection con) 520 throws TorqueException 521 { 522 523 setDbName(criteria); 524 525 if (con == null) 526 { 527 BasePeer.doDelete(criteria); 528 } 529 else 530 { 531 BasePeer.doDelete(criteria, con); 532 } 533 } 534 535 541 public static List doSelect(PaymentItem obj) throws TorqueException 542 { 543 return doSelect(buildSelectCriteria(obj)); 544 } 545 546 552 public static void doInsert(PaymentItem obj) throws TorqueException 553 { 554 obj.setPrimaryKey(doInsert(buildCriteria(obj))); 555 obj.setNew(false); 556 obj.setModified(false); 557 } 558 559 564 public static void doUpdate(PaymentItem obj) throws TorqueException 565 { 566 doUpdate(buildCriteria(obj)); 567 obj.setModified(false); 568 } 569 570 575 public static void doDelete(PaymentItem obj) throws TorqueException 576 { 577 doDelete(buildSelectCriteria(obj)); 578 } 579 580 590 public static void doInsert(PaymentItem obj, Connection con) 591 throws TorqueException 592 { 593 obj.setPrimaryKey(doInsert(buildCriteria(obj), con)); 594 obj.setNew(false); 595 obj.setModified(false); 596 } 597 598 608 public static void doUpdate(PaymentItem obj, Connection con) 609 throws TorqueException 610 { 611 doUpdate(buildCriteria(obj), con); 612 obj.setModified(false); 613 } 614 615 625 public static void doDelete(PaymentItem obj, Connection con) 626 throws TorqueException 627 { 628 doDelete(buildSelectCriteria(obj), con); 629 } 630 631 638 public static void doDelete(ObjectKey pk) throws TorqueException 639 { 640 BasePaymentItemPeer 641 .doDelete(pk, (Connection ) null); 642 } 643 644 654 public static void doDelete(ObjectKey pk, Connection con) 655 throws TorqueException 656 { 657 doDelete(buildCriteria(pk), con); 658 } 659 660 661 public static Criteria buildCriteria( ObjectKey pk ) 662 { 663 Criteria criteria = new Criteria(); 664 criteria.add(PAYMENT_ITEM_ID, pk); 665 return criteria; 666 } 667 668 669 public static Criteria buildCriteria( PaymentItem obj ) 670 { 671 Criteria criteria = new Criteria(DATABASE_NAME); 672 if (!obj.isNew()) 673 criteria.add(PAYMENT_ITEM_ID, obj.getPaymentItemId()); 674 criteria.add(PAYMENT_ID, obj.getPaymentId()); 675 criteria.add(SORDER_ID, obj.getSorderId()); 676 criteria.add(CUSTOMER_ID, obj.getCustomerId()); 677 criteria.add(PROJECT_ID, obj.getProjectId()); 678 criteria.add(PRODUCT_ID, obj.getProductId()); 679 criteria.add(DESCRIPTION, obj.getDescription()); 680 criteria.add(UNIT_PRICE, obj.getUnitPrice()); 681 criteria.add(QUANTITY, obj.getQuantity()); 682 criteria.add(CURRENCY_ID, obj.getCurrencyId()); 683 criteria.add(ITEM_CURR_TOTAL, obj.getItemCurrTotal()); 684 criteria.add(ITEM_TOTAL, obj.getItemTotal()); 685 return criteria; 686 } 687 688 689 public static Criteria buildSelectCriteria( PaymentItem obj ) 690 { 691 Criteria criteria = new Criteria(DATABASE_NAME); 692 if (!obj.isNew()) 693 criteria.add(PAYMENT_ITEM_ID, obj.getPaymentItemId()); 694 criteria.add(PAYMENT_ID, obj.getPaymentId()); 695 criteria.add(SORDER_ID, obj.getSorderId()); 696 criteria.add(CUSTOMER_ID, obj.getCustomerId()); 697 criteria.add(PROJECT_ID, obj.getProjectId()); 698 criteria.add(PRODUCT_ID, obj.getProductId()); 699 criteria.add(DESCRIPTION, obj.getDescription()); 700 criteria.add(UNIT_PRICE, obj.getUnitPrice()); 701 criteria.add(QUANTITY, obj.getQuantity()); 702 criteria.add(CURRENCY_ID, obj.getCurrencyId()); 703 criteria.add(ITEM_CURR_TOTAL, obj.getItemCurrTotal()); 704 criteria.add(ITEM_TOTAL, obj.getItemTotal()); 705 return criteria; 706 } 707 708 709 718 public static PaymentItem retrieveByPK(int pk) 719 throws TorqueException, NoRowsException, TooManyRowsException 720 { 721 return retrieveByPK(SimpleKey.keyFor(pk)); 722 } 723 724 734 public static PaymentItem retrieveByPK(int pk, Connection con) 735 throws TorqueException, NoRowsException, TooManyRowsException 736 { 737 return retrieveByPK(SimpleKey.keyFor(pk), con); 738 } 739 740 749 public static PaymentItem retrieveByPK(ObjectKey pk) 750 throws TorqueException, NoRowsException, TooManyRowsException 751 { 752 Connection db = null; 753 PaymentItem retVal = null; 754 try 755 { 756 db = Torque.getConnection(DATABASE_NAME); 757 retVal = retrieveByPK(pk, db); 758 } 759 finally 760 { 761 Torque.closeConnection(db); 762 } 763 return(retVal); 764 } 765 766 776 public static PaymentItem retrieveByPK(ObjectKey pk, Connection con) 777 throws TorqueException, NoRowsException, TooManyRowsException 778 { 779 Criteria criteria = buildCriteria(pk); 780 List v = doSelect(criteria, con); 781 if (v.size() == 0) 782 { 783 throw new NoRowsException("Failed to select a row."); 784 } 785 else if (v.size() > 1) 786 { 787 throw new TooManyRowsException("Failed to select only one row."); 788 } 789 else 790 { 791 return (PaymentItem)v.get(0); 792 } 793 } 794 795 802 public static List retrieveByPKs(List pks) 803 throws TorqueException 804 { 805 Connection db = null; 806 List retVal = null; 807 try 808 { 809 db = Torque.getConnection(DATABASE_NAME); 810 retVal = retrieveByPKs(pks, db); 811 } 812 finally 813 { 814 Torque.closeConnection(db); 815 } 816 return(retVal); 817 } 818 819 827 public static List retrieveByPKs( List pks, Connection dbcon ) 828 throws TorqueException 829 { 830 List objs = null; 831 if (pks == null || pks.size() == 0) 832 { 833 objs = new LinkedList (); 834 } 835 else 836 { 837 Criteria criteria = new Criteria(); 838 criteria.addIn( PAYMENT_ITEM_ID, pks ); 839 objs = doSelect(criteria, dbcon); 840 } 841 return objs; 842 } 843 844 845 846 847 848 849 850 851 852 853 864 protected static List doSelectJoinPayment(Criteria criteria) 865 throws TorqueException 866 { 867 setDbName(criteria); 868 869 PaymentItemPeer.addSelectColumns(criteria); 870 int offset = numColumns + 1; 871 PaymentPeer.addSelectColumns(criteria); 872 873 874 criteria.addJoin(PaymentItemPeer.PAYMENT_ID, 875 PaymentPeer.PAYMENT_ID); 876 877 878 879 List rows = BasePeer.doSelect(criteria); 880 List results = new ArrayList (); 881 882 for (int i = 0; i < rows.size(); i++) 883 { 884 Record row = (Record) rows.get(i); 885 886 Class omClass = PaymentItemPeer.getOMClass(); 887 PaymentItem obj1 = (PaymentItem) PaymentItemPeer 888 .row2Object(row, 1, omClass); 889 omClass = PaymentPeer.getOMClass(); 890 Payment obj2 = (Payment)PaymentPeer 891 .row2Object(row, offset, omClass); 892 893 boolean newObject = true; 894 for (int j = 0; j < results.size(); j++) 895 { 896 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 897 Payment temp_obj2 = (Payment)temp_obj1.getPayment(); 898 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 899 { 900 newObject = false; 901 temp_obj2.addPaymentItem(obj1); 902 break; 903 } 904 } 905 if (newObject) 906 { 907 obj2.initPaymentItems(); 908 obj2.addPaymentItem(obj1); 909 } 910 results.add(obj1); 911 } 912 return results; 913 } 914 915 916 917 918 929 protected static List doSelectJoinSorder(Criteria criteria) 930 throws TorqueException 931 { 932 setDbName(criteria); 933 934 PaymentItemPeer.addSelectColumns(criteria); 935 int offset = numColumns + 1; 936 SorderPeer.addSelectColumns(criteria); 937 938 939 criteria.addJoin(PaymentItemPeer.SORDER_ID, 940 SorderPeer.SORDER_ID); 941 942 943 944 List rows = BasePeer.doSelect(criteria); 945 List results = new ArrayList (); 946 947 for (int i = 0; i < rows.size(); i++) 948 { 949 Record row = (Record) rows.get(i); 950 951 Class omClass = PaymentItemPeer.getOMClass(); 952 PaymentItem obj1 = (PaymentItem) PaymentItemPeer 953 .row2Object(row, 1, omClass); 954 omClass = SorderPeer.getOMClass(); 955 Sorder obj2 = (Sorder)SorderPeer 956 .row2Object(row, offset, omClass); 957 958 boolean newObject = true; 959 for (int j = 0; j < results.size(); j++) 960 { 961 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 962 Sorder temp_obj2 = (Sorder)temp_obj1.getSorder(); 963 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 964 { 965 newObject = false; 966 temp_obj2.addPaymentItem(obj1); 967 break; 968 } 969 } 970 if (newObject) 971 { 972 obj2.initPaymentItems(); 973 obj2.addPaymentItem(obj1); 974 } 975 results.add(obj1); 976 } 977 return results; 978 } 979 980 981 982 983 994 protected static List doSelectJoinProduct(Criteria criteria) 995 throws TorqueException 996 { 997 setDbName(criteria); 998 999 PaymentItemPeer.addSelectColumns(criteria); 1000 int offset = numColumns + 1; 1001 ProductPeer.addSelectColumns(criteria); 1002 1003 1004 criteria.addJoin(PaymentItemPeer.PRODUCT_ID, 1005 ProductPeer.PRODUCT_ID); 1006 1007 1008 1009 List rows = BasePeer.doSelect(criteria); 1010 List results = new ArrayList (); 1011 1012 for (int i = 0; i < rows.size(); i++) 1013 { 1014 Record row = (Record) rows.get(i); 1015 1016 Class omClass = PaymentItemPeer.getOMClass(); 1017 PaymentItem obj1 = (PaymentItem) PaymentItemPeer 1018 .row2Object(row, 1, omClass); 1019 omClass = ProductPeer.getOMClass(); 1020 Product obj2 = (Product)ProductPeer 1021 .row2Object(row, offset, omClass); 1022 1023 boolean newObject = true; 1024 for (int j = 0; j < results.size(); j++) 1025 { 1026 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1027 Product temp_obj2 = (Product)temp_obj1.getProduct(); 1028 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1029 { 1030 newObject = false; 1031 temp_obj2.addPaymentItem(obj1); 1032 break; 1033 } 1034 } 1035 if (newObject) 1036 { 1037 obj2.initPaymentItems(); 1038 obj2.addPaymentItem(obj1); 1039 } 1040 results.add(obj1); 1041 } 1042 return results; 1043 } 1044 1045 1046 1047 1048 1059 protected static List doSelectJoinCurrency(Criteria criteria) 1060 throws TorqueException 1061 { 1062 setDbName(criteria); 1063 1064 PaymentItemPeer.addSelectColumns(criteria); 1065 int offset = numColumns + 1; 1066 CurrencyPeer.addSelectColumns(criteria); 1067 1068 1069 criteria.addJoin(PaymentItemPeer.CURRENCY_ID, 1070 CurrencyPeer.CURRENCY_ID); 1071 1072 1073 1074 List rows = BasePeer.doSelect(criteria); 1075 List results = new ArrayList (); 1076 1077 for (int i = 0; i < rows.size(); i++) 1078 { 1079 Record row = (Record) rows.get(i); 1080 1081 Class omClass = PaymentItemPeer.getOMClass(); 1082 PaymentItem obj1 = (PaymentItem) PaymentItemPeer 1083 .row2Object(row, 1, omClass); 1084 omClass = CurrencyPeer.getOMClass(); 1085 Currency obj2 = (Currency)CurrencyPeer 1086 .row2Object(row, offset, omClass); 1087 1088 boolean newObject = true; 1089 for (int j = 0; j < results.size(); j++) 1090 { 1091 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1092 Currency temp_obj2 = (Currency)temp_obj1.getCurrency(); 1093 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1094 { 1095 newObject = false; 1096 temp_obj2.addPaymentItem(obj1); 1097 break; 1098 } 1099 } 1100 if (newObject) 1101 { 1102 obj2.initPaymentItems(); 1103 obj2.addPaymentItem(obj1); 1104 } 1105 results.add(obj1); 1106 } 1107 return results; 1108 } 1109 1110 1111 1112 1113 1124 protected static List doSelectJoinCustomer(Criteria criteria) 1125 throws TorqueException 1126 { 1127 setDbName(criteria); 1128 1129 PaymentItemPeer.addSelectColumns(criteria); 1130 int offset = numColumns + 1; 1131 CustomerPeer.addSelectColumns(criteria); 1132 1133 1134 criteria.addJoin(PaymentItemPeer.CUSTOMER_ID, 1135 CustomerPeer.CUSTOMER_ID); 1136 1137 1138 1139 List rows = BasePeer.doSelect(criteria); 1140 List results = new ArrayList (); 1141 1142 for (int i = 0; i < rows.size(); i++) 1143 { 1144 Record row = (Record) rows.get(i); 1145 1146 Class omClass = PaymentItemPeer.getOMClass(); 1147 PaymentItem obj1 = (PaymentItem) PaymentItemPeer 1148 .row2Object(row, 1, omClass); 1149 omClass = CustomerPeer.getOMClass(); 1150 Customer obj2 = (Customer)CustomerPeer 1151 .row2Object(row, offset, omClass); 1152 1153 boolean newObject = true; 1154 for (int j = 0; j < results.size(); j++) 1155 { 1156 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1157 Customer temp_obj2 = (Customer)temp_obj1.getCustomer(); 1158 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1159 { 1160 newObject = false; 1161 temp_obj2.addPaymentItem(obj1); 1162 break; 1163 } 1164 } 1165 if (newObject) 1166 { 1167 obj2.initPaymentItems(); 1168 obj2.addPaymentItem(obj1); 1169 } 1170 results.add(obj1); 1171 } 1172 return results; 1173 } 1174 1175 1176 1177 1178 1189 protected static List doSelectJoinProject(Criteria criteria) 1190 throws TorqueException 1191 { 1192 setDbName(criteria); 1193 1194 PaymentItemPeer.addSelectColumns(criteria); 1195 int offset = numColumns + 1; 1196 ProjectPeer.addSelectColumns(criteria); 1197 1198 1199 criteria.addJoin(PaymentItemPeer.PROJECT_ID, 1200 ProjectPeer.PROJECT_ID); 1201 1202 1203 1204 List rows = BasePeer.doSelect(criteria); 1205 List results = new ArrayList (); 1206 1207 for (int i = 0; i < rows.size(); i++) 1208 { 1209 Record row = (Record) rows.get(i); 1210 1211 Class omClass = PaymentItemPeer.getOMClass(); 1212 PaymentItem obj1 = (PaymentItem) PaymentItemPeer 1213 .row2Object(row, 1, omClass); 1214 omClass = ProjectPeer.getOMClass(); 1215 Project obj2 = (Project)ProjectPeer 1216 .row2Object(row, offset, omClass); 1217 1218 boolean newObject = true; 1219 for (int j = 0; j < results.size(); j++) 1220 { 1221 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1222 Project temp_obj2 = (Project)temp_obj1.getProject(); 1223 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1224 { 1225 newObject = false; 1226 temp_obj2.addPaymentItem(obj1); 1227 break; 1228 } 1229 } 1230 if (newObject) 1231 { 1232 obj2.initPaymentItems(); 1233 obj2.addPaymentItem(obj1); 1234 } 1235 results.add(obj1); 1236 } 1237 return results; 1238 } 1239 1240 1241 1242 1243 1244 1245 1246 1247 1258 protected static List doSelectJoinAllExceptPayment(Criteria criteria) 1259 throws TorqueException 1260 { 1261 setDbName(criteria); 1262 1263 addSelectColumns(criteria); 1264 int offset2 = numColumns + 1; 1265 1266 1267 SorderPeer.addSelectColumns(criteria); 1268 int offset3 = offset2 + SorderPeer.numColumns; 1269 1270 ProductPeer.addSelectColumns(criteria); 1271 int offset4 = offset3 + ProductPeer.numColumns; 1272 1273 CurrencyPeer.addSelectColumns(criteria); 1274 int offset5 = offset4 + CurrencyPeer.numColumns; 1275 1276 CustomerPeer.addSelectColumns(criteria); 1277 int offset6 = offset5 + CustomerPeer.numColumns; 1278 1279 ProjectPeer.addSelectColumns(criteria); 1280 int offset7 = offset6 + ProjectPeer.numColumns; 1281 1282 List rows = BasePeer.doSelect(criteria); 1283 List results = new ArrayList (); 1284 1285 for (int i = 0; i < rows.size(); i++) 1286 { 1287 Record row = (Record)rows.get(i); 1288 1289 Class omClass = PaymentItemPeer.getOMClass(); 1290 PaymentItem obj1 = (PaymentItem)PaymentItemPeer 1291 .row2Object(row, 1, omClass); 1292 1293 1294 1295 1296 1297 omClass = SorderPeer.getOMClass(); 1298 Sorder obj2 = (Sorder)SorderPeer 1299 .row2Object( row, offset2, omClass); 1300 1301 boolean newObject = true; 1302 for (int j = 0; j < results.size(); j++) 1303 { 1304 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1305 Sorder temp_obj2 = (Sorder)temp_obj1.getSorder(); 1306 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1307 { 1308 newObject = false; 1309 temp_obj2.addPaymentItem(obj1); 1310 break; 1311 } 1312 } 1313 if (newObject) 1314 { 1315 obj2.initPaymentItems(); 1316 obj2.addPaymentItem(obj1); 1317 } 1318 1319 1320 1321 1322 omClass = ProductPeer.getOMClass(); 1323 Product obj3 = (Product)ProductPeer 1324 .row2Object( row, offset3, omClass); 1325 1326 newObject = true; 1327 for (int j = 0; j < results.size(); j++) 1328 { 1329 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1330 Product temp_obj3 = (Product)temp_obj1.getProduct(); 1331 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1332 { 1333 newObject = false; 1334 temp_obj3.addPaymentItem(obj1); 1335 break; 1336 } 1337 } 1338 if (newObject) 1339 { 1340 obj3.initPaymentItems(); 1341 obj3.addPaymentItem(obj1); 1342 } 1343 1344 1345 1346 1347 omClass = CurrencyPeer.getOMClass(); 1348 Currency obj4 = (Currency)CurrencyPeer 1349 .row2Object( row, offset4, omClass); 1350 1351 newObject = true; 1352 for (int j = 0; j < results.size(); j++) 1353 { 1354 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1355 Currency temp_obj4 = (Currency)temp_obj1.getCurrency(); 1356 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey())) 1357 { 1358 newObject = false; 1359 temp_obj4.addPaymentItem(obj1); 1360 break; 1361 } 1362 } 1363 if (newObject) 1364 { 1365 obj4.initPaymentItems(); 1366 obj4.addPaymentItem(obj1); 1367 } 1368 1369 1370 1371 1372 omClass = CustomerPeer.getOMClass(); 1373 Customer obj5 = (Customer)CustomerPeer 1374 .row2Object( row, offset5, omClass); 1375 1376 newObject = true; 1377 for (int j = 0; j < results.size(); j++) 1378 { 1379 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1380 Customer temp_obj5 = (Customer)temp_obj1.getCustomer(); 1381 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey())) 1382 { 1383 newObject = false; 1384 temp_obj5.addPaymentItem(obj1); 1385 break; 1386 } 1387 } 1388 if (newObject) 1389 { 1390 obj5.initPaymentItems(); 1391 obj5.addPaymentItem(obj1); 1392 } 1393 1394 1395 1396 1397 omClass = ProjectPeer.getOMClass(); 1398 Project obj6 = (Project)ProjectPeer 1399 .row2Object( row, offset6, omClass); 1400 1401 newObject = true; 1402 for (int j = 0; j < results.size(); j++) 1403 { 1404 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1405 Project temp_obj6 = (Project)temp_obj1.getProject(); 1406 if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey())) 1407 { 1408 newObject = false; 1409 temp_obj6.addPaymentItem(obj1); 1410 break; 1411 } 1412 } 1413 if (newObject) 1414 { 1415 obj6.initPaymentItems(); 1416 obj6.addPaymentItem(obj1); 1417 } 1418 results.add(obj1); 1419 } 1420 return results; 1421 } 1422 1423 1424 1425 1426 1427 1438 protected static List doSelectJoinAllExceptSorder(Criteria criteria) 1439 throws TorqueException 1440 { 1441 setDbName(criteria); 1442 1443 addSelectColumns(criteria); 1444 int offset2 = numColumns + 1; 1445 1446 PaymentPeer.addSelectColumns(criteria); 1447 int offset3 = offset2 + PaymentPeer.numColumns; 1448 1449 1450 ProductPeer.addSelectColumns(criteria); 1451 int offset4 = offset3 + ProductPeer.numColumns; 1452 1453 CurrencyPeer.addSelectColumns(criteria); 1454 int offset5 = offset4 + CurrencyPeer.numColumns; 1455 1456 CustomerPeer.addSelectColumns(criteria); 1457 int offset6 = offset5 + CustomerPeer.numColumns; 1458 1459 ProjectPeer.addSelectColumns(criteria); 1460 int offset7 = offset6 + ProjectPeer.numColumns; 1461 1462 List rows = BasePeer.doSelect(criteria); 1463 List results = new ArrayList (); 1464 1465 for (int i = 0; i < rows.size(); i++) 1466 { 1467 Record row = (Record)rows.get(i); 1468 1469 Class omClass = PaymentItemPeer.getOMClass(); 1470 PaymentItem obj1 = (PaymentItem)PaymentItemPeer 1471 .row2Object(row, 1, omClass); 1472 1473 1474 1475 1476 omClass = PaymentPeer.getOMClass(); 1477 Payment obj2 = (Payment)PaymentPeer 1478 .row2Object( row, offset2, omClass); 1479 1480 boolean newObject = true; 1481 for (int j = 0; j < results.size(); j++) 1482 { 1483 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1484 Payment temp_obj2 = (Payment)temp_obj1.getPayment(); 1485 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1486 { 1487 newObject = false; 1488 temp_obj2.addPaymentItem(obj1); 1489 break; 1490 } 1491 } 1492 if (newObject) 1493 { 1494 obj2.initPaymentItems(); 1495 obj2.addPaymentItem(obj1); 1496 } 1497 1498 1499 1500 1501 1502 omClass = ProductPeer.getOMClass(); 1503 Product obj3 = (Product)ProductPeer 1504 .row2Object( row, offset3, omClass); 1505 1506 newObject = true; 1507 for (int j = 0; j < results.size(); j++) 1508 { 1509 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1510 Product temp_obj3 = (Product)temp_obj1.getProduct(); 1511 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1512 { 1513 newObject = false; 1514 temp_obj3.addPaymentItem(obj1); 1515 break; 1516 } 1517 } 1518 if (newObject) 1519 { 1520 obj3.initPaymentItems(); 1521 obj3.addPaymentItem(obj1); 1522 } 1523 1524 1525 1526 1527 omClass = CurrencyPeer.getOMClass(); 1528 Currency obj4 = (Currency)CurrencyPeer 1529 .row2Object( row, offset4, omClass); 1530 1531 newObject = true; 1532 for (int j = 0; j < results.size(); j++) 1533 { 1534 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1535 Currency temp_obj4 = (Currency)temp_obj1.getCurrency(); 1536 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey())) 1537 { 1538 newObject = false; 1539 temp_obj4.addPaymentItem(obj1); 1540 break; 1541 } 1542 } 1543 if (newObject) 1544 { 1545 obj4.initPaymentItems(); 1546 obj4.addPaymentItem(obj1); 1547 } 1548 1549 1550 1551 1552 omClass = CustomerPeer.getOMClass(); 1553 Customer obj5 = (Customer)CustomerPeer 1554 .row2Object( row, offset5, omClass); 1555 1556 newObject = true; 1557 for (int j = 0; j < results.size(); j++) 1558 { 1559 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1560 Customer temp_obj5 = (Customer)temp_obj1.getCustomer(); 1561 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey())) 1562 { 1563 newObject = false; 1564 temp_obj5.addPaymentItem(obj1); 1565 break; 1566 } 1567 } 1568 if (newObject) 1569 { 1570 obj5.initPaymentItems(); 1571 obj5.addPaymentItem(obj1); 1572 } 1573 1574 1575 1576 1577 omClass = ProjectPeer.getOMClass(); 1578 Project obj6 = (Project)ProjectPeer 1579 .row2Object( row, offset6, omClass); 1580 1581 newObject = true; 1582 for (int j = 0; j < results.size(); j++) 1583 { 1584 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1585 Project temp_obj6 = (Project)temp_obj1.getProject(); 1586 if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey())) 1587 { 1588 newObject = false; 1589 temp_obj6.addPaymentItem(obj1); 1590 break; 1591 } 1592 } 1593 if (newObject) 1594 { 1595 obj6.initPaymentItems(); 1596 obj6.addPaymentItem(obj1); 1597 } 1598 results.add(obj1); 1599 } 1600 return results; 1601 } 1602 1603 1604 1605 1606 1607 1618 protected static List doSelectJoinAllExceptProduct(Criteria criteria) 1619 throws TorqueException 1620 { 1621 setDbName(criteria); 1622 1623 addSelectColumns(criteria); 1624 int offset2 = numColumns + 1; 1625 1626 PaymentPeer.addSelectColumns(criteria); 1627 int offset3 = offset2 + PaymentPeer.numColumns; 1628 1629 SorderPeer.addSelectColumns(criteria); 1630 int offset4 = offset3 + SorderPeer.numColumns; 1631 1632 1633 CurrencyPeer.addSelectColumns(criteria); 1634 int offset5 = offset4 + CurrencyPeer.numColumns; 1635 1636 CustomerPeer.addSelectColumns(criteria); 1637 int offset6 = offset5 + CustomerPeer.numColumns; 1638 1639 ProjectPeer.addSelectColumns(criteria); 1640 int offset7 = offset6 + ProjectPeer.numColumns; 1641 1642 List rows = BasePeer.doSelect(criteria); 1643 List results = new ArrayList (); 1644 1645 for (int i = 0; i < rows.size(); i++) 1646 { 1647 Record row = (Record)rows.get(i); 1648 1649 Class omClass = PaymentItemPeer.getOMClass(); 1650 PaymentItem obj1 = (PaymentItem)PaymentItemPeer 1651 .row2Object(row, 1, omClass); 1652 1653 1654 1655 1656 omClass = PaymentPeer.getOMClass(); 1657 Payment obj2 = (Payment)PaymentPeer 1658 .row2Object( row, offset2, omClass); 1659 1660 boolean newObject = true; 1661 for (int j = 0; j < results.size(); j++) 1662 { 1663 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1664 Payment temp_obj2 = (Payment)temp_obj1.getPayment(); 1665 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1666 { 1667 newObject = false; 1668 temp_obj2.addPaymentItem(obj1); 1669 break; 1670 } 1671 } 1672 if (newObject) 1673 { 1674 obj2.initPaymentItems(); 1675 obj2.addPaymentItem(obj1); 1676 } 1677 1678 1679 1680 1681 omClass = SorderPeer.getOMClass(); 1682 Sorder obj3 = (Sorder)SorderPeer 1683 .row2Object( row, offset3, omClass); 1684 1685 newObject = true; 1686 for (int j = 0; j < results.size(); j++) 1687 { 1688 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1689 Sorder temp_obj3 = (Sorder)temp_obj1.getSorder(); 1690 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1691 { 1692 newObject = false; 1693 temp_obj3.addPaymentItem(obj1); 1694 break; 1695 } 1696 } 1697 if (newObject) 1698 { 1699 obj3.initPaymentItems(); 1700 obj3.addPaymentItem(obj1); 1701 } 1702 1703 1704 1705 1706 1707 omClass = CurrencyPeer.getOMClass(); 1708 Currency obj4 = (Currency)CurrencyPeer 1709 .row2Object( row, offset4, omClass); 1710 1711 newObject = true; 1712 for (int j = 0; j < results.size(); j++) 1713 { 1714 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1715 Currency temp_obj4 = (Currency)temp_obj1.getCurrency(); 1716 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey())) 1717 { 1718 newObject = false; 1719 temp_obj4.addPaymentItem(obj1); 1720 break; 1721 } 1722 } 1723 if (newObject) 1724 { 1725 obj4.initPaymentItems(); 1726 obj4.addPaymentItem(obj1); 1727 } 1728 1729 1730 1731 1732 omClass = CustomerPeer.getOMClass(); 1733 Customer obj5 = (Customer)CustomerPeer 1734 .row2Object( row, offset5, omClass); 1735 1736 newObject = true; 1737 for (int j = 0; j < results.size(); j++) 1738 { 1739 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1740 Customer temp_obj5 = (Customer)temp_obj1.getCustomer(); 1741 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey())) 1742 { 1743 newObject = false; 1744 temp_obj5.addPaymentItem(obj1); 1745 break; 1746 } 1747 } 1748 if (newObject) 1749 { 1750 obj5.initPaymentItems(); 1751 obj5.addPaymentItem(obj1); 1752 } 1753 1754 1755 1756 1757 omClass = ProjectPeer.getOMClass(); 1758 Project obj6 = (Project)ProjectPeer 1759 .row2Object( row, offset6, omClass); 1760 1761 newObject = true; 1762 for (int j = 0; j < results.size(); j++) 1763 { 1764 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1765 Project temp_obj6 = (Project)temp_obj1.getProject(); 1766 if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey())) 1767 { 1768 newObject = false; 1769 temp_obj6.addPaymentItem(obj1); 1770 break; 1771 } 1772 } 1773 if (newObject) 1774 { 1775 obj6.initPaymentItems(); 1776 obj6.addPaymentItem(obj1); 1777 } 1778 results.add(obj1); 1779 } 1780 return results; 1781 } 1782 1783 1784 1785 1786 1787 1798 protected static List doSelectJoinAllExceptCurrency(Criteria criteria) 1799 throws TorqueException 1800 { 1801 setDbName(criteria); 1802 1803 addSelectColumns(criteria); 1804 int offset2 = numColumns + 1; 1805 1806 PaymentPeer.addSelectColumns(criteria); 1807 int offset3 = offset2 + PaymentPeer.numColumns; 1808 1809 SorderPeer.addSelectColumns(criteria); 1810 int offset4 = offset3 + SorderPeer.numColumns; 1811 1812 ProductPeer.addSelectColumns(criteria); 1813 int offset5 = offset4 + ProductPeer.numColumns; 1814 1815 1816 CustomerPeer.addSelectColumns(criteria); 1817 int offset6 = offset5 + CustomerPeer.numColumns; 1818 1819 ProjectPeer.addSelectColumns(criteria); 1820 int offset7 = offset6 + ProjectPeer.numColumns; 1821 1822 List rows = BasePeer.doSelect(criteria); 1823 List results = new ArrayList (); 1824 1825 for (int i = 0; i < rows.size(); i++) 1826 { 1827 Record row = (Record)rows.get(i); 1828 1829 Class omClass = PaymentItemPeer.getOMClass(); 1830 PaymentItem obj1 = (PaymentItem)PaymentItemPeer 1831 .row2Object(row, 1, omClass); 1832 1833 1834 1835 1836 omClass = PaymentPeer.getOMClass(); 1837 Payment obj2 = (Payment)PaymentPeer 1838 .row2Object( row, offset2, omClass); 1839 1840 boolean newObject = true; 1841 for (int j = 0; j < results.size(); j++) 1842 { 1843 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1844 Payment temp_obj2 = (Payment)temp_obj1.getPayment(); 1845 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1846 { 1847 newObject = false; 1848 temp_obj2.addPaymentItem(obj1); 1849 break; 1850 } 1851 } 1852 if (newObject) 1853 { 1854 obj2.initPaymentItems(); 1855 obj2.addPaymentItem(obj1); 1856 } 1857 1858 1859 1860 1861 omClass = SorderPeer.getOMClass(); 1862 Sorder obj3 = (Sorder)SorderPeer 1863 .row2Object( row, offset3, omClass); 1864 1865 newObject = true; 1866 for (int j = 0; j < results.size(); j++) 1867 { 1868 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1869 Sorder temp_obj3 = (Sorder)temp_obj1.getSorder(); 1870 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1871 { 1872 newObject = false; 1873 temp_obj3.addPaymentItem(obj1); 1874 break; 1875 } 1876 } 1877 if (newObject) 1878 { 1879 obj3.initPaymentItems(); 1880 obj3.addPaymentItem(obj1); 1881 } 1882 1883 1884 1885 1886 omClass = ProductPeer.getOMClass(); 1887 Product obj4 = (Product)ProductPeer 1888 .row2Object( row, offset4, omClass); 1889 1890 newObject = true; 1891 for (int j = 0; j < results.size(); j++) 1892 { 1893 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1894 Product temp_obj4 = (Product)temp_obj1.getProduct(); 1895 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey())) 1896 { 1897 newObject = false; 1898 temp_obj4.addPaymentItem(obj1); 1899 break; 1900 } 1901 } 1902 if (newObject) 1903 { 1904 obj4.initPaymentItems(); 1905 obj4.addPaymentItem(obj1); 1906 } 1907 1908 1909 1910 1911 1912 omClass = CustomerPeer.getOMClass(); 1913 Customer obj5 = (Customer)CustomerPeer 1914 .row2Object( row, offset5, omClass); 1915 1916 newObject = true; 1917 for (int j = 0; j < results.size(); j++) 1918 { 1919 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1920 Customer temp_obj5 = (Customer)temp_obj1.getCustomer(); 1921 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey())) 1922 { 1923 newObject = false; 1924 temp_obj5.addPaymentItem(obj1); 1925 break; 1926 } 1927 } 1928 if (newObject) 1929 { 1930 obj5.initPaymentItems(); 1931 obj5.addPaymentItem(obj1); 1932 } 1933 1934 1935 1936 1937 omClass = ProjectPeer.getOMClass(); 1938 Project obj6 = (Project)ProjectPeer 1939 .row2Object( row, offset6, omClass); 1940 1941 newObject = true; 1942 for (int j = 0; j < results.size(); j++) 1943 { 1944 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 1945 Project temp_obj6 = (Project)temp_obj1.getProject(); 1946 if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey())) 1947 { 1948 newObject = false; 1949 temp_obj6.addPaymentItem(obj1); 1950 break; 1951 } 1952 } 1953 if (newObject) 1954 { 1955 obj6.initPaymentItems(); 1956 obj6.addPaymentItem(obj1); 1957 } 1958 results.add(obj1); 1959 } 1960 return results; 1961 } 1962 1963 1964 1965 1966 1967 1978 protected static List doSelectJoinAllExceptCustomer(Criteria criteria) 1979 throws TorqueException 1980 { 1981 setDbName(criteria); 1982 1983 addSelectColumns(criteria); 1984 int offset2 = numColumns + 1; 1985 1986 PaymentPeer.addSelectColumns(criteria); 1987 int offset3 = offset2 + PaymentPeer.numColumns; 1988 1989 SorderPeer.addSelectColumns(criteria); 1990 int offset4 = offset3 + SorderPeer.numColumns; 1991 1992 ProductPeer.addSelectColumns(criteria); 1993 int offset5 = offset4 + ProductPeer.numColumns; 1994 1995 CurrencyPeer.addSelectColumns(criteria); 1996 int offset6 = offset5 + CurrencyPeer.numColumns; 1997 1998 1999 ProjectPeer.addSelectColumns(criteria); 2000 int offset7 = offset6 + ProjectPeer.numColumns; 2001 2002 List rows = BasePeer.doSelect(criteria); 2003 List results = new ArrayList (); 2004 2005 for (int i = 0; i < rows.size(); i++) 2006 { 2007 Record row = (Record)rows.get(i); 2008 2009 Class omClass = PaymentItemPeer.getOMClass(); 2010 PaymentItem obj1 = (PaymentItem)PaymentItemPeer 2011 .row2Object(row, 1, omClass); 2012 2013 2014 2015 2016 omClass = PaymentPeer.getOMClass(); 2017 Payment obj2 = (Payment)PaymentPeer 2018 .row2Object( row, offset2, omClass); 2019 2020 boolean newObject = true; 2021 for (int j = 0; j < results.size(); j++) 2022 { 2023 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2024 Payment temp_obj2 = (Payment)temp_obj1.getPayment(); 2025 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 2026 { 2027 newObject = false; 2028 temp_obj2.addPaymentItem(obj1); 2029 break; 2030 } 2031 } 2032 if (newObject) 2033 { 2034 obj2.initPaymentItems(); 2035 obj2.addPaymentItem(obj1); 2036 } 2037 2038 2039 2040 2041 omClass = SorderPeer.getOMClass(); 2042 Sorder obj3 = (Sorder)SorderPeer 2043 .row2Object( row, offset3, omClass); 2044 2045 newObject = true; 2046 for (int j = 0; j < results.size(); j++) 2047 { 2048 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2049 Sorder temp_obj3 = (Sorder)temp_obj1.getSorder(); 2050 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 2051 { 2052 newObject = false; 2053 temp_obj3.addPaymentItem(obj1); 2054 break; 2055 } 2056 } 2057 if (newObject) 2058 { 2059 obj3.initPaymentItems(); 2060 obj3.addPaymentItem(obj1); 2061 } 2062 2063 2064 2065 2066 omClass = ProductPeer.getOMClass(); 2067 Product obj4 = (Product)ProductPeer 2068 .row2Object( row, offset4, omClass); 2069 2070 newObject = true; 2071 for (int j = 0; j < results.size(); j++) 2072 { 2073 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2074 Product temp_obj4 = (Product)temp_obj1.getProduct(); 2075 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey())) 2076 { 2077 newObject = false; 2078 temp_obj4.addPaymentItem(obj1); 2079 break; 2080 } 2081 } 2082 if (newObject) 2083 { 2084 obj4.initPaymentItems(); 2085 obj4.addPaymentItem(obj1); 2086 } 2087 2088 2089 2090 2091 omClass = CurrencyPeer.getOMClass(); 2092 Currency obj5 = (Currency)CurrencyPeer 2093 .row2Object( row, offset5, omClass); 2094 2095 newObject = true; 2096 for (int j = 0; j < results.size(); j++) 2097 { 2098 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2099 Currency temp_obj5 = (Currency)temp_obj1.getCurrency(); 2100 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey())) 2101 { 2102 newObject = false; 2103 temp_obj5.addPaymentItem(obj1); 2104 break; 2105 } 2106 } 2107 if (newObject) 2108 { 2109 obj5.initPaymentItems(); 2110 obj5.addPaymentItem(obj1); 2111 } 2112 2113 2114 2115 2116 2117 omClass = ProjectPeer.getOMClass(); 2118 Project obj6 = (Project)ProjectPeer 2119 .row2Object( row, offset6, omClass); 2120 2121 newObject = true; 2122 for (int j = 0; j < results.size(); j++) 2123 { 2124 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2125 Project temp_obj6 = (Project)temp_obj1.getProject(); 2126 if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey())) 2127 { 2128 newObject = false; 2129 temp_obj6.addPaymentItem(obj1); 2130 break; 2131 } 2132 } 2133 if (newObject) 2134 { 2135 obj6.initPaymentItems(); 2136 obj6.addPaymentItem(obj1); 2137 } 2138 results.add(obj1); 2139 } 2140 return results; 2141 } 2142 2143 2144 2145 2146 2147 2158 protected static List doSelectJoinAllExceptProject(Criteria criteria) 2159 throws TorqueException 2160 { 2161 setDbName(criteria); 2162 2163 addSelectColumns(criteria); 2164 int offset2 = numColumns + 1; 2165 2166 PaymentPeer.addSelectColumns(criteria); 2167 int offset3 = offset2 + PaymentPeer.numColumns; 2168 2169 SorderPeer.addSelectColumns(criteria); 2170 int offset4 = offset3 + SorderPeer.numColumns; 2171 2172 ProductPeer.addSelectColumns(criteria); 2173 int offset5 = offset4 + ProductPeer.numColumns; 2174 2175 CurrencyPeer.addSelectColumns(criteria); 2176 int offset6 = offset5 + CurrencyPeer.numColumns; 2177 2178 CustomerPeer.addSelectColumns(criteria); 2179 int offset7 = offset6 + CustomerPeer.numColumns; 2180 2181 2182 List rows = BasePeer.doSelect(criteria); 2183 List results = new ArrayList (); 2184 2185 for (int i = 0; i < rows.size(); i++) 2186 { 2187 Record row = (Record)rows.get(i); 2188 2189 Class omClass = PaymentItemPeer.getOMClass(); 2190 PaymentItem obj1 = (PaymentItem)PaymentItemPeer 2191 .row2Object(row, 1, omClass); 2192 2193 2194 2195 2196 omClass = PaymentPeer.getOMClass(); 2197 Payment obj2 = (Payment)PaymentPeer 2198 .row2Object( row, offset2, omClass); 2199 2200 boolean newObject = true; 2201 for (int j = 0; j < results.size(); j++) 2202 { 2203 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2204 Payment temp_obj2 = (Payment)temp_obj1.getPayment(); 2205 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 2206 { 2207 newObject = false; 2208 temp_obj2.addPaymentItem(obj1); 2209 break; 2210 } 2211 } 2212 if (newObject) 2213 { 2214 obj2.initPaymentItems(); 2215 obj2.addPaymentItem(obj1); 2216 } 2217 2218 2219 2220 2221 omClass = SorderPeer.getOMClass(); 2222 Sorder obj3 = (Sorder)SorderPeer 2223 .row2Object( row, offset3, omClass); 2224 2225 newObject = true; 2226 for (int j = 0; j < results.size(); j++) 2227 { 2228 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2229 Sorder temp_obj3 = (Sorder)temp_obj1.getSorder(); 2230 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 2231 { 2232 newObject = false; 2233 temp_obj3.addPaymentItem(obj1); 2234 break; 2235 } 2236 } 2237 if (newObject) 2238 { 2239 obj3.initPaymentItems(); 2240 obj3.addPaymentItem(obj1); 2241 } 2242 2243 2244 2245 2246 omClass = ProductPeer.getOMClass(); 2247 Product obj4 = (Product)ProductPeer 2248 .row2Object( row, offset4, omClass); 2249 2250 newObject = true; 2251 for (int j = 0; j < results.size(); j++) 2252 { 2253 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2254 Product temp_obj4 = (Product)temp_obj1.getProduct(); 2255 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey())) 2256 { 2257 newObject = false; 2258 temp_obj4.addPaymentItem(obj1); 2259 break; 2260 } 2261 } 2262 if (newObject) 2263 { 2264 obj4.initPaymentItems(); 2265 obj4.addPaymentItem(obj1); 2266 } 2267 2268 2269 2270 2271 omClass = CurrencyPeer.getOMClass(); 2272 Currency obj5 = (Currency)CurrencyPeer 2273 .row2Object( row, offset5, omClass); 2274 2275 newObject = true; 2276 for (int j = 0; j < results.size(); j++) 2277 { 2278 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2279 Currency temp_obj5 = (Currency)temp_obj1.getCurrency(); 2280 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey())) 2281 { 2282 newObject = false; 2283 temp_obj5.addPaymentItem(obj1); 2284 break; 2285 } 2286 } 2287 if (newObject) 2288 { 2289 obj5.initPaymentItems(); 2290 obj5.addPaymentItem(obj1); 2291 } 2292 2293 2294 2295 2296 omClass = CustomerPeer.getOMClass(); 2297 Customer obj6 = (Customer)CustomerPeer 2298 .row2Object( row, offset6, omClass); 2299 2300 newObject = true; 2301 for (int j = 0; j < results.size(); j++) 2302 { 2303 PaymentItem temp_obj1 = (PaymentItem)results.get(j); 2304 Customer temp_obj6 = (Customer)temp_obj1.getCustomer(); 2305 if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey())) 2306 { 2307 newObject = false; 2308 temp_obj6.addPaymentItem(obj1); 2309 break; 2310 } 2311 } 2312 if (newObject) 2313 { 2314 obj6.initPaymentItems(); 2315 obj6.addPaymentItem(obj1); 2316 } 2317 2318 results.add(obj1); 2319 } 2320 return results; 2321 } 2322 2323 2324 2331 protected static TableMap getTableMap() 2332 throws TorqueException 2333 { 2334 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME); 2335 } 2336 2337 private static void setDbName(Criteria crit) 2338 { 2339 if (crit.getDbName() == Torque.getDefaultDB()) 2343 { 2344 crit.setDbName(DATABASE_NAME); 2345 } 2346 } 2347} 2348
| Popular Tags
|