KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > campware > cream > om > BaseTurbineUser


1 package org.campware.cream.om;
2
3
4 import java.math.BigDecimal JavaDoc;
5 import java.sql.Connection JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.Collections JavaDoc;
8 import java.util.Date JavaDoc;
9 import java.util.List JavaDoc;
10
11 import org.apache.commons.lang.ObjectUtils;
12 import org.apache.turbine.om.Retrievable;
13 import org.apache.torque.TorqueException;
14 import org.apache.torque.om.BaseObject;
15 import org.apache.torque.om.ComboKey;
16 import org.apache.torque.om.DateKey;
17 import org.apache.torque.om.NumberKey;
18 import org.apache.torque.om.ObjectKey;
19 import org.apache.torque.om.SimpleKey;
20 import org.apache.torque.om.StringKey;
21 import org.apache.torque.om.Persistent;
22 import org.apache.torque.util.Criteria;
23 import org.apache.torque.util.Transaction;
24
25
26 /**
27  * This class was autogenerated by Torque on:
28  *
29  * [Wed May 04 09:10:56 CEST 2005]
30  *
31  * You should not use this class directly. It should not even be
32  * extended all references should be to TurbineUser
33  */

34 public abstract class BaseTurbineUser extends BaseObject
35     implements org.apache.turbine.om.Retrievable
36 {
37     /** The Peer class */
38     private static final TurbineUserPeer peer =
39         new TurbineUserPeer();
40
41         
42     /** The value for the userId field */
43     private int userId;
44       
45     /** The value for the userName field */
46     private String JavaDoc userName;
47       
48     /** The value for the password field */
49     private String JavaDoc password;
50       
51     /** The value for the firstName field */
52     private String JavaDoc firstName;
53       
54     /** The value for the lastName field */
55     private String JavaDoc lastName;
56       
57     /** The value for the email field */
58     private String JavaDoc email;
59       
60     /** The value for the confirmed field */
61     private String JavaDoc confirmed;
62       
63     /** The value for the modified field */
64     private Date JavaDoc modified;
65       
66     /** The value for the createDate field */
67     private Date JavaDoc createDate;
68       
69     /** The value for the lastLogin field */
70     private Date JavaDoc lastLogin;
71       
72     /** The value for the objectdata field */
73     private byte[] objectdata;
74   
75     
76     /**
77      * Get the UserId
78      *
79      * @return int
80      */

81     public int getUserId()
82     {
83         return userId;
84     }
85
86                                               
87     /**
88      * Set the value of UserId
89      *
90      * @param v new value
91      */

92     public void setUserId(int v) throws TorqueException
93     {
94     
95                   if (this.userId != v)
96               {
97             this.userId = v;
98             setModified(true);
99         }
100     
101           
102                                   
103                   // update associated TurbineUserGroupRole
104
if (collTurbineUserGroupRoles != null)
105         {
106             for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
107             {
108                 ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i))
109                     .setUserId(v);
110             }
111         }
112                                 }
113   
114     /**
115      * Get the UserName
116      *
117      * @return String
118      */

119     public String JavaDoc getUserName()
120     {
121         return userName;
122     }
123
124                         
125     /**
126      * Set the value of UserName
127      *
128      * @param v new value
129      */

130     public void setUserName(String JavaDoc v)
131     {
132     
133                   if (!ObjectUtils.equals(this.userName, v))
134               {
135             this.userName = v;
136             setModified(true);
137         }
138     
139           
140               }
141   
142     /**
143      * Get the Password
144      *
145      * @return String
146      */

147     public String JavaDoc getPassword()
148     {
149         return password;
150     }
151
152                         
153     /**
154      * Set the value of Password
155      *
156      * @param v new value
157      */

158     public void setPassword(String JavaDoc v)
159     {
160     
161                   if (!ObjectUtils.equals(this.password, v))
162               {
163             this.password = v;
164             setModified(true);
165         }
166     
167           
168               }
169   
170     /**
171      * Get the FirstName
172      *
173      * @return String
174      */

175     public String JavaDoc getFirstName()
176     {
177         return firstName;
178     }
179
180                         
181     /**
182      * Set the value of FirstName
183      *
184      * @param v new value
185      */

186     public void setFirstName(String JavaDoc v)
187     {
188     
189                   if (!ObjectUtils.equals(this.firstName, v))
190               {
191             this.firstName = v;
192             setModified(true);
193         }
194     
195           
196               }
197   
198     /**
199      * Get the LastName
200      *
201      * @return String
202      */

