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