##### Coverage Report - org.apache.turbine.services.security.torque.om.BaseTurbineRolePermissionPeer

Classes in this File | Line Coverage | Branch Coverage | Complexity
BaseTurbineRolePermissionPeer |
0% | 0/256
0% | 0/50
| 1.8181818181818181;1,818

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