203     public String JavaDoc getLastName()
204     {
205         return lastName;
206     }
207
208                         
209     /**
210      * Set the value of LastName
211      *
212      * @param v new value
213      */

214     public void setLastName(String JavaDoc v)
215     {
216     
217                   if (!ObjectUtils.equals(this.lastName, v))
218               {
219             this.lastName = v;
220             setModified(true);
221         }
222     
223           
224               }
225   
226     /**
227      * Get the Email
228      *
229      * @return String
230      */

231     public String JavaDoc getEmail()
232     {
233         return email;
234     }
235
236                         
237     /**
238      * Set the value of Email
239      *
240      * @param v new value
241      */

242     public void setEmail(String JavaDoc v)
243     {
244     
245                   if (!ObjectUtils.equals(this.email, v))
246               {
247             this.email = v;
248             setModified(true);
249         }
250     
251           
252               }
253   
254     /**
255      * Get the Confirmed
256      *
257      * @return String
258      */

259     public String JavaDoc getConfirmed()
260     {
261         return confirmed;
262     }
263
264                         
265     /**
266      * Set the value of Confirmed
267      *
268      * @param v new value
269      */

270     public void setConfirmed(String JavaDoc v)
271     {
272     
273                   if (!ObjectUtils.equals(this.confirmed, v))
274               {
275             this.confirmed = v;
276             setModified(true);
277         }
278     
279           
280               }
281   
282     /**
283      * Get the Modified
284      *
285      * @return Date
286      */

287     public Date JavaDoc getModified()
288     {
289         return modified;
290     }
291
292                         
293     /**
294      * Set the value of Modified
295      *
296      * @param v new value
297      */

298     public void setModified(Date JavaDoc v)
299     {
300     
301                   if (!ObjectUtils.equals(this.modified, v))
302               {
303             this.modified = v;
304             setModified(true);
305         }
306     
307           
308               }
309   
310     /**
311      * Get the CreateDate
312      *
313      * @return Date
314      */

315     public Date JavaDoc getCreateDate()
316     {
317         return createDate;
318     }
319
320                         
321     /**
322      * Set the value of CreateDate
323      *
324      * @param v new value
325      */

326     public void setCreateDate(Date JavaDoc v)
327     {
328     
329                   if (!ObjectUtils.equals(this.createDate, v))
330               {
331             this.createDate = v;
332             setModified(true);
333         }
334     
335           
336               }
337   
338     /**
339      * Get the LastLogin
340      *
341      * @return Date
342      */

343     public Date JavaDoc getLastLogin()
344     {
345         return lastLogin;
346     }
347
348                         
349     /**
350      * Set the value of LastLogin
351      *
352      * @param v new value
353      */

354     public void setLastLogin(Date JavaDoc v)
355     {
356     
357                   if (!ObjectUtils.equals(this.lastLogin, v))
358               {
359             this.lastLogin = v;
360             setModified(true);
361         }
362     
363           
364               }
365   
366     /**
367      * Get the Objectdata
368      *
369      * @return byte[]
370      */

371     public byte[] getObjectdata()
372     {
373         return objectdata;
374     }
375
376                         
377     /**
378      * Set the value of Objectdata
379      *
380      * @param v new value
381      */

382     public void setObjectdata(byte[] v)
383     {
384     
385                   if (!ObjectUtils.equals(this.objectdata, v))
386               {
387             this.objectdata = v;
388             setModified(true);
389         }
390     
391           
392               }
393   
394          
395                                 
396             
397           /**
398      * Collection to store aggregation of collTurbineUserGroupRoles
399      */

400     protected List JavaDoc collTurbineUserGroupRoles;
401
402     /**
403      * Temporary storage of collTurbineUserGroupRoles to save a possible db hit in
404      * the event objects are add to the collection, but the
405      * complete collection is never requested.
406      */

407     protected void initTurbineUserGroupRoles()
408     {
409         if (collTurbineUserGroupRoles == null)
410         {
411             collTurbineUserGroupRoles = new ArrayList JavaDoc();
412         }
413     }
414
415     /**
416      * Method called to associate a TurbineUserGroupRole object to this object
417      * through the TurbineUserGroupRole foreign key attribute
418      *
419      * @param l TurbineUserGroupRole
420      * @throws TorqueException
421      */

422     public void addTurbineUserGroupRole(TurbineUserGroupRole l) throws TorqueException
423     {
424         getTurbineUserGroupRoles().add(l);
425         l.setTurbineUser((TurbineUser) this);
426     }
427
428     /**
429      * The criteria used to select the current contents of collTurbineUserGroupRoles
430      */

