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