View Javadoc

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