431     private Criteria lastTurbineUserGroupRolesCriteria = null;
432       
433     /**
434      * If this collection has already been initialized, returns
435      * the collection. Otherwise returns the results of
436      * getTurbineUserGroupRoles(new Criteria())
437      *
438      * @throws TorqueException
439      */

440     public List JavaDoc getTurbineUserGroupRoles() throws TorqueException
441     {
442               if (collTurbineUserGroupRoles == null)
443         {
444             collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10));
445         }
446         return collTurbineUserGroupRoles;
447           }
448
449     /**
450      * If this collection has already been initialized with
451      * an identical criteria, it returns the collection.
452      * Otherwise if this TurbineUser has previously
453      * been saved, it will retrieve related TurbineUserGroupRoles from storage.
454      * If this TurbineUser is new, it will return
455      * an empty collection or the current collection, the criteria
456      * is ignored on a new object.
457      *
458      * @throws TorqueException
459      */

460     public List JavaDoc getTurbineUserGroupRoles(Criteria criteria) throws TorqueException
461     {
462               if (collTurbineUserGroupRoles == null)
463         {
464             if (isNew())
465             {
466                collTurbineUserGroupRoles = new ArrayList JavaDoc();
467             }
468             else
469             {
470                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
471                         collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
472             }
473         }
474         else
475         {
476             // criteria has no effect for a new object
477
if (!isNew())
478             {
479                 // the following code is to determine if a new query is
480
// called for. If the criteria is the same as the last
481
// one, just return the collection.
482
criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
483                             if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
484                 {
485                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
486                 }
487             }
488         }
489         lastTurbineUserGroupRolesCriteria = criteria;
490
491         return collTurbineUserGroupRoles;
492           }
493
494     /**
495      * If this collection has already been initialized, returns
496      * the collection. Otherwise returns the results of
497      * getTurbineUserGroupRoles(new Criteria(),Connection)
498      * This method takes in the Connection also as input so that
499      * referenced objects can also be obtained using a Connection
500      * that is taken as input
501      */

502     public List JavaDoc getTurbineUserGroupRoles(Connection JavaDoc con) throws TorqueException
503     {
504               if (collTurbineUserGroupRoles == null)
505         {
506             collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10), con);
507         }
508         return collTurbineUserGroupRoles;
509           }
510
511     /**
512      * If this collection has already been initialized with
513      * an identical criteria, it returns the collection.
514      * Otherwise if this TurbineUser has previously
515      * been saved, it will retrieve related TurbineUserGroupRoles from storage.
516      * If this TurbineUser is new, it will return
517      * an empty collection or the current collection, the criteria
518      * is ignored on a new object.
519      * This method takes in the Connection also as input so that
520      * referenced objects can also be obtained using a Connection
521      * that is taken as input
522      */

523     public List JavaDoc getTurbineUserGroupRoles(Criteria criteria, Connection JavaDoc con)
524             throws TorqueException
525     {
526               if (collTurbineUserGroupRoles == null)
527         {
528             if (isNew())
529             {
530                collTurbineUserGroupRoles = new ArrayList JavaDoc();
531             }
532             else
533             {
534                          criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
535                          collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
536              }
537          }
538          else
539          {
540              // criteria has no effect for a new object
541
if (!isNew())
542              {
543                  // the following code is to determine if a new query is
544
// called for. If the criteria is the same as the last
545
// one, just return the collection.
546
criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
547                              if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
548                  {
549                      collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
550                  }
551              }
552          }
553          lastTurbineUserGroupRolesCriteria = criteria;
554
555          return collTurbineUserGroupRoles;
556            }
557
558                               
559               
560                     
561                               
562                                 
563                                                               
564                                         
565                     
566                     
567           
568     /**
569      * If this collection has already been initialized with
570      * an identical criteria, it returns the collection.
571      * Otherwise if this TurbineUser is new, it will return
572      * an empty collection; or if this TurbineUser has previously
573      * been saved, it will retrieve related TurbineUserGroupRoles from storage.
574      *
575      * This method is protected by default in order to keep the public
576      * api reasonable. You can provide public methods for those you
577      * actually need in TurbineUser.
578      */

