Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
BaseTurbineUserGroupRole |
|
| 2.7906976744186047;2,791 |
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.map.TableMap; | |
14 | import org.apache.torque.om.BaseObject; | |
15 | import org.apache.torque.om.ComboKey; | |
16 | import org.apache.torque.om.DateKey; | |
17 | import org.apache.torque.om.NumberKey; | |
18 | import org.apache.torque.om.ObjectKey; | |
19 | import org.apache.torque.om.SimpleKey; | |
20 | import org.apache.torque.om.StringKey; | |
21 | import org.apache.torque.om.Persistent; | |
22 | import org.apache.torque.util.Criteria; | |
23 | import org.apache.torque.util.Transaction; | |
24 | ||
25 | ||
26 | ||
27 | ||
28 | ||
29 | /** | |
30 | * This class was autogenerated by Torque on: | |
31 | * | |
32 | * [Thu Jun 23 17:25:46 CEST 2011] | |
33 | * | |
34 | * You should not use this class directly. It should not even be | |
35 | * extended all references should be to TurbineUserGroupRole | |
36 | */ | |
37 | 0 | public abstract class BaseTurbineUserGroupRole extends BaseObject |
38 | { | |
39 | /** Serial version */ | |
40 | private static final long serialVersionUID = 1308842746584L; | |
41 | ||
42 | /** The Peer class */ | |
43 | 0 | private static final TurbineUserGroupRolePeer peer = |
44 | new TurbineUserGroupRolePeer(); | |
45 | ||
46 | ||
47 | /** The value for the userId field */ | |
48 | private int userId; | |
49 | ||
50 | /** The value for the groupId field */ | |
51 | private int groupId; | |
52 | ||
53 | /** The value for the roleId field */ | |
54 | private int roleId; | |
55 | ||
56 | ||
57 | /** | |
58 | * Get the UserId | |
59 | * | |
60 | * @return int | |
61 | */ | |
62 | public int getUserId() | |
63 | { | |
64 | 0 | return userId; |
65 | } | |
66 | ||
67 | ||
68 | /** | |
69 | * Set the value of UserId | |
70 | * | |
71 | * @param v new value | |
72 | */ | |
73 | public void setUserId(int v) throws TorqueException | |
74 | { | |
75 | ||
76 | 0 | if (this.userId != v) |
77 | { | |
78 | 0 | this.userId = v; |
79 | 0 | setModified(true); |
80 | } | |
81 | ||
82 | ||
83 | 0 | if (aTurbineUser != null && !(aTurbineUser.getUserId() == v)) |
84 | { | |
85 | 0 | aTurbineUser = null; |
86 | } | |
87 | ||
88 | 0 | } |
89 | ||
90 | /** | |
91 | * Get the GroupId | |
92 | * | |
93 | * @return int | |
94 | */ | |
95 | public int getGroupId() | |
96 | { | |
97 | 0 | return groupId; |
98 | } | |
99 | ||
100 | ||
101 | /** | |
102 | * Set the value of GroupId | |
103 | * | |
104 | * @param v new value | |
105 | */ | |
106 | public void setGroupId(int v) throws TorqueException | |
107 | { | |
108 | ||
109 | 0 | if (this.groupId != v) |
110 | { | |
111 | 0 | this.groupId = v; |
112 | 0 | setModified(true); |
113 | } | |
114 | ||
115 | ||
116 | 0 | if (aTurbineGroup != null && !(aTurbineGroup.getGroupId() == v)) |
117 | { | |
118 | 0 | aTurbineGroup = null; |
119 | } | |
120 | ||
121 | 0 | } |
122 | ||
123 | /** | |
124 | * Get the RoleId | |
125 | * | |
126 | * @return int | |
127 | */ | |
128 | public int getRoleId() | |
129 | { | |
130 | 0 | return roleId; |
131 | } | |
132 | ||
133 | ||
134 | /** | |
135 | * Set the value of RoleId | |
136 | * | |
137 | * @param v new value | |
138 | */ | |
139 | public void setRoleId(int v) throws TorqueException | |
140 | { | |
141 | ||
142 | 0 | if (this.roleId != v) |
143 | { | |
144 | 0 | this.roleId = v; |
145 | 0 | setModified(true); |
146 | } | |
147 | ||
148 | ||
149 | 0 | if (aTurbineRole != null && !(aTurbineRole.getRoleId() == v)) |
150 | { | |
151 | 0 | aTurbineRole = null; |
152 | } | |
153 | ||
154 | 0 | } |
155 | ||
156 | ||
157 | ||
158 | ||
159 | ||
160 | private TurbineUser aTurbineUser; | |
161 | ||
162 | /** | |
163 | * Declares an association between this object and a TurbineUser object | |
164 | * | |
165 | * @param v TurbineUser | |
166 | * @throws TorqueException | |
167 | */ | |
168 | public void setTurbineUser(TurbineUser v) throws TorqueException | |
169 | { | |
170 | 0 | if (v == null) |
171 | { | |
172 | 0 | setUserId( 0); |
173 | } | |
174 | else | |
175 | { | |
176 | 0 | setUserId(v.getUserId()); |
177 | } | |
178 | 0 | aTurbineUser = v; |
179 | 0 | } |
180 | ||
181 | ||
182 | /** | |
183 | * Returns the associated TurbineUser object. | |
184 | * If it was not retrieved before, the object is retrieved from | |
185 | * the database | |
186 | * | |
187 | * @return the associated TurbineUser object | |
188 | * @throws TorqueException | |
189 | */ | |
190 | public TurbineUser getTurbineUser() | |
191 | throws TorqueException | |
192 | { | |
193 | 0 | if (aTurbineUser == null && (this.userId != 0)) |
194 | { | |
195 | 0 | aTurbineUser = TurbineUserPeer.retrieveByPK(SimpleKey.keyFor(this.userId)); |
196 | } | |
197 | 0 | return aTurbineUser; |
198 | } | |
199 | ||
200 | /** | |
201 | * Return the associated TurbineUser object | |
202 | * If it was not retrieved before, the object is retrieved from | |
203 | * the database using the passed connection | |
204 | * | |
205 | * @param connection the connection used to retrieve the associated object | |
206 | * from the database, if it was not retrieved before | |
207 | * @return the associated TurbineUser object | |
208 | * @throws TorqueException | |
209 | */ | |
210 | public TurbineUser getTurbineUser(Connection connection) | |
211 | throws TorqueException | |
212 | { | |
213 | 0 | if (aTurbineUser == null && (this.userId != 0)) |
214 | { | |
215 | 0 | aTurbineUser = TurbineUserPeer.retrieveByPK(SimpleKey.keyFor(this.userId), connection); |
216 | } | |
217 | 0 | return aTurbineUser; |
218 | } | |
219 | ||
220 | /** | |
221 | * Provides convenient way to set a relationship based on a | |
222 | * ObjectKey, for example | |
223 | * <code>bar.setFooKey(foo.getPrimaryKey())</code> | |
224 | * | |
225 | */ | |
226 | public void setTurbineUserKey(ObjectKey key) throws TorqueException | |
227 | { | |
228 | ||
229 | 0 | setUserId(((NumberKey) key).intValue()); |
230 | 0 | } |
231 | ||
232 | ||
233 | ||
234 | ||
235 | private TurbineGroup aTurbineGroup; | |
236 | ||
237 | /** | |
238 | * Declares an association between this object and a TurbineGroup object | |
239 | * | |
240 | * @param v TurbineGroup | |
241 | * @throws TorqueException | |
242 | */ | |
243 | public void setTurbineGroup(TurbineGroup v) throws TorqueException | |
244 | { | |
245 | 0 | if (v == null) |
246 | { | |
247 | 0 | setGroupId( 0); |
248 | } | |
249 | else | |
250 | { | |
251 | 0 | setGroupId(v.getGroupId()); |
252 | } | |
253 | 0 | aTurbineGroup = v; |
254 | 0 | } |
255 | ||
256 | ||
257 | /** | |
258 | * Returns the associated TurbineGroup object. | |
259 | * If it was not retrieved before, the object is retrieved from | |
260 | * the database | |
261 | * | |
262 | * @return the associated TurbineGroup object | |
263 | * @throws TorqueException | |
264 | */ | |
265 | public TurbineGroup getTurbineGroup() | |
266 | throws TorqueException | |
267 | { | |
268 | 0 | if (aTurbineGroup == null && (this.groupId != 0)) |
269 | { | |
270 | 0 | aTurbineGroup = TurbineGroupPeer.retrieveByPK(SimpleKey.keyFor(this.groupId)); |
271 | } | |
272 | 0 | return aTurbineGroup; |
273 | } | |
274 | ||
275 | /** | |
276 | * Return the associated TurbineGroup object | |
277 | * If it was not retrieved before, the object is retrieved from | |
278 | * the database using the passed connection | |
279 | * | |
280 | * @param connection the connection used to retrieve the associated object | |
281 | * from the database, if it was not retrieved before | |
282 | * @return the associated TurbineGroup object | |
283 | * @throws TorqueException | |
284 | */ | |
285 | public TurbineGroup getTurbineGroup(Connection connection) | |
286 | throws TorqueException | |
287 | { | |
288 | 0 | if (aTurbineGroup == null && (this.groupId != 0)) |
289 | { | |
290 | 0 | aTurbineGroup = TurbineGroupPeer.retrieveByPK(SimpleKey.keyFor(this.groupId), connection); |
291 | } | |
292 | 0 | return aTurbineGroup; |
293 | } | |
294 | ||
295 | /** | |
296 | * Provides convenient way to set a relationship based on a | |
297 | * ObjectKey, for example | |
298 | * <code>bar.setFooKey(foo.getPrimaryKey())</code> | |
299 | * | |
300 | */ | |
301 | public void setTurbineGroupKey(ObjectKey key) throws TorqueException | |
302 | { | |
303 | ||
304 | 0 | setGroupId(((NumberKey) key).intValue()); |
305 | 0 | } |
306 | ||
307 | ||
308 | ||
309 | ||
310 | private TurbineRole aTurbineRole; | |
311 | ||
312 | /** | |
313 | * Declares an association between this object and a TurbineRole object | |
314 | * | |
315 | * @param v TurbineRole | |
316 | * @throws TorqueException | |
317 | */ | |
318 | public void setTurbineRole(TurbineRole v) throws TorqueException | |
319 | { | |
320 | 0 | if (v == null) |
321 | { | |
322 | 0 | setRoleId( 0); |
323 | } | |
324 | else | |
325 | { | |
326 | 0 | setRoleId(v.getRoleId()); |
327 | } | |
328 | 0 | aTurbineRole = v; |
329 | 0 | } |
330 | ||
331 | ||
332 | /** | |
333 | * Returns the associated TurbineRole object. | |
334 | * If it was not retrieved before, the object is retrieved from | |
335 | * the database | |
336 | * | |
337 | * @return the associated TurbineRole object | |
338 | * @throws TorqueException | |
339 | */ | |
340 | public TurbineRole getTurbineRole() | |
341 | throws TorqueException | |
342 | { | |
343 | 0 | if (aTurbineRole == null && (this.roleId != 0)) |
344 | { | |
345 | 0 | aTurbineRole = TurbineRolePeer.retrieveByPK(SimpleKey.keyFor(this.roleId)); |
346 | } | |
347 | 0 | return aTurbineRole; |
348 | } | |
349 | ||
350 | /** | |
351 | * Return the associated TurbineRole object | |
352 | * If it was not retrieved before, the object is retrieved from | |
353 | * the database using the passed connection | |
354 | * | |
355 | * @param connection the connection used to retrieve the associated object | |
356 | * from the database, if it was not retrieved before | |
357 | * @return the associated TurbineRole object | |
358 | * @throws TorqueException | |
359 | */ | |
360 | public TurbineRole getTurbineRole(Connection connection) | |
361 | throws TorqueException | |
362 | { | |
363 | 0 | if (aTurbineRole == null && (this.roleId != 0)) |
364 | { | |
365 | 0 | aTurbineRole = TurbineRolePeer.retrieveByPK(SimpleKey.keyFor(this.roleId), connection); |
366 | } | |
367 | 0 | return aTurbineRole; |
368 | } | |
369 | ||
370 | /** | |
371 | * Provides convenient way to set a relationship based on a | |
372 | * ObjectKey, for example | |
373 | * <code>bar.setFooKey(foo.getPrimaryKey())</code> | |
374 | * | |
375 | */ | |
376 | public void setTurbineRoleKey(ObjectKey key) throws TorqueException | |
377 | { | |
378 | ||
379 | 0 | setRoleId(((NumberKey) key).intValue()); |
380 | 0 | } |
381 | ||
382 | ||
383 | 0 | private static List<String> fieldNames = null; |
384 | ||
385 | /** | |
386 | * Generate a list of field names. | |
387 | * | |
388 | * @return a list of field names | |
389 | */ | |
390 | public static synchronized List<String> getFieldNames() | |
391 | { | |
392 | 0 | if (fieldNames == null) |
393 | { | |
394 | 0 | fieldNames = new ArrayList<String>(); |
395 | 0 | fieldNames.add("UserId"); |
396 | 0 | fieldNames.add("GroupId"); |
397 | 0 | fieldNames.add("RoleId"); |
398 | 0 | fieldNames = Collections.unmodifiableList(fieldNames); |
399 | } | |
400 | 0 | return fieldNames; |
401 | } | |
402 | ||
403 | /** | |
404 | * Retrieves a field from the object by field (Java) name passed in as a String. | |
405 | * | |
406 | * @param name field name | |
407 | * @return value | |
408 | */ | |
409 | public Object getByName(String name) | |
410 | { | |
411 | 0 | if (name.equals("UserId")) |
412 | { | |
413 | 0 | return new Integer(getUserId()); |
414 | } | |
415 | 0 | if (name.equals("GroupId")) |
416 | { | |
417 | 0 | return new Integer(getGroupId()); |
418 | } | |
419 | 0 | if (name.equals("RoleId")) |
420 | { | |
421 | 0 | return new Integer(getRoleId()); |
422 | } | |
423 | 0 | return null; |
424 | } | |
425 | ||
426 | /** | |
427 | * Set a field in the object by field (Java) name. | |
428 | * | |
429 | * @param name field name | |
430 | * @param value field value | |
431 | * @return True if value was set, false if not (invalid name / protected field). | |
432 | * @throws IllegalArgumentException if object type of value does not match field object type. | |
433 | * @throws TorqueException If a problem occurs with the set[Field] method. | |
434 | */ | |
435 | public boolean setByName(String name, Object value ) | |
436 | throws TorqueException, IllegalArgumentException | |
437 | { | |
438 | 0 | if (name.equals("UserId")) |
439 | { | |
440 | 0 | if (value == null || ! (Integer.class.isInstance(value))) |
441 | { | |
442 | 0 | throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object."); |
443 | } | |
444 | 0 | setUserId(((Integer) value).intValue()); |
445 | 0 | return true; |
446 | } | |
447 | 0 | if (name.equals("GroupId")) |
448 | { | |
449 | 0 | if (value == null || ! (Integer.class.isInstance(value))) |
450 | { | |
451 | 0 | throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object."); |
452 | } | |
453 | 0 | setGroupId(((Integer) value).intValue()); |
454 | 0 | return true; |
455 | } | |
456 | 0 | if (name.equals("RoleId")) |
457 | { | |
458 | 0 | if (value == null || ! (Integer.class.isInstance(value))) |
459 | { | |
460 | 0 | throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object."); |
461 | } | |
462 | 0 | setRoleId(((Integer) value).intValue()); |
463 | 0 | return true; |
464 | } | |
465 | 0 | return false; |
466 | } | |
467 | ||
468 | /** | |
469 | * Retrieves a field from the object by name passed in | |
470 | * as a String. The String must be one of the static | |
471 | * Strings defined in this Class' Peer. | |
472 | * | |
473 | * @param name peer name | |
474 | * @return value | |
475 | */ | |
476 | public Object getByPeerName(String name) | |
477 | { | |
478 | 0 | if (name.equals(TurbineUserGroupRolePeer.USER_ID)) |
479 | { | |
480 | 0 | return new Integer(getUserId()); |
481 | } | |
482 | 0 | if (name.equals(TurbineUserGroupRolePeer.GROUP_ID)) |
483 | { | |
484 | 0 | return new Integer(getGroupId()); |
485 | } | |
486 | 0 | if (name.equals(TurbineUserGroupRolePeer.ROLE_ID)) |
487 | { | |
488 | 0 | return new Integer(getRoleId()); |
489 | } | |
490 | 0 | return null; |
491 | } | |
492 | ||
493 | /** | |
494 | * Set field values by Peer Field Name | |
495 | * | |
496 | * @param name field name | |
497 | * @param value field value | |
498 | * @return True if value was set, false if not (invalid name / protected field). | |
499 | * @throws IllegalArgumentException if object type of value does not match field object type. | |
500 | * @throws TorqueException If a problem occurs with the set[Field] method. | |
501 | */ | |
502 | public boolean setByPeerName(String name, Object value) | |
503 | throws TorqueException, IllegalArgumentException | |
504 | { | |
505 | 0 | if (TurbineUserGroupRolePeer.USER_ID.equals(name)) |
506 | { | |
507 | 0 | return setByName("UserId", value); |
508 | } | |
509 | 0 | if (TurbineUserGroupRolePeer.GROUP_ID.equals(name)) |
510 | { | |
511 | 0 | return setByName("GroupId", value); |
512 | } | |
513 | 0 | if (TurbineUserGroupRolePeer.ROLE_ID.equals(name)) |
514 | { | |
515 | 0 | return setByName("RoleId", value); |
516 | } | |
517 | 0 | return false; |
518 | } | |
519 | ||
520 | /** | |
521 | * Retrieves a field from the object by Position as specified | |
522 | * in the xml schema. Zero-based. | |
523 | * | |
524 | * @param pos position in xml schema | |
525 | * @return value | |
526 | */ | |
527 | public Object getByPosition(int pos) | |
528 | { | |
529 | 0 | if (pos == 0) |
530 | { | |
531 | 0 | return new Integer(getUserId()); |
532 | } | |
533 | 0 | if (pos == 1) |
534 | { | |
535 | 0 | return new Integer(getGroupId()); |
536 | } | |
537 | 0 | if (pos == 2) |
538 | { | |
539 | 0 | return new Integer(getRoleId()); |
540 | } | |
541 | 0 | return null; |
542 | } | |
543 | ||
544 | /** | |
545 | * Set field values by its position (zero based) in the XML schema. | |
546 | * | |
547 | * @param position The field position | |
548 | * @param value field value | |
549 | * @return True if value was set, false if not (invalid position / protected field). | |
550 | * @throws IllegalArgumentException if object type of value does not match field object type. | |
551 | * @throws TorqueException If a problem occurs with the set[Field] method. | |
552 | */ | |
553 | public boolean setByPosition(int position, Object value) | |
554 | throws TorqueException, IllegalArgumentException | |
555 | { | |
556 | 0 | if (position == 0) |
557 | { | |
558 | 0 | return setByName("UserId", value); |
559 | } | |
560 | 0 | if (position == 1) |
561 | { | |
562 | 0 | return setByName("GroupId", value); |
563 | } | |
564 | 0 | if (position == 2) |
565 | { | |
566 | 0 | return setByName("RoleId", value); |
567 | } | |
568 | 0 | return false; |
569 | } | |
570 | ||
571 | /** | |
572 | * Stores the object in the database. If the object is new, | |
573 | * it inserts it; otherwise an update is performed. | |
574 | * | |
575 | * @throws Exception | |
576 | */ | |
577 | public void save() throws Exception | |
578 | { | |
579 | 0 | save(TurbineUserGroupRolePeer.DATABASE_NAME); |
580 | 0 | } |
581 | ||
582 | /** | |
583 | * Stores the object in the database. If the object is new, | |
584 | * it inserts it; otherwise an update is performed. | |
585 | * Note: this code is here because the method body is | |
586 | * auto-generated conditionally and therefore needs to be | |
587 | * in this file instead of in the super class, BaseObject. | |
588 | * | |
589 | * @param dbName | |
590 | * @throws TorqueException | |
591 | */ | |
592 | public void save(String dbName) throws TorqueException | |
593 | { | |
594 | 0 | Connection con = null; |
595 | try | |
596 | { | |
597 | 0 | con = Transaction.begin(dbName); |
598 | 0 | save(con); |
599 | 0 | Transaction.commit(con); |
600 | } | |
601 | 0 | catch(TorqueException e) |
602 | { | |
603 | 0 | Transaction.safeRollback(con); |
604 | 0 | throw e; |
605 | 0 | } |
606 | 0 | } |
607 | ||
608 | /** flag to prevent endless save loop, if this object is referenced | |
609 | by another object which falls in this transaction. */ | |
610 | 0 | private boolean alreadyInSave = false; |
611 | /** | |
612 | * Stores the object in the database. If the object is new, | |
613 | * it inserts it; otherwise an update is performed. This method | |
614 | * is meant to be used as part of a transaction, otherwise use | |
615 | * the save() method and the connection details will be handled | |
616 | * internally | |
617 | * | |
618 | * @param con | |
619 | * @throws TorqueException | |
620 | */ | |
621 | public void save(Connection con) throws TorqueException | |
622 | { | |
623 | 0 | if (!alreadyInSave) |
624 | { | |
625 | 0 | alreadyInSave = true; |
626 | ||
627 | ||
628 | ||
629 | // If this object has been modified, then save it to the database. | |
630 | 0 | if (isModified()) |
631 | { | |
632 | 0 | if (isNew()) |
633 | { | |
634 | 0 | TurbineUserGroupRolePeer.doInsert((TurbineUserGroupRole) this, con); |
635 | 0 | setNew(false); |
636 | } | |
637 | else | |
638 | { | |
639 | 0 | TurbineUserGroupRolePeer.doUpdate((TurbineUserGroupRole) this, con); |
640 | } | |
641 | } | |
642 | ||
643 | 0 | alreadyInSave = false; |
644 | } | |
645 | 0 | } |
646 | ||
647 | ||
648 | ||
649 | 0 | private final SimpleKey[] pks = new SimpleKey[3]; |
650 | 0 | private final ComboKey comboPK = new ComboKey(pks); |
651 | ||
652 | /** | |
653 | * Set the PrimaryKey with an ObjectKey | |
654 | * | |
655 | * @param key | |
656 | */ | |
657 | public void setPrimaryKey(ObjectKey key) throws TorqueException | |
658 | { | |
659 | 0 | SimpleKey[] keys = (SimpleKey[]) key.getValue(); |
660 | 0 | setUserId(((NumberKey)keys[0]).intValue()); |
661 | 0 | setGroupId(((NumberKey)keys[1]).intValue()); |
662 | 0 | setRoleId(((NumberKey)keys[2]).intValue()); |
663 | 0 | } |
664 | ||
665 | /** | |
666 | * Set the PrimaryKey using SimpleKeys. | |
667 | * | |
668 | * @param userId int | |
669 | * @param groupId int | |
670 | * @param roleId int | |
671 | */ | |
672 | public void setPrimaryKey( int userId, int groupId, int roleId) | |
673 | throws TorqueException | |
674 | { | |
675 | 0 | setUserId(userId); |
676 | 0 | setGroupId(groupId); |
677 | 0 | setRoleId(roleId); |
678 | 0 | } |
679 | ||
680 | /** | |
681 | * Set the PrimaryKey using a String. | |
682 | */ | |
683 | public void setPrimaryKey(String key) throws TorqueException | |
684 | { | |
685 | 0 | setPrimaryKey(new ComboKey(key)); |
686 | 0 | } |
687 | ||
688 | /** | |
689 | * returns an id that differentiates this object from others | |
690 | * of its class. | |
691 | */ | |
692 | public ObjectKey getPrimaryKey() | |
693 | { | |
694 | 0 | pks[0] = SimpleKey.keyFor(getUserId()); |
695 | 0 | pks[1] = SimpleKey.keyFor(getGroupId()); |
696 | 0 | pks[2] = SimpleKey.keyFor(getRoleId()); |
697 | 0 | return comboPK; |
698 | } | |
699 | ||
700 | ||
701 | /** | |
702 | * Makes a copy of this object. | |
703 | * It creates a new object filling in the simple attributes. | |
704 | * It then fills all the association collections and sets the | |
705 | * related objects to isNew=true. | |
706 | */ | |
707 | public TurbineUserGroupRole copy() throws TorqueException | |
708 | { | |
709 | 0 | return copy(true); |
710 | } | |
711 | ||
712 | /** | |
713 | * Makes a copy of this object using connection. | |
714 | * It creates a new object filling in the simple attributes. | |
715 | * It then fills all the association collections and sets the | |
716 | * related objects to isNew=true. | |
717 | * | |
718 | * @param con the database connection to read associated objects. | |
719 | */ | |
720 | public TurbineUserGroupRole copy(Connection con) throws TorqueException | |
721 | { | |
722 | 0 | return copy(true, con); |
723 | } | |
724 | ||
725 | /** | |
726 | * Makes a copy of this object. | |
727 | * It creates a new object filling in the simple attributes. | |
728 | * If the parameter deepcopy is true, it then fills all the | |
729 | * association collections and sets the related objects to | |
730 | * isNew=true. | |
731 | * | |
732 | * @param deepcopy whether to copy the associated objects. | |
733 | */ | |
734 | public TurbineUserGroupRole copy(boolean deepcopy) throws TorqueException | |
735 | { | |
736 | 0 | return copyInto(new TurbineUserGroupRole(), deepcopy); |
737 | } | |
738 | ||
739 | /** | |
740 | * Makes a copy of this object using connection. | |
741 | * It creates a new object filling in the simple attributes. | |
742 | * If the parameter deepcopy is true, it then fills all the | |
743 | * association collections and sets the related objects to | |
744 | * isNew=true. | |
745 | * | |
746 | * @param deepcopy whether to copy the associated objects. | |
747 | * @param con the database connection to read associated objects. | |
748 | */ | |
749 | public TurbineUserGroupRole copy(boolean deepcopy, Connection con) throws TorqueException | |
750 | { | |
751 | 0 | return copyInto(new TurbineUserGroupRole(), deepcopy, con); |
752 | } | |
753 | ||
754 | /** | |
755 | * Fills the copyObj with the contents of this object. | |
756 | * The associated objects are also copied and treated as new objects. | |
757 | * | |
758 | * @param copyObj the object to fill. | |
759 | */ | |
760 | protected TurbineUserGroupRole copyInto(TurbineUserGroupRole copyObj) throws TorqueException | |
761 | { | |
762 | 0 | return copyInto(copyObj, true); |
763 | } | |
764 | ||
765 | ||
766 | /** | |
767 | * Fills the copyObj with the contents of this object using connection. | |
768 | * The associated objects are also copied and treated as new objects. | |
769 | * | |
770 | * @param copyObj the object to fill. | |
771 | * @param con the database connection to read associated objects. | |
772 | */ | |
773 | protected TurbineUserGroupRole copyInto(TurbineUserGroupRole copyObj, Connection con) throws TorqueException | |
774 | { | |
775 | 0 | return copyInto(copyObj, true, con); |
776 | } | |
777 | ||
778 | /** | |
779 | * Fills the copyObj with the contents of this object. | |
780 | * If deepcopy is true, The associated objects are also copied | |
781 | * and treated as new objects. | |
782 | * | |
783 | * @param copyObj the object to fill. | |
784 | * @param deepcopy whether the associated objects should be copied. | |
785 | */ | |
786 | protected TurbineUserGroupRole copyInto(TurbineUserGroupRole copyObj, boolean deepcopy) throws TorqueException | |
787 | { | |
788 | 0 | copyObj.setUserId(userId); |
789 | 0 | copyObj.setGroupId(groupId); |
790 | 0 | copyObj.setRoleId(roleId); |
791 | ||
792 | 0 | copyObj.setUserId( 0); |
793 | 0 | copyObj.setGroupId( 0); |
794 | 0 | copyObj.setRoleId( 0); |
795 | ||
796 | 0 | if (deepcopy) |
797 | { | |
798 | } | |
799 | 0 | return copyObj; |
800 | } | |
801 | ||
802 | ||
803 | /** | |
804 | * Fills the copyObj with the contents of this object using connection. | |
805 | * If deepcopy is true, The associated objects are also copied | |
806 | * and treated as new objects. | |
807 | * | |
808 | * @param copyObj the object to fill. | |
809 | * @param deepcopy whether the associated objects should be copied. | |
810 | * @param con the database connection to read associated objects. | |
811 | */ | |
812 | protected TurbineUserGroupRole copyInto(TurbineUserGroupRole copyObj, boolean deepcopy, Connection con) throws TorqueException | |
813 | { | |
814 | 0 | copyObj.setUserId(userId); |
815 | 0 | copyObj.setGroupId(groupId); |
816 | 0 | copyObj.setRoleId(roleId); |
817 | ||
818 | 0 | copyObj.setUserId( 0); |
819 | 0 | copyObj.setGroupId( 0); |
820 | 0 | copyObj.setRoleId( 0); |
821 | ||
822 | 0 | if (deepcopy) |
823 | { | |
824 | } | |
825 | 0 | return copyObj; |
826 | } | |
827 | ||
828 | ||
829 | ||
830 | /** | |
831 | * returns a peer instance associated with this om. Since Peer classes | |
832 | * are not to have any instance attributes, this method returns the | |
833 | * same instance for all member of this class. The method could therefore | |
834 | * be static, but this would prevent one from overriding the behavior. | |
835 | */ | |
836 | public TurbineUserGroupRolePeer getPeer() | |
837 | { | |
838 | 0 | return peer; |
839 | } | |
840 | ||
841 | /** | |
842 | * Retrieves the TableMap object related to this Table data without | |
843 | * compiler warnings of using getPeer().getTableMap(). | |
844 | * | |
845 | * @return The associated TableMap object. | |
846 | */ | |
847 | public TableMap getTableMap() throws TorqueException | |
848 | { | |
849 | 0 | return TurbineUserGroupRolePeer.getTableMap(); |
850 | } | |
851 | ||
852 | ||
853 | public String toString() | |
854 | { | |
855 | 0 | StringBuffer str = new StringBuffer(); |
856 | 0 | str.append("TurbineUserGroupRole:\n"); |
857 | 0 | str.append("UserId = ") |
858 | .append(getUserId()) | |
859 | .append("\n"); | |
860 | 0 | str.append("GroupId = ") |
861 | .append(getGroupId()) | |
862 | .append("\n"); | |
863 | 0 | str.append("RoleId = ") |
864 | .append(getRoleId()) | |
865 | .append("\n"); | |
866 | 0 | return(str.toString()); |
867 | } | |
868 | } |