1 package org.apache.jetspeed.om.security.turbine;
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 * [Thu Apr 22 23:12:36 EDT 2004]
29 *
30 * You should not use this class directly. It should not even be
31 * extended all references should be to TurbineUser
32 */
33 public abstract class BaseTurbineUser extends BaseObject
34 {
35 /*** The Peer class */
36 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 loginName field */
44 private String loginName;
45
46 /*** The value for the passwordValue field */
47 private String passwordValue;
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 confirmValue field */
59 private String confirmValue;
60
61 /*** The value for the modified field */
62 private Date modified;
63
64 /*** The value for the created field */
65 private Date created;
66
67 /*** The value for the lastLogin field */
68 private Date lastLogin;
69
70 /*** The value for the disabled field */
71 private String disabled;
72
73 /*** The value for the objectdata field */
74 private byte[] objectdata;
75
76 /*** The value for the passwordChanged field */
77 private Date passwordChanged;
78
79
80 /***
81 * Get the UserId
82 * @return int
83 */
84 public int getUserId()
85 {
86 return userId;
87 }
88
89
90 /***
91 * Set the value of UserId
92 */
93 public void setUserId(int v ) throws TorqueException
94 {
95
96 if (this.userId != v)
97 {
98 this.userId = v;
99 setModified(true);
100 }
101
102
103
104
105 if (collTurbineUserGroupRoles != null )
106 {
107 for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
108 {
109 ((TurbineUserGroupRole)collTurbineUserGroupRoles.get(i))
110 .setUserId(v);
111 }
112 }
113 }
114
115
116 /***
117 * Get the LoginName
118 * @return String
119 */
120 public String getLoginName()
121 {
122 return loginName;
123 }
124
125
126 /***
127 * Set the value of LoginName
128 */
129 public void setLoginName(String v )
130 {
131
132 if (!ObjectUtils.equals(this.loginName, v))
133 {
134 this.loginName = v;
135 setModified(true);
136 }
137
138
139 }
140
141
142 /***
143 * Get the PasswordValue
144 * @return String
145 */
146 public String getPasswordValue()
147 {
148 return passwordValue;
149 }
150
151
152 /***
153 * Set the value of PasswordValue
154 */
155 public void setPasswordValue(String v )
156 {
157
158 if (!ObjectUtils.equals(this.passwordValue, v))
159 {
160 this.passwordValue = v;
161 setModified(true);
162 }
163
164
165 }
166
167
168 /***
169 * Get the FirstName
170 * @return String
171 */
172 public String getFirstName()
173 {
174 return firstName;
175 }
176
177
178 /***
179 * Set the value of FirstName
180 */
181 public void setFirstName(String v )
182 {
183
184 if (!ObjectUtils.equals(this.firstName, v))
185 {
186 this.firstName = v;
187 setModified(true);
188 }
189
190
191 }
192
193
194 /***
195 * Get the LastName
196 * @return String
197 */
198 public String getLastName()
199 {
200 return lastName;
201 }
202
203
204 /***
205 * Set the value of LastName
206 */
207 public void setLastName(String v )
208 {
209
210 if (!ObjectUtils.equals(this.lastName, v))
211 {
212 this.lastName = v;
213 setModified(true);
214 }
215
216
217 }
218
219
220 /***
221 * Get the Email
222 * @return String
223 */
224 public String getEmail()
225 {
226 return email;
227 }
228
229
230 /***
231 * Set the value of Email
232 */
233 public void setEmail(String v )
234 {
235
236 if (!ObjectUtils.equals(this.email, v))
237 {
238 this.email = v;
239 setModified(true);
240 }
241
242
243 }
244
245
246 /***
247 * Get the ConfirmValue
248 * @return String
249 */
250 public String getConfirmValue()
251 {
252 return confirmValue;
253 }
254
255
256 /***
257 * Set the value of ConfirmValue
258 */
259 public void setConfirmValue(String v )
260 {
261
262 if (!ObjectUtils.equals(this.confirmValue, v))
263 {
264 this.confirmValue = v;
265 setModified(true);
266 }
267
268
269 }
270
271
272 /***
273 * Get the Modified
274 * @return Date
275 */
276 public Date getModified()
277 {
278 return modified;
279 }
280
281
282 /***
283 * Set the value of Modified
284 */
285 public void setModified(Date v )
286 {
287
288 if (!ObjectUtils.equals(this.modified, v))
289 {
290 this.modified = v;
291 setModified(true);
292 }
293
294
295 }
296
297
298 /***
299 * Get the Created
300 * @return Date
301 */
302 public Date getCreated()
303 {
304 return created;
305 }
306
307
308 /***
309 * Set the value of Created
310 */
311 public void setCreated(Date v )
312 {
313
314 if (!ObjectUtils.equals(this.created, v))
315 {
316 this.created = v;
317 setModified(true);
318 }
319
320
321 }
322
323
324 /***
325 * Get the LastLogin
326 * @return Date
327 */
328 public Date getLastLogin()
329 {
330 return lastLogin;
331 }
332
333
334 /***
335 * Set the value of LastLogin
336 */
337 public void setLastLogin(Date v )
338 {
339
340 if (!ObjectUtils.equals(this.lastLogin, v))
341 {
342 this.lastLogin = v;
343 setModified(true);
344 }
345
346
347 }
348
349
350 /***
351 * Get the Disabled
352 * @return String
353 */
354 public String getDisabled()
355 {
356 return disabled;
357 }
358
359
360 /***
361 * Set the value of Disabled
362 */
363 public void setDisabled(String v )
364 {
365
366 if (!ObjectUtils.equals(this.disabled, v))
367 {
368 this.disabled = v;
369 setModified(true);
370 }
371
372
373 }
374
375
376 /***
377 * Get the Objectdata
378 * @return byte[]
379 */
380 public byte[] getObjectdata()
381 {
382 return objectdata;
383 }
384
385
386 /***
387 * Set the value of Objectdata
388 */
389 public void setObjectdata(byte[] v )
390 {
391
392 if (!ObjectUtils.equals(this.objectdata, v))
393 {
394 this.objectdata = v;
395 setModified(true);
396 }
397
398
399 }
400
401
402 /***
403 * Get the PasswordChanged
404 * @return Date
405 */
406 public Date getPasswordChanged()
407 {
408 return passwordChanged;
409 }
410
411
412 /***
413 * Set the value of PasswordChanged
414 */
415 public void setPasswordChanged(Date v )
416 {
417
418 if (!ObjectUtils.equals(this.passwordChanged, v))
419 {
420 this.passwordChanged = v;
421 setModified(true);
422 }
423
424
425 }
426
427
428
429
430
431 /***
432 * Collection to store aggregation of collTurbineUserGroupRoles
433 */
434 protected List collTurbineUserGroupRoles;
435
436 /***
437 * Temporary storage of collTurbineUserGroupRoles to save a possible db hit in
438 * the event objects are add to the collection, but the
439 * complete collection is never requested.
440 */
441 protected void initTurbineUserGroupRoles()
442 {
443 if (collTurbineUserGroupRoles == null)
444 {
445 collTurbineUserGroupRoles = new ArrayList();
446 }
447 }
448
449
450 /***
451 * Method called to associate a TurbineUserGroupRole object to this object
452 * through the TurbineUserGroupRole foreign key attribute
453 *
454 * @param TurbineUserGroupRole l
455 */
456 public void addTurbineUserGroupRole(TurbineUserGroupRole l) throws TorqueException
457 {
458 getTurbineUserGroupRoles().add(l);
459 l.setTurbineUser((TurbineUser)this);
460 }
461
462 /***
463 * The criteria used to select the current contents of collTurbineUserGroupRoles
464 */
465 private Criteria lastTurbineUserGroupRolesCriteria = null;
466
467 /***
468 * If this collection has already been initialized, returns
469 * the collection. Otherwise returns the results of
470 * getTurbineUserGroupRoles(new Criteria())
471 */
472 public List getTurbineUserGroupRoles() throws TorqueException
473 {
474 if (collTurbineUserGroupRoles == null)
475 {
476 collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10));
477 }
478 return collTurbineUserGroupRoles;
479 }
480
481 /***
482 * If this collection has already been initialized with
483 * an identical criteria, it returns the collection.
484 * Otherwise if this TurbineUser has previously
485 * been saved, it will retrieve related TurbineUserGroupRoles from storage.
486 * If this TurbineUser is new, it will return
487 * an empty collection or the current collection, the criteria
488 * is ignored on a new object.
489 */
490 public List getTurbineUserGroupRoles(Criteria criteria) throws TorqueException
491 {
492 if (collTurbineUserGroupRoles == null)
493 {
494 if (isNew())
495 {
496 collTurbineUserGroupRoles = new ArrayList();
497 }
498 else
499 {
500 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
501 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
502 }
503 }
504 else
505 {
506
507 if (!isNew())
508 {
509
510
511
512 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
513 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
514 {
515 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
516 }
517 }
518 }
519 lastTurbineUserGroupRolesCriteria = criteria;
520
521 return collTurbineUserGroupRoles;
522 }
523
524 /***
525 * If this collection has already been initialized, returns
526 * the collection. Otherwise returns the results of
527 * getTurbineUserGroupRoles(new Criteria(),Connection)
528 * This method takes in the Connection also as input so that
529 * referenced objects can also be obtained using a Connection
530 * that is taken as input
531 */
532 public List getTurbineUserGroupRoles(Connection con) throws TorqueException
533 {
534 if (collTurbineUserGroupRoles == null)
535 {
536 collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10),con);
537 }
538 return collTurbineUserGroupRoles;
539 }
540
541 /***
542 * If this collection has already been initialized with
543 * an identical criteria, it returns the collection.
544 * Otherwise if this TurbineUser has previously
545 * been saved, it will retrieve related TurbineUserGroupRoles from storage.
546 * If this TurbineUser is new, it will return
547 * an empty collection or the current collection, the criteria
548 * is ignored on a new object.
549 * This method takes in the Connection also as input so that
550 * referenced objects can also be obtained using a Connection
551 * that is taken as input
552 */
553 public List getTurbineUserGroupRoles(Criteria criteria,Connection con) throws TorqueException
554 {
555 if (collTurbineUserGroupRoles == null)
556 {
557 if (isNew())
558 {
559 collTurbineUserGroupRoles = new ArrayList();
560 }
561 else
562 {
563 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
564 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria,con);
565 }
566 }
567 else
568 {
569
570 if (!isNew())
571 {
572
573
574
575 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
576 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
577 {
578 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria,con);
579 }
580 }
581 }
582 lastTurbineUserGroupRolesCriteria = criteria;
583
584 return collTurbineUserGroupRoles;
585 }
586
587
588
589
590
591
592
593
594
595
596
597
598 /***
599 * If this collection has already been initialized with
600 * an identical criteria, it returns the collection.
601 * Otherwise if this TurbineUser is new, it will return
602 * an empty collection; or if this TurbineUser has previously
603 * been saved, it will retrieve related TurbineUserGroupRoles from storage.
604 *
605 * This method is protected by default in order to keep the public
606 * api reasonable. You can provide public methods for those you
607 * actually need in TurbineUser.
608 */
609 protected List getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria)
610 throws TorqueException
611 {
612 if (collTurbineUserGroupRoles == null)
613 {
614 if (isNew())
615 {
616 collTurbineUserGroupRoles = new ArrayList();
617 }
618 else
619 {
620 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
621 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
622 }
623 }
624 else
625 {
626
627
628
629 boolean newCriteria = true;
630 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
631 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
632 {
633 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
634 }
635 }
636 lastTurbineUserGroupRolesCriteria = criteria;
637
638 return collTurbineUserGroupRoles;
639 }
640
641
642
643
644
645
646
647
648
649 /***
650 * If this collection has already been initialized with
651 * an identical criteria, it returns the collection.
652 * Otherwise if this TurbineUser is new, it will return
653 * an empty collection; or if this TurbineUser has previously
654 * been saved, it will retrieve related TurbineUserGroupRoles from storage.
655 *
656 * This method is protected by default in order to keep the public
657 * api reasonable. You can provide public methods for those you
658 * actually need in TurbineUser.
659 */
660 protected List getTurbineUserGroupRolesJoinTurbineGroup(Criteria criteria)
661 throws TorqueException
662 {
663 if (collTurbineUserGroupRoles == null)
664 {
665 if (isNew())
666 {
667 collTurbineUserGroupRoles = new ArrayList();
668 }
669 else
670 {
671 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
672 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
673 }
674 }
675 else
676 {
677
678
679
680 boolean newCriteria = true;
681 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
682 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
683 {
684 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
685 }
686 }
687 lastTurbineUserGroupRolesCriteria = criteria;
688
689 return collTurbineUserGroupRoles;
690 }
691
692
693
694
695
696
697
698
699
700 /***
701 * If this collection has already been initialized with
702 * an identical criteria, it returns the collection.
703 * Otherwise if this TurbineUser is new, it will return
704 * an empty collection; or if this TurbineUser has previously
705 * been saved, it will retrieve related TurbineUserGroupRoles from storage.
706 *
707 * This method is protected by default in order to keep the public
708 * api reasonable. You can provide public methods for those you
709 * actually need in TurbineUser.
710 */
711 protected List getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria)
712 throws TorqueException
713 {
714 if (collTurbineUserGroupRoles == null)
715 {
716 if (isNew())
717 {
718 collTurbineUserGroupRoles = new ArrayList();
719 }
720 else
721 {
722 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
723 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
724 }
725 }
726 else
727 {
728
729
730
731 boolean newCriteria = true;
732 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
733 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
734 {
735 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
736 }
737 }
738 lastTurbineUserGroupRolesCriteria = criteria;
739
740 return collTurbineUserGroupRoles;
741 }
742
743
744
745
746 private static List fieldNames = null;
747
748 /***
749 * Generate a list of field names.
750 */
751 public static synchronized List getFieldNames()
752 {
753 if (fieldNames == null)
754 {
755 fieldNames = new ArrayList();
756 fieldNames.add("UserId");
757 fieldNames.add("LoginName");
758 fieldNames.add("PasswordValue");
759 fieldNames.add("FirstName");
760 fieldNames.add("LastName");
761 fieldNames.add("Email");
762 fieldNames.add("ConfirmValue");
763 fieldNames.add("Modified");
764 fieldNames.add("Created");
765 fieldNames.add("LastLogin");
766 fieldNames.add("Disabled");
767 fieldNames.add("Objectdata");
768 fieldNames.add("PasswordChanged");
769 fieldNames = Collections.unmodifiableList(fieldNames);
770 }
771 return fieldNames;
772 }
773
774 /***
775 * Retrieves a field from the object by name passed in
776 * as a String.
777 */
778 public Object getByName(String name)
779 {
780 if (name.equals("UserId"))
781 {
782 return new Integer(getUserId());
783 }
784 if (name.equals("LoginName"))
785 {
786 return getLoginName();
787 }
788 if (name.equals("PasswordValue"))
789 {
790 return getPasswordValue();
791 }
792 if (name.equals("FirstName"))
793 {
794 return getFirstName();
795 }
796 if (name.equals("LastName"))
797 {
798 return getLastName();
799 }
800 if (name.equals("Email"))
801 {
802 return getEmail();
803 }
804 if (name.equals("ConfirmValue"))
805 {
806 return getConfirmValue();
807 }
808 if (name.equals("Modified"))
809 {
810 return getModified();
811 }
812 if (name.equals("Created"))
813 {
814 return getCreated();
815 }
816 if (name.equals("LastLogin"))
817 {
818 return getLastLogin();
819 }
820 if (name.equals("Disabled"))
821 {
822 return getDisabled();
823 }
824 if (name.equals("Objectdata"))
825 {
826 return getObjectdata();
827 }
828 if (name.equals("PasswordChanged"))
829 {
830 return getPasswordChanged();
831 }
832 return null;
833 }
834
835 /***
836 * Retrieves a field from the object by name passed in
837 * as a String. The String must be one of the static
838 * Strings defined in this Class' Peer.
839 */
840 public Object getByPeerName(String name)
841 {
842 if (name.equals(TurbineUserPeer.USER_ID ))
843 {
844 return new Integer(getUserId());
845 }
846 if (name.equals(TurbineUserPeer.LOGIN_NAME ))
847 {
848 return getLoginName();
849 }
850 if (name.equals(TurbineUserPeer.PASSWORD_VALUE ))
851 {
852 return getPasswordValue();
853 }
854 if (name.equals(TurbineUserPeer.FIRST_NAME ))
855 {
856 return getFirstName();
857 }
858 if (name.equals(TurbineUserPeer.LAST_NAME ))
859 {
860 return getLastName();
861 }
862 if (name.equals(TurbineUserPeer.EMAIL ))
863 {
864 return getEmail();
865 }
866 if (name.equals(TurbineUserPeer.CONFIRM_VALUE ))
867 {
868 return getConfirmValue();
869 }
870 if (name.equals(TurbineUserPeer.MODIFIED ))
871 {
872 return getModified();
873 }
874 if (name.equals(TurbineUserPeer.CREATED ))
875 {
876 return getCreated();
877 }
878 if (name.equals(TurbineUserPeer.LAST_LOGIN ))
879 {
880 return getLastLogin();
881 }
882 if (name.equals(TurbineUserPeer.DISABLED ))
883 {
884 return getDisabled();
885 }
886 if (name.equals(TurbineUserPeer.OBJECTDATA ))
887 {
888 return getObjectdata();
889 }
890 if (name.equals(TurbineUserPeer.PASSWORD_CHANGED ))
891 {
892 return getPasswordChanged();
893 }
894 return null;
895 }
896
897 /***
898 * Retrieves a field from the object by Position as specified
899 * in the xml schema. Zero-based.
900 */
901 public Object getByPosition(int pos)
902 {
903 if ( pos == 0 )
904 {
905 return new Integer(getUserId());
906 }
907 if ( pos == 1 )
908 {
909 return getLoginName();
910 }
911 if ( pos == 2 )
912 {
913 return getPasswordValue();
914 }
915 if ( pos == 3 )
916 {
917 return getFirstName();
918 }
919 if ( pos == 4 )
920 {
921 return getLastName();
922 }
923 if ( pos == 5 )
924 {
925 return getEmail();
926 }
927 if ( pos == 6 )
928 {
929 return getConfirmValue();
930 }
931 if ( pos == 7 )
932 {
933 return getModified();
934 }
935 if ( pos == 8 )
936 {
937 return getCreated();
938 }
939 if ( pos == 9 )
940 {
941 return getLastLogin();
942 }
943 if ( pos == 10 )
944 {
945 return getDisabled();
946 }
947 if ( pos == 11 )
948 {
949 return getObjectdata();
950 }
951 if ( pos == 12 )
952 {
953 return getPasswordChanged();
954 }
955 return null;
956 }
957
958 /***
959 * Stores the object in the database. If the object is new,
960 * it inserts it; otherwise an update is performed.
961 */
962 public void save() throws Exception
963 {
964 save(TurbineUserPeer.getMapBuilder()
965 .getDatabaseMap().getName());
966 }
967
968 /***
969 * Stores the object in the database. If the object is new,
970 * it inserts it; otherwise an update is performed.
971 * Note: this code is here because the method body is
972 * auto-generated conditionally and therefore needs to be
973 * in this file instead of in the super class, BaseObject.
974 */
975 public void save(String dbName) throws TorqueException
976 {
977 Connection con = null;
978 try
979 {
980 con = Transaction.begin(dbName);
981 save(con);
982 Transaction.commit(con);
983 }
984 catch(TorqueException e)
985 {
986 Transaction.safeRollback(con);
987 throw e;
988 }
989 }
990
991 /*** flag to prevent endless save loop, if this object is referenced
992 by another object which falls in this transaction. */
993 private boolean alreadyInSave = false;
994 /***
995 * Stores the object in the database. If the object is new,
996 * it inserts it; otherwise an update is performed. This method
997 * is meant to be used as part of a transaction, otherwise use
998 * the save() method and the connection details will be handled
999 * internally
1000 */
1001 public void save(Connection con) throws TorqueException
1002 {
1003 if (!alreadyInSave)
1004 {
1005 alreadyInSave = true;
1006
1007
1008
1009
1010 if (isModified())
1011 {
1012 if (isNew())
1013 {
1014 TurbineUserPeer.doInsert((TurbineUser)this, con);
1015 setNew(false);
1016 }
1017 else
1018 {
1019 TurbineUserPeer.doUpdate((TurbineUser)this, con);
1020 }
1021
1022 if (isCacheOnSave())
1023 {
1024 TurbineUserManager.putInstance(this);
1025 }
1026 }
1027
1028
1029 if (collTurbineUserGroupRoles != null )
1030 {
1031 for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
1032 {
1033 ((TurbineUserGroupRole)collTurbineUserGroupRoles.get(i)).save(con);
1034 }
1035 }
1036 alreadyInSave = false;
1037 }
1038 }
1039
1040 /***
1041 * Specify whether to cache the object after saving to the db.
1042 * This method returns false
1043 */
1044 protected boolean isCacheOnSave()
1045 {
1046 return true;
1047 }
1048
1049
1050 /***
1051 * Set the PrimaryKey using ObjectKey.
1052 *
1053 * @param ObjectKey userId
1054 */
1055 public void setPrimaryKey(ObjectKey userId)
1056 throws TorqueException {
1057 setUserId(((NumberKey)userId).intValue());
1058 }
1059
1060 /***
1061 * Set the PrimaryKey using a String.
1062 */
1063 public void setPrimaryKey(String key) throws TorqueException
1064 {
1065 setUserId(Integer.parseInt(key));
1066 }
1067
1068
1069 /***
1070 * returns an id that differentiates this object from others
1071 * of its class.
1072 */
1073 public ObjectKey getPrimaryKey()
1074 {
1075 return SimpleKey.keyFor(getUserId());
1076 }
1077
1078
1079 /***
1080 * Makes a copy of this object.
1081 * It creates a new object filling in the simple attributes.
1082 * It then fills all the association collections.
1083 */
1084 public TurbineUser copy() throws TorqueException
1085 {
1086 TurbineUser copyObj = new TurbineUser();
1087 copyObj.setUserId(userId);
1088 copyObj.setLoginName(loginName);
1089 copyObj.setPasswordValue(passwordValue);
1090 copyObj.setFirstName(firstName);
1091 copyObj.setLastName(lastName);
1092 copyObj.setEmail(email);
1093 copyObj.setConfirmValue(confirmValue);
1094 copyObj.setModified(modified);
1095 copyObj.setCreated(created);
1096 copyObj.setLastLogin(lastLogin);
1097 copyObj.setDisabled(disabled);
1098 copyObj.setObjectdata(objectdata);
1099 copyObj.setPasswordChanged(passwordChanged);
1100
1101 copyObj.setUserId(0);
1102
1103
1104
1105 List v = getTurbineUserGroupRoles();
1106 for (int i = 0; i < v.size(); i++)
1107 {
1108 TurbineUserGroupRole obj = (TurbineUserGroupRole) v.get(i);
1109 copyObj.addTurbineUserGroupRole(obj.copy());
1110 }
1111 return copyObj;
1112 }
1113
1114 /***
1115 * returns a peer instance associated with this om. Since Peer classes
1116 * are not to have any instance attributes, this method returns the
1117 * same instance for all member of this class. The method could therefore
1118 * be static, but this would prevent one from overriding the behavior.
1119 */
1120 public TurbineUserPeer getPeer()
1121 {
1122 return peer;
1123 }
1124 }