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 43 public abstract class BaseTurbineUserGroupRolePeer 44 extends BasePeer 45 { 46 47 48 public static final String DATABASE_NAME = "cream"; 49 50 51 public static final String TABLE_NAME = "TURBINE_USER_GROUP_ROLE"; 52 53 58 public static MapBuilder getMapBuilder() 59 throws TorqueException 60 { 61 return getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME); 62 } 63 64 65 public static final String USER_ID; 66 67 public static final String GROUP_ID; 68 69 public static final String ROLE_ID; 70 71 static 72 { 73 USER_ID = "TURBINE_USER_GROUP_ROLE.USER_ID"; 74 GROUP_ID = "TURBINE_USER_GROUP_ROLE.GROUP_ID"; 75 ROLE_ID = "TURBINE_USER_GROUP_ROLE.ROLE_ID"; 76 if (Torque.isInit()) 77 { 78 try 79 { 80 getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME); 81 } 82 catch (Exception e) 83 { 84 log.error("Could not initialize Peer", e); 85 } 86 } 87 else 88 { 89 Torque.registerMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME); 90 } 91 } 92 93 94 public static final int numColumns = 3; 95 96 97 protected static final String CLASSNAME_DEFAULT = 98 "org.campware.cream.om.TurbineUserGroupRole"; 99 100 101 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT); 102 103 109 private static Class initClass(String className) 110 { 111 Class c = null; 112 try 113 { 114 c = Class.forName(className); 115 } 116 catch (Throwable t) 117 { 118 log.error("A FATAL ERROR has occurred which should not " 119 + "have happened under any circumstance. Please notify " 120 + "the Torque developers <torque-dev@db.apache.org> " 121 + "and give as many details as possible (including the error " 122 + "stack trace).", t); 123 124 if (t instanceof Error ) 126 { 127 throw (Error ) t.fillInStackTrace(); 128 } 129 } 130 return c; 131 } 132 133 143 public static List resultSet2Objects(java.sql.ResultSet results) 144 throws TorqueException 145 { 146 try 147 { 148 QueryDataSet qds = null; 149 List rows = null; 150 try 151 { 152 qds = new QueryDataSet(results); 153 rows = getSelectResults(qds); 154 } 155 finally 156 { 157 if (qds != null) 158 { 159 qds.close(); 160 } 161 } 162 163 return populateObjects(rows); 164 } 165 catch (SQLException e) 166 { 167 throw new TorqueException(e); 168 } 169 catch (DataSetException e) 170 { 171 throw new TorqueException(e); 172 } 173 } 174 175 176 177 184 public static ObjectKey doInsert(Criteria criteria) 185 throws TorqueException 186 { 187 return BaseTurbineUserGroupRolePeer 188 .doInsert(criteria, (Connection ) null); 189 } 190 191 201 public static ObjectKey doInsert(Criteria criteria, Connection con) 202 throws TorqueException 203 { 204 205 setDbName(criteria); 206 207 if (con == null) 208 { 209 return BasePeer.doInsert(criteria); 210 } 211 else 212 { 213 return BasePeer.doInsert(criteria, con); 214 } 215 } 216 217 224 public static void addSelectColumns(Criteria criteria) 225 throws TorqueException 226 { 227 criteria.addSelectColumn(USER_ID); 228 criteria.addSelectColumn(GROUP_ID); 229 criteria.addSelectColumn(ROLE_ID); 230 } 231 232 241 public static TurbineUserGroupRole row2Object(Record row, 242 int offset, 243 Class cls) 244 throws TorqueException 245 { 246 try 247 { 248 TurbineUserGroupRole obj = (TurbineUserGroupRole) cls.newInstance(); 249 TurbineUserGroupRolePeer.populateObject(row, offset, obj); 250 obj.setModified(false); 251 obj.setNew(false); 252 253 return obj; 254 } 255 catch (InstantiationException e) 256 { 257 throw new TorqueException(e); 258 } 259 catch (IllegalAccessException e) 260 { 261 throw new TorqueException(e); 262 } 263 } 264 265 274 public static void populateObject(Record row, 275 int offset, 276 TurbineUserGroupRole obj) 277 throws TorqueException 278 { 279 try 280 { 281 obj.setUserId(row.getValue(offset + 0).asInt()); 282 obj.setGroupId(row.getValue(offset + 1).asInt()); 283 obj.setRoleId(row.getValue(offset + 2).asInt()); 284 } 285 catch (DataSetException e) 286 { 287 throw new TorqueException(e); 288 } 289 } 290 291 299 public static List doSelect(Criteria criteria) throws TorqueException 300 { 301 return populateObjects(doSelectVillageRecords(criteria)); 302 } 303 304 313 public static List doSelect(Criteria criteria, Connection con) 314 throws TorqueException 315 { 316 return populateObjects(doSelectVillageRecords(criteria, con)); 317 } 318 319 329 public static List doSelectVillageRecords(Criteria criteria) 330 throws TorqueException 331 { 332 return BaseTurbineUserGroupRolePeer 333 .doSelectVillageRecords(criteria, (Connection ) null); 334 } 335 336 345 public static List doSelectVillageRecords(Criteria criteria, Connection con) 346 throws TorqueException 347 { 348 if (criteria.getSelectColumns().size() == 0) 349 { 350 addSelectColumns(criteria); 351 } 352 353 354 setDbName(criteria); 355 356 if (con == null) 359 { 360 return BasePeer.doSelect(criteria); 361 } 362 else 363 { 364 return BasePeer.doSelect(criteria, con); 365 } 366 } 367 368 375 public static List populateObjects(List records) 376 throws TorqueException 377 { 378 List results = new ArrayList (records.size()); 379 380 for (int i = 0; i < records.size(); i++) 382 { 383 Record row = (Record) records.get(i); 384 results.add(TurbineUserGroupRolePeer.row2Object(row, 1, 385 TurbineUserGroupRolePeer.getOMClass())); 386 } 387 return results; 388 } 389 390 391 399 public static Class getOMClass() 400 throws TorqueException 401 { 402 return CLASS_DEFAULT; 403 } 404 405 413 public static void doUpdate(Criteria criteria) throws TorqueException 414 { 415 BaseTurbineUserGroupRolePeer 416 .doUpdate(criteria, (Connection ) null); 417 } 418 419 430 public static void doUpdate(Criteria criteria, Connection con) 431 throws TorqueException 432 { 433 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2); 434 selectCriteria.put(USER_ID, criteria.remove(USER_ID)); 435 selectCriteria.put(GROUP_ID, criteria.remove(GROUP_ID)); 436 selectCriteria.put(ROLE_ID, criteria.remove(ROLE_ID)); 437 438 setDbName(criteria); 439 440 if (con == null) 441 { 442 BasePeer.doUpdate(selectCriteria, criteria); 443 } 444 else 445 { 446 BasePeer.doUpdate(selectCriteria, criteria, con); 447 } 448 } 449 450 457 public static void doDelete(Criteria criteria) throws TorqueException 458 { 459 TurbineUserGroupRolePeer 460 .doDelete(criteria, (Connection ) null); 461 } 462 463 473 public static void doDelete(Criteria criteria, Connection con) 474 throws TorqueException 475 { 476 477 setDbName(criteria); 478 479 if (con == null) 480 { 481 BasePeer.doDelete(criteria); 482 } 483 else 484 { 485 BasePeer.doDelete(criteria, con); 486 } 487 } 488 489 495 public static List doSelect(TurbineUserGroupRole obj) throws TorqueException 496 { 497 return doSelect(buildSelectCriteria(obj)); 498 } 499 500 506 public static void doInsert(TurbineUserGroupRole obj) throws TorqueException 507 { 508 doInsert(buildCriteria(obj)); 509 obj.setNew(false); 510 obj.setModified(false); 511 } 512 513 518 public static void doUpdate(TurbineUserGroupRole obj) throws TorqueException 519 { 520 doUpdate(buildCriteria(obj)); 521 obj.setModified(false); 522 } 523 524 529 public static void doDelete(TurbineUserGroupRole obj) throws TorqueException 530 { 531 doDelete(buildSelectCriteria(obj)); 532 } 533 534 544 public static void doInsert(TurbineUserGroupRole obj, Connection con) 545 throws TorqueException 546 { 547 doInsert(buildCriteria(obj), con); 548 obj.setNew(false); 549 obj.setModified(false); 550 } 551 552 562 public static void doUpdate(TurbineUserGroupRole obj, Connection con) 563 throws TorqueException 564 { 565 doUpdate(buildCriteria(obj), con); 566 obj.setModified(false); 567 } 568 569 579 public static void doDelete(TurbineUserGroupRole obj, Connection con) 580 throws TorqueException 581 { 582 doDelete(buildSelectCriteria(obj), con); 583 } 584 585 592 public static void doDelete(ObjectKey pk) throws TorqueException 593 { 594 BaseTurbineUserGroupRolePeer 595 .doDelete(pk, (Connection ) null); 596 } 597 598 608 public static void doDelete(ObjectKey pk, Connection con) 609 throws TorqueException 610 { 611 doDelete(buildCriteria(pk), con); 612 } 613 614 615 public static Criteria buildCriteria( ObjectKey pk ) 616 { 617 Criteria criteria = new Criteria(); 618 SimpleKey[] keys = (SimpleKey[])pk.getValue(); 619 criteria.add(USER_ID, keys[0]); 620 criteria.add(GROUP_ID, keys[1]); 621 criteria.add(ROLE_ID, keys[2]); 622 return criteria; 623 } 624 625 626 public static Criteria buildCriteria( TurbineUserGroupRole obj ) 627 { 628 Criteria criteria = new Criteria(DATABASE_NAME); 629 criteria.add(USER_ID, obj.getUserId()); 630 criteria.add(GROUP_ID, obj.getGroupId()); 631 criteria.add(ROLE_ID, obj.getRoleId()); 632 return criteria; 633 } 634 635 636 public static Criteria buildSelectCriteria( TurbineUserGroupRole obj ) 637 { 638 Criteria criteria = new Criteria(DATABASE_NAME); 639 criteria.add(USER_ID, obj.getUserId()); 640 criteria.add(GROUP_ID, obj.getGroupId()); 641 criteria.add(ROLE_ID, obj.getRoleId()); 642 return criteria; 643 } 644 645 646 647 656 public static TurbineUserGroupRole retrieveByPK(ObjectKey pk) 657 throws TorqueException, NoRowsException, TooManyRowsException 658 { 659 Connection db = null; 660 TurbineUserGroupRole retVal = null; 661 try 662 { 663 db = Torque.getConnection(DATABASE_NAME); 664 retVal = retrieveByPK(pk, db); 665 } 666 finally 667 { 668 Torque.closeConnection(db); 669 } 670 return(retVal); 671 } 672 673 683 public static TurbineUserGroupRole retrieveByPK(ObjectKey pk, Connection con) 684 throws TorqueException, NoRowsException, TooManyRowsException 685 { 686 Criteria criteria = buildCriteria(pk); 687 List v = doSelect(criteria, con); 688 if (v.size() == 0) 689 { 690 throw new NoRowsException("Failed to select a row."); 691 } 692 else if (v.size() > 1) 693 { 694 throw new TooManyRowsException("Failed to select only one row."); 695 } 696 else 697 { 698 return (TurbineUserGroupRole)v.get(0); 699 } 700 } 701 702 709 public static List retrieveByPKs(List pks) 710 throws TorqueException 711 { 712 Connection db = null; 713 List retVal = null; 714 try 715 { 716 db = Torque.getConnection(DATABASE_NAME); 717 retVal = retrieveByPKs(pks, db); 718 } 719 finally 720 { 721 Torque.closeConnection(db); 722 } 723 return(retVal); 724 } 725 726 734 public static List retrieveByPKs( List pks, Connection dbcon ) 735 throws TorqueException 736 { 737 List objs = null; 738 if (pks == null || pks.size() == 0) 739 { 740 objs = new LinkedList (); 741 } 742 else 743 { 744 Criteria criteria = new Criteria(); 745 Iterator iter = pks.iterator(); 746 while (iter.hasNext()) 747 { 748 ObjectKey pk = (ObjectKey)iter.next(); 749 SimpleKey[] keys = (SimpleKey[])pk.getValue(); 750 Criteria.Criterion c0 = criteria.getNewCriterion( 751 USER_ID, keys[0], Criteria.EQUAL); 752 Criteria.Criterion c1 = criteria.getNewCriterion( 753 GROUP_ID, keys[1], Criteria.EQUAL); 754 c0.and(c1); 755 Criteria.Criterion c2 = criteria.getNewCriterion( 756 ROLE_ID, keys[2], Criteria.EQUAL); 757 c1.and(c2); 758 criteria.or(c0); 759 } 760 objs = doSelect(criteria, dbcon); 761 } 762 return objs; 763 } 764 765 766 773 public static TurbineUserGroupRole retrieveByPK( 774 int user_id 775 , int group_id 776 , int role_id 777 ) throws TorqueException 778 { 779 Connection db = null; 780 TurbineUserGroupRole retVal = null; 781 try 782 { 783 db = Torque.getConnection(DATABASE_NAME); 784 retVal = retrieveByPK( 785 user_id 786 , group_id 787 , role_id 788 , db); 789 } 790 finally 791 { 792 Torque.closeConnection(db); 793 } 794 return(retVal); 795 } 796 797 805 public static TurbineUserGroupRole retrieveByPK( 806 int user_id 807 , int group_id 808 , int role_id 809 ,Connection con) throws TorqueException 810 { 811 812 Criteria criteria = new Criteria(5); 813 criteria.add(USER_ID, user_id); 814 criteria.add(GROUP_ID, group_id); 815 criteria.add(ROLE_ID, role_id); 816 List v = doSelect(criteria, con); 817 if (v.size() != 1) 818 { 819 throw new TorqueException("Failed to select one and only one row."); 820 } 821 else 822 { 823 return (TurbineUserGroupRole) v.get(0); 824 } 825 } 826 827 828 829 830 831 832 833 834 845 protected static List doSelectJoinTurbineUser(Criteria criteria) 846 throws TorqueException 847 { 848 setDbName(criteria); 849 850 TurbineUserGroupRolePeer.addSelectColumns(criteria); 851 int offset = numColumns + 1; 852 TurbineUserPeer.addSelectColumns(criteria); 853 854 855 criteria.addJoin(TurbineUserGroupRolePeer.USER_ID, 856 TurbineUserPeer.USER_ID); 857 858 859 860 List rows = BasePeer.doSelect(criteria); 861 List results = new ArrayList (); 862 863 for (int i = 0; i < rows.size(); i++) 864 { 865 Record row = (Record) rows.get(i); 866 867 Class omClass = TurbineUserGroupRolePeer.getOMClass(); 868 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer 869 .row2Object(row, 1, omClass); 870 omClass = TurbineUserPeer.getOMClass(); 871 TurbineUser obj2 = (TurbineUser)TurbineUserPeer 872 .row2Object(row, offset, omClass); 873 874 boolean newObject = true; 875 for (int j = 0; j < results.size(); j++) 876 { 877 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 878 TurbineUser temp_obj2 = (TurbineUser)temp_obj1.getTurbineUser(); 879 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 880 { 881 newObject = false; 882 temp_obj2.addTurbineUserGroupRole(obj1); 883 break; 884 } 885 } 886 if (newObject) 887 { 888 obj2.initTurbineUserGroupRoles(); 889 obj2.addTurbineUserGroupRole(obj1); 890 } 891 results.add(obj1); 892 } 893 return results; 894 } 895 896 897 898 899 910 protected static List doSelectJoinTurbineGroup(Criteria criteria) 911 throws TorqueException 912 { 913 setDbName(criteria); 914 915 TurbineUserGroupRolePeer.addSelectColumns(criteria); 916 int offset = numColumns + 1; 917 TurbineGroupPeer.addSelectColumns(criteria); 918 919 920 criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID, 921 TurbineGroupPeer.GROUP_ID); 922 923 924 925 List rows = BasePeer.doSelect(criteria); 926 List results = new ArrayList (); 927 928 for (int i = 0; i < rows.size(); i++) 929 { 930 Record row = (Record) rows.get(i); 931 932 Class omClass = TurbineUserGroupRolePeer.getOMClass(); 933 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer 934 .row2Object(row, 1, omClass); 935 omClass = TurbineGroupPeer.getOMClass(); 936 TurbineGroup obj2 = (TurbineGroup)TurbineGroupPeer 937 .row2Object(row, offset, omClass); 938 939 boolean newObject = true; 940 for (int j = 0; j < results.size(); j++) 941 { 942 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 943 TurbineGroup temp_obj2 = (TurbineGroup)temp_obj1.getTurbineGroup(); 944 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 945 { 946 newObject = false; 947 temp_obj2.addTurbineUserGroupRole(obj1); 948 break; 949 } 950 } 951 if (newObject) 952 { 953 obj2.initTurbineUserGroupRoles(); 954 obj2.addTurbineUserGroupRole(obj1); 955 } 956 results.add(obj1); 957 } 958 return results; 959 } 960 961 962 963 964 975 protected static List doSelectJoinTurbineRole(Criteria criteria) 976 throws TorqueException 977 { 978 setDbName(criteria); 979 980 TurbineUserGroupRolePeer.addSelectColumns(criteria); 981 int offset = numColumns + 1; 982 TurbineRolePeer.addSelectColumns(criteria); 983 984 985 criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID, 986 TurbineRolePeer.ROLE_ID); 987 988 989 990 List rows = BasePeer.doSelect(criteria); 991 List results = new ArrayList (); 992 993 for (int i = 0; i < rows.size(); i++) 994 { 995 Record row = (Record) rows.get(i); 996 997 Class omClass = TurbineUserGroupRolePeer.getOMClass(); 998 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer 999 .row2Object(row, 1, omClass); 1000 omClass = TurbineRolePeer.getOMClass(); 1001 TurbineRole obj2 = (TurbineRole)TurbineRolePeer 1002 .row2Object(row, offset, omClass); 1003 1004 boolean newObject = true; 1005 for (int j = 0; j < results.size(); j++) 1006 { 1007 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1008 TurbineRole temp_obj2 = (TurbineRole)temp_obj1.getTurbineRole(); 1009 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1010 { 1011 newObject = false; 1012 temp_obj2.addTurbineUserGroupRole(obj1); 1013 break; 1014 } 1015 } 1016 if (newObject) 1017 { 1018 obj2.initTurbineUserGroupRoles(); 1019 obj2.addTurbineUserGroupRole(obj1); 1020 } 1021 results.add(obj1); 1022 } 1023 return results; 1024 } 1025 1026 1027 1028 1029 1030 1031 1032 1033 1044 protected static List doSelectJoinAllExceptTurbineUser(Criteria criteria) 1045 throws TorqueException 1046 { 1047 setDbName(criteria); 1048 1049 addSelectColumns(criteria); 1050 int offset2 = numColumns + 1; 1051 1052 1053 TurbineGroupPeer.addSelectColumns(criteria); 1054 int offset3 = offset2 + TurbineGroupPeer.numColumns; 1055 1056 TurbineRolePeer.addSelectColumns(criteria); 1057 int offset4 = offset3 + TurbineRolePeer.numColumns; 1058 1059 List rows = BasePeer.doSelect(criteria); 1060 List results = new ArrayList (); 1061 1062 for (int i = 0; i < rows.size(); i++) 1063 { 1064 Record row = (Record)rows.get(i); 1065 1066 Class omClass = TurbineUserGroupRolePeer.getOMClass(); 1067 TurbineUserGroupRole obj1 = (TurbineUserGroupRole)TurbineUserGroupRolePeer 1068 .row2Object(row, 1, omClass); 1069 1070 1071 1072 1073 1074 omClass = TurbineGroupPeer.getOMClass(); 1075 TurbineGroup obj2 = (TurbineGroup)TurbineGroupPeer 1076 .row2Object( row, offset2, omClass); 1077 1078 boolean newObject = true; 1079 for (int j = 0; j < results.size(); j++) 1080 { 1081 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1082 TurbineGroup temp_obj2 = (TurbineGroup)temp_obj1.getTurbineGroup(); 1083 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1084 { 1085 newObject = false; 1086 temp_obj2.addTurbineUserGroupRole(obj1); 1087 break; 1088 } 1089 } 1090 if (newObject) 1091 { 1092 obj2.initTurbineUserGroupRoles(); 1093 obj2.addTurbineUserGroupRole(obj1); 1094 } 1095 1096 1097 1098 1099 omClass = TurbineRolePeer.getOMClass(); 1100 TurbineRole obj3 = (TurbineRole)TurbineRolePeer 1101 .row2Object( row, offset3, omClass); 1102 1103 newObject = true; 1104 for (int j = 0; j < results.size(); j++) 1105 { 1106 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1107 TurbineRole temp_obj3 = (TurbineRole)temp_obj1.getTurbineRole(); 1108 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1109 { 1110 newObject = false; 1111 temp_obj3.addTurbineUserGroupRole(obj1); 1112 break; 1113 } 1114 } 1115 if (newObject) 1116 { 1117 obj3.initTurbineUserGroupRoles(); 1118 obj3.addTurbineUserGroupRole(obj1); 1119 } 1120 results.add(obj1); 1121 } 1122 return results; 1123 } 1124 1125 1126 1127 1128 1129 1140 protected static List doSelectJoinAllExceptTurbineGroup(Criteria criteria) 1141 throws TorqueException 1142 { 1143 setDbName(criteria); 1144 1145 addSelectColumns(criteria); 1146 int offset2 = numColumns + 1; 1147 1148 TurbineUserPeer.addSelectColumns(criteria); 1149 int offset3 = offset2 + TurbineUserPeer.numColumns; 1150 1151 1152 TurbineRolePeer.addSelectColumns(criteria); 1153 int offset4 = offset3 + TurbineRolePeer.numColumns; 1154 1155 List rows = BasePeer.doSelect(criteria); 1156 List results = new ArrayList (); 1157 1158 for (int i = 0; i < rows.size(); i++) 1159 { 1160 Record row = (Record)rows.get(i); 1161 1162 Class omClass = TurbineUserGroupRolePeer.getOMClass(); 1163 TurbineUserGroupRole obj1 = (TurbineUserGroupRole)TurbineUserGroupRolePeer 1164 .row2Object(row, 1, omClass); 1165 1166 1167 1168 1169 omClass = TurbineUserPeer.getOMClass(); 1170 TurbineUser obj2 = (TurbineUser)TurbineUserPeer 1171 .row2Object( row, offset2, omClass); 1172 1173 boolean newObject = true; 1174 for (int j = 0; j < results.size(); j++) 1175 { 1176 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1177 TurbineUser temp_obj2 = (TurbineUser)temp_obj1.getTurbineUser(); 1178 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1179 { 1180 newObject = false; 1181 temp_obj2.addTurbineUserGroupRole(obj1); 1182 break; 1183 } 1184 } 1185 if (newObject) 1186 { 1187 obj2.initTurbineUserGroupRoles(); 1188 obj2.addTurbineUserGroupRole(obj1); 1189 } 1190 1191 1192 1193 1194 1195 omClass = TurbineRolePeer.getOMClass(); 1196 TurbineRole obj3 = (TurbineRole)TurbineRolePeer 1197 .row2Object( row, offset3, omClass); 1198 1199 newObject = true; 1200 for (int j = 0; j < results.size(); j++) 1201 { 1202 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1203 TurbineRole temp_obj3 = (TurbineRole)temp_obj1.getTurbineRole(); 1204 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1205 { 1206 newObject = false; 1207 temp_obj3.addTurbineUserGroupRole(obj1); 1208 break; 1209 } 1210 } 1211 if (newObject) 1212 { 1213 obj3.initTurbineUserGroupRoles(); 1214 obj3.addTurbineUserGroupRole(obj1); 1215 } 1216 results.add(obj1); 1217 } 1218 return results; 1219 } 1220 1221 1222 1223 1224 1225 1236 protected static List doSelectJoinAllExceptTurbineRole(Criteria criteria) 1237 throws TorqueException 1238 { 1239 setDbName(criteria); 1240 1241 addSelectColumns(criteria); 1242 int offset2 = numColumns + 1; 1243 1244 TurbineUserPeer.addSelectColumns(criteria); 1245 int offset3 = offset2 + TurbineUserPeer.numColumns; 1246 1247 TurbineGroupPeer.addSelectColumns(criteria); 1248 int offset4 = offset3 + TurbineGroupPeer.numColumns; 1249 1250 1251 List rows = BasePeer.doSelect(criteria); 1252 List results = new ArrayList (); 1253 1254 for (int i = 0; i < rows.size(); i++) 1255 { 1256 Record row = (Record)rows.get(i); 1257 1258 Class omClass = TurbineUserGroupRolePeer.getOMClass(); 1259 TurbineUserGroupRole obj1 = (TurbineUserGroupRole)TurbineUserGroupRolePeer 1260 .row2Object(row, 1, omClass); 1261 1262 1263 1264 1265 omClass = TurbineUserPeer.getOMClass(); 1266 TurbineUser obj2 = (TurbineUser)TurbineUserPeer 1267 .row2Object( row, offset2, omClass); 1268 1269 boolean newObject = true; 1270 for (int j = 0; j < results.size(); j++) 1271 { 1272 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1273 TurbineUser temp_obj2 = (TurbineUser)temp_obj1.getTurbineUser(); 1274 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey())) 1275 { 1276 newObject = false; 1277 temp_obj2.addTurbineUserGroupRole(obj1); 1278 break; 1279 } 1280 } 1281 if (newObject) 1282 { 1283 obj2.initTurbineUserGroupRoles(); 1284 obj2.addTurbineUserGroupRole(obj1); 1285 } 1286 1287 1288 1289 1290 omClass = TurbineGroupPeer.getOMClass(); 1291 TurbineGroup obj3 = (TurbineGroup)TurbineGroupPeer 1292 .row2Object( row, offset3, omClass); 1293 1294 newObject = true; 1295 for (int j = 0; j < results.size(); j++) 1296 { 1297 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j); 1298 TurbineGroup temp_obj3 = (TurbineGroup)temp_obj1.getTurbineGroup(); 1299 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey())) 1300 { 1301 newObject = false; 1302 temp_obj3.addTurbineUserGroupRole(obj1); 1303 break; 1304 } 1305 } 1306 if (newObject) 1307 { 1308 obj3.initTurbineUserGroupRoles(); 1309 obj3.addTurbineUserGroupRole(obj1); 1310 } 1311 1312 results.add(obj1); 1313 } 1314 return results; 1315 } 1316 1317 1318 1325 protected static TableMap getTableMap() 1326 throws TorqueException 1327 { 1328 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME); 1329 } 1330 1331 private static void setDbName(Criteria crit) 1332 { 1333 if (crit.getDbName() == Torque.getDefaultDB()) 1337 { 1338 crit.setDbName(DATABASE_NAME); 1339 } 1340 } 1341} 1342
| Popular Tags
|