579     protected List JavaDoc getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria)
580         throws TorqueException
581     {
582                     if (collTurbineUserGroupRoles == null)
583         {
584             if (isNew())
585             {
586                collTurbineUserGroupRoles = new ArrayList JavaDoc();
587             }
588             else
589             {
590                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
591                               collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
592             }
593         }
594         else
595         {
596             // the following code is to determine if a new query is
597
// called for. If the criteria is the same as the last
598
// one, just return the collection.
599

600                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
601                                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
602             {
603                 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
604             }
605         }
606         lastTurbineUserGroupRolesCriteria = criteria;
607
608         return collTurbineUserGroupRoles;
609                 }
610                   
611                     
612                     
613                                 
614                                                               
615                                         
616                     
617                     
618           
619     /**
620      * If this collection has already been initialized with
621      * an identical criteria, it returns the collection.
622      * Otherwise if this TurbineUser is new, it will return
623      * an empty collection; or if this TurbineUser has previously
624      * been saved, it will retrieve related TurbineUserGroupRoles from storage.
625      *
626      * This method is protected by default in order to keep the public
627      * api reasonable. You can provide public methods for those you
628      * actually need in TurbineUser.
629      */

630     protected List JavaDoc getTurbineUserGroupRolesJoinTurbineGroup(Criteria criteria)
631         throws TorqueException
632     {
633                     if (collTurbineUserGroupRoles == null)
634         {
635             if (isNew())
636             {
637                collTurbineUserGroupRoles = new ArrayList JavaDoc();
638             }
639             else
640             {
641                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
642                               collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
643             }
644         }
645         else
646         {
647             // the following code is to determine if a new query is
648
// called for. If the criteria is the same as the last
649
// one, just return the collection.
650

651                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
652                                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
653             {
654                 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
655             }
656         }
657         lastTurbineUserGroupRolesCriteria = criteria;
658
659         return collTurbineUserGroupRoles;
660                 }
661                   
662                     
663                     
664                                 
665                                                               
666                                         
667                     
668                     
669           
670     /**
671      * If this collection has already been initialized with
672      * an identical criteria, it returns the collection.
673      * Otherwise if this TurbineUser is new, it will return
674      * an empty collection; or if this TurbineUser has previously
675      * been saved, it will retrieve related TurbineUserGroupRoles from storage.
676      *
677      * This method is protected by default in order to keep the public
678      * api reasonable. You can provide public methods for those you
679      * actually need in TurbineUser.
680      */

681     protected List JavaDoc getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria)
682         throws TorqueException
683     {
684                     if (collTurbineUserGroupRoles == null)
685         {
686             if (isNew())
687             {
688                collTurbineUserGroupRoles = new ArrayList JavaDoc();
689             }
690             else
691             {
692                               criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
693                               collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
694             }
695         }
696         else
697         {
698             // the following code is to determine if a new query is
699
// called for. If the criteria is the same as the last
700
// one, just return the collection.
701

702                         criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
703                                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
704             {
705                 collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
706             }
707         }
708         lastTurbineUserGroupRolesCriteria = criteria;
709
710         return collTurbineUserGroupRoles;
711                 }
712                             
713
714
715           
716     private static List JavaDoc fieldNames = null;
717
718     /**
719      * Generate a list of field names.
720      *
721      * @return a list of field names
722      */

723     public static synchronized List JavaDoc getFieldNames()
724     {
725         if (fieldNames == null)
726         {
727             fieldNames = new ArrayList JavaDoc();
728               fieldNames.add("UserId");
729               fieldNames.add("UserName");
730               fieldNames.add("Password");
731               fieldNames.add("FirstName");
732               fieldNames.add("LastName");
733               fieldNames.add("Email");
734               fieldNames.add("Confirmed");
735               fieldNames.add("Modified");
736               fieldNames.add("CreateDate");
737               fieldNames.add("LastLogin");
738               fieldNames.add("Objectdata");
739               fieldNames = Collections.unmodifiableList(fieldNames);
740         }
741         return fieldNames;
742     }
743
744     /**
745      * Retrieves a field from the object by name passed in as a String.
746      *
747      * @param name field name
748      * @return value
749      */

