1 package olr.om;
2
3 import java.sql.Connection;
4 import java.sql.SQLException;
5 import java.util.ArrayList;
6 import java.util.LinkedList;
7 import java.util.List;
8
9 import olr.om.map.RdfUserMapBuilder;
10
11 import org.apache.torque.NoRowsException;
12 import org.apache.torque.TooManyRowsException;
13 import org.apache.torque.Torque;
14 import org.apache.torque.TorqueException;
15 import org.apache.torque.map.MapBuilder;
16 import org.apache.torque.map.TableMap;
17 import org.apache.torque.om.ObjectKey;
18 import org.apache.torque.om.SimpleKey;
19 import org.apache.torque.util.BasePeer;
20 import org.apache.torque.util.Criteria;
21
22 import com.workingdogs.village.DataSetException;
23 import com.workingdogs.village.QueryDataSet;
24 import com.workingdogs.village.Record;
25
26
27
28 /***
29 * This class was autogenerated by Torque on:
30 *
31 * [Tue Jul 13 14:47:47 CEST 2004]
32 *
33 */
34 public abstract class BaseRdfUserPeer
35 extends BasePeer
36 {
37
38 /*** the default database name for this class */
39 public static final String DATABASE_NAME = "default";
40
41 /*** the table name for this class */
42 public static final String TABLE_NAME = "rdf_user";
43
44 /***
45 * @return the map builder for this peer
46 * @throws TorqueException Any exceptions caught during processing will be
47 * rethrown wrapped into a TorqueException.
48 */
49 public static MapBuilder getMapBuilder()
50 throws TorqueException
51 {
52 return getMapBuilder(RdfUserMapBuilder.CLASS_NAME);
53 }
54
55 /*** the column name for the ID field */
56 public static final String ID;
57 /*** the column name for the FIRST_NAME field */
58 public static final String FIRST_NAME;
59 /*** the column name for the LAST_NAME field */
60 public static final String LAST_NAME;
61 /*** the column name for the DESCRIPTION field */
62 public static final String DESCRIPTION;
63 /*** the column name for the LOGIN field */
64 public static final String LOGIN;
65 /*** the column name for the PASSWORD field */
66 public static final String PASSWORD;
67 /*** the column name for the EMAIL field */
68 public static final String EMAIL;
69 /*** the column name for the LAST_ACCESS field */
70 public static final String LAST_ACCESS;
71 /*** the column name for the SESSION_KEY field */
72 public static final String SESSION_KEY;
73 /*** the column name for the GROUP_ID field */
74 public static final String GROUP_ID;
75
76 static
77 {
78 ID = "rdf_user.ID";
79 FIRST_NAME = "rdf_user.FIRST_NAME";
80 LAST_NAME = "rdf_user.LAST_NAME";
81 DESCRIPTION = "rdf_user.DESCRIPTION";
82 LOGIN = "rdf_user.LOGIN";
83 PASSWORD = "rdf_user.PASSWORD";
84 EMAIL = "rdf_user.EMAIL";
85 LAST_ACCESS = "rdf_user.LAST_ACCESS";
86 SESSION_KEY = "rdf_user.SESSION_KEY";
87 GROUP_ID = "rdf_user.GROUP_ID";
88 if (Torque.isInit())
89 {
90 try
91 {
92 getMapBuilder(RdfUserMapBuilder.CLASS_NAME);
93 }
94 catch (Exception e)
95 {
96 log.error("Could not initialize Peer", e);
97 }
98 }
99 else
100 {
101 Torque.registerMapBuilder(RdfUserMapBuilder.CLASS_NAME);
102 }
103 }
104
105 /*** number of columns for this peer */
106 public static final int numColumns = 10;
107
108 /*** A class that can be returned by this peer. */
109 protected static final String CLASSNAME_DEFAULT =
110 "olr.om.RdfUser";
111
112 /*** A class that can be returned by this peer. */
113 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
114
115 /***
116 * Class object initialization method.
117 *
118 * @param className name of the class to initialize
119 * @return the initialized class
120 */
121 private static Class initClass(String className)
122 {
123 Class c = null;
124 try
125 {
126 c = Class.forName(className);
127 }
128 catch (Throwable t)
129 {
130 log.error("A FATAL ERROR has occurred which should not "
131 + "have happened under any circumstance. Please notify "
132 + "the Torque developers <torque-dev@db.apache.org> "
133 + "and give as many details as possible (including the error "
134 + "stack trace).", t);
135
136
137 if (t instanceof Error)
138 {
139 throw (Error) t.fillInStackTrace();
140 }
141 }
142 return c;
143 }
144
145 /***
146 * Get the list of objects for a ResultSet. Please not that your
147 * resultset MUST return columns in the right order. You can use
148 * getFieldNames() in BaseObject to get the correct sequence.
149 *
150 * @param results the ResultSet
151 * @return the list of objects
152 * @throws TorqueException Any exceptions caught during processing will be
153 * rethrown wrapped into a TorqueException.
154 */
155 public static List resultSet2Objects(java.sql.ResultSet results)
156 throws TorqueException
157 {
158 try
159 {
160 QueryDataSet qds = null;
161 List rows = null;
162 try
163 {
164 qds = new QueryDataSet(results);
165 rows = getSelectResults(qds);
166 }
167 finally
168 {
169 if (qds != null)
170 {
171 qds.close();
172 }
173 }
174
175 return populateObjects(rows);
176 }
177 catch (SQLException e)
178 {
179 throw new TorqueException(e);
180 }
181 catch (DataSetException e)
182 {
183 throw new TorqueException(e);
184 }
185 }
186
187
188
189 /***
190 * Method to do inserts.
191 *
192 * @param criteria object used to create the INSERT statement.
193 * @throws TorqueException Any exceptions caught during processing will be
194 * rethrown wrapped into a TorqueException.
195 */
196 public static ObjectKey doInsert(Criteria criteria)
197 throws TorqueException
198 {
199 return BaseRdfUserPeer
200 .doInsert(criteria, (Connection) null);
201 }
202
203 /***
204 * Method to do inserts. This method is to be used during a transaction,
205 * otherwise use the doInsert(Criteria) method. It will take care of
206 * the connection details internally.
207 *
208 * @param criteria object used to create the INSERT statement.
209 * @param con the connection to use
210 * @throws TorqueException Any exceptions caught during processing will be
211 * rethrown wrapped into a TorqueException.
212 */
213 public static ObjectKey doInsert(Criteria criteria, Connection con)
214 throws TorqueException
215 {
216
217
218
219
220 if (criteria.getDbName() == Torque.getDefaultDB())
221 {
222 criteria.setDbName(DATABASE_NAME);
223 }
224 if (con == null)
225 {
226 return BasePeer.doInsert(criteria);
227 }
228 else
229 {
230 return BasePeer.doInsert(criteria, con);
231 }
232 }
233
234 /***
235 * Add all the columns needed to create a new object.
236 *
237 * @param criteria object containing the columns to add.
238 * @throws TorqueException Any exceptions caught during processing will be
239 * rethrown wrapped into a TorqueException.
240 */
241 public static void addSelectColumns(Criteria criteria)
242 throws TorqueException
243 {
244 criteria.addSelectColumn(ID);
245 criteria.addSelectColumn(FIRST_NAME);
246 criteria.addSelectColumn(LAST_NAME);
247 criteria.addSelectColumn(DESCRIPTION);
248 criteria.addSelectColumn(LOGIN);
249 criteria.addSelectColumn(PASSWORD);
250 criteria.addSelectColumn(EMAIL);
251 criteria.addSelectColumn(LAST_ACCESS);
252 criteria.addSelectColumn(SESSION_KEY);
253 criteria.addSelectColumn(GROUP_ID);
254 }
255
256 /***
257 * Create a new object of type cls from a resultset row starting
258 * from a specified offset. This is done so that you can select
259 * other rows than just those needed for this object. You may
260 * for example want to create two objects from the same row.
261 *
262 * @throws TorqueException Any exceptions caught during processing will be
263 * rethrown wrapped into a TorqueException.
264 */
265 public static RdfUser row2Object(Record row,
266 int offset,
267 Class cls)
268 throws TorqueException
269 {
270 try
271 {
272 RdfUser obj = (RdfUser) cls.newInstance();
273 RdfUserPeer.populateObject(row, offset, obj);
274 obj.setModified(false);
275 obj.setNew(false);
276
277 return obj;
278 }
279 catch (InstantiationException e)
280 {
281 throw new TorqueException(e);
282 }
283 catch (IllegalAccessException e)
284 {
285 throw new TorqueException(e);
286 }
287 }
288
289 /***
290 * Populates an object from a resultset row starting
291 * from a specified offset. This is done so that you can select
292 * other rows than just those needed for this object. You may
293 * for example want to create two objects from the same row.
294 *
295 * @throws TorqueException Any exceptions caught during processing will be
296 * rethrown wrapped into a TorqueException.
297 */
298 public static void populateObject(Record row,
299 int offset,
300 RdfUser obj)
301 throws TorqueException
302 {
303 try
304 {
305 obj.setId(row.getValue(offset + 0).asInt());
306 obj.setFirstName(row.getValue(offset + 1).asString());
307 obj.setLastName(row.getValue(offset + 2).asString());
308 obj.setDescription(row.getValue(offset + 3).asString());
309 obj.setLogin(row.getValue(offset + 4).asString());
310 obj.setPassword(row.getValue(offset + 5).asString());
311 obj.setEmail(row.getValue(offset + 6).asString());
312 obj.setLastAccess(row.getValue(offset + 7).asUtilDate());
313 obj.setSessionKey(row.getValue(offset + 8).asLong());
314 obj.setGroupId(row.getValue(offset + 9).asInt());
315 }
316 catch (DataSetException e)
317 {
318 throw new TorqueException(e);
319 }
320 }
321
322 /***
323 * Method to do selects.
324 *
325 * @param criteria object used to create the SELECT statement.
326 * @return List of selected Objects
327 * @throws TorqueException Any exceptions caught during processing will be
328 * rethrown wrapped into a TorqueException.
329 */
330 public static List doSelect(Criteria criteria) throws TorqueException
331 {
332 return populateObjects(doSelectVillageRecords(criteria));
333 }
334
335 /***
336 * Method to do selects within a transaction.
337 *
338 * @param criteria object used to create the SELECT statement.
339 * @param con the connection to use
340 * @return List of selected Objects
341 * @throws TorqueException Any exceptions caught during processing will be
342 * rethrown wrapped into a TorqueException.
343 */
344 public static List doSelect(Criteria criteria, Connection con)
345 throws TorqueException
346 {
347 return populateObjects(doSelectVillageRecords(criteria, con));
348 }
349
350 /***
351 * Grabs the raw Village records to be formed into objects.
352 * This method handles connections internally. The Record objects
353 * returned by this method should be considered readonly. Do not
354 * alter the data and call save(), your results may vary, but are
355 * certainly likely to result in hard to track MT bugs.
356 *
357 * @throws TorqueException Any exceptions caught during processing will be
358 * rethrown wrapped into a TorqueException.
359 */
360 public static List doSelectVillageRecords(Criteria criteria)
361 throws TorqueException
362 {
363 return BaseRdfUserPeer
364 .doSelectVillageRecords(criteria, (Connection) null);
365 }
366
367 /***
368 * Grabs the raw Village records to be formed into objects.
369 * This method should be used for transactions
370 *
371 * @param con the connection to use
372 * @throws TorqueException Any exceptions caught during processing will be
373 * rethrown wrapped into a TorqueException.
374 */
375 public static List doSelectVillageRecords(Criteria criteria, Connection con)
376 throws TorqueException
377 {
378 if (criteria.getSelectColumns().size() == 0)
379 {
380 addSelectColumns(criteria);
381 }
382
383
384
385
386
387 if (criteria.getDbName() == Torque.getDefaultDB())
388 {
389 criteria.setDbName(DATABASE_NAME);
390 }
391
392
393 if (con == null)
394 {
395 return BasePeer.doSelect(criteria);
396 }
397 else
398 {
399 return BasePeer.doSelect(criteria, con);
400 }
401 }
402
403 /***
404 * The returned List will contain objects of the default type or
405 * objects that inherit from the default.
406 *
407 * @throws TorqueException Any exceptions caught during processing will be
408 * rethrown wrapped into a TorqueException.
409 */
410 public static List populateObjects(List records)
411 throws TorqueException
412 {
413 List results = new ArrayList(records.size());
414
415
416 for (int i = 0; i < records.size(); i++)
417 {
418 Record row = (Record) records.get(i);
419 results.add(RdfUserPeer.row2Object(row, 1,
420 RdfUserPeer.getOMClass()));
421 }
422 return results;
423 }
424
425
426 /***
427 * The class that the Peer will make instances of.
428 * If the BO is abstract then you must implement this method
429 * in the BO.
430 *
431 * @throws TorqueException Any exceptions caught during processing will be
432 * rethrown wrapped into a TorqueException.
433 */
434 public static Class getOMClass()
435 throws TorqueException
436 {
437 return CLASS_DEFAULT;
438 }
439
440 /***
441 * Method to do updates.
442 *
443 * @param criteria object containing data that is used to create the UPDATE
444 * statement.
445 * @throws TorqueException Any exceptions caught during processing will be
446 * rethrown wrapped into a TorqueException.
447 */
448 public static void doUpdate(Criteria criteria) throws TorqueException
449 {
450 BaseRdfUserPeer
451 .doUpdate(criteria, (Connection) null);
452 }
453
454 /***
455 * Method to do updates. This method is to be used during a transaction,
456 * otherwise use the doUpdate(Criteria) method. It will take care of
457 * the connection details internally.
458 *
459 * @param criteria object containing data that is used to create the UPDATE
460 * statement.
461 * @param con the connection to use
462 * @throws TorqueException Any exceptions caught during processing will be
463 * rethrown wrapped into a TorqueException.
464 */
465 public static void doUpdate(Criteria criteria, Connection con)
466 throws TorqueException
467 {
468 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
469 selectCriteria.put(ID, criteria.remove(ID));
470
471
472
473
474 if (criteria.getDbName() == Torque.getDefaultDB())
475 {
476 criteria.setDbName(DATABASE_NAME);
477 }
478 if (con == null)
479 {
480 BasePeer.doUpdate(selectCriteria, criteria);
481 }
482 else
483 {
484 BasePeer.doUpdate(selectCriteria, criteria, con);
485 }
486 }
487
488 /***
489 * Method to do deletes.
490 *
491 * @param criteria object containing data that is used DELETE from database.
492 * @throws TorqueException Any exceptions caught during processing will be
493 * rethrown wrapped into a TorqueException.
494 */
495 public static void doDelete(Criteria criteria) throws TorqueException
496 {
497 BaseRdfUserPeer
498 .doDelete(criteria, (Connection) null);
499 }
500
501 /***
502 * Method to do deletes. This method is to be used during a transaction,
503 * otherwise use the doDelete(Criteria) method. It will take care of
504 * the connection details internally.
505 *
506 * @param criteria object containing data that is used DELETE from database.
507 * @param con the connection to use
508 * @throws TorqueException Any exceptions caught during processing will be
509 * rethrown wrapped into a TorqueException.
510 */
511 public static void doDelete(Criteria criteria, Connection con)
512 throws TorqueException
513 {
514
515
516
517
518 if (criteria.getDbName() == Torque.getDefaultDB())
519 {
520 criteria.setDbName(DATABASE_NAME);
521 }
522 if (con == null)
523 {
524 BasePeer.doDelete(criteria);
525 }
526 else
527 {
528 BasePeer.doDelete(criteria, con);
529 }
530 }
531
532 /***
533 * Method to do selects
534 *
535 * @throws TorqueException Any exceptions caught during processing will be
536 * rethrown wrapped into a TorqueException.
537 */
538 public static List doSelect(RdfUser obj) throws TorqueException
539 {
540 return doSelect(buildCriteria(obj));
541 }
542
543 /***
544 * Method to do inserts
545 *
546 * @throws TorqueException Any exceptions caught during processing will be
547 * rethrown wrapped into a TorqueException.
548 */
549 public static void doInsert(RdfUser obj) throws TorqueException
550 {
551 obj.setPrimaryKey(doInsert(buildCriteria(obj)));
552 obj.setNew(false);
553 obj.setModified(false);
554 }
555
556 /***
557 * @param obj the data object to update in the database.
558 * @throws TorqueException Any exceptions caught during processing will be
559 * rethrown wrapped into a TorqueException.
560 */
561 public static void doUpdate(RdfUser obj) throws TorqueException
562 {
563 doUpdate(buildCriteria(obj));
564 obj.setModified(false);
565 }
566
567 /***
568 * @param obj the data object to delete in the database.
569 * @throws TorqueException Any exceptions caught during processing will be
570 * rethrown wrapped into a TorqueException.
571 */
572 public static void doDelete(RdfUser obj) throws TorqueException
573 {
574 doDelete(buildCriteria(obj));
575 }
576
577 /***
578 * Method to do inserts. This method is to be used during a transaction,
579 * otherwise use the doInsert(RdfUser) method. It will take
580 * care of the connection details internally.
581 *
582 * @param obj the data object to insert into the database.
583 * @param con the connection to use
584 * @throws TorqueException Any exceptions caught during processing will be
585 * rethrown wrapped into a TorqueException.
586 */
587 public static void doInsert(RdfUser obj, Connection con)
588 throws TorqueException
589 {
590 obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
591 obj.setNew(false);
592 obj.setModified(false);
593 }
594
595 /***
596 * Method to do update. This method is to be used during a transaction,
597 * otherwise use the doUpdate(RdfUser) method. It will take
598 * care of the connection details internally.
599 *
600 * @param obj the data object to update in the database.
601 * @param con the connection to use
602 * @throws TorqueException Any exceptions caught during processing will be
603 * rethrown wrapped into a TorqueException.
604 */
605 public static void doUpdate(RdfUser obj, Connection con)
606 throws TorqueException
607 {
608 doUpdate(buildCriteria(obj), con);
609 obj.setModified(false);
610 }
611
612 /***
613 * Method to delete. This method is to be used during a transaction,
614 * otherwise use the doDelete(RdfUser) method. It will take
615 * care of the connection details internally.
616 *
617 * @param obj the data object to delete in the database.
618 * @param con the connection to use
619 * @throws TorqueException Any exceptions caught during processing will be
620 * rethrown wrapped into a TorqueException.
621 */
622 public static void doDelete(RdfUser obj, Connection con)
623 throws TorqueException
624 {
625 doDelete(buildCriteria(obj), con);
626 }
627
628 /***
629 * Method to do deletes.
630 *
631 * @param pk ObjectKey that is used DELETE from database.
632 * @throws TorqueException Any exceptions caught during processing will be
633 * rethrown wrapped into a TorqueException.
634 */
635 public static void doDelete(ObjectKey pk) throws TorqueException
636 {
637 BaseRdfUserPeer
638 .doDelete(pk, (Connection) null);
639 }
640
641 /***
642 * Method to delete. This method is to be used during a transaction,
643 * otherwise use the doDelete(ObjectKey) method. It will take
644 * care of the connection details internally.
645 *
646 * @param pk the primary key for the object to delete in the database.
647 * @param con the connection to use
648 * @throws TorqueException Any exceptions caught during processing will be
649 * rethrown wrapped into a TorqueException.
650 */
651 public static void doDelete(ObjectKey pk, Connection con)
652 throws TorqueException
653 {
654 doDelete(buildCriteria(pk), con);
655 }
656
657 /*** Build a Criteria object from an ObjectKey */
658 public static Criteria buildCriteria( ObjectKey pk )
659 {
660 Criteria criteria = new Criteria();
661 criteria.add(ID, pk);
662 return criteria;
663 }
664
665 /*** Build a Criteria object from the data object for this peer */
666 public static Criteria buildCriteria( RdfUser obj )
667 {
668 Criteria criteria = new Criteria(DATABASE_NAME);
669 if (!obj.isNew())
670 criteria.add(ID, obj.getId());
671 criteria.add(FIRST_NAME, obj.getFirstName());
672 criteria.add(LAST_NAME, obj.getLastName());
673 criteria.add(DESCRIPTION, obj.getDescription());
674 criteria.add(LOGIN, obj.getLogin());
675 criteria.add(PASSWORD, obj.getPassword());
676 criteria.add(EMAIL, obj.getEmail());
677 criteria.add(LAST_ACCESS, obj.getLastAccess());
678 criteria.add(SESSION_KEY, obj.getSessionKey());
679 criteria.add(GROUP_ID, obj.getGroupId());
680 return criteria;
681 }
682
683
684 /***
685 * Retrieve a single object by pk
686 *
687 * @param pk the primary key
688 * @throws TorqueException Any exceptions caught during processing will be
689 * rethrown wrapped into a TorqueException.
690 * @throws NoRowsException Primary key was not found in database.
691 * @throws TooManyRowsException Primary key was not found in database.
692 */
693 public static RdfUser retrieveByPK(int pk)
694 throws TorqueException, NoRowsException, TooManyRowsException
695 {
696 return retrieveByPK(SimpleKey.keyFor(pk));
697 }
698
699 /***
700 * Retrieve a single object by pk
701 *
702 * @param pk the primary key
703 * @throws TorqueException Any exceptions caught during processing will be
704 * rethrown wrapped into a TorqueException.
705 * @throws NoRowsException Primary key was not found in database.
706 * @throws TooManyRowsException Primary key was not found in database.
707 */
708 public static RdfUser retrieveByPK(ObjectKey pk)
709 throws TorqueException, NoRowsException, TooManyRowsException
710 {
711 Connection db = null;
712 RdfUser retVal = null;
713 try
714 {
715 db = Torque.getConnection(DATABASE_NAME);
716 retVal = retrieveByPK(pk, db);
717 }
718 finally
719 {
720 Torque.closeConnection(db);
721 }
722 return(retVal);
723 }
724
725 /***
726 * Retrieve a single object by pk
727 *
728 * @param pk the primary key
729 * @param con the connection to use
730 * @throws TorqueException Any exceptions caught during processing will be
731 * rethrown wrapped into a TorqueException.
732 * @throws NoRowsException Primary key was not found in database.
733 * @throws TooManyRowsException Primary key was not found in database.
734 */
735 public static RdfUser retrieveByPK(ObjectKey pk, Connection con)
736 throws TorqueException, NoRowsException, TooManyRowsException
737 {
738 Criteria criteria = buildCriteria(pk);
739 List v = doSelect(criteria, con);
740 if (v.size() == 0)
741 {
742 throw new NoRowsException("Failed to select a row.");
743 }
744 else if (v.size() > 1)
745 {
746 throw new TooManyRowsException("Failed to select only one row.");
747 }
748 else
749 {
750 return (RdfUser)v.get(0);
751 }
752 }
753
754 /***
755 * Retrieve a multiple objects by pk
756 *
757 * @param pks List of primary keys
758 * @throws TorqueException Any exceptions caught during processing will be
759 * rethrown wrapped into a TorqueException.
760 */
761 public static List retrieveByPKs(List pks)
762 throws TorqueException
763 {
764 Connection db = null;
765 List retVal = null;
766 try
767 {
768 db = Torque.getConnection(DATABASE_NAME);
769 retVal = retrieveByPKs(pks, db);
770 }
771 finally
772 {
773 Torque.closeConnection(db);
774 }
775 return(retVal);
776 }
777
778 /***
779 * Retrieve a multiple objects by pk
780 *
781 * @param pks List of primary keys
782 * @param dbcon the connection to use
783 * @throws TorqueException Any exceptions caught during processing will be
784 * rethrown wrapped into a TorqueException.
785 */
786 public static List retrieveByPKs( List pks, Connection dbcon )
787 throws TorqueException
788 {
789 List objs = null;
790 if (pks == null || pks.size() == 0)
791 {
792 objs = new LinkedList();
793 }
794 else
795 {
796 Criteria criteria = new Criteria();
797 criteria.addIn( ID, pks );
798 objs = doSelect(criteria, dbcon);
799 }
800 return objs;
801 }
802
803
804
805
806
807
808
809
810
811
812 /***
813 * selects a collection of RdfUser objects pre-filled with their
814 * RdfGroup objects.
815 *
816 * This method is protected by default in order to keep the public
817 * api reasonable. You can provide public methods for those you
818 * actually need in RdfUserPeer.
819 *
820 * @throws TorqueException Any exceptions caught during processing will be
821 * rethrown wrapped into a TorqueException.
822 */
823 protected static List doSelectJoinRdfGroup(Criteria c)
824 throws TorqueException
825 {
826
827
828
829 if (c.getDbName() == Torque.getDefaultDB())
830 {
831 c.setDbName(DATABASE_NAME);
832 }
833
834 RdfUserPeer.addSelectColumns(c);
835 int offset = numColumns + 1;
836 RdfGroupPeer.addSelectColumns(c);
837
838
839 c.addJoin(RdfUserPeer.GROUP_ID,
840 RdfGroupPeer.ID);
841
842
843
844 List rows = BasePeer.doSelect(c);
845 List results = new ArrayList();
846
847 for (int i = 0; i < rows.size(); i++)
848 {
849 Record row = (Record) rows.get(i);
850
851 Class omClass = RdfUserPeer.getOMClass();
852 RdfUser obj1 = (RdfUser) RdfUserPeer
853 .row2Object(row, 1, omClass);
854 omClass = RdfGroupPeer.getOMClass();
855 RdfGroup obj2 = (RdfGroup)RdfGroupPeer
856 .row2Object(row, offset, omClass);
857
858 boolean newObject = true;
859 for (int j = 0; j < results.size(); j++)
860 {
861 RdfUser temp_obj1 = (RdfUser)results.get(j);
862 RdfGroup temp_obj2 = (RdfGroup)temp_obj1.getRdfGroup();
863 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
864 {
865 newObject = false;
866 temp_obj2.addRdfUser(obj1);
867 break;
868 }
869 }
870 if (newObject)
871 {
872 obj2.initRdfUsers();
873 obj2.addRdfUser(obj1);
874 }
875 results.add(obj1);
876 }
877 return results;
878 }
879
880
881
882
883 /***
884 * Returns the TableMap related to this peer. This method is not
885 * needed for general use but a specific application could have a need.
886 *
887 * @throws TorqueException Any exceptions caught during processing will be
888 * rethrown wrapped into a TorqueException.
889 */
890 protected static TableMap getTableMap()
891 throws TorqueException
892 {
893 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
894 }
895 }