1 package org.apache.jetspeed.om.security.turbine;
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
31 import org.apache.jetspeed.om.security.turbine.map.*;
32
33
34
35
36
37 /***
38 * This class was autogenerated by Torque on:
39 *
40 * [Thu Apr 22 23:12:36 EDT 2004]
41 *
42 */
43 public abstract class BaseTurbineUserGroupRolePeer
44 extends BasePeer
45 {
46
47 /*** the default database name for this class */
48 public static final String DATABASE_NAME = "default";
49
50 /*** the table name for this class */
51 public static final String TABLE_NAME = "TURBINE_USER_GROUP_ROLE";
52
53 /***
54 * @return the map builder for this peer
55 * @throws TorqueException Any exceptions caught during processing will be
56 * rethrown wrapped into a TorqueException.
57 */
58 public static MapBuilder getMapBuilder()
59 throws TorqueException
60 {
61 return getMapBuilder(TurbineUserGroupRoleMapBuilder.CLASS_NAME);
62 }
63
64 /*** the column name for the USER_ID field */
65 public static final String USER_ID;
66 /*** the column name for the GROUP_ID field */
67 public static final String GROUP_ID;
68 /*** the column name for the ROLE_ID field */
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();
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 /*** number of columns for this peer */
94 public static final int numColumns = 3;
95
96 /*** A class that can be returned by this peer. */
97 protected static final String CLASSNAME_DEFAULT =
98 "org.apache.jetspeed.om.security.turbine.TurbineUserGroupRole";
99
100 /*** A class that can be returned by this peer. */
101 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
102
103 /***
104 * Class object initialization method.
105 *
106 * @param className name of the class to initialize
107 * @return the initialized class
108 */
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 <turbine-torque-dev@jakarta.apache.org> "
121 + "and give as many details as possible (including the error "
122 + "stack trace).", t);
123
124
125 if (t instanceof Error)
126 {
127 throw (Error) t.fillInStackTrace();
128 }
129 }
130 return c;
131 }
132
133 /***
134 * Get the list of objects for a ResultSet. Please not that your
135 * resultset MUST return columns in the right order. You can use
136 * getFieldNames() in BaseObject to get the correct sequence.
137 *
138 * @param results the ResultSet
139 * @return the list of objects
140 * @throws TorqueException Any exceptions caught during processing will be
141 * rethrown wrapped into a TorqueException.
142 */
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 /***
178 * Method to do inserts.
179 *
180 * @param criteria object used to create the INSERT statement.
181 * @throws TorqueException Any exceptions caught during processing will be
182 * rethrown wrapped into a TorqueException.
183 */
184 public static ObjectKey doInsert(Criteria criteria)
185 throws TorqueException
186 {
187 return BaseTurbineUserGroupRolePeer
188 .doInsert(criteria, (Connection) null);
189 }
190
191 /***
192 * Method to do inserts. This method is to be used during a transaction,
193 * otherwise use the doInsert(Criteria) method. It will take care of
194 * the connection details internally.
195 *
196 * @param criteria object used to create the INSERT statement.
197 * @param con the connection to use
198 * @throws TorqueException Any exceptions caught during processing will be
199 * rethrown wrapped into a TorqueException.
200 */
201 public static ObjectKey doInsert(Criteria criteria, Connection con)
202 throws TorqueException
203 {
204
205
206
207
208 if (criteria.getDbName() == Torque.getDefaultDB())
209 {
210 criteria.setDbName(DATABASE_NAME);
211 }
212 if (con == null)
213 {
214 return BasePeer.doInsert(criteria);
215 }
216 else
217 {
218 return BasePeer.doInsert(criteria, con);
219 }
220 }
221
222 /***
223 * Add all the columns needed to create a new object.
224 *
225 * @param criteria object containing the columns to add.
226 * @throws TorqueException Any exceptions caught during processing will be
227 * rethrown wrapped into a TorqueException.
228 */
229 public static void addSelectColumns(Criteria criteria)
230 throws TorqueException
231 {
232 criteria.addSelectColumn(USER_ID);
233 criteria.addSelectColumn(GROUP_ID);
234 criteria.addSelectColumn(ROLE_ID);
235 }
236
237 /***
238 * Create a new object of type cls from a resultset row starting
239 * from a specified offset. This is done so that you can select
240 * other rows than just those needed for this object. You may
241 * for example want to create two objects from the same row.
242 *
243 * @throws TorqueException Any exceptions caught during processing will be
244 * rethrown wrapped into a TorqueException.
245 */
246 public static TurbineUserGroupRole row2Object(Record row,
247 int offset,
248 Class cls)
249 throws TorqueException
250 {
251 try
252 {
253 TurbineUserGroupRole obj = (TurbineUserGroupRole) cls.newInstance();
254 TurbineUserGroupRolePeer.populateObject(row, offset, obj);
255 obj.setModified(false);
256 obj.setNew(false);
257
258 return obj;
259 }
260 catch (InstantiationException e)
261 {
262 throw new TorqueException(e);
263 }
264 catch (IllegalAccessException e)
265 {
266 throw new TorqueException(e);
267 }
268 }
269
270 /***
271 * Populates an object from a resultset row starting
272 * from a specified offset. This is done so that you can select
273 * other rows than just those needed for this object. You may
274 * for example want to create two objects from the same row.
275 *
276 * @throws TorqueException Any exceptions caught during processing will be
277 * rethrown wrapped into a TorqueException.
278 */
279 public static void populateObject(Record row,
280 int offset,
281 TurbineUserGroupRole obj)
282 throws TorqueException
283 {
284 try
285 {
286 obj.setUserId(row.getValue(offset + 0).asInt());
287 obj.setGroupId(row.getValue(offset + 1).asInt());
288 obj.setRoleId(row.getValue(offset + 2).asInt());
289 }
290 catch (DataSetException e)
291 {
292 throw new TorqueException(e);
293 }
294 }
295
296 /***
297 * Method to do selects.
298 *
299 * @param criteria object used to create the SELECT statement.
300 * @return List of selected Objects
301 * @throws TorqueException Any exceptions caught during processing will be
302 * rethrown wrapped into a TorqueException.
303 */
304 public static List doSelect(Criteria criteria) throws TorqueException
305 {
306 return populateObjects(doSelectVillageRecords(criteria));
307 }
308
309 /***
310 * Method to do selects within a transaction.
311 *
312 * @param criteria object used to create the SELECT statement.
313 * @param con the connection to use
314 * @return List of selected Objects
315 * @throws TorqueException Any exceptions caught during processing will be
316 * rethrown wrapped into a TorqueException.
317 */
318 public static List doSelect(Criteria criteria, Connection con)
319 throws TorqueException
320 {
321 return populateObjects(doSelectVillageRecords(criteria, con));
322 }
323
324 /***
325 * Grabs the raw Village records to be formed into objects.
326 * This method handles connections internally. The Record objects
327 * returned by this method should be considered readonly. Do not
328 * alter the data and call save(), your results may vary, but are
329 * certainly likely to result in hard to track MT bugs.
330 *
331 * @throws TorqueException Any exceptions caught during processing will be
332 * rethrown wrapped into a TorqueException.
333 */
334 public static List doSelectVillageRecords(Criteria criteria)
335 throws TorqueException
336 {
337 return BaseTurbineUserGroupRolePeer
338 .doSelectVillageRecords(criteria, (Connection) null);
339 }
340
341 /***
342 * Grabs the raw Village records to be formed into objects.
343 * This method should be used for transactions
344 *
345 * @param con the connection to use
346 * @throws TorqueException Any exceptions caught during processing will be
347 * rethrown wrapped into a TorqueException.
348 */
349 public static List doSelectVillageRecords(Criteria criteria, Connection con)
350 throws TorqueException
351 {
352 if (criteria.getSelectColumns().size() == 0)
353 {
354 addSelectColumns(criteria);
355 }
356
357
358
359
360
361 if (criteria.getDbName() == Torque.getDefaultDB())
362 {
363 criteria.setDbName(DATABASE_NAME);
364 }
365
366
367 if (con == null)
368 {
369 return BasePeer.doSelect(criteria);
370 }
371 else
372 {
373 return BasePeer.doSelect(criteria, con);
374 }
375 }
376
377 /***
378 * The returned List will contain objects of the default type or
379 * objects that inherit from the default.
380 *
381 * @throws TorqueException Any exceptions caught during processing will be
382 * rethrown wrapped into a TorqueException.
383 */
384 public static List populateObjects(List records)
385 throws TorqueException
386 {
387 List results = new ArrayList(records.size());
388
389
390 for (int i = 0; i < records.size(); i++)
391 {
392 Record row = (Record) records.get(i);
393 results.add(TurbineUserGroupRolePeer.row2Object(row, 1,
394 TurbineUserGroupRolePeer.getOMClass()));
395 }
396 return results;
397 }
398
399
400 /***
401 * The class that the Peer will make instances of.
402 * If the BO is abstract then you must implement this method
403 * in the BO.
404 *
405 * @throws TorqueException Any exceptions caught during processing will be
406 * rethrown wrapped into a TorqueException.
407 */
408 public static Class getOMClass()
409 throws TorqueException
410 {
411 return CLASS_DEFAULT;
412 }
413
414 /***
415 * Method to do updates.
416 *
417 * @param criteria object containing data that is used to create the UPDATE
418 * statement.
419 * @throws TorqueException Any exceptions caught during processing will be
420 * rethrown wrapped into a TorqueException.
421 */
422 public static void doUpdate(Criteria criteria) throws TorqueException
423 {
424 BaseTurbineUserGroupRolePeer
425 .doUpdate(criteria, (Connection) null);
426 }
427
428 /***
429 * Method to do updates. This method is to be used during a transaction,
430 * otherwise use the doUpdate(Criteria) method. It will take care of
431 * the connection details internally.
432 *
433 * @param criteria object containing data that is used to create the UPDATE
434 * statement.
435 * @param con the connection to use
436 * @throws TorqueException Any exceptions caught during processing will be
437 * rethrown wrapped into a TorqueException.
438 */
439 public static void doUpdate(Criteria criteria, Connection con)
440 throws TorqueException
441 {
442 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
443 selectCriteria.put(USER_ID, criteria.remove(USER_ID));
444 selectCriteria.put(GROUP_ID, criteria.remove(GROUP_ID));
445 selectCriteria.put(ROLE_ID, criteria.remove(ROLE_ID));
446
447
448
449
450 if (criteria.getDbName() == Torque.getDefaultDB())
451 {
452 criteria.setDbName(DATABASE_NAME);
453 }
454 if (con == null)
455 {
456 BasePeer.doUpdate(selectCriteria, criteria);
457 }
458 else
459 {
460 BasePeer.doUpdate(selectCriteria, criteria, con);
461 }
462 }
463
464 /***
465 * Method to do deletes.
466 *
467 * @param criteria object containing data that is used DELETE from database.
468 * @throws TorqueException Any exceptions caught during processing will be
469 * rethrown wrapped into a TorqueException.
470 */
471 public static void doDelete(Criteria criteria) throws TorqueException
472 {
473 BaseTurbineUserGroupRolePeer
474 .doDelete(criteria, (Connection) null);
475 }
476
477 /***
478 * Method to do deletes. This method is to be used during a transaction,
479 * otherwise use the doDelete(Criteria) method. It will take care of
480 * the connection details internally.
481 *
482 * @param criteria object containing data that is used DELETE from database.
483 * @param con the connection to use
484 * @throws TorqueException Any exceptions caught during processing will be
485 * rethrown wrapped into a TorqueException.
486 */
487 public static void doDelete(Criteria criteria, Connection con)
488 throws TorqueException
489 {
490
491
492
493
494 if (criteria.getDbName() == Torque.getDefaultDB())
495 {
496 criteria.setDbName(DATABASE_NAME);
497 }
498 if (con == null)
499 {
500 BasePeer.doDelete(criteria);
501 }
502 else
503 {
504 BasePeer.doDelete(criteria, con);
505 }
506 }
507
508 /***
509 * Method to do selects
510 *
511 * @throws TorqueException Any exceptions caught during processing will be
512 * rethrown wrapped into a TorqueException.
513 */
514 public static List doSelect(TurbineUserGroupRole obj) throws TorqueException
515 {
516 return doSelect(buildCriteria(obj));
517 }
518
519 /***
520 * Method to do inserts
521 *
522 * @throws TorqueException Any exceptions caught during processing will be
523 * rethrown wrapped into a TorqueException.
524 */
525 public static void doInsert(TurbineUserGroupRole obj) throws TorqueException
526 {
527 doInsert(buildCriteria(obj));
528 obj.setNew(false);
529 obj.setModified(false);
530 }
531
532 /***
533 * @param obj the data object to update in the database.
534 * @throws TorqueException Any exceptions caught during processing will be
535 * rethrown wrapped into a TorqueException.
536 */
537 public static void doUpdate(TurbineUserGroupRole obj) throws TorqueException
538 {
539 doUpdate(buildCriteria(obj));
540 obj.setModified(false);
541 }
542
543 /***
544 * @param obj the data object to delete in the database.
545 * @throws TorqueException Any exceptions caught during processing will be
546 * rethrown wrapped into a TorqueException.
547 */
548 public static void doDelete(TurbineUserGroupRole obj) throws TorqueException
549 {
550 doDelete(buildCriteria(obj));
551 }
552
553 /***
554 * Method to do inserts. This method is to be used during a transaction,
555 * otherwise use the doInsert(TurbineUserGroupRole) method. It will take
556 * care of the connection details internally.
557 *
558 * @param obj the data object to insert into the database.
559 * @param con the connection to use
560 * @throws TorqueException Any exceptions caught during processing will be
561 * rethrown wrapped into a TorqueException.
562 */
563 public static void doInsert(TurbineUserGroupRole obj, Connection con)
564 throws TorqueException
565 {
566 doInsert(buildCriteria(obj), con);
567 obj.setNew(false);
568 obj.setModified(false);
569 }
570
571 /***
572 * Method to do update. This method is to be used during a transaction,
573 * otherwise use the doUpdate(TurbineUserGroupRole) method. It will take
574 * care of the connection details internally.
575 *
576 * @param obj the data object to update in the database.
577 * @param con the connection to use
578 * @throws TorqueException Any exceptions caught during processing will be
579 * rethrown wrapped into a TorqueException.
580 */
581 public static void doUpdate(TurbineUserGroupRole obj, Connection con)
582 throws TorqueException
583 {
584 doUpdate(buildCriteria(obj), con);
585 obj.setModified(false);
586 }
587
588 /***
589 * Method to delete. This method is to be used during a transaction,
590 * otherwise use the doDelete(TurbineUserGroupRole) method. It will take
591 * care of the connection details internally.
592 *
593 * @param obj the data object to delete in the database.
594 * @param con the connection to use
595 * @throws TorqueException Any exceptions caught during processing will be
596 * rethrown wrapped into a TorqueException.
597 */
598 public static void doDelete(TurbineUserGroupRole obj, Connection con)
599 throws TorqueException
600 {
601 doDelete(buildCriteria(obj), con);
602 }
603
604 /***
605 * Method to do deletes.
606 *
607 * @param pk ObjectKey that is used DELETE from database.
608 * @throws TorqueException Any exceptions caught during processing will be
609 * rethrown wrapped into a TorqueException.
610 */
611 public static void doDelete(ObjectKey pk) throws TorqueException
612 {
613 BaseTurbineUserGroupRolePeer
614 .doDelete(pk, (Connection) null);
615 }
616
617 /***
618 * Method to delete. This method is to be used during a transaction,
619 * otherwise use the doDelete(ObjectKey) method. It will take
620 * care of the connection details internally.
621 *
622 * @param pk the primary key for the object to delete in the database.
623 * @param con the connection to use
624 * @throws TorqueException Any exceptions caught during processing will be
625 * rethrown wrapped into a TorqueException.
626 */
627 public static void doDelete(ObjectKey pk, Connection con)
628 throws TorqueException
629 {
630 doDelete(buildCriteria(pk), con);
631 }
632
633 /*** Build a Criteria object from an ObjectKey */
634 public static Criteria buildCriteria( ObjectKey pk )
635 {
636 Criteria criteria = new Criteria();
637 SimpleKey[] keys = (SimpleKey[])pk.getValue();
638 criteria.add(USER_ID, keys[0]);
639 criteria.add(GROUP_ID, keys[1]);
640 criteria.add(ROLE_ID, keys[2]);
641 return criteria;
642 }
643
644 /*** Build a Criteria object from the data object for this peer */
645 public static Criteria buildCriteria( TurbineUserGroupRole obj )
646 {
647 Criteria criteria = new Criteria(DATABASE_NAME);
648 criteria.add(USER_ID, obj.getUserId());
649 criteria.add(GROUP_ID, obj.getGroupId());
650 criteria.add(ROLE_ID, obj.getRoleId());
651 return criteria;
652 }
653
654
655
656 /***
657 * Retrieve a single object by pk
658 *
659 * @param pk the primary key
660 * @throws TorqueException Any exceptions caught during processing will be
661 * rethrown wrapped into a TorqueException.
662 * @throws NoRowsException Primary key was not found in database.
663 * @throws TooManyRowsException Primary key was not found in database.
664 */
665 public static TurbineUserGroupRole retrieveByPK(ObjectKey pk)
666 throws TorqueException, NoRowsException, TooManyRowsException
667 {
668 Connection db = null;
669 TurbineUserGroupRole retVal = null;
670 try
671 {
672 db = Torque.getConnection(DATABASE_NAME);
673 retVal = retrieveByPK(pk, db);
674 }
675 finally
676 {
677 Torque.closeConnection(db);
678 }
679 return(retVal);
680 }
681
682 /***
683 * Retrieve a single object by pk
684 *
685 * @param pk the primary key
686 * @param con the connection to use
687 * @throws TorqueException Any exceptions caught during processing will be
688 * rethrown wrapped into a TorqueException.
689 * @throws NoRowsException Primary key was not found in database.
690 * @throws TooManyRowsException Primary key was not found in database.
691 */
692 public static TurbineUserGroupRole retrieveByPK(ObjectKey pk, Connection con)
693 throws TorqueException, NoRowsException, TooManyRowsException
694 {
695 Criteria criteria = buildCriteria(pk);
696 List v = doSelect(criteria, con);
697 if (v.size() == 0)
698 {
699 throw new NoRowsException("Failed to select a row.");
700 }
701 else if (v.size() > 1)
702 {
703 throw new TooManyRowsException("Failed to select only one row.");
704 }
705 else
706 {
707 return (TurbineUserGroupRole)v.get(0);
708 }
709 }
710
711 /***
712 * Retrieve a multiple objects by pk
713 *
714 * @param pks List of primary keys
715 * @throws TorqueException Any exceptions caught during processing will be
716 * rethrown wrapped into a TorqueException.
717 */
718 public static List retrieveByPKs(List pks)
719 throws TorqueException
720 {
721 Connection db = null;
722 List retVal = null;
723 try
724 {
725 db = Torque.getConnection(DATABASE_NAME);
726 retVal = retrieveByPKs(pks, db);
727 }
728 finally
729 {
730 Torque.closeConnection(db);
731 }
732 return(retVal);
733 }
734
735 /***
736 * Retrieve a multiple objects by pk
737 *
738 * @param pks List of primary keys
739 * @param dbcon the connection to use
740 * @throws TorqueException Any exceptions caught during processing will be
741 * rethrown wrapped into a TorqueException.
742 */
743 public static List retrieveByPKs( List pks, Connection dbcon )
744 throws TorqueException
745 {
746 List objs = null;
747 if (pks == null || pks.size() == 0)
748 {
749 objs = new LinkedList();
750 }
751 else
752 {
753 Criteria criteria = new Criteria();
754 Iterator iter = pks.iterator();
755 while (iter.hasNext())
756 {
757 ObjectKey pk = (ObjectKey)iter.next();
758 SimpleKey[] keys = (SimpleKey[])pk.getValue();
759 Criteria.Criterion c0 = criteria.getNewCriterion(
760 USER_ID, keys[0], Criteria.EQUAL);
761 Criteria.Criterion c1 = criteria.getNewCriterion(
762 GROUP_ID, keys[1], Criteria.EQUAL);
763 c0.and(c1);
764 Criteria.Criterion c2 = criteria.getNewCriterion(
765 ROLE_ID, keys[2], Criteria.EQUAL);
766 c1.and(c2);
767 criteria.or(c0);
768 }
769 objs = doSelect(criteria, dbcon);
770 }
771 return objs;
772 }
773
774
775 /***
776 * retrieve object using using pk values.
777 *
778 * @param user_id int
779 * @param group_id int
780 * @param role_id int
781 */
782 public static TurbineUserGroupRole retrieveByPK(
783 int user_id
784 , int group_id
785 , int role_id
786 ) throws TorqueException
787 {
788 Connection db = null;
789 TurbineUserGroupRole retVal = null;
790 try
791 {
792 db = Torque.getConnection(DATABASE_NAME);
793 retVal = retrieveByPK(
794 user_id
795 , group_id
796 , role_id
797 , db);
798 }
799 finally
800 {
801 Torque.closeConnection(db);
802 }
803 return(retVal);
804 }
805
806 /***
807 * retrieve object using using pk values.
808 *
809 * @param user_id int
810 * @param group_id int
811 * @param role_id int
812 * @param Connection con
813 */
814 public static TurbineUserGroupRole retrieveByPK(
815 int user_id
816 , int group_id
817 , int role_id
818 ,Connection con) throws TorqueException
819 {
820
821 Criteria criteria = new Criteria(5);
822 criteria.add(USER_ID, user_id);
823 criteria.add(GROUP_ID, group_id);
824 criteria.add(ROLE_ID, role_id);
825 List v = doSelect(criteria, con);
826 if (v.size() != 1)
827 {
828 throw new TorqueException("Failed to select one and only one row.");
829 }
830 else
831 {
832 return (TurbineUserGroupRole) v.get(0);
833 }
834 }
835
836
837
838
839
840
841
842
843 /***
844 * selects a collection of TurbineUserGroupRole objects pre-filled with their
845 * TurbineUser objects.
846 *
847 * This method is protected by default in order to keep the public
848 * api reasonable. You can provide public methods for those you
849 * actually need in TurbineUserGroupRolePeer.
850 *
851 * @throws TorqueException Any exceptions caught during processing will be
852 * rethrown wrapped into a TorqueException.
853 */
854 protected static List doSelectJoinTurbineUser(Criteria c)
855 throws TorqueException
856 {
857
858
859
860 if (c.getDbName() == Torque.getDefaultDB())
861 {
862 c.setDbName(DATABASE_NAME);
863 }
864
865 TurbineUserGroupRolePeer.addSelectColumns(c);
866 int offset = numColumns + 1;
867 TurbineUserPeer.addSelectColumns(c);
868
869
870 c.addJoin(TurbineUserGroupRolePeer.USER_ID,
871 TurbineUserPeer.USER_ID);
872
873
874
875 List rows = BasePeer.doSelect(c);
876 List results = new ArrayList();
877
878 for (int i = 0; i < rows.size(); i++)
879 {
880 Record row = (Record) rows.get(i);
881
882 Class omClass = TurbineUserGroupRolePeer.getOMClass();
883 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
884 .row2Object(row, 1, omClass);
885 omClass = TurbineUserPeer.getOMClass();
886 TurbineUser obj2 = (TurbineUser)TurbineUserPeer
887 .row2Object(row, offset, omClass);
888
889 boolean newObject = true;
890 for (int j = 0; j < results.size(); j++)
891 {
892 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
893 TurbineUser temp_obj2 = (TurbineUser)temp_obj1.getTurbineUser();
894 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
895 {
896 newObject = false;
897 temp_obj2.addTurbineUserGroupRole(obj1);
898 break;
899 }
900 }
901 if (newObject)
902 {
903 obj2.initTurbineUserGroupRoles();
904 obj2.addTurbineUserGroupRole(obj1);
905 }
906 results.add(obj1);
907 }
908 return results;
909 }
910
911
912
913
914 /***
915 * selects a collection of TurbineUserGroupRole objects pre-filled with their
916 * TurbineGroup objects.
917 *
918 * This method is protected by default in order to keep the public
919 * api reasonable. You can provide public methods for those you
920 * actually need in TurbineUserGroupRolePeer.
921 *
922 * @throws TorqueException Any exceptions caught during processing will be
923 * rethrown wrapped into a TorqueException.
924 */
925 protected static List doSelectJoinTurbineGroup(Criteria c)
926 throws TorqueException
927 {
928
929
930
931 if (c.getDbName() == Torque.getDefaultDB())
932 {
933 c.setDbName(DATABASE_NAME);
934 }
935
936 TurbineUserGroupRolePeer.addSelectColumns(c);
937 int offset = numColumns + 1;
938 TurbineGroupPeer.addSelectColumns(c);
939
940
941 c.addJoin(TurbineUserGroupRolePeer.GROUP_ID,
942 TurbineGroupPeer.GROUP_ID);
943
944
945
946 List rows = BasePeer.doSelect(c);
947 List results = new ArrayList();
948
949 for (int i = 0; i < rows.size(); i++)
950 {
951 Record row = (Record) rows.get(i);
952
953 Class omClass = TurbineUserGroupRolePeer.getOMClass();
954 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
955 .row2Object(row, 1, omClass);
956 omClass = TurbineGroupPeer.getOMClass();
957 TurbineGroup obj2 = (TurbineGroup)TurbineGroupPeer
958 .row2Object(row, offset, omClass);
959
960 boolean newObject = true;
961 for (int j = 0; j < results.size(); j++)
962 {
963 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
964 TurbineGroup temp_obj2 = (TurbineGroup)temp_obj1.getTurbineGroup();
965 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
966 {
967 newObject = false;
968 temp_obj2.addTurbineUserGroupRole(obj1);
969 break;
970 }
971 }
972 if (newObject)
973 {
974 obj2.initTurbineUserGroupRoles();
975 obj2.addTurbineUserGroupRole(obj1);
976 }
977 results.add(obj1);
978 }
979 return results;
980 }
981
982
983
984
985 /***
986 * selects a collection of TurbineUserGroupRole objects pre-filled with their
987 * TurbineRole objects.
988 *
989 * This method is protected by default in order to keep the public
990 * api reasonable. You can provide public methods for those you
991 * actually need in TurbineUserGroupRolePeer.
992 *
993 * @throws TorqueException Any exceptions caught during processing will be
994 * rethrown wrapped into a TorqueException.
995 */
996 protected static List doSelectJoinTurbineRole(Criteria c)
997 throws TorqueException
998 {
999
1000
1001
1002 if (c.getDbName() == Torque.getDefaultDB())
1003 {
1004 c.setDbName(DATABASE_NAME);
1005 }
1006
1007 TurbineUserGroupRolePeer.addSelectColumns(c);
1008 int offset = numColumns + 1;
1009 TurbineRolePeer.addSelectColumns(c);
1010
1011
1012 c.addJoin(TurbineUserGroupRolePeer.ROLE_ID,
1013 TurbineRolePeer.ROLE_ID);
1014
1015
1016
1017 List rows = BasePeer.doSelect(c);
1018 List results = new ArrayList();
1019
1020 for (int i = 0; i < rows.size(); i++)
1021 {
1022 Record row = (Record) rows.get(i);
1023
1024 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1025 TurbineUserGroupRole obj1 = (TurbineUserGroupRole) TurbineUserGroupRolePeer
1026 .row2Object(row, 1, omClass);
1027 omClass = TurbineRolePeer.getOMClass();
1028 TurbineRole obj2 = (TurbineRole)TurbineRolePeer
1029 .row2Object(row, offset, omClass);
1030
1031 boolean newObject = true;
1032 for (int j = 0; j < results.size(); j++)
1033 {
1034 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1035 TurbineRole temp_obj2 = (TurbineRole)temp_obj1.getTurbineRole();
1036 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1037 {
1038 newObject = false;
1039 temp_obj2.addTurbineUserGroupRole(obj1);
1040 break;
1041 }
1042 }
1043 if (newObject)
1044 {
1045 obj2.initTurbineUserGroupRoles();
1046 obj2.addTurbineUserGroupRole(obj1);
1047 }
1048 results.add(obj1);
1049 }
1050 return results;
1051 }
1052
1053
1054
1055
1056
1057
1058
1059
1060 /***
1061 * selects a collection of TurbineUserGroupRole objects pre-filled with
1062 * all related objects.
1063 *
1064 * This method is protected by default in order to keep the public
1065 * api reasonable. You can provide public methods for those you
1066 * actually need in TurbineUserGroupRolePeer.
1067 *
1068 * @throws TorqueException Any exceptions caught during processing will be
1069 * rethrown wrapped into a TorqueException.
1070 */
1071 protected static List doSelectJoinAllExceptTurbineUser(Criteria c)
1072 throws TorqueException
1073 {
1074
1075
1076
1077 if (c.getDbName() == Torque.getDefaultDB())
1078 {
1079 c.setDbName(DATABASE_NAME);
1080 }
1081
1082 addSelectColumns(c);
1083 int offset2 = numColumns + 1;
1084
1085
1086 TurbineGroupPeer.addSelectColumns(c);
1087 int offset3 = offset2 + TurbineGroupPeer.numColumns;
1088
1089 TurbineRolePeer.addSelectColumns(c);
1090 int offset4 = offset3 + TurbineRolePeer.numColumns;
1091
1092 List rows = BasePeer.doSelect(c);
1093 List results = new ArrayList();
1094
1095 for (int i = 0; i < rows.size(); i++)
1096 {
1097 Record row = (Record)rows.get(i);
1098
1099 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1100 TurbineUserGroupRole obj1 = (TurbineUserGroupRole)TurbineUserGroupRolePeer
1101 .row2Object(row, 1, omClass);
1102
1103
1104
1105
1106
1107 omClass = TurbineGroupPeer.getOMClass();
1108 TurbineGroup obj2 = (TurbineGroup)TurbineGroupPeer
1109 .row2Object( row, offset2, omClass);
1110
1111 boolean newObject = true;
1112 for (int j = 0; j < results.size(); j++)
1113 {
1114 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1115 TurbineGroup temp_obj2 = (TurbineGroup)temp_obj1.getTurbineGroup();
1116 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1117 {
1118 newObject = false;
1119 temp_obj2.addTurbineUserGroupRole(obj1);
1120 break;
1121 }
1122 }
1123 if (newObject)
1124 {
1125 obj2.initTurbineUserGroupRoles();
1126 obj2.addTurbineUserGroupRole(obj1);
1127 }
1128
1129
1130
1131
1132 omClass = TurbineRolePeer.getOMClass();
1133 TurbineRole obj3 = (TurbineRole)TurbineRolePeer
1134 .row2Object( row, offset3, omClass);
1135
1136 newObject = true;
1137 for (int j = 0; j < results.size(); j++)
1138 {
1139 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1140 TurbineRole temp_obj3 = (TurbineRole)temp_obj1.getTurbineRole();
1141 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1142 {
1143 newObject = false;
1144 temp_obj3.addTurbineUserGroupRole(obj1);
1145 break;
1146 }
1147 }
1148 if (newObject)
1149 {
1150 obj3.initTurbineUserGroupRoles();
1151 obj3.addTurbineUserGroupRole(obj1);
1152 }
1153 results.add(obj1);
1154 }
1155 return results;
1156 }
1157
1158
1159
1160
1161
1162 /***
1163 * selects a collection of TurbineUserGroupRole objects pre-filled with
1164 * all related objects.
1165 *
1166 * This method is protected by default in order to keep the public
1167 * api reasonable. You can provide public methods for those you
1168 * actually need in TurbineUserGroupRolePeer.
1169 *
1170 * @throws TorqueException Any exceptions caught during processing will be
1171 * rethrown wrapped into a TorqueException.
1172 */
1173 protected static List doSelectJoinAllExceptTurbineGroup(Criteria c)
1174 throws TorqueException
1175 {
1176
1177
1178
1179 if (c.getDbName() == Torque.getDefaultDB())
1180 {
1181 c.setDbName(DATABASE_NAME);
1182 }
1183
1184 addSelectColumns(c);
1185 int offset2 = numColumns + 1;
1186
1187 TurbineUserPeer.addSelectColumns(c);
1188 int offset3 = offset2 + TurbineUserPeer.numColumns;
1189
1190
1191 TurbineRolePeer.addSelectColumns(c);
1192 int offset4 = offset3 + TurbineRolePeer.numColumns;
1193
1194 List rows = BasePeer.doSelect(c);
1195 List results = new ArrayList();
1196
1197 for (int i = 0; i < rows.size(); i++)
1198 {
1199 Record row = (Record)rows.get(i);
1200
1201 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1202 TurbineUserGroupRole obj1 = (TurbineUserGroupRole)TurbineUserGroupRolePeer
1203 .row2Object(row, 1, omClass);
1204
1205
1206
1207
1208 omClass = TurbineUserPeer.getOMClass();
1209 TurbineUser obj2 = (TurbineUser)TurbineUserPeer
1210 .row2Object( row, offset2, omClass);
1211
1212 boolean newObject = true;
1213 for (int j = 0; j < results.size(); j++)
1214 {
1215 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1216 TurbineUser temp_obj2 = (TurbineUser)temp_obj1.getTurbineUser();
1217 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1218 {
1219 newObject = false;
1220 temp_obj2.addTurbineUserGroupRole(obj1);
1221 break;
1222 }
1223 }
1224 if (newObject)
1225 {
1226 obj2.initTurbineUserGroupRoles();
1227 obj2.addTurbineUserGroupRole(obj1);
1228 }
1229
1230
1231
1232
1233
1234 omClass = TurbineRolePeer.getOMClass();
1235 TurbineRole obj3 = (TurbineRole)TurbineRolePeer
1236 .row2Object( row, offset3, omClass);
1237
1238 newObject = true;
1239 for (int j = 0; j < results.size(); j++)
1240 {
1241 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1242 TurbineRole temp_obj3 = (TurbineRole)temp_obj1.getTurbineRole();
1243 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1244 {
1245 newObject = false;
1246 temp_obj3.addTurbineUserGroupRole(obj1);
1247 break;
1248 }
1249 }
1250 if (newObject)
1251 {
1252 obj3.initTurbineUserGroupRoles();
1253 obj3.addTurbineUserGroupRole(obj1);
1254 }
1255 results.add(obj1);
1256 }
1257 return results;
1258 }
1259
1260
1261
1262
1263
1264 /***
1265 * selects a collection of TurbineUserGroupRole objects pre-filled with
1266 * all related objects.
1267 *
1268 * This method is protected by default in order to keep the public
1269 * api reasonable. You can provide public methods for those you
1270 * actually need in TurbineUserGroupRolePeer.
1271 *
1272 * @throws TorqueException Any exceptions caught during processing will be
1273 * rethrown wrapped into a TorqueException.
1274 */
1275 protected static List doSelectJoinAllExceptTurbineRole(Criteria c)
1276 throws TorqueException
1277 {
1278
1279
1280
1281 if (c.getDbName() == Torque.getDefaultDB())
1282 {
1283 c.setDbName(DATABASE_NAME);
1284 }
1285
1286 addSelectColumns(c);
1287 int offset2 = numColumns + 1;
1288
1289 TurbineUserPeer.addSelectColumns(c);
1290 int offset3 = offset2 + TurbineUserPeer.numColumns;
1291
1292 TurbineGroupPeer.addSelectColumns(c);
1293 int offset4 = offset3 + TurbineGroupPeer.numColumns;
1294
1295
1296 List rows = BasePeer.doSelect(c);
1297 List results = new ArrayList();
1298
1299 for (int i = 0; i < rows.size(); i++)
1300 {
1301 Record row = (Record)rows.get(i);
1302
1303 Class omClass = TurbineUserGroupRolePeer.getOMClass();
1304 TurbineUserGroupRole obj1 = (TurbineUserGroupRole)TurbineUserGroupRolePeer
1305 .row2Object(row, 1, omClass);
1306
1307
1308
1309
1310 omClass = TurbineUserPeer.getOMClass();
1311 TurbineUser obj2 = (TurbineUser)TurbineUserPeer
1312 .row2Object( row, offset2, omClass);
1313
1314 boolean newObject = true;
1315 for (int j = 0; j < results.size(); j++)
1316 {
1317 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1318 TurbineUser temp_obj2 = (TurbineUser)temp_obj1.getTurbineUser();
1319 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1320 {
1321 newObject = false;
1322 temp_obj2.addTurbineUserGroupRole(obj1);
1323 break;
1324 }
1325 }
1326 if (newObject)
1327 {
1328 obj2.initTurbineUserGroupRoles();
1329 obj2.addTurbineUserGroupRole(obj1);
1330 }
1331
1332
1333
1334
1335 omClass = TurbineGroupPeer.getOMClass();
1336 TurbineGroup obj3 = (TurbineGroup)TurbineGroupPeer
1337 .row2Object( row, offset3, omClass);
1338
1339 newObject = true;
1340 for (int j = 0; j < results.size(); j++)
1341 {
1342 TurbineUserGroupRole temp_obj1 = (TurbineUserGroupRole)results.get(j);
1343 TurbineGroup temp_obj3 = (TurbineGroup)temp_obj1.getTurbineGroup();
1344 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1345 {
1346 newObject = false;
1347 temp_obj3.addTurbineUserGroupRole(obj1);
1348 break;
1349 }
1350 }
1351 if (newObject)
1352 {
1353 obj3.initTurbineUserGroupRoles();
1354 obj3.addTurbineUserGroupRole(obj1);
1355 }
1356
1357 results.add(obj1);
1358 }
1359 return results;
1360 }
1361
1362
1363 /***
1364 * Returns the TableMap related to this peer. This method is not
1365 * needed for general use but a specific application could have a need.
1366 *
1367 * @throws TorqueException Any exceptions caught during processing will be
1368 * rethrown wrapped into a TorqueException.
1369 */
1370 protected static TableMap getTableMap()
1371 throws TorqueException
1372 {
1373 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1374 }
1375 }