750     public Object JavaDoc getByName(String JavaDoc name)
751     {
752           if (name.equals("UserId"))
753         {
754                 return new Integer JavaDoc(getUserId());
755             }
756           if (name.equals("UserName"))
757         {
758                 return getUserName();
759             }
760           if (name.equals("Password"))
761         {
762                 return getPassword();
763             }
764           if (name.equals("FirstName"))
765         {
766                 return getFirstName();
767             }
768           if (name.equals("LastName"))
769         {
770                 return getLastName();
771             }
772           if (name.equals("Email"))
773         {
774                 return getEmail();
775             }
776           if (name.equals("Confirmed"))
777         {
778                 return getConfirmed();
779             }
780           if (name.equals("Modified"))
781         {
782                 return getModified();
783             }
784           if (name.equals("CreateDate"))
785         {
786                 return getCreateDate();
787             }
788           if (name.equals("LastLogin"))
789         {
790                 return getLastLogin();
791             }
792           if (name.equals("Objectdata"))
793         {
794                 return getObjectdata();
795             }
796           return null;
797     }
798     
799     /**
800      * Retrieves a field from the object by name passed in
801      * as a String. The String must be one of the static
802      * Strings defined in this Class' Peer.
803      *
804      * @param name peer name
805      * @return value
806      */

807     public Object JavaDoc getByPeerName(String JavaDoc name)
808     {
809           if (name.equals(TurbineUserPeer.USER_ID))
810         {
811                 return new Integer JavaDoc(getUserId());
812             }
813           if (name.equals(TurbineUserPeer.LOGIN_NAME))
814         {
815                 return getUserName();
816             }
817           if (name.equals(TurbineUserPeer.PASSWORD_VALUE))
818         {
819                 return getPassword();
820             }
821           if (name.equals(TurbineUserPeer.FIRST_NAME))
822         {
823                 return getFirstName();
824             }
825           if (name.equals(TurbineUserPeer.LAST_NAME))
826         {
827                 return getLastName();
828             }
829           if (name.equals(TurbineUserPeer.EMAIL))
830         {
831                 return getEmail();
832             }
833           if (name.equals(TurbineUserPeer.CONFIRM_VALUE))
834         {
835                 return getConfirmed();
836             }
837           if (name.equals(TurbineUserPeer.MODIFIED))
838         {
839                 return getModified();
840             }
841           if (name.equals(TurbineUserPeer.CREATED))
842         {
843                 return getCreateDate();
844             }
845           if (name.equals(TurbineUserPeer.LAST_LOGIN))
846         {
847                 return getLastLogin();
848             }
849           if (name.equals(TurbineUserPeer.OBJECTDATA))
850         {
851                 return getObjectdata();
852             }
853           return null;
854     }
855
856     /**
857      * Retrieves a field from the object by Position as specified
858      * in the xml schema. Zero-based.
859      *
860      * @param pos position in xml schema
861      * @return value
862      */

863     public Object JavaDoc getByPosition(int pos)
864     {
865             if (pos == 0)
866         {
867                 return new Integer JavaDoc(getUserId());
868             }
869               if (pos == 1)
870         {
871                 return getUserName();
872             }
873               if (pos == 2)
874         {
875                 return getPassword();
876             }
877               if (pos == 3)
878         {
879                 return getFirstName();
880             }
881               if (pos == 4)
882         {
883                 return getLastName();
884             }
885               if (pos == 5)
886         {
887                 return getEmail();
888             }
889               if (pos == 6)
890         {
891                 return getConfirmed();
892             }
893               if (pos == 7)
894         {
895                 return getModified();
896             }
897               if (pos == 8)
898         {
899                 return getCreateDate();
900             }
901               if (pos == 9)
902         {
903                 return getLastLogin();
904             }
905               if (pos == 10)
906         {
907                 return getObjectdata();
908             }
909               return null;
910     }
911      
912     /**
913      * Stores the object in the database. If the object is new,
914      * it inserts it; otherwise an update is performed.
915      *
916      * @throws Exception
917      */

918     public void save() throws Exception JavaDoc
919     {
920           save(TurbineUserPeer.getMapBuilder()
921                 .getDatabaseMap().getName());
922       }
923
924     /**
925      * Stores the object in the database. If the object is new,
926      * it inserts it; otherwise an update is performed.
927        * Note: this code is here because the method body is
928      * auto-generated conditionally and therefore needs to be
929      * in this file instead of in the super class, BaseObject.
930        *
931      * @param dbName
932      * @throws TorqueException
933      */

934     public void save(String JavaDoc dbName) throws TorqueException
935     {
936         Connection JavaDoc con = null;
937           try
938         {
939             con = Transaction.begin(dbName);
940             save(con);
941             Transaction.commit(con);
942         }
943         catch(TorqueException e)
944         {
945             Transaction.safeRollback(con);
946             throw e;
947         }
948       }
949
950       /** flag to prevent endless save loop, if this object is referenced
951         by another object which falls in this transaction. */

