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   * 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  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 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          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                    if (this.userId != v)
94                {
95              this.userId = v;
96              setModified(true);
97          }
98      
99            
100                                   
101                   // update associated TurbineUserGroupRole
102         if (collTurbineUserGroupRoles != null)
103         {
104             for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
105             {
106                 ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i))
107                     .setUserId(v);
108             }
109         }
110                                 }
111   
112     /***
113      * Get the UserName
114      *
115      * @return String
116      */
117     public String getUserName()
118     {
119         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                   if (!ObjectUtils.equals(this.userName, v))
132               {
133             this.userName = v;
134             setModified(true);
135         }
136     
137           
138               }
139   
140     /***
141      * Get the Password
142      *
143      * @return String
144      */
145     public String getPassword()
146     {
147         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                   if (!ObjectUtils.equals(this.password, v))
160               {
161             this.password = v;
162             setModified(true);
163         }
164     
165           
166               }
167   
168     /***
169      * Get the FirstName
170      *
171      * @return String
172      */
173     public String getFirstName()
174     {
175         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                   if (!ObjectUtils.equals(this.firstName, v))
188               {
189             this.firstName = v;
190             setModified(true);
191         }
192     
193           
194               }
195   
196     /***
197      * Get the LastName
198      *
199      * @return String
200      */
201     public String getLastName()
202     {
203         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                   if (!ObjectUtils.equals(this.lastName, v))
216               {
217             this.lastName = v;
218             setModified(true);
219         }
220     
221           
222               }
223   
224     /***
225      * Get the Email
226      *
227      * @return String
228      */
229     public String getEmail()
230     {
231         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                   if (!ObjectUtils.equals(this.email, v))
244               {
245             this.email = v;
246             setModified(true);
247         }
248     
249           
250               }
251   
252     /***
253      * Get the Confirmed
254      *
255      * @return String
256      */
257     public String getConfirmed()
258     {
259         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                   if (!ObjectUtils.equals(this.confirmed, v))
272               {
273             this.confirmed = v;
274             setModified(true);
275         }
276     
277           
278               }
279   
280     /***
281      * Get the Modified
282      *
283      * @return Date
284      */
285     public Date getModified()
286     {
287         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                   if (!ObjectUtils.equals(this.modified, v))
300               {
301             this.modified = v;
302             setModified(true);
303         }
304     
305           
306               }
307   
308     /***
309      * Get the CreateDate
310      *
311      * @return Date
312      */
313     public Date getCreateDate()
314     {
315         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                   if (!ObjectUtils.equals(this.createDate, v))
328               {
329             this.createDate = v;
330             setModified(true);
331         }
332     
333           
334               }
335   
336     /***
337      * Get the LastLogin
338      *
339      * @return Date
340      */
341     public Date getLastLogin()
342     {
343         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                   if (!ObjectUtils.equals(this.lastLogin, v))
356               {
357             this.lastLogin = v;
358             setModified(true);
359         }
360     
361           
362               }
363   
364     /***
365      * Get the Objectdata
366      *
367      * @return byte[]
368      */
369     public byte[] getObjectdata()
370     {
371         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                   if (!ObjectUtils.equals(this.objectdata, v))
384               {
385             this.objectdata = v;
386             setModified(true);
387         }
388     
389           
390               }
391   
392          
393                                 
394             
395           /***
396      * Collection to store aggregation of collTurbineUserGroupRoles
397      */
398     protected List collTurbineUserGroupRoles;
399 
400     /***
401      * Temporary storage of collTurbineUserGroupRoles to save a possible db hit in
402      * the event objects are add to the collection, but the
403      * complete collection is never requested.
404      */
405     protected void initTurbineUserGroupRoles()
406     {
407         if (collTurbineUserGroupRoles == null)
408         {
409             collTurbineUserGroupRoles = new ArrayList();
410         }
411     }
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         getTurbineUserGroupRoles().add(l);
423         l.setTurbineUser((TurbineUser) this);
424     }
425 
426     /***
427      * The criteria used to select the current contents of collTurbineUserGroupRoles
428      */
429     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               if (collTurbineUserGroupRoles == null)
441         {
442             collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10));
443         }
444         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               if (collTurbineUserGroupRoles == null)
461         {
462             if (isNew())
463             {
464                collTurbineUserGroupRoles = new ArrayList();
465             }
466             else
467             {
468                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
469                         collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
470             }
471         }
472         else
473         {
474             // criteria has no effect for a new object
475             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                             criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
481                             if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
482                 {
483                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
484                 }
485             }
486         }
487         lastTurbineUserGroupRolesCriteria = criteria;
488 
489         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               if (collTurbineUserGroupRoles == null)
503         {
504             collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10), con);
505         }
506         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               if (collTurbineUserGroupRoles == null)
525         {
526             if (isNew())
527             {
528                collTurbineUserGroupRoles = new ArrayList();
529             }
530             else
531             {
532                          criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
533                          collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
534              }
535          }
536          else
537          {
538              // criteria has no effect for a new object
539              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                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
545                              if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
546                  {
547                      collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
548                  }
549              }
550          }
551          lastTurbineUserGroupRolesCriteria = criteria;
552 
553          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                     if (collTurbineUserGroupRoles == null)
581         {
582             if (isNew())
583             {
584                collTurbineUserGroupRoles = new ArrayList();
585             }
586             else
587             {
588                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
589                               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                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
599                                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
600             {
601                 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
602             }
603         }
604         lastTurbineUserGroupRolesCriteria = criteria;
605 
606         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                     if (collTurbineUserGroupRoles == null)
632         {
633             if (isNew())
634             {
635                collTurbineUserGroupRoles = new ArrayList();
636             }
637             else
638             {
639                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
640                               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                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
650                                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
651             {
652                 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
653             }
654         }
655         lastTurbineUserGroupRolesCriteria = criteria;
656 
657         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                     if (collTurbineUserGroupRoles == null)
683         {
684             if (isNew())
685             {
686                collTurbineUserGroupRoles = new ArrayList();
687             }
688             else
689             {
690                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
691                               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                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
701                                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
702             {
703                 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
704             }
705         }
706         lastTurbineUserGroupRolesCriteria = criteria;
707 
708         return collTurbineUserGroupRoles;
709                 }
710                             
711 
712 
713           
714     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         if (fieldNames == null)
724         {
725             fieldNames = new ArrayList();
726               fieldNames.add("UserId");
727               fieldNames.add("UserName");
728               fieldNames.add("Password");
729               fieldNames.add("FirstName");
730               fieldNames.add("LastName");
731               fieldNames.add("Email");
732               fieldNames.add("Confirmed");
733               fieldNames.add("Modified");
734               fieldNames.add("CreateDate");
735               fieldNames.add("LastLogin");
736               fieldNames.add("Objectdata");
737               fieldNames = Collections.unmodifiableList(fieldNames);
738         }
739         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           if (name.equals("UserId"))
751         {
752                 return new Integer(getUserId());
753             }
754           if (name.equals("UserName"))
755         {
756                 return getUserName();
757             }
758           if (name.equals("Password"))
759         {
760                 return getPassword();
761             }
762           if (name.equals("FirstName"))
763         {
764                 return getFirstName();
765             }
766           if (name.equals("LastName"))
767         {
768                 return getLastName();
769             }
770           if (name.equals("Email"))
771         {
772                 return getEmail();
773             }
774           if (name.equals("Confirmed"))
775         {
776                 return getConfirmed();
777             }
778           if (name.equals("Modified"))
779         {
780                 return getModified();
781             }
782           if (name.equals("CreateDate"))
783         {
784                 return getCreateDate();
785             }
786           if (name.equals("LastLogin"))
787         {
788                 return getLastLogin();
789             }
790           if (name.equals("Objectdata"))
791         {
792                 return getObjectdata();
793             }
794           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           if (name.equals(TurbineUserPeer.USER_ID))
808         {
809                 return new Integer(getUserId());
810             }
811           if (name.equals(TurbineUserPeer.LOGIN_NAME))
812         {
813                 return getUserName();
814             }
815           if (name.equals(TurbineUserPeer.PASSWORD_VALUE))
816         {
817                 return getPassword();
818             }
819           if (name.equals(TurbineUserPeer.FIRST_NAME))
820         {
821                 return getFirstName();
822             }
823           if (name.equals(TurbineUserPeer.LAST_NAME))
824         {
825                 return getLastName();
826             }
827           if (name.equals(TurbineUserPeer.EMAIL))
828         {
829                 return getEmail();
830             }
831           if (name.equals(TurbineUserPeer.CONFIRM_VALUE))
832         {
833                 return getConfirmed();
834             }
835           if (name.equals(TurbineUserPeer.MODIFIED))
836         {
837                 return getModified();
838             }
839           if (name.equals(TurbineUserPeer.CREATED))
840         {
841                 return getCreateDate();
842             }
843           if (name.equals(TurbineUserPeer.LAST_LOGIN))
844         {
845                 return getLastLogin();
846             }
847           if (name.equals(TurbineUserPeer.OBJECTDATA))
848         {
849                 return getObjectdata();
850             }
851           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             if (pos == 0)
864         {
865                 return new Integer(getUserId());
866             }
867               if (pos == 1)
868         {
869                 return getUserName();
870             }
871               if (pos == 2)
872         {
873                 return getPassword();
874             }
875               if (pos == 3)
876         {
877                 return getFirstName();
878             }
879               if (pos == 4)
880         {
881                 return getLastName();
882             }
883               if (pos == 5)
884         {
885                 return getEmail();
886             }
887               if (pos == 6)
888         {
889                 return getConfirmed();
890             }
891               if (pos == 7)
892         {
893                 return getModified();
894             }
895               if (pos == 8)
896         {
897                 return getCreateDate();
898             }
899               if (pos == 9)
900         {
901                 return getLastLogin();
902             }
903               if (pos == 10)
904         {
905                 return getObjectdata();
906             }
907               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           save(TurbineUserPeer.getMapBuilder()
919                 .getDatabaseMap().getName());
920       }
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         Connection con = null;
935           try
936         {
937             con = Transaction.begin(dbName);
938             save(con);
939             Transaction.commit(con);
940         }
941         catch(TorqueException e)
942         {
943             Transaction.safeRollback(con);
944             throw e;
945         }
946       }
947 
948       /*** flag to prevent endless save loop, if this object is referenced
949         by another object which falls in this transaction. */
950     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           if (!alreadyInSave)
964         {
965             alreadyInSave = true;
966 
967 
968   
969             // If this object has been modified, then save it to the database.
970             if (isModified())
971             {
972                 if (isNew())
973                 {
974                     TurbineUserPeer.doInsert((TurbineUser) this, con);
975                     setNew(false);
976                 }
977                 else
978                 {
979                     TurbineUserPeer.doUpdate((TurbineUser) this, con);
980                 }
981             }
982 
983                                       
984                 
985                     if (collTurbineUserGroupRoles != null)
986             {
987                 for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
988                 {
989                     ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)).save(con);
990                 }
991             }
992                                   alreadyInSave = false;
993         }
994       }
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             setUserId(((NumberKey) key).intValue());
1006         }
1007 
1008     /***
1009      * Set the PrimaryKey using a String.
1010      *
1011      * @param key
1012      */
1013     public void setPrimaryKey(String key) throws TorqueException
1014     {
1015             setUserId(Integer.parseInt(key));
1016         }
1017 
1018   
1019     /***
1020      * returns an id that differentiates this object from others
1021      * of its class.
1022      */
1023     public ObjectKey getPrimaryKey()
1024     {
1025           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         return copyInto(new TurbineUser());
1038     }
1039   
1040     protected TurbineUser copyInto(TurbineUser copyObj) throws TorqueException
1041     {
1042           copyObj.setUserId(userId);
1043           copyObj.setUserName(userName);
1044           copyObj.setPassword(password);
1045           copyObj.setFirstName(firstName);
1046           copyObj.setLastName(lastName);
1047           copyObj.setEmail(email);
1048           copyObj.setConfirmed(confirmed);
1049           copyObj.setModified(modified);
1050           copyObj.setCreateDate(createDate);
1051           copyObj.setLastLogin(lastLogin);
1052           copyObj.setObjectdata(objectdata);
1053   
1054                             copyObj.setUserId( 0);
1055                                                                         
1056                                       
1057                             
1058         List v = getTurbineUserGroupRoles();
1059         for (int i = 0; i < v.size(); i++)
1060         {
1061             TurbineUserGroupRole obj = (TurbineUserGroupRole) v.get(i);
1062             copyObj.addTurbineUserGroupRole(obj.copy());
1063         }
1064                             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         return peer;
1076     }
1077 
1078     public String toString()
1079     {
1080         StringBuffer str = new StringBuffer();
1081         str.append("TurbineUser:\n");
1082         str.append("UserId = ")
1083                .append(getUserId())
1084              .append("\n");
1085         str.append("UserName = ")
1086                .append(getUserName())
1087              .append("\n");
1088         str.append("Password = ")
1089                .append(getPassword())
1090              .append("\n");
1091         str.append("FirstName = ")
1092                .append(getFirstName())
1093              .append("\n");
1094         str.append("LastName = ")
1095                .append(getLastName())
1096              .append("\n");
1097         str.append("Email = ")
1098                .append(getEmail())
1099              .append("\n");
1100         str.append("Confirmed = ")
1101                .append(getConfirmed())
1102              .append("\n");
1103         str.append("Modified = ")
1104                .append(getModified())
1105              .append("\n");
1106         str.append("CreateDate = ")
1107                .append(getCreateDate())
1108              .append("\n");
1109         str.append("LastLogin = ")
1110                .append(getLastLogin())
1111              .append("\n");
1112         str.append("Objectdata = ")
1113                .append("<binary>")
1114              .append("\n");
1115         return(str.toString());
1116     }
1117 }