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.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.turbine.services.security.torque.om.map.*;
32
33
34
35
36
37 /***
38 * This class was autogenerated by Torque on:
39 *
40 * [Mon Oct 03 14:24:58 CEST 2005]
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(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 /*** 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.turbine.services.security.torque.om.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 <torque-dev@db.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 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 /***
218 * Add all the columns needed to create a new object.
219 *
220 * @param criteria object containing the columns to add.
221 * @throws TorqueException Any exceptions caught during processing will be
222 * rethrown wrapped into a TorqueException.
223 */
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 /***
233 * Create a new object of type cls from a resultset row starting
234 * from a specified offset. This is done so that you can select
235 * other rows than just those needed for this object. You may
236 * for example want to create two objects from the same row.
237 *
238 * @throws TorqueException Any exceptions caught during processing will be
239 * rethrown wrapped into a TorqueException.
240 */
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 /***
266 * Populates an object from a resultset row starting
267 * from a specified offset. This is done so that you can select
268 * other rows than just those needed for this object. You may
269 * for example want to create two objects from the same row.
270 *
271 * @throws TorqueException Any exceptions caught during processing will be
272 * rethrown wrapped into a TorqueException.
273 */
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 /***
292 * Method to do selects.
293 *
294 * @param criteria object used to create the SELECT statement.
295 * @return List of selected Objects
296 * @throws TorqueException Any exceptions caught during processing will be
297 * rethrown wrapped into a TorqueException.
298 */
299 public static List doSelect(Criteria criteria) throws TorqueException
300 {
301 return populateObjects(doSelectVillageRecords(criteria));
302 }
303
304 /***
305 * Method to do selects within a transaction.
306 *
307 * @param criteria object used to create the SELECT statement.
308 * @param con the connection to use
309 * @return List of selected Objects
310 * @throws TorqueException Any exceptions caught during processing will be
311 * rethrown wrapped into a TorqueException.
312 */
313 public static List doSelect(Criteria criteria, Connection con)
314 throws TorqueException
315 {
316 return populateObjects(doSelectVillageRecords(criteria, con));
317 }
318
319 /***
320 * Grabs the raw Village records to be formed into objects.
321 * This method handles connections internally. The Record objects
322 * returned by this method should be considered readonly. Do not
323 * alter the data and call save(), your results may vary, but are
324 * certainly likely to result in hard to track MT bugs.
325 *
326 * @throws TorqueException Any exceptions caught during processing will be
327 * rethrown wrapped into a TorqueException.
328 */
329 public static List doSelectVillageRecords(Criteria criteria)
330 throws TorqueException
331 {
332 return BaseTurbineUserGroupRolePeer
333 .doSelectVillageRecords(criteria, (Connection) null);
334 }
335
336 /***
337 * Grabs the raw Village records to be formed into objects.
338 * This method should be used for transactions
339 *
340 * @param criteria object used to create the SELECT statement.
341 * @param con the connection to use
342 * @throws TorqueException Any exceptions caught during processing will be
343 * rethrown wrapped into a TorqueException.
344 */
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
357
358 if (con == null)
359 {
360 return BasePeer.doSelect(criteria);
361 }
362 else
363 {
364 return BasePeer.doSelect(criteria, con);
365 }
366 }
367
368 /***
369 * The returned List will contain objects of the default type or
370 * objects that inherit from the default.
371 *
372 * @throws TorqueException Any exceptions caught during processing will be
373 * rethrown wrapped into a TorqueException.
374 */
375 public static List populateObjects(List records)
376 throws TorqueException
377 {
378 List results = new ArrayList(records.size());
379
380
381 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 /***
392 * The class that the Peer will make instances of.
393 * If the BO is abstract then you must implement this method
394 * in the BO.
395 *
396 * @throws TorqueException Any exceptions caught during processing will be
397 * rethrown wrapped into a TorqueException.
398 */
399 public static Class getOMClass()
400 throws TorqueException
401 {
402 return CLASS_DEFAULT;
403 }
404
405 /***
406 * Method to do updates.
407 *
408 * @param criteria object containing data that is used to create the UPDATE
409 * statement.
410 * @throws TorqueException Any exceptions caught during processing will be
411 * rethrown wrapped into a TorqueException.
412 */
413 public static void doUpdate(Criteria criteria) throws TorqueException
414 {
415 BaseTurbineUserGroupRolePeer
416 .doUpdate(criteria, (Connection) null);
417 }
418
419 /***
420 * Method to do updates. This method is to be used during a transaction,
421 * otherwise use the doUpdate(Criteria) method. It will take care of
422 * the connection details internally.
423 *
424 * @param criteria object containing data that is used to create the UPDATE
425 * statement.
426 * @param con the connection to use
427 * @throws TorqueException Any exceptions caught during processing will be
428 * rethrown wrapped into a TorqueException.
429 */
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 /***
451 * Method to do deletes.
452 *
453 * @param criteria object containing data that is used DELETE from database.
454 * @throws TorqueException Any exceptions caught during processing will be
455 * rethrown wrapped into a TorqueException.
456 */
457 public static void doDelete(Criteria criteria) throws TorqueException
458 {
459 TurbineUserGroupRolePeer
460 .doDelete(criteria, (Connection) null);
461 }
462
463 /***
464 * Method to do deletes. This method is to be used during a transaction,
465 * otherwise use the doDelete(Criteria) method. It will take care of
466 * the connection details internally.
467 *
468 * @param criteria object containing data that is used DELETE from database.
469 * @param con the connection to use
470 * @throws TorqueException Any exceptions caught during processing will be
471 * rethrown wrapped into a TorqueException.
472 */
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 /***
490 * Method to do selects
491 *
492 * @throws TorqueException Any exceptions caught during processing will be
493 * rethrown wrapped into a TorqueException.
494 */
495 public static List doSelect(TurbineUserGroupRole obj) throws TorqueException
496 {
497 return doSelect(buildSelectCriteria(obj));
498 }
499
500 /***
501 * Method to do inserts
502 *
503 * @throws TorqueException Any exceptions caught during processing will be
504 * rethrown wrapped into a TorqueException.
505 */
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 /***
514 * @param obj the data object to update in the database.
515 * @throws TorqueException Any exceptions caught during processing will be
516 * rethrown wrapped into a TorqueException.
517 */
518 public static void doUpdate(TurbineUserGroupRole obj) throws TorqueException
519 {
520 doUpdate(buildCriteria(obj));
521 obj.setModified(false);
522 }
523
524 /***
525 * @param obj the data object to delete in the database.
526 * @throws TorqueException Any exceptions caught during processing will be
527 * rethrown wrapped into a TorqueException.
528 */
529 public static void doDelete(TurbineUserGroupRole obj) throws TorqueException
530 {
531 doDelete(buildSelectCriteria(obj));
532 }
533
534 /***
535 * Method to do inserts. This method is to be used during a transaction,
536 * otherwise use the doInsert(TurbineUserGroupRole) method. It will take
537 * care of the connection details internally.
538 *
539 * @param obj the data object to insert into the database.
540 * @param con the connection to use
541 * @throws TorqueException Any exceptions caught during processing will be
542 * rethrown wrapped into a TorqueException.
543 */
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 /***
553 * Method to do update. This method is to be used during a transaction,
554 * otherwise use the doUpdate(TurbineUserGroupRole) method. It will take
555 * care of the connection details internally.
556 *
557 * @param obj the data object to update in the database.
558 * @param con the connection to use
559 * @throws TorqueException Any exceptions caught during processing will be
560 * rethrown wrapped into a TorqueException.
561 */
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 /***
570 * Method to delete. This method is to be used during a transaction,
571 * otherwise use the doDelete(TurbineUserGroupRole) method. It will take
572 * care of the connection details internally.
573 *
574 * @param obj the data object to delete in the database.
575 * @param con the connection to use
576 * @throws TorqueException Any exceptions caught during processing will be
577 * rethrown wrapped into a TorqueException.
578 */
579 public static void doDelete(TurbineUserGroupRole obj, Connection con)
580 throws TorqueException
581 {
582 doDelete(buildSelectCriteria(obj), con);
583 }
584
585 /***
586 * Method to do deletes.
587 *
588 * @param pk ObjectKey that is used DELETE from database.
589 * @throws TorqueException Any exceptions caught during processing will be
590 * rethrown wrapped into a TorqueException.
591 */
592 public static void doDelete(ObjectKey pk) throws TorqueException
593 {
594 BaseTurbineUserGroupRolePeer
595 .doDelete(pk, (Connection) null);
596 }
597
598 /***
599 * Method to delete. This method is to be used during a transaction,
600 * otherwise use the doDelete(ObjectKey) method. It will take
601 * care of the connection details internally.
602 *
603 * @param pk the primary key for the object to delete in the database.
604 * @param con the connection to use
605 * @throws TorqueException Any exceptions caught during processing will be
606 * rethrown wrapped into a TorqueException.
607 */
608 public static void doDelete(ObjectKey pk, Connection con)
609 throws TorqueException
610 {
611 doDelete(buildCriteria(pk), con);
612 }
613
614 /*** Build a Criteria object from an ObjectKey */
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 /*** Build a Criteria object from the data object for this peer */
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 /*** Build a Criteria object from the data object for this peer, skipping all binary columns */
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 /***
648 * Retrieve a single object by pk
649 *
650 * @param pk the primary key
651 * @throws TorqueException Any exceptions caught during processing will be
652 * rethrown wrapped into a TorqueException.
653 * @throws NoRowsException Primary key was not found in database.
654 * @throws TooManyRowsException Primary key was not found in database.
655 */
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 /***
674 * Retrieve a single object by pk
675 *
676 * @param pk the primary key
677 * @param con the connection to use
678 * @throws TorqueException Any exceptions caught during processing will be
679 * rethrown wrapped into a TorqueException.
680 * @throws NoRowsException Primary key was not found in database.
681 * @throws TooManyRowsException Primary key was not found in database.
682 */
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 /***
703 * Retrieve a multiple objects by pk
704 *
705 * @param pks List of primary keys
706 * @throws TorqueException Any exceptions caught during processing will be
707 * rethrown wrapped into a TorqueException.
708 */
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 /***
727 * Retrieve a multiple objects by pk
728 *
729 * @param pks List of primary keys
730 * @param dbcon the connection to use
731 * @throws TorqueException Any exceptions caught during processing will be
732 * rethrown wrapped into a TorqueException.
733 */
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 /***
767 * retrieve object using using pk values.
768 *
769 * @param user_id int
770 * @param group_id int
771 * @param role_id int
772 */
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 /***
798 * retrieve object using using pk values.
799 *
800 * @param user_id int
801 * @param group_id int
802 * @param role_id int
803 * @param con Connection
804 */
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 /***
835 * selects a collection of TurbineUserGroupRole objects pre-filled with their
836 * TurbineUser objects.
837 *
838 * This method is protected by default in order to keep the public
839 * api reasonable. You can provide public methods for those you
840 * actually need in TurbineUserGroupRolePeer.
841 *
842 * @throws TorqueException Any exceptions caught during processing will be
843 * rethrown wrapped into a TorqueException.
844 */
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 /***
900 * selects a collection of TurbineUserGroupRole objects pre-filled with their
901 * TurbineGroup objects.
902 *
903 * This method is protected by default in order to keep the public
904 * api reasonable. You can provide public methods for those you
905 * actually need in TurbineUserGroupRolePeer.
906 *
907 * @throws TorqueException Any exceptions caught during processing will be
908 * rethrown wrapped into a TorqueException.
909 */
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 /***
965 * selects a collection of TurbineUserGroupRole objects pre-filled with their
966 * TurbineRole objects.
967 *
968 * This method is protected by default in order to keep the public
969 * api reasonable. You can provide public methods for those you
970 * actually need in TurbineUserGroupRolePeer.
971 *
972 * @throws TorqueException Any exceptions caught during processing will be
973 * rethrown wrapped into a TorqueException.
974 */
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 /***
1034 * selects a collection of TurbineUserGroupRole objects pre-filled with
1035 * all related objects.
1036 *
1037 * This method is protected by default in order to keep the public
1038 * api reasonable. You can provide public methods for those you
1039 * actually need in TurbineUserGroupRolePeer.
1040 *
1041 * @throws TorqueException Any exceptions caught during processing will be
1042 * rethrown wrapped into a TorqueException.
1043 */
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 /***
1130 * selects a collection of TurbineUserGroupRole objects pre-filled with
1131 * all related objects.
1132 *
1133 * This method is protected by default in order to keep the public
1134 * api reasonable. You can provide public methods for those you
1135 * actually need in TurbineUserGroupRolePeer.
1136 *
1137 * @throws TorqueException Any exceptions caught during processing will be
1138 * rethrown wrapped into a TorqueException.
1139 */
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 /***
1226 * selects a collection of TurbineUserGroupRole objects pre-filled with
1227 * all related objects.
1228 *
1229 * This method is protected by default in order to keep the public
1230 * api reasonable. You can provide public methods for those you
1231 * actually need in TurbineUserGroupRolePeer.
1232 *
1233 * @throws TorqueException Any exceptions caught during processing will be
1234 * rethrown wrapped into a TorqueException.
1235 */
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 /***
1319 * Returns the TableMap related to this peer. This method is not
1320 * needed for general use but a specific application could have a need.
1321 *
1322 * @throws TorqueException Any exceptions caught during processing will be
1323 * rethrown wrapped into a TorqueException.
1324 */
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
1334
1335
1336 if (crit.getDbName() == Torque.getDefaultDB())
1337 {
1338 crit.setDbName(DATABASE_NAME);
1339 }
1340 }
1341 }