952     private boolean alreadyInSave = false;
953       /**
954      * Stores the object in the database. If the object is new,
955      * it inserts it; otherwise an update is performed. This method
956      * is meant to be used as part of a transaction, otherwise use
957      * the save() method and the connection details will be handled
958      * internally
959      *
960      * @param con
961      * @throws TorqueException
962      */

963     public void save(Connection JavaDoc con) throws TorqueException
964     {
965           if (!alreadyInSave)
966         {
967             alreadyInSave = true;
968
969
970   
971             // If this object has been modified, then save it to the database.
972
if (isModified())
973             {
974                 if (isNew())
975                 {
976                     TurbineUserPeer.doInsert((TurbineUser) this, con);
977                     setNew(false);
978                 }
979                 else
980                 {
981                     TurbineUserPeer.doUpdate((TurbineUser) this, con);
982                 }
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 JavaDoc 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     * get an id that differentiates this object from others
1032     * of its class.
1033     */

1034    public String JavaDoc getQueryKey()
1035    {
1036        if (getPrimaryKey() == null)
1037        {
1038            return "";
1039        }
1040        else
1041        {
1042            return getPrimaryKey().toString();
1043        }
1044    }
1045
1046    /**
1047     * set an id that differentiates this object from others
1048     * of its class.
1049     */

1050    public void setQueryKey(String JavaDoc key)
1051        throws TorqueException
1052    {
1053        setPrimaryKey(key);
1054    }
1055
1056    /**
1057     * Makes a copy of this object.
1058     * It creates a new object filling in the simple attributes.
1059       * It then fills all the association collections and sets the
1060     * related objects to isNew=true.
1061       */

1062      public TurbineUser copy() throws TorqueException
1063    {
1064        return copyInto(new TurbineUser());
1065    }
1066  
1067    protected TurbineUser copyInto(TurbineUser copyObj) throws TorqueException
1068    {
1069          copyObj.setUserId(userId);
1070          copyObj.setUserName(userName);
1071          copyObj.setPassword(password);
1072          copyObj.setFirstName(firstName);
1073          copyObj.setLastName(lastName);
1074          copyObj.setEmail(email);
1075          copyObj.setConfirmed(confirmed);
1076          copyObj.setModified(modified);
1077          copyObj.setCreateDate(createDate);
1078          copyObj.setLastLogin(lastLogin);
1079          copyObj.setObjectdata(objectdata);
1080  
1081                            copyObj.setUserId( 0);
1082                                                                        
1083                                      
1084                            
1085        List JavaDoc v = getTurbineUserGroupRoles();
1086        for (int i = 0; i < v.size(); i++)
1087        {
1088            TurbineUserGroupRole obj = (TurbineUserGroupRole) v.get(i);
1089            copyObj.addTurbineUserGroupRole(obj.copy());
1090        }
1091                            return copyObj;
1092    }
1093
1094    /**
1095     * returns a peer instance associated with this om. Since Peer classes
1096     * are not to have any instance attributes, this method returns the
1097     * same instance for all member of this class. The method could therefore
1098     * be static, but this would prevent one from overriding the behavior.
1099     */

1100    public TurbineUserPeer getPeer()
1101    {
1102        return peer;
1103    }
1104
1105    public String JavaDoc toString()
1106    {
1107        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1108        str.append("TurbineUser:\n");
1109        str.append("UserId = ")
1110               .append(getUserId())
1111             .append("\n");
1112        str.append("UserName = ")
1113               .append(getUserName())
1114             .append("\n");
1115        str.append("Password = ")
1116               .append(getPassword())
1117             .append("\n");
1118        str.append("FirstName = ")
1119               .append(getFirstName())
1120             .append("\n");
1121        str.append("LastName = ")
1122               .append(getLastName())
1123             .append("\n");
1124        str.append("Email = ")
1125               .append(getEmail())
1126             .append("\n");
1127        str.append("Confirmed = ")
1128               .append(getConfirmed())
1129             .append("\n");
1130        str.append("Modified = ")
1131               .append(getModified())
1132             .append("\n");
1133        str.append("CreateDate = ")
1134               .append(getCreateDate())
1135             .append("\n");
1136        str.append("LastLogin = ")
1137               .append(getLastLogin())
1138             .append("\n");
1139        str.append("Objectdata = ")
1140               .append("<binary>")
1141             .append("\n");
1142        return(str.toString());
1143    }
1144}
1145
Popular Tags