1 package org.apache.turbine.services.security.torque.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.TorqueRuntimeException;
17 import org.apache.torque.map.MapBuilder;
18 import org.apache.torque.map.TableMap;
19 import org.apache.torque.om.DateKey;
20 import org.apache.torque.om.NumberKey;
21 import org.apache.torque.om.StringKey;
22 import org.apache.torque.om.ObjectKey;
23 import org.apache.torque.om.SimpleKey;
24 import org.apache.torque.util.BasePeer;
25 import org.apache.torque.util.Criteria;
26
27 import com.workingdogs.village.DataSetException;
28 import com.workingdogs.village.QueryDataSet;
29 import com.workingdogs.village.Record;
30
31
32 import org.apache.turbine.services.security.torque.om.map.*;
33
34
35
36
37
38
39
40
41
42
43 public abstract class BaseTurbineUserGroupRolePeer
44 extends BasePeer
45 {
46
47 private static final long serialVersionUID = 1308842746584L;
48
49
50
51 public static final String DATABASE_NAME;
52
53
54 public static final String TABLE_NAME;
55
56
57
58
59
60
61
62 public static MapBuilder getMapBuilder()
63 throws TorqueException
64 {
65 return Torque.getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
66 }
67
68
69 public static final String USER_ID;
70
71 public static final String GROUP_ID;
72
73 public static final String ROLE_ID;
74
75 static
76 {
77 DATABASE_NAME = "default";
78 TABLE_NAME = "TURBINE_USER_GROUP_ROLE";
79
80 USER_ID = "TURBINE_USER_GROUP_ROLE.USER_ID";
81 GROUP_ID = "TURBINE_USER_GROUP_ROLE.GROUP_ID";
82 ROLE_ID = "TURBINE_USER_GROUP_ROLE.ROLE_ID";
83 if (Torque.isInit())
84 {
85 try
86 {
87 Torque.getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
88 }
89 catch (TorqueException e)
90 {
91 log.error("Could not initialize Peer", e);
92 throw new TorqueRuntimeException(e);
93 }
94 }
95 else
96 {
97 Torque.registerMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
98 }
99 }
100
101
102 public static final int numColumns = 3;
103
104
105 protected static final String CLASSNAME_DEFAULT =
106 "org.apache.turbine.services.security.torque.om.TurbineUserGroupRole";
107
108
109 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
110
111
112
113
114
115
116
117 private static Class initClass(String className)
118 {
119 Class c = null;
120 try
121 {
122 c = Class.forName(className);
123 }
124 catch (Throwable t)
125 {
126 log.error("A FATAL ERROR has occurred which should not "
127 + "have happened under any circumstance. Please notify "
128 + "the Torque developers <torque-dev@db.apache.org> "
129 + "and give as many details as possible (including the error "
130 + "stack trace).", t);
131
132
133 if (t instanceof Error)
134 {
135 throw (Error) t.fillInStackTrace();
136 }
137 }
138 return c;
139 }
140
141
142
143
144
145
146
147
148
149
150
151 public static List<TurbineUserGroupRole> resultSet2Objects(java.sql.ResultSet results)
152 throws TorqueException
153 {
154 try
155 {
156 QueryDataSet qds = null;
157 List<Record> rows = null;
158 try
159 {
160 qds = new QueryDataSet(results);
161 rows = getSelectResults(qds);
162 }
163 finally
164 {
165 if (qds != null)
166 {
167 qds.close();
168 }
169 }
170
171 return populateObjects(rows);
172 }
173 catch (SQLException e)
174 {
175 throw new TorqueException(e);
176 }
177 catch (DataSetException e)
178 {
179 throw new TorqueException(e);
180 }
181 }
182
183
184
185
186
187
188
189
190
191
192 public static ObjectKey doInsert(Criteria criteria)
193 throws TorqueException
194 {
195 return BaseTurbineUserGroupRolePeer
196 .doInsert(criteria, (Connection) null);
197 }
198
199
200
201
202
203
204
205
206
207
208
209 public static ObjectKey doInsert(Criteria criteria, Connection con)
210 throws TorqueException
211 {
212 correctBooleans(criteria);
213
214 setDbName(criteria);
215
216 if (con == null)
217 {
218 return BasePeer.doInsert(criteria);
219 }
220 else
221 {
222 return BasePeer.doInsert(criteria, con);
223 }
224 }
225
226
227
228
229
230
231
232
233 public static void addSelectColumns(Criteria criteria)
234 throws TorqueException
235 {
236 criteria.addSelectColumn(USER_ID);
237 criteria.addSelectColumn(GROUP_ID);
238 criteria.addSelectColumn(ROLE_ID);
239 }
240
241
242
243
244
245
246
247
248
249
250 public static void correctBooleans(Criteria criteria) throws TorqueException
251 {
252 correctBooleans(criteria, getTableMap());
253 }
254
255
256
257
258
259
260
261
262
263
264 public static TurbineUserGroupRole row2Object(Record row,
265 int offset,
266 Class cls)
267 throws TorqueException
268 {
269 try
270 {
271 TurbineUserGroupRole obj = (TurbineUserGroupRole) cls.newInstance();
272 TurbineUserGroupRolePeer.populateObject(row, offset, obj);
273 obj.setModified(false);
274 obj.setNew(false);
275
276 return obj;
277 }
278 catch (InstantiationException e)
279 {
280 throw new TorqueException(e);
281 }
282 catch (IllegalAccessException e)
283 {
284 throw new TorqueException(e);
285 }
286 }
287
288
289
290
291
292
293
294
295
296
297 public static void populateObject(Record row,
298 int offset,
299 TurbineUserGroupRole obj)
300 throws TorqueException
301 {
302 try
303 {
304 obj.setUserId(row.getValue(offset + 0).asInt());
305 obj.setGroupId(row.getValue(offset + 1).asInt());
306 obj.setRoleId(row.getValue(offset + 2).asInt());
307 }
308 catch (DataSetException e)
309 {
310 throw new TorqueException(e);
311 }
312 }
313
314
315
316
317
318
319
320
321
322 public static List<TurbineUserGroupRole> doSelect(Criteria criteria) throws TorqueException
323 {
324 return populateObjects(doSelectVillageRecords(criteria));
325 }
326
327
328
329
330
331
332
333
334
335
336 public static List<TurbineUserGroupRole> doSelect(Criteria criteria, Connection con)
337 throws TorqueException
338 {
339 return populateObjects(doSelectVillageRecords(criteria, con));
340 }
341
342
343
344
345
346
347
348
349
350
351
352 public static List<Record> doSelectVillageRecords(Criteria criteria)
353 throws TorqueException
354 {
355 return BaseTurbineUserGroupRolePeer
356 .doSelectVillageRecords(criteria, (Connection) null);
357 }
358
359
360
361
362
363
364
365
366
367
368 public static List<Record> doSelectVillageRecords(Criteria criteria, Connection con)
369 throws TorqueException
370 {
371 if (criteria.getSelectColumns().size() == 0)
372 {
373 addSelectColumns(criteria);
374 }
375 correctBooleans(criteria);
376
377 setDbName(criteria);
378
379
380
381 if (con == null)
382 {
383 return BasePeer.doSelect(criteria);
384 }
385 else
386 {
387 return BasePeer.doSelect(criteria, con);
388 }
389 }
390
391
392
393
394
395
396
397
398 public static List<TurbineUserGroupRole> populateObjects(List<Record> records)
399 throws TorqueException
400 {
401 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>(records.size());
402
403
404 for (int i = 0; i < records.size(); i++)
405 {
406 Record row = records.get(i);
407 results.add(TurbineUserGroupRolePeer.row2Object(row, 1,
408 TurbineUserGroupRolePeer.getOMClass()));
409 }
410 return results;
411 }
412
413
414
415
416
417
418
419
420
421
422 public static Class getOMClass()
423 throws TorqueException
424 {
425 return CLASS_DEFAULT;
426 }
427
428
429
430
431
432
433
434
435
436 public static void doUpdate(Criteria criteria) throws TorqueException
437 {
438 BaseTurbineUserGroupRolePeer
439 .doUpdate(criteria, (Connection) null);
440 }
441
442
443
444
445
446
447
448
449
450
451
452
453 public static void doUpdate(Criteria criteria, Connection con)
454 throws TorqueException
455 {
456 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
457 correctBooleans(criteria);
458
459
460 selectCriteria.put(USER_ID, criteria.remove(USER_ID));
461
462 selectCriteria.put(GROUP_ID, criteria.remove(GROUP_ID));
463
464 selectCriteria.put(ROLE_ID, criteria.remove(ROLE_ID));
465
466 setDbName(criteria);
467
468 if (con == null)
469 {
470 BasePeer.doUpdate(selectCriteria, criteria);
471 }
472 else
473 {
474 BasePeer.doUpdate(selectCriteria, criteria, con);
475 }
476 }
477
478
479
480
481
482
483
484
485 public static void doDelete(Criteria criteria) throws TorqueException
486 {
487 TurbineUserGroupRolePeer
488 .doDelete(criteria, (Connection) null);
489 }
490
491
492
493
494
495
496
497
498
499
500
501 public static void doDelete(Criteria criteria, Connection con)
502 throws TorqueException
503 {
504 correctBooleans(criteria);
505
506 setDbName(criteria);
507
508 if (con == null)
509 {
510 BasePeer.doDelete(criteria, TABLE_NAME);
511 }
512 else
513 {
514 BasePeer.doDelete(criteria, TABLE_NAME, con);
515 }
516 }
517
518
519
520
521
522
523
524 public static List<TurbineUserGroupRole> doSelect(TurbineUserGroupRole obj) throws TorqueException
525 {
526 return doSelect(buildSelectCriteria(obj));
527 }
528
529
530
531
532
533
534
535 public static void doInsert(TurbineUserGroupRole obj) throws TorqueException
536 {
537 doInsert(buildCriteria(obj));
538 obj.setNew(false);
539 obj.setModified(false);
540 }
541
542
543
544
545
546
547 public static void doUpdate(TurbineUserGroupRole obj) throws TorqueException
548 {
549 doUpdate(buildCriteria(obj));
550 obj.setModified(false);
551 }
552
553
554
555
556
557
558 public static void doDelete(TurbineUserGroupRole obj) throws TorqueException
559 {
560 doDelete(buildSelectCriteria(obj));
561 }
562
563
564
565
566
567
568
569
570
571
572
573 public static void doInsert(TurbineUserGroupRole obj, Connection con)
574 throws TorqueException
575 {
576 doInsert(buildCriteria(obj), con);
577 obj.setNew(false);
578 obj.setModified(false);
579 }
580
581
582
583
584
585
586
587
588
589
590
591 public static void doUpdate(TurbineUserGroupRole obj, Connection con)
592 throws TorqueException
593 {
594 doUpdate(buildCriteria(obj), con);
595 obj.setModified(false);
596 }
597
598
599
600
601
602
603
604
605
606
607
608 public static void doDelete(TurbineUserGroupRole obj, Connection con)
609 throws TorqueException
610 {
611 doDelete(buildSelectCriteria(obj), con);
612 }
613
614
615
616
617
618
619
620
621 public static void doDelete(ObjectKey pk) throws TorqueException
622 {
623 BaseTurbineUserGroupRolePeer
624 .doDelete(pk, (Connection) null);
625 }
626
627
628
629
630
631
632
633
634
635
636
637 public static void doDelete(ObjectKey pk, Connection con)
638 throws TorqueException
639 {
640 doDelete(buildCriteria(pk), con);
641 }
642
643
644 public static Criteria buildCriteria( ObjectKey pk )
645 {
646 Criteria criteria = new Criteria();
647 SimpleKey[] keys = (SimpleKey[])pk.getValue();
648 criteria.add(USER_ID, keys[0]);
649 criteria.add(GROUP_ID, keys[1]);
650 criteria.add(ROLE_ID, keys[2]);
651 return criteria;
652 }
653
654
655 public static Criteria buildCriteria( TurbineUserGroupRole obj )
656 {
657 Criteria criteria = new Criteria(DATABASE_NAME);
658 criteria.add(USER_ID, obj.getUserId());
659 criteria.add(GROUP_ID, obj.getGroupId());
660 criteria.add(ROLE_ID, obj.getRoleId());
661 return criteria;
662 }
663
664
665 public static Criteria buildSelectCriteria( TurbineUserGroupRole obj )
666 {
667 Criteria criteria = new Criteria(DATABASE_NAME);
668 criteria.add(USER_ID, obj.getUserId());
669 criteria.add(GROUP_ID, obj.getGroupId());
670 criteria.add(ROLE_ID, obj.getRoleId());
671 return criteria;
672 }
673
674
675
676
677
678
679
680
681
682
683
684
685 public static TurbineUserGroupRole retrieveByPK(ObjectKey pk)
686 throws TorqueException, NoRowsException, TooManyRowsException
687 {
688 Connection db = null;
689 TurbineUserGroupRole retVal = null;
690 try
691 {
692 db = Torque.getConnection(DATABASE_NAME);
693 retVal = retrieveByPK(pk, db);
694 }
695 finally
696 {
697 Torque.closeConnection(db);
698 }
699 return retVal;
700 }
701
702
703
704
705
706
707
708
709
710
711
712 public static TurbineUserGroupRole retrieveByPK(ObjectKey pk, Connection con)
713 throws TorqueException, NoRowsException, TooManyRowsException
714 {
715 Criteria criteria = buildCriteria(pk);
716 List<TurbineUserGroupRole> v = doSelect(criteria, con);
717 if (v.size() == 0)
718 {
719 throw new NoRowsException("Failed to select a row.");
720 }
721 else if (v.size() > 1)
722 {
723 throw new TooManyRowsException("Failed to select only one row.");
724 }
725 else
726 {
727 return (TurbineUserGroupRole)v.get(0);
728 }
729 }
730
731
732
733
734
735
736
737
738 public static List<TurbineUserGroupRole> retrieveByPKs(List<ObjectKey> pks)
739 throws TorqueException
740 {
741 Connection db = null;
742 List<TurbineUserGroupRole> retVal = null;
743 try
744 {
745 db = Torque.getConnection(DATABASE_NAME);
746 retVal = retrieveByPKs(pks, db);
747 }
748 finally
749 {
750 Torque.closeConnection(db);
751 }
752 return retVal;
753 }
754
755
756
757
758
759
760
761
762
763 public static List<TurbineUserGroupRole> retrieveByPKs( List<ObjectKey> pks, Connection dbcon )
764 throws TorqueException
765 {
766 List<TurbineUserGroupRole> objs = null;
767 if (pks == null || pks.size() == 0)
768 {
769 objs = new LinkedList<TurbineUserGroupRole>();
770 }
771 else
772 {
773 Criteria criteria = new Criteria();
774 Iterator<ObjectKey> iter = pks.iterator();
775 while (iter.hasNext())
776 {
777 ObjectKey pk = iter.next();
778 SimpleKey[] keys = (SimpleKey[])pk.getValue();
779 Criteria.Criterion c0 = criteria.getNewCriterion(
780 USER_ID, keys[0], Criteria.EQUAL);
781 Criteria.Criterion c1 = criteria.getNewCriterion(
782 GROUP_ID, keys[1], Criteria.EQUAL);
783 c0.and(c1);
784 Criteria.Criterion c2 = criteria.getNewCriterion(
785 ROLE_ID, keys[2], Criteria.EQUAL);
786 c1.and(c2);
787 criteria.or(c0);
788 }
789 objs = doSelect(criteria, dbcon);
790 }
791 return objs;
792 }
793
794
795
796
797
798
799
800
801
802 public static TurbineUserGroupRole retrieveByPK(
803 int userId
804 , int groupId
805 , int roleId
806 ) throws TorqueException
807 {
808 Connection db = null;
809 TurbineUserGroupRole retVal = null;
810 try
811 {
812 db = Torque.getConnection(DATABASE_NAME);
813 retVal = retrieveByPK(
814 userId
815 , groupId
816 , roleId
817 , db);
818 }
819 finally
820 {
821 Torque.closeConnection(db);
822 }
823 return retVal;
824 }
825
826
827
828
829
830
831
832
833
834 public static TurbineUserGroupRole retrieveByPK(
835 int userId
836 , int groupId
837 , int roleId
838 ,Connection con) throws TorqueException
839 {
840
841 Criteria criteria = new Criteria(5);
842 criteria.add(USER_ID, userId);
843 criteria.add(GROUP_ID, groupId);
844 criteria.add(ROLE_ID, roleId);
845 List<TurbineUserGroupRole> v = doSelect(criteria, con);
846 if (v.size() == 1)
847 {
848 return v.get(0);
849 }
850 else
851 {
852 throw new TorqueException("Failed to select one and only one row.");
853 }
854 }
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874 protected static List<TurbineUserGroupRole> doSelectJoinTurbineUser(Criteria criteria)
875 throws TorqueException
876 {
877 return doSelectJoinTurbineUser(criteria, null);
878 }
879
880
881
882
883
884
885
886
887
888
889
890
891 protected static List<TurbineUserGroupRole> doSelectJoinTurbineUser(Criteria criteria, Connection conn)
892 throws TorqueException
893 {
894 setDbName(criteria);
895
896 TurbineUserGroupRolePeer.addSelectColumns(criteria);
897 int offset = numColumns + 1;
898 TurbineUserPeer.addSelectColumns(criteria);
899
900 criteria.addJoin(TurbineUserGroupRolePeer.USER_ID,
901 TurbineUserPeer.USER_ID);
902
903 correctBooleans(criteria);
904
905 List<Record> rows;
906 if (conn == null)
907 {
908 rows = BasePeer.doSelect(criteria);
909 }
910 else
911 {
912 rows = BasePeer.doSelect(criteria,conn);
913 }
914
915 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
916
917 for (int i = 0; i < rows.size(); i++)
918 {
919 Record row = rows.get(i);
920
921 Class omClass = TurbineUserGroupRolePeer.getOMClass();
922 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
923 .row2Object(row, 1, omClass);
924 omClass = TurbineUserPeer.getOMClass();
925 TurbineUser obj2 = (TurbineUser) TurbineUserPeer
926 .row2Object(row, offset, omClass);
927
928 boolean newObject = true;
929 for (int j = 0; j < results.size(); j++)
930 {
931 TurbineUserGroupRole temp_obj1 = results.get(j);
932 TurbineUser temp_obj2 = (TurbineUser) temp_obj1.getTurbineUser();
933 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
934 {
935 newObject = false;
936 temp_obj2.addTurbineUserGroupRole(obj1);
937 break;
938 }
939 }
940 if (newObject)
941 {
942 obj2.initTurbineUserGroupRoles();
943 obj2.addTurbineUserGroupRole(obj1);
944 }
945 results.add(obj1);
946 }
947 return results;
948 }
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964 protected static List<TurbineUserGroupRole> doSelectJoinTurbineGroup(Criteria criteria)
965 throws TorqueException
966 {
967 return doSelectJoinTurbineGroup(criteria, null);
968 }
969
970
971
972
973
974
975
976
977
978
979
980
981 protected static List<TurbineUserGroupRole> doSelectJoinTurbineGroup(Criteria criteria, Connection conn)
982 throws TorqueException
983 {
984 setDbName(criteria);
985
986 TurbineUserGroupRolePeer.addSelectColumns(criteria);
987 int offset = numColumns + 1;
988 TurbineGroupPeer.addSelectColumns(criteria);
989
990 criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID,
991 TurbineGroupPeer.GROUP_ID);
992
993 correctBooleans(criteria);
994
995 List<Record> rows;
996 if (conn == null)
997 {
998 rows = BasePeer.doSelect(criteria);
999 }
1000 else
1001 {
1002 rows = BasePeer.doSelect(criteria,conn);
1003 }
1004
1005 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
1006
1007 for (int i = 0; i < rows.size(); i++)
1008 {
1009 Record row = rows.get(i);
1010
1011 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1012 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
1013 .row2Object(row, 1, omClass);
1014 omClass = TurbineGroupPeer.getOMClass();
1015 TurbineGroup obj2 = (TurbineGroup) TurbineGroupPeer
1016 .row2Object(row, offset, omClass);
1017
1018 boolean newObject = true;
1019 for (int j = 0; j < results.size(); j++)
1020 {
1021 TurbineUserGroupRole temp_obj1 = results.get(j);
1022 TurbineGroup temp_obj2 = (TurbineGroup) temp_obj1.getTurbineGroup();
1023 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1024 {
1025 newObject = false;
1026 temp_obj2.addTurbineUserGroupRole(obj1);
1027 break;
1028 }
1029 }
1030 if (newObject)
1031 {
1032 obj2.initTurbineUserGroupRoles();
1033 obj2.addTurbineUserGroupRole(obj1);
1034 }
1035 results.add(obj1);
1036 }
1037 return results;
1038 }
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054 protected static List<TurbineUserGroupRole> doSelectJoinTurbineRole(Criteria criteria)
1055 throws TorqueException
1056 {
1057 return doSelectJoinTurbineRole(criteria, null);
1058 }
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071 protected static List<TurbineUserGroupRole> doSelectJoinTurbineRole(Criteria criteria, Connection conn)
1072 throws TorqueException
1073 {
1074 setDbName(criteria);
1075
1076 TurbineUserGroupRolePeer.addSelectColumns(criteria);
1077 int offset = numColumns + 1;
1078 TurbineRolePeer.addSelectColumns(criteria);
1079
1080 criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID,
1081 TurbineRolePeer.ROLE_ID);
1082
1083 correctBooleans(criteria);
1084
1085 List<Record> rows;
1086 if (conn == null)
1087 {
1088 rows = BasePeer.doSelect(criteria);
1089 }
1090 else
1091 {
1092 rows = BasePeer.doSelect(criteria,conn);
1093 }
1094
1095 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
1096
1097 for (int i = 0; i < rows.size(); i++)
1098 {
1099 Record row = rows.get(i);
1100
1101 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1102 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
1103 .row2Object(row, 1, omClass);
1104 omClass = TurbineRolePeer.getOMClass();
1105 TurbineRole obj2 = (TurbineRole) TurbineRolePeer
1106 .row2Object(row, offset, omClass);
1107
1108 boolean newObject = true;
1109 for (int j = 0; j < results.size(); j++)
1110 {
1111 TurbineUserGroupRole temp_obj1 = results.get(j);
1112 TurbineRole temp_obj2 = (TurbineRole) temp_obj1.getTurbineRole();
1113 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1114 {
1115 newObject = false;
1116 temp_obj2.addTurbineUserGroupRole(obj1);
1117 break;
1118 }
1119 }
1120 if (newObject)
1121 {
1122 obj2.initTurbineUserGroupRoles();
1123 obj2.addTurbineUserGroupRole(obj1);
1124 }
1125 results.add(obj1);
1126 }
1127 return results;
1128 }
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147 protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineUser(Criteria criteria)
1148 throws TorqueException
1149 {
1150 return doSelectJoinAllExceptTurbineUser(criteria, null);
1151 }
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164 protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineUser(Criteria criteria, Connection conn)
1165 throws TorqueException
1166 {
1167 setDbName(criteria);
1168
1169 addSelectColumns(criteria);
1170 int offset2 = numColumns + 1;
1171
1172
1173 TurbineGroupPeer.addSelectColumns(criteria);
1174 criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID, TurbineGroupPeer.GROUP_ID);
1175 int offset3 = offset2 + TurbineGroupPeer.numColumns;
1176
1177 TurbineRolePeer.addSelectColumns(criteria);
1178 criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID, TurbineRolePeer.ROLE_ID);
1179
1180 correctBooleans(criteria);
1181
1182 List<Record> rows;
1183 if (conn == null)
1184 {
1185 rows = BasePeer.doSelect(criteria);
1186 }
1187 else
1188 {
1189 rows = BasePeer.doSelect(criteria,conn);
1190 }
1191
1192 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
1193
1194 for (int i = 0; i < rows.size(); i++)
1195 {
1196 Record row = rows.get(i);
1197
1198 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1199 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
1200 .row2Object(row, 1, omClass);
1201
1202
1203
1204
1205
1206 omClass = TurbineGroupPeer.getOMClass();
1207 TurbineGroup obj2 = (TurbineGroup) TurbineGroupPeer
1208 .row2Object( row, offset2, omClass);
1209
1210 boolean newObject = true;
1211 for (int j = 0; j < results.size(); j++)
1212 {
1213 TurbineUserGroupRole temp_obj1 = results.get(j);
1214 TurbineGroup temp_obj2 = (TurbineGroup) temp_obj1.getTurbineGroup();
1215 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1216 {
1217 newObject = false;
1218 temp_obj2.addTurbineUserGroupRole(obj1);
1219 break;
1220 }
1221 }
1222 if (newObject)
1223 {
1224 obj2.initTurbineUserGroupRoles();
1225 obj2.addTurbineUserGroupRole(obj1);
1226 }
1227
1228
1229
1230
1231 omClass = TurbineRolePeer.getOMClass();
1232 TurbineRole obj3 = (TurbineRole) TurbineRolePeer
1233 .row2Object( row, offset3, omClass);
1234
1235 newObject = true;
1236 for (int j = 0; j < results.size(); j++)
1237 {
1238 TurbineUserGroupRole temp_obj1 = results.get(j);
1239 TurbineRole temp_obj3 = (TurbineRole) temp_obj1.getTurbineRole();
1240 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1241 {
1242 newObject = false;
1243 temp_obj3.addTurbineUserGroupRole(obj1);
1244 break;
1245 }
1246 }
1247 if (newObject)
1248 {
1249 obj3.initTurbineUserGroupRoles();
1250 obj3.addTurbineUserGroupRole(obj1);
1251 }
1252 results.add(obj1);
1253 }
1254 return results;
1255 }
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271 protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineGroup(Criteria criteria)
1272 throws TorqueException
1273 {
1274 return doSelectJoinAllExceptTurbineGroup(criteria, null);
1275 }
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288 protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineGroup(Criteria criteria, Connection conn)
1289 throws TorqueException
1290 {
1291 setDbName(criteria);
1292
1293 addSelectColumns(criteria);
1294 int offset2 = numColumns + 1;
1295
1296 TurbineUserPeer.addSelectColumns(criteria);
1297 criteria.addJoin(TurbineUserGroupRolePeer.USER_ID, TurbineUserPeer.USER_ID);
1298 int offset3 = offset2 + TurbineUserPeer.numColumns;
1299
1300
1301 TurbineRolePeer.addSelectColumns(criteria);
1302 criteria.addJoin(TurbineUserGroupRolePeer.ROLE_ID, TurbineRolePeer.ROLE_ID);
1303
1304 correctBooleans(criteria);
1305
1306 List<Record> rows;
1307 if (conn == null)
1308 {
1309 rows = BasePeer.doSelect(criteria);
1310 }
1311 else
1312 {
1313 rows = BasePeer.doSelect(criteria,conn);
1314 }
1315
1316 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
1317
1318 for (int i = 0; i < rows.size(); i++)
1319 {
1320 Record row = rows.get(i);
1321
1322 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1323 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
1324 .row2Object(row, 1, omClass);
1325
1326
1327
1328
1329 omClass = TurbineUserPeer.getOMClass();
1330 TurbineUser obj2 = (TurbineUser) TurbineUserPeer
1331 .row2Object( row, offset2, omClass);
1332
1333 boolean newObject = true;
1334 for (int j = 0; j < results.size(); j++)
1335 {
1336 TurbineUserGroupRole temp_obj1 = results.get(j);
1337 TurbineUser temp_obj2 = (TurbineUser) temp_obj1.getTurbineUser();
1338 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1339 {
1340 newObject = false;
1341 temp_obj2.addTurbineUserGroupRole(obj1);
1342 break;
1343 }
1344 }
1345 if (newObject)
1346 {
1347 obj2.initTurbineUserGroupRoles();
1348 obj2.addTurbineUserGroupRole(obj1);
1349 }
1350
1351
1352
1353
1354
1355 omClass = TurbineRolePeer.getOMClass();
1356 TurbineRole obj3 = (TurbineRole) TurbineRolePeer
1357 .row2Object( row, offset3, omClass);
1358
1359 newObject = true;
1360 for (int j = 0; j < results.size(); j++)
1361 {
1362 TurbineUserGroupRole temp_obj1 = results.get(j);
1363 TurbineRole temp_obj3 = (TurbineRole) temp_obj1.getTurbineRole();
1364 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1365 {
1366 newObject = false;
1367 temp_obj3.addTurbineUserGroupRole(obj1);
1368 break;
1369 }
1370 }
1371 if (newObject)
1372 {
1373 obj3.initTurbineUserGroupRoles();
1374 obj3.addTurbineUserGroupRole(obj1);
1375 }
1376 results.add(obj1);
1377 }
1378 return results;
1379 }
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395 protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineRole(Criteria criteria)
1396 throws TorqueException
1397 {
1398 return doSelectJoinAllExceptTurbineRole(criteria, null);
1399 }
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412 protected static List<TurbineUserGroupRole> doSelectJoinAllExceptTurbineRole(Criteria criteria, Connection conn)
1413 throws TorqueException
1414 {
1415 setDbName(criteria);
1416
1417 addSelectColumns(criteria);
1418 int offset2 = numColumns + 1;
1419
1420 TurbineUserPeer.addSelectColumns(criteria);
1421 criteria.addJoin(TurbineUserGroupRolePeer.USER_ID, TurbineUserPeer.USER_ID);
1422 int offset3 = offset2 + TurbineUserPeer.numColumns;
1423
1424 TurbineGroupPeer.addSelectColumns(criteria);
1425 criteria.addJoin(TurbineUserGroupRolePeer.GROUP_ID, TurbineGroupPeer.GROUP_ID);
1426
1427
1428 correctBooleans(criteria);
1429
1430 List<Record> rows;
1431 if (conn == null)
1432 {
1433 rows = BasePeer.doSelect(criteria);
1434 }
1435 else
1436 {
1437 rows = BasePeer.doSelect(criteria,conn);
1438 }
1439
1440 List<TurbineUserGroupRole> results = new ArrayList<TurbineUserGroupRole>();
1441
1442 for (int i = 0; i < rows.size(); i++)
1443 {
1444 Record row = rows.get(i);
1445
1446 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1447 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
1448 .row2Object(row, 1, omClass);
1449
1450
1451
1452
1453 omClass = TurbineUserPeer.getOMClass();
1454 TurbineUser obj2 = (TurbineUser) TurbineUserPeer
1455 .row2Object( row, offset2, omClass);
1456
1457 boolean newObject = true;
1458 for (int j = 0; j < results.size(); j++)
1459 {
1460 TurbineUserGroupRole temp_obj1 = results.get(j);
1461 TurbineUser temp_obj2 = (TurbineUser) temp_obj1.getTurbineUser();
1462 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1463 {
1464 newObject = false;
1465 temp_obj2.addTurbineUserGroupRole(obj1);
1466 break;
1467 }
1468 }
1469 if (newObject)
1470 {
1471 obj2.initTurbineUserGroupRoles();
1472 obj2.addTurbineUserGroupRole(obj1);
1473 }
1474
1475
1476
1477
1478 omClass = TurbineGroupPeer.getOMClass();
1479 TurbineGroup obj3 = (TurbineGroup) TurbineGroupPeer
1480 .row2Object( row, offset3, omClass);
1481
1482 newObject = true;
1483 for (int j = 0; j < results.size(); j++)
1484 {
1485 TurbineUserGroupRole temp_obj1 = results.get(j);
1486 TurbineGroup temp_obj3 = (TurbineGroup) temp_obj1.getTurbineGroup();
1487 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1488 {
1489 newObject = false;
1490 temp_obj3.addTurbineUserGroupRole(obj1);
1491 break;
1492 }
1493 }
1494 if (newObject)
1495 {
1496 obj3.initTurbineUserGroupRoles();
1497 obj3.addTurbineUserGroupRole(obj1);
1498 }
1499
1500 results.add(obj1);
1501 }
1502 return results;
1503 }
1504
1505
1506
1507
1508
1509
1510
1511
1512 public static TableMap getTableMap()
1513 throws TorqueException
1514 {
1515 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1516 }
1517
1518 private static void setDbName(Criteria crit)
1519 {
1520
1521
1522
1523 if (crit.getDbName() == Torque.getDefaultDB())
1524 {
1525 crit.setDbName(DATABASE_NAME);
1526 }
1527 }
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544 public static List<Record> executeQuery(String queryString) throws TorqueException
1545 {
1546 return BasePeer.executeQuery(queryString);
1547 }
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561 public static List<Record> executeQuery(String queryString, String dbName)
1562 throws TorqueException
1563 {
1564 return BasePeer.executeQuery(queryString,dbName);
1565 }
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580 public static List<Record> executeQuery(
1581 String queryString,
1582 String dbName,
1583 boolean singleRecord)
1584 throws TorqueException
1585 {
1586 return BasePeer.executeQuery(queryString,dbName,singleRecord);
1587 }
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601 public static List<Record> executeQuery(
1602 String queryString,
1603 boolean singleRecord,
1604 Connection con)
1605 throws TorqueException
1606 {
1607 return BasePeer.executeQuery(queryString,singleRecord,con);
1608 }
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624 public static List<Record> executeQuery(
1625 String queryString,
1626 int start,
1627 int numberOfResults,
1628 String dbName,
1629 boolean singleRecord)
1630 throws TorqueException
1631 {
1632 return BasePeer.executeQuery(queryString,start,numberOfResults,dbName,singleRecord);
1633 }
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649 public static List<Record> executeQuery(
1650 String queryString,
1651 int start,
1652 int numberOfResults,
1653 boolean singleRecord,
1654 Connection con)
1655 throws TorqueException
1656 {
1657 return BasePeer.executeQuery(queryString,start,numberOfResults,singleRecord,con);
1658 }
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671 public static List<Record> getSelectResults(QueryDataSet qds)
1672 throws TorqueException
1673 {
1674 return BasePeer.getSelectResults(qds);
1675 }
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689 public static List<Record> getSelectResults(QueryDataSet qds, boolean singleRecord)
1690 throws TorqueException
1691 {
1692 return BasePeer.getSelectResults(qds,singleRecord);
1693 }
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709 public static List<Record> getSelectResults(
1710 QueryDataSet qds,
1711 int numberOfResults,
1712 boolean singleRecord)
1713 throws TorqueException
1714 {
1715 return BasePeer.getSelectResults(qds,numberOfResults,singleRecord);
1716 }
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735 public static List getSelectResults(
1736 QueryDataSet qds,
1737 int start,
1738 int numberOfResults,
1739 boolean singleRecord)
1740 throws TorqueException
1741 {
1742 return BasePeer.getSelectResults(qds,start,numberOfResults,singleRecord);
1743 }
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755 public static List<Record> doPSSelect(Criteria criteria, Connection con)
1756 throws TorqueException
1757 {
1758 return BasePeer.doPSSelect(criteria,con);
1759 }
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770 public static List<Record> doPSSelect(Criteria criteria) throws TorqueException
1771 {
1772 return BasePeer.doPSSelect(criteria);
1773 }
1774 }