%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.services.security.torque.om.BaseTurbineRole |
|
|
1 | package org.apache.turbine.services.security.torque.om; |
|
2 | ||
3 | ||
4 | import java.math.BigDecimal; |
|
5 | import java.sql.Connection; |
|
6 | import java.util.ArrayList; |
|
7 | import java.util.Collections; |
|
8 | import java.util.Date; |
|
9 | import java.util.List; |
|
10 | ||
11 | import org.apache.commons.lang.ObjectUtils; |
|
12 | import org.apache.torque.TorqueException; |
|
13 | import org.apache.torque.om.BaseObject; |
|
14 | import org.apache.torque.om.ComboKey; |
|
15 | import org.apache.torque.om.DateKey; |
|
16 | import org.apache.torque.om.NumberKey; |
|
17 | import org.apache.torque.om.ObjectKey; |
|
18 | import org.apache.torque.om.SimpleKey; |
|
19 | import org.apache.torque.om.StringKey; |
|
20 | import org.apache.torque.om.Persistent; |
|
21 | import org.apache.torque.util.Criteria; |
|
22 | import org.apache.torque.util.Transaction; |
|
23 | ||
24 | ||
25 | /** |
|
26 | * This class was autogenerated by Torque on: |
|
27 | * |
|
28 | * [Mon Oct 03 14:24:58 CEST 2005] |
|
29 | * |
|
30 | * You should not use this class directly. It should not even be |
|
31 | * extended all references should be to TurbineRole |
|
32 | */ |
|
33 | 282 | public abstract class BaseTurbineRole extends BaseObject |
34 | { |
|
35 | /** The Peer class */ |
|
36 | 24 | private static final TurbineRolePeer peer = |
37 | new TurbineRolePeer(); |
|
38 | ||
39 | ||
40 | /** The value for the roleId field */ |
|
41 | private int roleId; |
|
42 | ||
43 | /** The value for the name field */ |
|
44 | private String name; |
|
45 | ||
46 | ||
47 | /** |
|
48 | * Get the RoleId |
|
49 | * |
|
50 | * @return int |
|
51 | */ |
|
52 | public int getRoleId() |
|
53 | { |
|
54 | 802 | return roleId; |
55 | } |
|
56 | ||
57 | ||
58 | /** |
|
59 | * Set the value of RoleId |
|
60 | * |
|
61 | * @param v new value |
|
62 | */ |
|
63 | public void setRoleId(int v) throws TorqueException |
|
64 | { |
|
65 | ||
66 | 174 | if (this.roleId != v) |
67 | { |
|
68 | 174 | this.roleId = v; |
69 | 174 | setModified(true); |
70 | } |
|
71 | ||
72 | ||
73 | ||
74 | // update associated TurbineRolePermission |
|
75 | 174 | if (collTurbineRolePermissions != null) |
76 | { |
|
77 | 0 | for (int i = 0; i < collTurbineRolePermissions.size(); i++) |
78 | { |
|
79 | 0 | ((TurbineRolePermission) collTurbineRolePermissions.get(i)) |
80 | .setRoleId(v); |
|
81 | } |
|
82 | } |
|
83 | ||
84 | // update associated TurbineUserGroupRole |
|
85 | 174 | if (collTurbineUserGroupRoles != null) |
86 | { |
|
87 | 0 | for (int i = 0; i < collTurbineUserGroupRoles.size(); i++) |
88 | { |
|
89 | 0 | ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)) |
90 | .setRoleId(v); |
|
91 | } |
|
92 | } |
|
93 | 174 | } |
94 | ||
95 | /** |
|
96 | * Get the Name |
|
97 | * |
|
98 | * @return String |
|
99 | */ |
|
100 | public String getName() |
|
101 | { |
|
102 | 300 | return name; |
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * Set the value of Name |
|
108 | * |
|
109 | * @param v new value |
|
110 | */ |
|
111 | public void setName(String v) |
|
112 | { |
|
113 | ||
114 | 188 | if (!ObjectUtils.equals(this.name, v)) |
115 | { |
|
116 | 188 | this.name = v; |
117 | 188 | setModified(true); |
118 | } |
|
119 | ||
120 | ||
121 | 188 | } |
122 | ||
123 | ||
124 | ||
125 | ||
126 | /** |
|
127 | * Collection to store aggregation of collTurbineRolePermissions |
|
128 | */ |
|
129 | protected List collTurbineRolePermissions; |
|
130 | ||
131 | /** |
|
132 | * Temporary storage of collTurbineRolePermissions to save a possible db hit in |
|
133 | * the event objects are add to the collection, but the |
|
134 | * complete collection is never requested. |
|
135 | */ |
|
136 | protected void initTurbineRolePermissions() |
|
137 | { |
|
138 | 0 | if (collTurbineRolePermissions == null) |
139 | { |
|
140 | 0 | collTurbineRolePermissions = new ArrayList(); |
141 | } |
|
142 | 0 | } |
143 | ||
144 | /** |
|
145 | * Method called to associate a TurbineRolePermission object to this object |
|
146 | * through the TurbineRolePermission foreign key attribute |
|
147 | * |
|
148 | * @param l TurbineRolePermission |
|
149 | * @throws TorqueException |
|
150 | */ |
|
151 | public void addTurbineRolePermission(TurbineRolePermission l) throws TorqueException |
|
152 | { |
|
153 | 0 | getTurbineRolePermissions().add(l); |
154 | 0 | l.setTurbineRole((TurbineRole) this); |
155 | 0 | } |
156 | ||
157 | /** |
|
158 | * The criteria used to select the current contents of collTurbineRolePermissions |
|
159 | */ |
|
160 | 188 | private Criteria lastTurbineRolePermissionsCriteria = null; |
161 | ||
162 | /** |
|
163 | * If this collection has already been initialized, returns |
|
164 | * the collection. Otherwise returns the results of |
|
165 | * getTurbineRolePermissions(new Criteria()) |
|
166 | * |
|
167 | * @throws TorqueException |
|
168 | */ |
|
169 | public List getTurbineRolePermissions() throws TorqueException |
|
170 | { |
|
171 | 0 | if (collTurbineRolePermissions == null) |
172 | { |
|
173 | 0 | collTurbineRolePermissions = getTurbineRolePermissions(new Criteria(10)); |
174 | } |
|
175 | 0 | return collTurbineRolePermissions; |
176 | } |
|
177 | ||
178 | /** |
|
179 | * If this collection has already been initialized with |
|
180 | * an identical criteria, it returns the collection. |
|
181 | * Otherwise if this TurbineRole has previously |
|
182 | * been saved, it will retrieve related TurbineRolePermissions from storage. |
|
183 | * If this TurbineRole is new, it will return |
|
184 | * an empty collection or the current collection, the criteria |
|
185 | * is ignored on a new object. |
|
186 | * |
|
187 | * @throws TorqueException |
|
188 | */ |
|
189 | public List getTurbineRolePermissions(Criteria criteria) throws TorqueException |
|
190 | { |
|
191 | 0 | if (collTurbineRolePermissions == null) |
192 | { |
|
193 | 0 | if (isNew()) |
194 | { |
|
195 | 0 | collTurbineRolePermissions = new ArrayList(); |
196 | } |
|
197 | else |
|
198 | { |
|
199 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId() ); |
200 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria); |
201 | } |
|
202 | } |
|
203 | else |
|
204 | { |
|
205 | // criteria has no effect for a new object |
|
206 | 0 | if (!isNew()) |
207 | { |
|
208 | // the following code is to determine if a new query is |
|
209 | // called for. If the criteria is the same as the last |
|
210 | // one, just return the collection. |
|
211 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
212 | 0 | if (!lastTurbineRolePermissionsCriteria.equals(criteria)) |
213 | { |
|
214 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria); |
215 | } |
|
216 | } |
|
217 | } |
|
218 | 0 | lastTurbineRolePermissionsCriteria = criteria; |
219 | ||
220 | 0 | return collTurbineRolePermissions; |
221 | } |
|
222 | ||
223 | /** |
|
224 | * If this collection has already been initialized, returns |
|
225 | * the collection. Otherwise returns the results of |
|
226 | * getTurbineRolePermissions(new Criteria(),Connection) |
|
227 | * This method takes in the Connection also as input so that |
|
228 | * referenced objects can also be obtained using a Connection |
|
229 | * that is taken as input |
|
230 | */ |
|
231 | public List getTurbineRolePermissions(Connection con) throws TorqueException |
|
232 | { |
|
233 | 0 | if (collTurbineRolePermissions == null) |
234 | { |
|
235 | 0 | collTurbineRolePermissions = getTurbineRolePermissions(new Criteria(10), con); |
236 | } |
|
237 | 0 | return collTurbineRolePermissions; |
238 | } |
|
239 | ||
240 | /** |
|
241 | * If this collection has already been initialized with |
|
242 | * an identical criteria, it returns the collection. |
|
243 | * Otherwise if this TurbineRole has previously |
|
244 | * been saved, it will retrieve related TurbineRolePermissions from storage. |
|
245 | * If this TurbineRole is new, it will return |
|
246 | * an empty collection or the current collection, the criteria |
|
247 | * is ignored on a new object. |
|
248 | * This method takes in the Connection also as input so that |
|
249 | * referenced objects can also be obtained using a Connection |
|
250 | * that is taken as input |
|
251 | */ |
|
252 | public List getTurbineRolePermissions(Criteria criteria, Connection con) |
|
253 | throws TorqueException |
|
254 | { |
|
255 | 0 | if (collTurbineRolePermissions == null) |
256 | { |
|
257 | 0 | if (isNew()) |
258 | { |
|
259 | 0 | collTurbineRolePermissions = new ArrayList(); |
260 | } |
|
261 | else |
|
262 | { |
|
263 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
264 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria, con); |
265 | } |
|
266 | } |
|
267 | else |
|
268 | { |
|
269 | // criteria has no effect for a new object |
|
270 | 0 | if (!isNew()) |
271 | { |
|
272 | // the following code is to determine if a new query is |
|
273 | // called for. If the criteria is the same as the last |
|
274 | // one, just return the collection. |
|
275 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
276 | 0 | if (!lastTurbineRolePermissionsCriteria.equals(criteria)) |
277 | { |
|
278 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelect(criteria, con); |
279 | } |
|
280 | } |
|
281 | } |
|
282 | 0 | lastTurbineRolePermissionsCriteria = criteria; |
283 | ||
284 | 0 | return collTurbineRolePermissions; |
285 | } |
|
286 | ||
287 | ||
288 | ||
289 | ||
290 | ||
291 | ||
292 | ||
293 | ||
294 | ||
295 | ||
296 | ||
297 | /** |
|
298 | * If this collection has already been initialized with |
|
299 | * an identical criteria, it returns the collection. |
|
300 | * Otherwise if this TurbineRole is new, it will return |
|
301 | * an empty collection; or if this TurbineRole has previously |
|
302 | * been saved, it will retrieve related TurbineRolePermissions from storage. |
|
303 | * |
|
304 | * This method is protected by default in order to keep the public |
|
305 | * api reasonable. You can provide public methods for those you |
|
306 | * actually need in TurbineRole. |
|
307 | */ |
|
308 | protected List getTurbineRolePermissionsJoinTurbineRole(Criteria criteria) |
|
309 | throws TorqueException |
|
310 | { |
|
311 | 0 | if (collTurbineRolePermissions == null) |
312 | { |
|
313 | 0 | if (isNew()) |
314 | { |
|
315 | 0 | collTurbineRolePermissions = new ArrayList(); |
316 | } |
|
317 | else |
|
318 | { |
|
319 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
320 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbineRole(criteria); |
321 | } |
|
322 | } |
|
323 | else |
|
324 | { |
|
325 | // the following code is to determine if a new query is |
|
326 | // called for. If the criteria is the same as the last |
|
327 | // one, just return the collection. |
|
328 | ||
329 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
330 | 0 | if (!lastTurbineRolePermissionsCriteria.equals(criteria)) |
331 | { |
|
332 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbineRole(criteria); |
333 | } |
|
334 | } |
|
335 | 0 | lastTurbineRolePermissionsCriteria = criteria; |
336 | ||
337 | 0 | return collTurbineRolePermissions; |
338 | } |
|
339 | ||
340 | ||
341 | ||
342 | ||
343 | ||
344 | ||
345 | ||
346 | ||
347 | ||
348 | /** |
|
349 | * If this collection has already been initialized with |
|
350 | * an identical criteria, it returns the collection. |
|
351 | * Otherwise if this TurbineRole is new, it will return |
|
352 | * an empty collection; or if this TurbineRole has previously |
|
353 | * been saved, it will retrieve related TurbineRolePermissions from storage. |
|
354 | * |
|
355 | * This method is protected by default in order to keep the public |
|
356 | * api reasonable. You can provide public methods for those you |
|
357 | * actually need in TurbineRole. |
|
358 | */ |
|
359 | protected List getTurbineRolePermissionsJoinTurbinePermission(Criteria criteria) |
|
360 | throws TorqueException |
|
361 | { |
|
362 | 0 | if (collTurbineRolePermissions == null) |
363 | { |
|
364 | 0 | if (isNew()) |
365 | { |
|
366 | 0 | collTurbineRolePermissions = new ArrayList(); |
367 | } |
|
368 | else |
|
369 | { |
|
370 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
371 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbinePermission(criteria); |
372 | } |
|
373 | } |
|
374 | else |
|
375 | { |
|
376 | // the following code is to determine if a new query is |
|
377 | // called for. If the criteria is the same as the last |
|
378 | // one, just return the collection. |
|
379 | ||
380 | 0 | criteria.add(TurbineRolePermissionPeer.ROLE_ID, getRoleId()); |
381 | 0 | if (!lastTurbineRolePermissionsCriteria.equals(criteria)) |
382 | { |
|
383 | 0 | collTurbineRolePermissions = TurbineRolePermissionPeer.doSelectJoinTurbinePermission(criteria); |
384 | } |
|
385 | } |
|
386 | 0 | lastTurbineRolePermissionsCriteria = criteria; |
387 | ||
388 | 0 | return collTurbineRolePermissions; |
389 | } |
|
390 | ||
391 | ||
392 | ||
393 | ||
394 | ||
395 | /** |
|
396 | * Collection to store aggregation of collTurbineUserGroupRoles |
|
397 | */ |
|
398 | protected List collTurbineUserGroupRoles; |
|
399 | ||
400 | /** |
|
401 | * Temporary storage of collTurbineUserGroupRoles to save a possible db hit in |
|
402 | * the event objects are add to the collection, but the |
|
403 | * complete collection is never requested. |
|
404 | */ |
|
405 | protected void initTurbineUserGroupRoles() |
|
406 | { |
|
407 | 0 | if (collTurbineUserGroupRoles == null) |
408 | { |
|
409 | 0 | collTurbineUserGroupRoles = new ArrayList(); |
410 | } |
|
411 | 0 | } |
412 | ||
413 | /** |
|
414 | * Method called to associate a TurbineUserGroupRole object to this object |
|
415 | * through the TurbineUserGroupRole foreign key attribute |
|
416 | * |
|
417 | * @param l TurbineUserGroupRole |
|
418 | * @throws TorqueException |
|
419 | */ |
|
420 | public void addTurbineUserGroupRole(TurbineUserGroupRole l) throws TorqueException |
|
421 | { |
|
422 | 0 | getTurbineUserGroupRoles().add(l); |
423 | 0 | l.setTurbineRole((TurbineRole) this); |
424 | 0 | } |
425 | ||
426 | /** |
|
427 | * The criteria used to select the current contents of collTurbineUserGroupRoles |
|
428 | */ |
|
429 | 188 | private Criteria lastTurbineUserGroupRolesCriteria = null; |
430 | ||
431 | /** |
|
432 | * If this collection has already been initialized, returns |
|
433 | * the collection. Otherwise returns the results of |
|
434 | * getTurbineUserGroupRoles(new Criteria()) |
|
435 | * |
|
436 | * @throws TorqueException |
|
437 | */ |
|
438 | public List getTurbineUserGroupRoles() throws TorqueException |
|
439 | { |
|
440 | 0 | if (collTurbineUserGroupRoles == null) |
441 | { |
|
442 | 0 | collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10)); |
443 | } |
|
444 | 0 | return collTurbineUserGroupRoles; |
445 | } |
|
446 | ||
447 | /** |
|
448 | * If this collection has already been initialized with |
|
449 | * an identical criteria, it returns the collection. |
|
450 | * Otherwise if this TurbineRole has previously |
|
451 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
452 | * If this TurbineRole is new, it will return |
|
453 | * an empty collection or the current collection, the criteria |
|
454 | * is ignored on a new object. |
|
455 | * |
|
456 | * @throws TorqueException |
|
457 | */ |
|
458 | public List getTurbineUserGroupRoles(Criteria criteria) throws TorqueException |
|
459 | { |
|
460 | 0 | if (collTurbineUserGroupRoles == null) |
461 | { |
|
462 | 0 | if (isNew()) |
463 | { |
|
464 | 0 | collTurbineUserGroupRoles = new ArrayList(); |
465 | } |
|
466 | else |
|
467 | { |
|
468 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId() ); |
469 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria); |
470 | } |
|
471 | } |
|
472 | else |
|
473 | { |
|
474 | // criteria has no effect for a new object |
|
475 | 0 | if (!isNew()) |
476 | { |
|
477 | // the following code is to determine if a new query is |
|
478 | // called for. If the criteria is the same as the last |
|
479 | // one, just return the collection. |
|
480 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
481 | 0 | if (!lastTurbineUserGroupRolesCriteria.equals(criteria)) |
482 | { |
|
483 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria); |
484 | } |
|
485 | } |
|
486 | } |
|
487 | 0 | lastTurbineUserGroupRolesCriteria = criteria; |
488 | ||
489 | 0 | return collTurbineUserGroupRoles; |
490 | } |
|
491 | ||
492 | /** |
|
493 | * If this collection has already been initialized, returns |
|
494 | * the collection. Otherwise returns the results of |
|
495 | * getTurbineUserGroupRoles(new Criteria(),Connection) |
|
496 | * This method takes in the Connection also as input so that |
|
497 | * referenced objects can also be obtained using a Connection |
|
498 | * that is taken as input |
|
499 | */ |
|
500 | public List getTurbineUserGroupRoles(Connection con) throws TorqueException |
|
501 | { |
|
502 | 0 | if (collTurbineUserGroupRoles == null) |
503 | { |
|
504 | 0 | collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10), con); |
505 | } |
|
506 | 0 | return collTurbineUserGroupRoles; |
507 | } |
|
508 | ||
509 | /** |
|
510 | * If this collection has already been initialized with |
|
511 | * an identical criteria, it returns the collection. |
|
512 | * Otherwise if this TurbineRole has previously |
|
513 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
514 | * If this TurbineRole is new, it will return |
|
515 | * an empty collection or the current collection, the criteria |
|
516 | * is ignored on a new object. |
|
517 | * This method takes in the Connection also as input so that |
|
518 | * referenced objects can also be obtained using a Connection |
|
519 | * that is taken as input |
|
520 | */ |
|
521 | public List getTurbineUserGroupRoles(Criteria criteria, Connection con) |
|
522 | throws TorqueException |
|
523 | { |
|
524 | 0 | if (collTurbineUserGroupRoles == null) |
525 | { |
|
526 | 0 | if (isNew()) |
527 | { |
|
528 | 0 | collTurbineUserGroupRoles = new ArrayList(); |
529 | } |
|
530 | else |
|
531 | { |
|
532 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
533 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con); |
534 | } |
|
535 | } |
|
536 | else |
|
537 | { |
|
538 | // criteria has no effect for a new object |
|
539 | 0 | if (!isNew()) |
540 | { |
|
541 | // the following code is to determine if a new query is |
|
542 | // called for. If the criteria is the same as the last |
|
543 | // one, just return the collection. |
|
544 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
545 | 0 | if (!lastTurbineUserGroupRolesCriteria.equals(criteria)) |
546 | { |
|
547 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con); |
548 | } |
|
549 | } |
|
550 | } |
|
551 | 0 | lastTurbineUserGroupRolesCriteria = criteria; |
552 | ||
553 | 0 | return collTurbineUserGroupRoles; |
554 | } |
|
555 | ||
556 | ||
557 | ||
558 | ||
559 | ||
560 | ||
561 | ||
562 | ||
563 | ||
564 | ||
565 | ||
566 | /** |
|
567 | * If this collection has already been initialized with |
|
568 | * an identical criteria, it returns the collection. |
|
569 | * Otherwise if this TurbineRole is new, it will return |
|
570 | * an empty collection; or if this TurbineRole has previously |
|
571 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
572 | * |
|
573 | * This method is protected by default in order to keep the public |
|
574 | * api reasonable. You can provide public methods for those you |
|
575 | * actually need in TurbineRole. |
|
576 | */ |
|
577 | protected List getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria) |
|
578 | throws TorqueException |
|
579 | { |
|
580 | 0 | if (collTurbineUserGroupRoles == null) |
581 | { |
|
582 | 0 | if (isNew()) |
583 | { |
|
584 | 0 | collTurbineUserGroupRoles = new ArrayList(); |
585 | } |
|
586 | else |
|
587 | { |
|
588 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
589 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria); |
590 | } |
|
591 | } |
|
592 | else |
|
593 | { |
|
594 | // the following code is to determine if a new query is |
|
595 | // called for. If the criteria is the same as the last |
|
596 | // one, just return the collection. |
|
597 | ||
598 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
599 | 0 | if (!lastTurbineUserGroupRolesCriteria.equals(criteria)) |
600 | { |
|
601 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria); |
602 | } |
|
603 | } |
|
604 | 0 | lastTurbineUserGroupRolesCriteria = criteria; |
605 | ||
606 | 0 | return collTurbineUserGroupRoles; |
607 | } |
|
608 | ||
609 | ||
610 | ||
611 | ||
612 | ||
613 | ||
614 | ||
615 | ||
616 | ||
617 | /** |
|
618 | * If this collection has already been initialized with |
|
619 | * an identical criteria, it returns the collection. |
|
620 | * Otherwise if this TurbineRole is new, it will return |
|
621 | * an empty collection; or if this TurbineRole has previously |
|
622 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
623 | * |
|
624 | * This method is protected by default in order to keep the public |
|
625 | * api reasonable. You can provide public methods for those you |
|
626 | * actually need in TurbineRole. |
|
627 | */ |
|
628 | protected List getTurbineUserGroupRolesJoinTurbineGroup(Criteria criteria) |
|
629 | throws TorqueException |
|
630 | { |
|
631 | 0 | if (collTurbineUserGroupRoles == null) |
632 | { |
|
633 | 0 | if (isNew()) |
634 | { |
|
635 | 0 | collTurbineUserGroupRoles = new ArrayList(); |
636 | } |
|
637 | else |
|
638 | { |
|
639 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
640 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria); |
641 | } |
|
642 | } |
|
643 | else |
|
644 | { |
|
645 | // the following code is to determine if a new query is |
|
646 | // called for. If the criteria is the same as the last |
|
647 | // one, just return the collection. |
|
648 | ||
649 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
650 | 0 | if (!lastTurbineUserGroupRolesCriteria.equals(criteria)) |
651 | { |
|
652 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria); |
653 | } |
|
654 | } |
|
655 | 0 | lastTurbineUserGroupRolesCriteria = criteria; |
656 | ||
657 | 0 | return collTurbineUserGroupRoles; |
658 | } |
|
659 | ||
660 | ||
661 | ||
662 | ||
663 | ||
664 | ||
665 | ||
666 | ||
667 | ||
668 | /** |
|
669 | * If this collection has already been initialized with |
|
670 | * an identical criteria, it returns the collection. |
|
671 | * Otherwise if this TurbineRole is new, it will return |
|
672 | * an empty collection; or if this TurbineRole has previously |
|
673 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
674 | * |
|
675 | * This method is protected by default in order to keep the public |
|
676 | * api reasonable. You can provide public methods for those you |
|
677 | * actually need in TurbineRole. |
|
678 | */ |
|
679 | protected List getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria) |
|
680 | throws TorqueException |
|
681 | { |
|
682 | 0 | if (collTurbineUserGroupRoles == null) |
683 | { |
|
684 | 0 | if (isNew()) |
685 | { |
|
686 | 0 | collTurbineUserGroupRoles = new ArrayList(); |
687 | } |
|
688 | else |
|
689 | { |
|
690 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
691 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria); |
692 | } |
|
693 | } |
|
694 | else |
|
695 | { |
|
696 | // the following code is to determine if a new query is |
|
697 | // called for. If the criteria is the same as the last |
|
698 | // one, just return the collection. |
|
699 | ||
700 | 0 | criteria.add(TurbineUserGroupRolePeer.ROLE_ID, getRoleId()); |
701 | 0 | if (!lastTurbineUserGroupRolesCriteria.equals(criteria)) |
702 | { |
|
703 | 0 | collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria); |
704 | } |
|
705 | } |
|
706 | 0 | lastTurbineUserGroupRolesCriteria = criteria; |
707 | ||
708 | 0 | return collTurbineUserGroupRoles; |
709 | } |
|
710 | ||
711 | ||
712 | ||
713 | ||
714 | 16 | private static List fieldNames = null; |
715 | ||
716 | /** |
|
717 | * Generate a list of field names. |
|
718 | * |
|
719 | * @return a list of field names |
|
720 | */ |
|
721 | public static synchronized List getFieldNames() |
|
722 | { |
|
723 | 0 | if (fieldNames == null) |
724 | { |
|
725 | 0 | fieldNames = new ArrayList(); |
726 | 0 | fieldNames.add("RoleId"); |
727 | 0 | fieldNames.add("Name"); |
728 | 0 | fieldNames = Collections.unmodifiableList(fieldNames); |
729 | } |
|
730 | 0 | return fieldNames; |
731 | } |
|
732 | ||
733 | /** |
|
734 | * Retrieves a field from the object by name passed in as a String. |
|
735 | * |
|
736 | * @param name field name |
|
737 | * @return value |
|
738 | */ |
|
739 | public Object getByName(String name) |
|
740 | { |
|
741 | 0 | if (name.equals("RoleId")) |
742 | { |
|
743 | 0 | return new Integer(getRoleId()); |
744 | } |
|
745 | 0 | if (name.equals("Name")) |
746 | { |
|
747 | 0 | return getName(); |
748 | } |
|
749 | 0 | return null; |
750 | } |
|
751 | ||
752 | /** |
|
753 | * Retrieves a field from the object by name passed in |
|
754 | * as a String. The String must be one of the static |
|
755 | * Strings defined in this Class' Peer. |
|
756 | * |
|
757 | * @param name peer name |
|
758 | * @return value |
|
759 | */ |
|
760 | public Object getByPeerName(String name) |
|
761 | { |
|
762 | 0 | if (name.equals(TurbineRolePeer.ROLE_ID)) |
763 | { |
|
764 | 0 | return new Integer(getRoleId()); |
765 | } |
|
766 | 0 | if (name.equals(TurbineRolePeer.ROLE_NAME)) |
767 | { |
|
768 | 0 | return getName(); |
769 | } |
|
770 | 0 | return null; |
771 | } |
|
772 | ||
773 | /** |
|
774 | * Retrieves a field from the object by Position as specified |
|
775 | * in the xml schema. Zero-based. |
|
776 | * |
|
777 | * @param pos position in xml schema |
|
778 | * @return value |
|
779 | */ |
|
780 | public Object getByPosition(int pos) |
|
781 | { |
|
782 | 0 | if (pos == 0) |
783 | { |
|
784 | 0 | return new Integer(getRoleId()); |
785 | } |
|
786 | 0 | if (pos == 1) |
787 | { |
|
788 | 0 | return getName(); |
789 | } |
|
790 | 0 | return null; |
791 | } |
|
792 | ||
793 | /** |
|
794 | * Stores the object in the database. If the object is new, |
|
795 | * it inserts it; otherwise an update is performed. |
|
796 | * |
|
797 | * @throws Exception |
|
798 | */ |
|
799 | public void save() throws Exception |
|
800 | { |
|
801 | 0 | save(TurbineRolePeer.getMapBuilder() |
802 | .getDatabaseMap().getName()); |
|
803 | 0 | } |
804 | ||
805 | /** |
|
806 | * Stores the object in the database. If the object is new, |
|
807 | * it inserts it; otherwise an update is performed. |
|
808 | * Note: this code is here because the method body is |
|
809 | * auto-generated conditionally and therefore needs to be |
|
810 | * in this file instead of in the super class, BaseObject. |
|
811 | * |
|
812 | * @param dbName |
|
813 | * @throws TorqueException |
|
814 | */ |
|
815 | public void save(String dbName) throws TorqueException |
|
816 | { |
|
817 | 0 | Connection con = null; |
818 | try |
|
819 | { |
|
820 | 0 | con = Transaction.begin(dbName); |
821 | 0 | save(con); |
822 | 0 | Transaction.commit(con); |
823 | } |
|
824 | 0 | catch(TorqueException e) |
825 | { |
|
826 | 0 | Transaction.safeRollback(con); |
827 | 0 | throw e; |
828 | 0 | } |
829 | 0 | } |
830 | ||
831 | /** flag to prevent endless save loop, if this object is referenced |
|
832 | by another object which falls in this transaction. */ |
|
833 | 188 | private boolean alreadyInSave = false; |
834 | /** |
|
835 | * Stores the object in the database. If the object is new, |
|
836 | * it inserts it; otherwise an update is performed. This method |
|
837 | * is meant to be used as part of a transaction, otherwise use |
|
838 | * the save() method and the connection details will be handled |
|
839 | * internally |
|
840 | * |
|
841 | * @param con |
|
842 | * @throws TorqueException |
|
843 | */ |
|
844 | public void save(Connection con) throws TorqueException |
|
845 | { |
|
846 | 0 | if (!alreadyInSave) |
847 | { |
|
848 | 0 | alreadyInSave = true; |
849 | ||
850 | ||
851 | ||
852 | // If this object has been modified, then save it to the database. |
|
853 | 0 | if (isModclass="keyword">ified()) |
854 | { |
|
855 | 0 | if (isNew()) |
856 | { |
|
857 | 0 | TurbineRolePeer.doInsert((TurbineRole) this, con); |
858 | 0 | setNew(false); |
859 | } |
|
860 | else |
|
861 | { |
|
862 | 0 | TurbineRolePeer.doUpdate((TurbineRole) this, con); |
863 | } |
|
864 | } |
|
865 | ||
866 | ||
867 | ||
868 | 0 | if (collTurbineRolePermissions != null) |
869 | { |
|
870 | 0 | for (int i = 0; i < collTurbineRolePermissions.size(); i++) |
871 | { |
|
872 | 0 | ((TurbineRolePermission) collTurbineRolePermissions.get(i)).save(con); |
873 | } |
|
874 | } |
|
875 | ||
876 | ||
877 | 0 | if (collTurbineUserGroupRoles != null) |
878 | { |
|
879 | 0 | for (int i = 0; i < collTurbineUserGroupRoles.size(); i++) |
880 | { |
|
881 | 0 | ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)).save(con); |
882 | } |
|
883 | } |
|
884 | 0 | alreadyInSave = false; |
885 | } |
|
886 | 0 | } |
887 | ||
888 | ||
889 | /** |
|
890 | * Set the PrimaryKey using ObjectKey. |
|
891 | * |
|
892 | * @param key roleId ObjectKey |
|
893 | */ |
|
894 | public void setPrimaryKey(ObjectKey key) |
|
895 | throws TorqueException |
|
896 | { |
|
897 | 0 | setRoleId(((NumberKey) key).intValue()); |
898 | 0 | } |
899 | ||
900 | /** |
|
901 | * Set the PrimaryKey using a String. |
|
902 | * |
|
903 | * @param key |
|
904 | */ |
|
905 | public void setPrimaryKey(String key) throws TorqueException |
|
906 | { |
|
907 | 0 | setRoleId(Integer.parseInt(key)); |
908 | 0 | } |
909 | ||
910 | ||
911 | /** |
|
912 | * returns an id that differentiates this object from others |
|
913 | * of its class. |
|
914 | */ |
|
915 | public ObjectKey getPrimaryKey() |
|
916 | { |
|
917 | 620 | return SimpleKey.keyFor(getRoleId()); |
918 | } |
|
919 | ||
920 | ||
921 | /** |
|
922 | * Makes a copy of this object. |
|
923 | * It creates a new object filling in the simple attributes. |
|
924 | * It then fills all the association collections and sets the |
|
925 | * related objects to isNew=true. |
|
926 | */ |
|
927 | public TurbineRole copy() throws TorqueException |
|
928 | { |
|
929 | 0 | return copyInto(new TurbineRole()); |
930 | } |
|
931 | ||
932 | protected TurbineRole copyInto(TurbineRole copyObj) throws TorqueException |
|
933 | { |
|
934 | 0 | copyObj.setRoleId(roleId); |
935 | 0 | copyObj.setName(name); |
936 | ||
937 | 0 | copyObj.setRoleId( 0); |
938 | ||
939 | ||
940 | ||
941 | 0 | List v = getTurbineRolePermissions(); |
942 | 0 | for (int i = 0; i < v.size(); i++) |
943 | { |
|
944 | 0 | TurbineRolePermission obj = (TurbineRolePermission) v.get(i); |
945 | 0 | copyObj.addTurbineRolePermission(obj.copy()); |
946 | } |
|
947 | ||
948 | ||
949 | 0 | v = getTurbineUserGroupRoles(); |
950 | 0 | for (int i = 0; i < v.size(); i++) |
951 | { |
|
952 | 0 | TurbineUserGroupRole obj = (TurbineUserGroupRole) v.get(i); |
953 | 0 | copyObj.addTurbineUserGroupRole(obj.copy()); |
954 | } |
|
955 | 0 | return copyObj; |
956 | } |
|
957 | ||
958 | /** |
|
959 | * returns a peer instance associated with this om. Since Peer classes |
|
960 | * are not to have any instance attributes, this method returns the |
|
961 | * same instance for all member of this class. The method could therefore |
|
962 | * be static, but this would prevent one from overriding the behavior. |
|
963 | */ |
|
964 | public TurbineRolePeer getPeer() |
|
965 | { |
|
966 | 0 | return peer; |
967 | } |
|
968 | ||
969 | public String toString() |
|
970 | { |
|
971 | 0 | StringBuffer str = new StringBuffer(); |
972 | 0 | str.append("TurbineRole:\n"); |
973 | 0 | str.append("RoleId = ") |
974 | .append(getRoleId()) |
|
975 | .append("\n"); |
|
976 | 0 | str.append("Name = ") |
977 | .append(getName()) |
|
978 | .append("\n"); |
|
979 | 0 | return(str.toString()); |
980 | } |
|
981 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |