%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.services.security.torque.om.BaseTurbineUser |
|
|
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 TurbineUser |
|
32 | */ |
|
33 | 465 | public abstract class BaseTurbineUser extends BaseObject |
34 | { |
|
35 | /** The Peer class */ |
|
36 | 24 | private static final TurbineUserPeer peer = |
37 | new TurbineUserPeer(); |
|
38 | ||
39 | ||
40 | /** The value for the userId field */ |
|
41 | private int userId; |
|
42 | ||
43 | /** The value for the userName field */ |
|
44 | private String userName; |
|
45 | ||
46 | /** The value for the password field */ |
|
47 | private String password; |
|
48 | ||
49 | /** The value for the firstName field */ |
|
50 | private String firstName; |
|
51 | ||
52 | /** The value for the lastName field */ |
|
53 | private String lastName; |
|
54 | ||
55 | /** The value for the email field */ |
|
56 | private String email; |
|
57 | ||
58 | /** The value for the confirmed field */ |
|
59 | private String confirmed; |
|
60 | ||
61 | /** The value for the modified field */ |
|
62 | private Date modified; |
|
63 | ||
64 | /** The value for the createDate field */ |
|
65 | private Date createDate; |
|
66 | ||
67 | /** The value for the lastLogin field */ |
|
68 | private Date lastLogin; |
|
69 | ||
70 | /** The value for the objectdata field */ |
|
71 | private byte[] objectdata; |
|
72 | ||
73 | ||
74 | /** |
|
75 | * Get the UserId |
|
76 | * |
|
77 | * @return int |
|
78 | */ |
|
79 | public int getUserId() |
|
80 | { |
|
81 | 40 | return userId; |
82 | } |
|
83 | ||
84 | ||
85 | /** |
|
86 | * Set the value of UserId |
|
87 | * |
|
88 | * @param v new value |
|
89 | */ |
|
90 | public void setUserId(int v) throws TorqueException |
|
91 | { |
|
92 | ||
93 | 290 | if (this.userId != v) |
94 | { |
|
95 | 290 | this.userId = v; |
96 | 290 | setModified(true); |
97 | } |
|
98 | ||
99 | ||
100 | ||
101 | // update associated TurbineUserGroupRole |
|
102 | 290 | if (collTurbineUserGroupRoles != null) |
103 | { |
|
104 | 0 | for (int i = 0; i < collTurbineUserGroupRoles.size(); i++) |
105 | { |
|
106 | 0 | ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)) |
107 | .setUserId(v); |
|
108 | } |
|
109 | } |
|
110 | 290 | } |
111 | ||
112 | /** |
|
113 | * Get the UserName |
|
114 | * |
|
115 | * @return String |
|
116 | */ |
|
117 | public String getUserName() |
|
118 | { |
|
119 | 204 | return userName; |
120 | } |
|
121 | ||
122 | ||
123 | /** |
|
124 | * Set the value of UserName |
|
125 | * |
|
126 | * @param v new value |
|
127 | */ |
|
128 | public void setUserName(String v) |
|
129 | { |
|
130 | ||
131 | 302 | if (!ObjectUtils.equals(this.userName, v)) |
132 | { |
|
133 | 302 | this.userName = v; |
134 | 302 | setModified(true); |
135 | } |
|
136 | ||
137 | ||
138 | 302 | } |
139 | ||
140 | /** |
|
141 | * Get the Password |
|
142 | * |
|
143 | * @return String |
|
144 | */ |
|
145 | public String getPassword() |
|
146 | { |
|
147 | 60 | return password; |
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * Set the value of Password |
|
153 | * |
|
154 | * @param v new value |
|
155 | */ |
|
156 | public void setPassword(String v) |
|
157 | { |
|
158 | ||
159 | 302 | if (!ObjectUtils.equals(this.password, v)) |
160 | { |
|
161 | 302 | this.password = v; |
162 | 302 | setModified(true); |
163 | } |
|
164 | ||
165 | ||
166 | 302 | } |
167 | ||
168 | /** |
|
169 | * Get the FirstName |
|
170 | * |
|
171 | * @return String |
|
172 | */ |
|
173 | public String getFirstName() |
|
174 | { |
|
175 | 22 | return firstName; |
176 | } |
|
177 | ||
178 | ||
179 | /** |
|
180 | * Set the value of FirstName |
|
181 | * |
|
182 | * @param v new value |
|
183 | */ |
|
184 | public void setFirstName(String v) |
|
185 | { |
|
186 | ||
187 | 290 | if (!ObjectUtils.equals(this.firstName, v)) |
188 | { |
|
189 | 290 | this.firstName = v; |
190 | 290 | setModified(true); |
191 | } |
|
192 | ||
193 | ||
194 | 290 | } |
195 | ||
196 | /** |
|
197 | * Get the LastName |
|
198 | * |
|
199 | * @return String |
|
200 | */ |
|
201 | public String getLastName() |
|
202 | { |
|
203 | 22 | return lastName; |
204 | } |
|
205 | ||
206 | ||
207 | /** |
|
208 | * Set the value of LastName |
|
209 | * |
|
210 | * @param v new value |
|
211 | */ |
|
212 | public void setLastName(String v) |
|
213 | { |
|
214 | ||
215 | 290 | if (!ObjectUtils.equals(this.lastName, v)) |
216 | { |
|
217 | 290 | this.lastName = v; |
218 | 290 | setModified(true); |
219 | } |
|
220 | ||
221 | ||
222 | 290 | } |
223 | ||
224 | /** |
|
225 | * Get the Email |
|
226 | * |
|
227 | * @return String |
|
228 | */ |
|
229 | public String getEmail() |
|
230 | { |
|
231 | 22 | return email; |
232 | } |
|
233 | ||
234 | ||
235 | /** |
|
236 | * Set the value of Email |
|
237 | * |
|
238 | * @param v new value |
|
239 | */ |
|
240 | public void setEmail(String v) |
|
241 | { |
|
242 | ||
243 | 286 | if (!ObjectUtils.equals(this.email, v)) |
244 | { |
|
245 | 0 | this.email = v; |
246 | 0 | setModified(true); |
247 | } |
|
248 | ||
249 | ||
250 | 286 | } |
251 | ||
252 | /** |
|
253 | * Get the Confirmed |
|
254 | * |
|
255 | * @return String |
|
256 | */ |
|
257 | public String getConfirmed() |
|
258 | { |
|
259 | 22 | return confirmed; |
260 | } |
|
261 | ||
262 | ||
263 | /** |
|
264 | * Set the value of Confirmed |
|
265 | * |
|
266 | * @param v new value |
|
267 | */ |
|
268 | public void setConfirmed(String v) |
|
269 | { |
|
270 | ||
271 | 286 | if (!ObjectUtils.equals(this.confirmed, v)) |
272 | { |
|
273 | 0 | this.confirmed = v; |
274 | 0 | setModified(true); |
275 | } |
|
276 | ||
277 | ||
278 | 286 | } |
279 | ||
280 | /** |
|
281 | * Get the Modified |
|
282 | * |
|
283 | * @return Date |
|
284 | */ |
|
285 | public Date getModified() |
|
286 | { |
|
287 | 22 | return modified; |
288 | } |
|
289 | ||
290 | ||
291 | /** |
|
292 | * Set the value of Modified |
|
293 | * |
|
294 | * @param v new value |
|
295 | */ |
|
296 | public void setModified(Date v) |
|
297 | { |
|
298 | ||
299 | 286 | if (!ObjectUtils.equals(this.modclass="keyword">ified, v)) |
300 | { |
|
301 | 0 | this.modified = v; |
302 | 0 | setModified(true); |
303 | } |
|
304 | ||
305 | ||
306 | 286 | } |
307 | ||
308 | /** |
|
309 | * Get the CreateDate |
|
310 | * |
|
311 | * @return Date |
|
312 | */ |
|
313 | public Date getCreateDate() |
|
314 | { |
|
315 | 22 | return createDate; |
316 | } |
|
317 | ||
318 | ||
319 | /** |
|
320 | * Set the value of CreateDate |
|
321 | * |
|
322 | * @param v new value |
|
323 | */ |
|
324 | public void setCreateDate(Date v) |
|
325 | { |
|
326 | ||
327 | 310 | if (!ObjectUtils.equals(this.createDate, v)) |
328 | { |
|
329 | 38 | this.createDate = v; |
330 | 38 | setModified(true); |
331 | } |
|
332 | ||
333 | ||
334 | 310 | } |
335 | ||
336 | /** |
|
337 | * Get the LastLogin |
|
338 | * |
|
339 | * @return Date |
|
340 | */ |
|
341 | public Date getLastLogin() |
|
342 | { |
|
343 | 22 | return lastLogin; |
344 | } |
|
345 | ||
346 | ||
347 | /** |
|
348 | * Set the value of LastLogin |
|
349 | * |
|
350 | * @param v new value |
|
351 | */ |
|
352 | public void setLastLogin(Date v) |
|
353 | { |
|
354 | ||
355 | 286 | if (!ObjectUtils.equals(this.lastLogin, v)) |
356 | { |
|
357 | 0 | this.lastLogin = v; |
358 | 0 | setModified(true); |
359 | } |
|
360 | ||
361 | ||
362 | 286 | } |
363 | ||
364 | /** |
|
365 | * Get the Objectdata |
|
366 | * |
|
367 | * @return byte[] |
|
368 | */ |
|
369 | public byte[] getObjectdata() |
|
370 | { |
|
371 | 42 | return objectdata; |
372 | } |
|
373 | ||
374 | ||
375 | /** |
|
376 | * Set the value of Objectdata |
|
377 | * |
|
378 | * @param v new value |
|
379 | */ |
|
380 | public void setObjectdata(byte[] v) |
|
381 | { |
|
382 | ||
383 | 308 | if (!ObjectUtils.equals(this.objectdata, v)) |
384 | { |
|
385 | 308 | this.objectdata = v; |
386 | 308 | setModified(true); |
387 | } |
|
388 | ||
389 | ||
390 | 308 | } |
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.setTurbineUser((TurbineUser) this); |
424 | 0 | } |
425 | ||
426 | /** |
|
427 | * The criteria used to select the current contents of collTurbineUserGroupRoles |
|
428 | */ |
|
429 | 310 | 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 TurbineUser has previously |
|
451 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
452 | * If this TurbineUser 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.USER_ID, getUserId() ); |
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.USER_ID, getUserId()); |
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 TurbineUser has previously |
|
513 | * been saved, it will retrieve related TurbineUserGroupRoles from storage. |
|
514 | * If this TurbineUser 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.USER_ID, getUserId()); |
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.USER_ID, getUserId()); |
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 TurbineUser is new, it will return |
|
570 | * an empty collection; or if this TurbineUser 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 TurbineUser. |
|
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.USER_ID, getUserId()); |
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.USER_ID, getUserId()); |
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 TurbineUser is new, it will return |
|
621 | * an empty collection; or if this TurbineUser 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 TurbineUser. |
|
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.USER_ID, getUserId()); |
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.USER_ID, getUserId()); |
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 TurbineUser is new, it will return |
|
672 | * an empty collection; or if this TurbineUser 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 TurbineUser. |
|
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.USER_ID, getUserId()); |
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.USER_ID, getUserId()); |
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("UserId"); |
727 | 0 | fieldNames.add("UserName"); |
728 | 0 | fieldNames.add("Password"); |
729 | 0 | fieldNames.add("FirstName"); |
730 | 0 | fieldNames.add("LastName"); |
731 | 0 | fieldNames.add("Email"); |
732 | 0 | fieldNames.add("Confirmed"); |
733 | 0 | fieldNames.add("Modified"); |
734 | 0 | fieldNames.add("CreateDate"); |
735 | 0 | fieldNames.add("LastLogin"); |
736 | 0 | fieldNames.add("Objectdata"); |
737 | 0 | fieldNames = Collections.unmodifiableList(fieldNames); |
738 | } |
|
739 | 0 | return fieldNames; |
740 | } |
|
741 | ||
742 | /** |
|
743 | * Retrieves a field from the object by name passed in as a String. |
|
744 | * |
|
745 | * @param name field name |
|
746 | * @return value |
|
747 | */ |
|
748 | public Object getByName(String name) |
|
749 | { |
|
750 | 0 | if (name.equals("UserId")) |
751 | { |
|
752 | 0 | return new Integer(getUserId()); |
753 | } |
|
754 | 0 | if (name.equals("UserName")) |
755 | { |
|
756 | 0 | return getUserName(); |
757 | } |
|
758 | 0 | if (name.equals("Password")) |
759 | { |
|
760 | 0 | return getPassword(); |
761 | } |
|
762 | 0 | if (name.equals("FirstName")) |
763 | { |
|
764 | 0 | return getFirstName(); |
765 | } |
|
766 | 0 | if (name.equals("LastName")) |
767 | { |
|
768 | 0 | return getLastName(); |
769 | } |
|
770 | 0 | if (name.equals("Email")) |
771 | { |
|
772 | 0 | return getEmail(); |
773 | } |
|
774 | 0 | if (name.equals("Confirmed")) |
775 | { |
|
776 | 0 | return getConfirmed(); |
777 | } |
|
778 | 0 | if (name.equals("Modified")) |
779 | { |
|
780 | 0 | return getModified(); |
781 | } |
|
782 | 0 | if (name.equals("CreateDate")) |
783 | { |
|
784 | 0 | return getCreateDate(); |
785 | } |
|
786 | 0 | if (name.equals("LastLogin")) |
787 | { |
|
788 | 0 | return getLastLogin(); |
789 | } |
|
790 | 0 | if (name.equals("Objectdata")) |
791 | { |
|
792 | 0 | return getObjectdata(); |
793 | } |
|
794 | 0 | return null; |
795 | } |
|
796 | ||
797 | /** |
|
798 | * Retrieves a field from the object by name passed in |
|
799 | * as a String. The String must be one of the static |
|
800 | * Strings defined in this Class' Peer. |
|
801 | * |
|
802 | * @param name peer name |
|
803 | * @return value |
|
804 | */ |
|
805 | public Object getByPeerName(String name) |
|
806 | { |
|
807 | 0 | if (name.equals(TurbineUserPeer.USER_ID)) |
808 | { |
|
809 | 0 | return new Integer(getUserId()); |
810 | } |
|
811 | 0 | if (name.equals(TurbineUserPeer.LOGIN_NAME)) |
812 | { |
|
813 | 0 | return getUserName(); |
814 | } |
|
815 | 0 | if (name.equals(TurbineUserPeer.PASSWORD_VALUE)) |
816 | { |
|
817 | 0 | return getPassword(); |
818 | } |
|
819 | 0 | if (name.equals(TurbineUserPeer.FIRST_NAME)) |
820 | { |
|
821 | 0 | return getFirstName(); |
822 | } |
|
823 | 0 | if (name.equals(TurbineUserPeer.LAST_NAME)) |
824 | { |
|
825 | 0 | return getLastName(); |
826 | } |
|
827 | 0 | if (name.equals(TurbineUserPeer.EMAIL)) |
828 | { |
|
829 | 0 | return getEmail(); |
830 | } |
|
831 | 0 | if (name.equals(TurbineUserPeer.CONFIRM_VALUE)) |
832 | { |
|
833 | 0 | return getConfirmed(); |
834 | } |
|
835 | 0 | if (name.equals(TurbineUserPeer.MODIFIED)) |
836 | { |
|
837 | 0 | return getModified(); |
838 | } |
|
839 | 0 | if (name.equals(TurbineUserPeer.CREATED)) |
840 | { |
|
841 | 0 | return getCreateDate(); |
842 | } |
|
843 | 0 | if (name.equals(TurbineUserPeer.LAST_LOGIN)) |
844 | { |
|
845 | 0 | return getLastLogin(); |
846 | } |
|
847 | 0 | if (name.equals(TurbineUserPeer.OBJECTDATA)) |
848 | { |
|
849 | 0 | return getObjectdata(); |
850 | } |
|
851 | 0 | return null; |
852 | } |
|
853 | ||
854 | /** |
|
855 | * Retrieves a field from the object by Position as specified |
|
856 | * in the xml schema. Zero-based. |
|
857 | * |
|
858 | * @param pos position in xml schema |
|
859 | * @return value |
|
860 | */ |
|
861 | public Object getByPosition(int pos) |
|
862 | { |
|
863 | 0 | if (pos == 0) |
864 | { |
|
865 | 0 | return new Integer(getUserId()); |
866 | } |
|
867 | 0 | if (pos == 1) |
868 | { |
|
869 | 0 | return getUserName(); |
870 | } |
|
871 | 0 | if (pos == 2) |
872 | { |
|
873 | 0 | return getPassword(); |
874 | } |
|
875 | 0 | if (pos == 3) |
876 | { |
|
877 | 0 | return getFirstName(); |
878 | } |
|
879 | 0 | if (pos == 4) |
880 | { |
|
881 | 0 | return getLastName(); |
882 | } |
|
883 | 0 | if (pos == 5) |
884 | { |
|
885 | 0 | return getEmail(); |
886 | } |
|
887 | 0 | if (pos == 6) |
888 | { |
|
889 | 0 | return getConfirmed(); |
890 | } |
|
891 | 0 | if (pos == 7) |
892 | { |
|
893 | 0 | return getModified(); |
894 | } |
|
895 | 0 | if (pos == 8) |
896 | { |
|
897 | 0 | return getCreateDate(); |
898 | } |
|
899 | 0 | if (pos == 9) |
900 | { |
|
901 | 0 | return getLastLogin(); |
902 | } |
|
903 | 0 | if (pos == 10) |
904 | { |
|
905 | 0 | return getObjectdata(); |
906 | } |
|
907 | 0 | return null; |
908 | } |
|
909 | ||
910 | /** |
|
911 | * Stores the object in the database. If the object is new, |
|
912 | * it inserts it; otherwise an update is performed. |
|
913 | * |
|
914 | * @throws Exception |
|
915 | */ |
|
916 | public void save() throws Exception |
|
917 | { |
|
918 | 22 | save(TurbineUserPeer.getMapBuilder() |
919 | .getDatabaseMap().getName()); |
|
920 | 22 | } |
921 | ||
922 | /** |
|
923 | * Stores the object in the database. If the object is new, |
|
924 | * it inserts it; otherwise an update is performed. |
|
925 | * Note: this code is here because the method body is |
|
926 | * auto-generated conditionally and therefore needs to be |
|
927 | * in this file instead of in the super class, BaseObject. |
|
928 | * |
|
929 | * @param dbName |
|
930 | * @throws TorqueException |
|
931 | */ |
|
932 | public void save(String dbName) throws TorqueException |
|
933 | { |
|
934 | 22 | Connection con = null; |
935 | try |
|
936 | { |
|
937 | 22 | con = Transaction.begin(dbName); |
938 | 22 | save(con); |
939 | 22 | Transaction.commit(con); |
940 | 11 | } |
941 | 0 | catch(TorqueException e) |
942 | { |
|
943 | 0 | Transaction.safeRollback(con); |
944 | 0 | throw e; |
945 | 11 | } |
946 | 22 | } |
947 | ||
948 | /** flag to prevent endless save loop, if this object is referenced |
|
949 | by another object which falls in this transaction. */ |
|
950 | 310 | private boolean alreadyInSave = false; |
951 | /** |
|
952 | * Stores the object in the database. If the object is new, |
|
953 | * it inserts it; otherwise an update is performed. This method |
|
954 | * is meant to be used as part of a transaction, otherwise use |
|
955 | * the save() method and the connection details will be handled |
|
956 | * internally |
|
957 | * |
|
958 | * @param con |
|
959 | * @throws TorqueException |
|
960 | */ |
|
961 | public void save(Connection con) throws TorqueException |
|
962 | { |
|
963 | 22 | if (!alreadyInSave) |
964 | { |
|
965 | 22 | alreadyInSave = true; |
966 | ||
967 | ||
968 | ||
969 | // If this object has been modified, then save it to the database. |
|
970 | 22 | if (isModclass="keyword">ified()) |
971 | { |
|
972 | 22 | if (isNew()) |
973 | { |
|
974 | 4 | TurbineUserPeer.doInsert((TurbineUser) this, con); |
975 | 4 | setNew(false); |
976 | } |
|
977 | else |
|
978 | { |
|
979 | 18 | TurbineUserPeer.doUpdate((TurbineUser) this, con); |
980 | } |
|
981 | } |
|
982 | ||
983 | ||
984 | ||
985 | 22 | if (collTurbineUserGroupRoles != null) |
986 | { |
|
987 | 0 | for (int i = 0; i < collTurbineUserGroupRoles.size(); i++) |
988 | { |
|
989 | 0 | ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)).save(con); |
990 | } |
|
991 | } |
|
992 | 22 | alreadyInSave = false; |
993 | } |
|
994 | 22 | } |
995 | ||
996 | ||
997 | /** |
|
998 | * Set the PrimaryKey using ObjectKey. |
|
999 | * |
|
1000 | * @param key userId ObjectKey |
|
1001 | */ |
|
1002 | public void setPrimaryKey(ObjectKey key) |
|
1003 | throws TorqueException |
|
1004 | { |
|
1005 | 4 | setUserId(((NumberKey) key).intValue()); |
1006 | 4 | } |
1007 | ||
1008 | /** |
|
1009 | * Set the PrimaryKey using a String. |
|
1010 | * |
|
1011 | * @param key |
|
1012 | */ |
|
1013 | public void setPrimaryKey(String key) throws TorqueException |
|
1014 | { |
|
1015 | 0 | setUserId(Integer.parseInt(key)); |
1016 | 0 | } |
1017 | ||
1018 | ||
1019 | /** |
|
1020 | * returns an id that differentiates this object from others |
|
1021 | * of its class. |
|
1022 | */ |
|
1023 | public ObjectKey getPrimaryKey() |
|
1024 | { |
|
1025 | 18 | return SimpleKey.keyFor(getUserId()); |
1026 | } |
|
1027 | ||
1028 | ||
1029 | /** |
|
1030 | * Makes a copy of this object. |
|
1031 | * It creates a new object filling in the simple attributes. |
|
1032 | * It then fills all the association collections and sets the |
|
1033 | * related objects to isNew=true. |
|
1034 | */ |
|
1035 | public TurbineUser copy() throws TorqueException |
|
1036 | { |
|
1037 | 0 | return copyInto(new TurbineUser()); |
1038 | } |
|
1039 | ||
1040 | protected TurbineUser copyInto(TurbineUser copyObj) throws TorqueException |
|
1041 | { |
|
1042 | 0 | copyObj.setUserId(userId); |
1043 | 0 | copyObj.setUserName(userName); |
1044 | 0 | copyObj.setPassword(password); |
1045 | 0 | copyObj.setFirstName(firstName); |
1046 | 0 | copyObj.setLastName(lastName); |
1047 | 0 | copyObj.setEmail(email); |
1048 | 0 | copyObj.setConfirmed(confirmed); |
1049 | 0 | copyObj.setModified(modified); |
1050 | 0 | copyObj.setCreateDate(createDate); |
1051 | 0 | copyObj.setLastLogin(lastLogin); |
1052 | 0 | copyObj.setObjectdata(objectdata); |
1053 | ||
1054 | 0 | copyObj.setUserId( 0); |
1055 | ||
1056 | ||
1057 | ||
1058 | 0 | List v = getTurbineUserGroupRoles(); |
1059 | 0 | for (int i = 0; i < v.size(); i++) |
1060 | { |
|
1061 | 0 | TurbineUserGroupRole obj = (TurbineUserGroupRole) v.get(i); |
1062 | 0 | copyObj.addTurbineUserGroupRole(obj.copy()); |
1063 | } |
|
1064 | 0 | return copyObj; |
1065 | } |
|
1066 | ||
1067 | /** |
|
1068 | * returns a peer instance associated with this om. Since Peer classes |
|
1069 | * are not to have any instance attributes, this method returns the |
|
1070 | * same instance for all member of this class. The method could therefore |
|
1071 | * be static, but this would prevent one from overriding the behavior. |
|
1072 | */ |
|
1073 | public TurbineUserPeer getPeer() |
|
1074 | { |
|
1075 | 0 | return peer; |
1076 | } |
|
1077 | ||
1078 | public String toString() |
|
1079 | { |
|
1080 | 0 | StringBuffer str = new StringBuffer(); |
1081 | 0 | str.append("TurbineUser:\n"); |
1082 | 0 | str.append("UserId = ") |
1083 | .append(getUserId()) |
|
1084 | .append("\n"); |
|
1085 | 0 | str.append("UserName = ") |
1086 | .append(getUserName()) |
|
1087 | .append("\n"); |
|
1088 | 0 | str.append("Password = ") |
1089 | .append(getPassword()) |
|
1090 | .append("\n"); |
|
1091 | 0 | str.append("FirstName = ") |
1092 | .append(getFirstName()) |
|
1093 | .append("\n"); |
|
1094 | 0 | str.append("LastName = ") |
1095 | .append(getLastName()) |
|
1096 | .append("\n"); |
|
1097 | 0 | str.append("Email = ") |
1098 | .append(getEmail()) |
|
1099 | .append("\n"); |
|
1100 | 0 | str.append("Confirmed = ") |
1101 | .append(getConfirmed()) |
|
1102 | .append("\n"); |
|
1103 | 0 | str.append("Modified = ") |
1104 | .append(getModified()) |
|
1105 | .append("\n"); |
|
1106 | 0 | str.append("CreateDate = ") |
1107 | .append(getCreateDate()) |
|
1108 | .append("\n"); |
|
1109 | 0 | str.append("LastLogin = ") |
1110 | .append(getLastLogin()) |
|
1111 | .append("\n"); |
|
1112 | 0 | str.append("Objectdata = ") |
1113 | .append("<binary>") |
|
1114 | .append("\n"); |
|
1115 | 0 | return(str.toString()); |
1116 | } |
|
1117 | } |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |