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