View Javadoc

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