##### Coverage Report - org.apache.turbine.services.security.torque.om.BaseTurbineUser

Classes in this File | Line Coverage | Branch Coverage | Complexity
BaseTurbineUser |
0% | 0/406
0% | 0/266
| 4.785714285714286;4,786

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.map.TableMap;
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 |  |
28 |  |
29 |  |
     /**
30 |  |
      * This class was autogenerated by Torque on:
31 |  |
      *
32 |  |
      * [Thu Jun 23 17:25:46 CEST 2011]
33 |  |
      *
34 |  |
      * You should not use this class directly.  It should not even be
35 |  |
      * extended all references should be to TurbineUser
36 |  |
      */
37 | 0 |
     public abstract class BaseTurbineUser extends BaseObject
38 |  |
     {
39 |  |
         /** Serial version */
40 |  |
         private static final long serialVersionUID = 1308842746584L;
41 |  |
42 |  |
         /** The Peer class */
43 | 0 |
         private static final TurbineUserPeer peer =
44 |  |
             new TurbineUserPeer();
45 |  |
46 |  |
47 |  |
         /** The value for the userId field */
48 |  |
         private int userId;
49 |  |
50 |  |
         /** The value for the userName field */
51 |  |
         private String userName;
52 |  |
53 |  |
         /** The value for the password field */
54 |  |
         private String password;
55 |  |
56 |  |
         /** The value for the firstName field */
57 |  |
         private String firstName;
58 |  |
59 |  |
         /** The value for the lastName field */
60 |  |
         private String lastName;
61 |  |
62 |  |
         /** The value for the email field */
63 |  |
         private String email;
64 |  |
65 |  |
         /** The value for the confirmed field */
66 |  |
         private String confirmed;
67 |  |
68 |  |
         /** The value for the modified field */
69 |  |
         private Date modified;
70 |  |
71 |  |
         /** The value for the createDate field */
72 |  |
         private Date createDate;
73 |  |
74 |  |
         /** The value for the lastLogin field */
75 |  |
         private Date lastLogin;
76 |  |
77 |  |
         /** The value for the objectdata field */
78 |  |
         private byte[] objectdata;
79 |  |
80 |  |
81 |  |
         /**
82 |  |
          * Get the UserId
83 |  |
          *
84 |  |
          * @return int
85 |  |
          */
86 |  |
         public int getUserId()
87 |  |
         {
88 | 0 |
             return userId;
89 |  |
         }
90 |  |
91 |  |
92 |  |
         /**
93 |  |
          * Set the value of UserId
94 |  |
          *
95 |  |
          * @param v new value
96 |  |
          */
97 |  |
         public void setUserId(int v) throws TorqueException
98 |  |
         {
99 |  |
100 | 0 |
             if (this.userId != v)
101 |  |
             {
102 | 0 |
                 this.userId = v;
103 | 0 |
                 setModified(true);
104 |  |
             }
105 |  |
106 |  |
107 |  |
108 |  |
             // update associated TurbineUserGroupRole
109 | 0 |
             if (collTurbineUserGroupRoles != null)
110 |  |
             {
111 | 0 |
                 for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
112 |  |
                 {
113 | 0 |
                     ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i))
114 |  |
                             .setUserId(v);
115 |  |
                 }
116 |  |
             }
117 | 0 |
         }
118 |  |
119 |  |
         /**
120 |  |
          * Get the UserName
121 |  |
          *
122 |  |
          * @return String
123 |  |
          */
124 |  |
         public String getUserName()
125 |  |
         {
126 | 0 |
             return userName;
127 |  |
         }
128 |  |
129 |  |
130 |  |
         /**
131 |  |
          * Set the value of UserName
132 |  |
          *
133 |  |
          * @param v new value
134 |  |
          */
135 |  |
         public void setUserName(String v)
136 |  |
         {
137 |  |
138 | 0 |
             if (!ObjectUtils.equals(this.userName, v))
139 |  |
             {
140 | 0 |
                 this.userName = v;
141 | 0 |
                 setModified(true);
142 |  |
             }
143 |  |
144 |  |
145 | 0 |
         }
146 |  |
147 |  |
         /**
148 |  |
          * Get the Password
149 |  |
          *
150 |  |
          * @return String
151 |  |
          */
152 |  |
         public String getPassword()
153 |  |
         {
154 | 0 |
             return password;
155 |  |
         }
156 |  |
157 |  |
158 |  |
         /**
159 |  |
          * Set the value of Password
160 |  |
          *
161 |  |
          * @param v new value
162 |  |
          */
163 |  |
         public void setPassword(String v)
164 |  |
         {
165 |  |
166 | 0 |
             if (!ObjectUtils.equals(this.password, v))
167 |  |
             {
168 | 0 |
                 this.password = v;
169 | 0 |
                 setModified(true);
170 |  |
             }
171 |  |
172 |  |
173 | 0 |
         }
174 |  |
175 |  |
         /**
176 |  |
          * Get the FirstName
177 |  |
          *
178 |  |
          * @return String
179 |  |
          */
180 |  |
         public String getFirstName()
181 |  |
         {
182 | 0 |
             return firstName;
183 |  |
         }
184 |  |
185 |  |
186 |  |
         /**
187 |  |
          * Set the value of FirstName
188 |  |
          *
189 |  |
          * @param v new value
190 |  |
          */
191 |  |
         public void setFirstName(String v)
192 |  |
         {
193 |  |
194 | 0 |
             if (!ObjectUtils.equals(this.firstName, v))
195 |  |
             {
196 | 0 |
                 this.firstName = v;
197 | 0 |
                 setModified(true);
198 |  |
             }
199 |  |
200 |  |
201 | 0 |
         }
202 |  |
203 |  |
         /**
204 |  |
          * Get the LastName
205 |  |
          *
206 |  |
          * @return String
207 |  |
          */
208 |  |
         public String getLastName()
209 |  |
         {
210 | 0 |
             return lastName;
211 |  |
         }
212 |  |
213 |  |
214 |  |
         /**
215 |  |
          * Set the value of LastName
216 |  |
          *
217 |  |
          * @param v new value
218 |  |
          */
219 |  |
         public void setLastName(String v)
220 |  |
         {
221 |  |
222 | 0 |
             if (!ObjectUtils.equals(this.lastName, v))
223 |  |
             {
224 | 0 |
                 this.lastName = v;
225 | 0 |
                 setModified(true);
226 |  |
             }
227 |  |
228 |  |
229 | 0 |
         }
230 |  |
231 |  |
         /**
232 |  |
          * Get the Email
233 |  |
          *
234 |  |
          * @return String
235 |  |
          */
236 |  |
         public String getEmail()
237 |  |
         {
238 | 0 |
             return email;
239 |  |
         }
240 |  |
241 |  |
242 |  |
         /**
243 |  |
          * Set the value of Email
244 |  |
          *
245 |  |
          * @param v new value
246 |  |
          */
247 |  |
         public void setEmail(String v)
248 |  |
         {
249 |  |
250 | 0 |
             if (!ObjectUtils.equals(this.email, v))
251 |  |
             {
252 | 0 |
                 this.email = v;
253 | 0 |
                 setModified(true);
254 |  |
             }
255 |  |
256 |  |
257 | 0 |
         }
258 |  |
259 |  |
         /**
260 |  |
          * Get the Confirmed
261 |  |
          *
262 |  |
          * @return String
263 |  |
          */
264 |  |
         public String getConfirmed()
265 |  |
         {
266 | 0 |
             return confirmed;
267 |  |
         }
268 |  |
269 |  |
270 |  |
         /**
271 |  |
          * Set the value of Confirmed
272 |  |
          *
273 |  |
          * @param v new value
274 |  |
          */
275 |  |
         public void setConfirmed(String v)
276 |  |
         {
277 |  |
278 | 0 |
             if (!ObjectUtils.equals(this.confirmed, v))
279 |  |
             {
280 | 0 |
                 this.confirmed = v;
281 | 0 |
                 setModified(true);
282 |  |
             }
283 |  |
284 |  |
285 | 0 |
         }
286 |  |
287 |  |
         /**
288 |  |
          * Get the Modified
289 |  |
          *
290 |  |
          * @return Date
291 |  |
          */
292 |  |
         public Date getModified()
293 |  |
         {
294 | 0 |
             return modified;
295 |  |
         }
296 |  |
297 |  |
298 |  |
         /**
299 |  |
          * Set the value of Modified
300 |  |
          *
301 |  |
          * @param v new value
302 |  |
          */
303 |  |
         public void setModified(Date v)
304 |  |
         {
305 |  |
306 | 0 |
             if (!ObjectUtils.equals(this.modified, v))
307 |  |
             {
308 | 0 |
                 this.modified = v;
309 | 0 |
                 setModified(true);
310 |  |
             }
311 |  |
312 |  |
313 | 0 |
         }
314 |  |
315 |  |
         /**
316 |  |
          * Get the CreateDate
317 |  |
          *
318 |  |
          * @return Date
319 |  |
          */
320 |  |
         public Date getCreateDate()
321 |  |
         {
322 | 0 |
             return createDate;
323 |  |
         }
324 |  |
325 |  |
326 |  |
         /**
327 |  |
          * Set the value of CreateDate
328 |  |
          *
329 |  |
          * @param v new value
330 |  |
          */
331 |  |
         public void setCreateDate(Date v)
332 |  |
         {
333 |  |
334 | 0 |
             if (!ObjectUtils.equals(this.createDate, v))
335 |  |
             {
336 | 0 |
                 this.createDate = v;
337 | 0 |
                 setModified(true);
338 |  |
             }
339 |  |
340 |  |
341 | 0 |
         }
342 |  |
343 |  |
         /**
344 |  |
          * Get the LastLogin
345 |  |
          *
346 |  |
          * @return Date
347 |  |
          */
348 |  |
         public Date getLastLogin()
349 |  |
         {
350 | 0 |
             return lastLogin;
351 |  |
         }
352 |  |
353 |  |
354 |  |
         /**
355 |  |
          * Set the value of LastLogin
356 |  |
          *
357 |  |
          * @param v new value
358 |  |
          */
359 |  |
         public void setLastLogin(Date v)
360 |  |
         {
361 |  |
362 | 0 |
             if (!ObjectUtils.equals(this.lastLogin, v))
363 |  |
             {
364 | 0 |
                 this.lastLogin = v;
365 | 0 |
                 setModified(true);
366 |  |
             }
367 |  |
368 |  |
369 | 0 |
         }
370 |  |
371 |  |
         /**
372 |  |
          * Get the Objectdata
373 |  |
          *
374 |  |
          * @return byte[]
375 |  |
          */
376 |  |
         public byte[] getObjectdata()
377 |  |
         {
378 | 0 |
             return objectdata;
379 |  |
         }
380 |  |
381 |  |
382 |  |
         /**
383 |  |
          * Set the value of Objectdata
384 |  |
          *
385 |  |
          * @param v new value
386 |  |
          */
387 |  |
         public void setObjectdata(byte[] v)
388 |  |
         {
389 |  |
390 | 0 |
             if (!ObjectUtils.equals(this.objectdata, v))
391 |  |
             {
392 | 0 |
                 this.objectdata = v;
393 | 0 |
                 setModified(true);
394 |  |
             }
395 |  |
396 |  |
397 | 0 |
         }
398 |  |
399 |  |
400 |  |
401 |  |
402 |  |
         /**
403 |  |
          * Collection to store aggregation of collTurbineUserGroupRoles
404 |  |
          */
405 |  |
         protected List<TurbineUserGroupRole> collTurbineUserGroupRoles;
406 |  |
407 |  |
         /**
408 |  |
          * Temporary storage of collTurbineUserGroupRoles to save a possible db hit in
409 |  |
          * the event objects are add to the collection, but the
410 |  |
          * complete collection is never requested.
411 |  |
          */
412 |  |
         protected void initTurbineUserGroupRoles()
413 |  |
         {
414 | 0 |
             if (collTurbineUserGroupRoles == null)
415 |  |
             {
416 | 0 |
                 collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
417 |  |
             }
418 | 0 |
         }
419 |  |
420 |  |
421 |  |
         /**
422 |  |
          * Method called to associate a TurbineUserGroupRole object to this object
423 |  |
          * through the TurbineUserGroupRole foreign key attribute
424 |  |
          *
425 |  |
          * @param l TurbineUserGroupRole
426 |  |
          * @throws TorqueException
427 |  |
          */
428 |  |
         public void addTurbineUserGroupRole(TurbineUserGroupRole l) throws TorqueException
429 |  |
         {
430 | 0 |
             getTurbineUserGroupRoles().add(l);
431 | 0 |
             l.setTurbineUser((TurbineUser) this);
432 | 0 |
         }
433 |  |
434 |  |
         /**
435 |  |
          * Method called to associate a TurbineUserGroupRole object to this object
436 |  |
          * through the TurbineUserGroupRole foreign key attribute using connection.
437 |  |
          *
438 |  |
          * @param l TurbineUserGroupRole
439 |  |
          * @throws TorqueException
440 |  |
          */
441 |  |
         public void addTurbineUserGroupRole(TurbineUserGroupRole l, Connection con) throws TorqueException
442 |  |
         {
443 | 0 |
             getTurbineUserGroupRoles(con).add(l);
444 | 0 |
             l.setTurbineUser((TurbineUser) this);
445 | 0 |
         }
446 |  |
447 |  |
         /**
448 |  |
          * The criteria used to select the current contents of collTurbineUserGroupRoles
449 |  |
          */
450 | 0 |
         private Criteria lastTurbineUserGroupRolesCriteria = null;
451 |  |
452 |  |
         /**
453 |  |
          * If this collection has already been initialized, returns
454 |  |
          * the collection. Otherwise returns the results of
455 |  |
          * getTurbineUserGroupRoles(new Criteria())
456 |  |
          *
457 |  |
          * @return the collection of associated objects
458 |  |
          * @throws TorqueException
459 |  |
          */
460 |  |
         public List<TurbineUserGroupRole> getTurbineUserGroupRoles()
461 |  |
             throws TorqueException
462 |  |
         {
463 | 0 |
             if (collTurbineUserGroupRoles == null)
464 |  |
             {
465 | 0 |
                 collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10));
466 |  |
             }
467 | 0 |
             return collTurbineUserGroupRoles;
468 |  |
         }
469 |  |
470 |  |
         /**
471 |  |
          * If this collection has already been initialized with
472 |  |
          * an identical criteria, it returns the collection.
473 |  |
          * Otherwise if this TurbineUser has previously
474 |  |
          * been saved, it will retrieve related TurbineUserGroupRoles from storage.
475 |  |
          * If this TurbineUser is new, it will return
476 |  |
          * an empty collection or the current collection, the criteria
477 |  |
          * is ignored on a new object.
478 |  |
          *
479 |  |
          * @throws TorqueException
480 |  |
          */
481 |  |
         public List<TurbineUserGroupRole> getTurbineUserGroupRoles(Criteria criteria) throws TorqueException
482 |  |
         {
483 | 0 |
             if (collTurbineUserGroupRoles == null)
484 |  |
             {
485 | 0 |
                 if (isNew())
486 |  |
                 {
487 | 0 |
                    collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
488 |  |
                 }
489 |  |
                 else
490 |  |
                 {
491 | 0 |
                     criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId() );
492 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
493 |  |
                 }
494 |  |
             }
495 |  |
             else
496 |  |
             {
497 |  |
                 // criteria has no effect for a new object
498 | 0 |
                 if (!isNew())
499 |  |
                 {
500 |  |
                     // the following code is to determine if a new query is
501 |  |
                     // called for.  If the criteria is the same as the last
502 |  |
                     // one, just return the collection.
503 | 0 |
                     criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
504 | 0 |
                     if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
505 |  |
                     {
506 | 0 |
                         collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria);
507 |  |
                     }
508 |  |
                 }
509 |  |
             }
510 | 0 |
             lastTurbineUserGroupRolesCriteria = criteria;
511 |  |
512 | 0 |
             return collTurbineUserGroupRoles;
513 |  |
         }
514 |  |
515 |  |
         /**
516 |  |
          * If this collection has already been initialized, returns
517 |  |
          * the collection. Otherwise returns the results of
518 |  |
          * getTurbineUserGroupRoles(new Criteria(),Connection)
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<TurbineUserGroupRole> getTurbineUserGroupRoles(Connection con) throws TorqueException
524 |  |
         {
525 | 0 |
             if (collTurbineUserGroupRoles == null)
526 |  |
             {
527 | 0 |
                 collTurbineUserGroupRoles = getTurbineUserGroupRoles(new Criteria(10), con);
528 |  |
             }
529 | 0 |
             return collTurbineUserGroupRoles;
530 |  |
         }
531 |  |
532 |  |
         /**
533 |  |
          * If this collection has already been initialized with
534 |  |
          * an identical criteria, it returns the collection.
535 |  |
          * Otherwise if this TurbineUser has previously
536 |  |
          * been saved, it will retrieve related TurbineUserGroupRoles from storage.
537 |  |
          * If this TurbineUser is new, it will return
538 |  |
          * an empty collection or the current collection, the criteria
539 |  |
          * is ignored on a new object.
540 |  |
          * This method takes in the Connection also as input so that
541 |  |
          * referenced objects can also be obtained using a Connection
542 |  |
          * that is taken as input
543 |  |
          */
544 |  |
         public List<TurbineUserGroupRole> getTurbineUserGroupRoles(Criteria criteria, Connection con)
545 |  |
                 throws TorqueException
546 |  |
         {
547 | 0 |
             if (collTurbineUserGroupRoles == null)
548 |  |
             {
549 | 0 |
                 if (isNew())
550 |  |
                 {
551 | 0 |
                    collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
552 |  |
                 }
553 |  |
                 else
554 |  |
                 {
555 | 0 |
                      criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
556 | 0 |
                      collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
557 |  |
                  }
558 |  |
              }
559 |  |
              else
560 |  |
              {
561 |  |
                  // criteria has no effect for a new object
562 | 0 |
                  if (!isNew())
563 |  |
                  {
564 |  |
                      // the following code is to determine if a new query is
565 |  |
                      // called for.  If the criteria is the same as the last
566 |  |
                      // one, just return the collection.
567 | 0 |
                      criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
568 | 0 |
                      if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
569 |  |
                      {
570 | 0 |
                          collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelect(criteria, con);
571 |  |
                      }
572 |  |
                  }
573 |  |
              }
574 | 0 |
              lastTurbineUserGroupRolesCriteria = criteria;
575 |  |
576 | 0 |
              return collTurbineUserGroupRoles;
577 |  |
          }
578 |  |
579 |  |
580 |  |
581 |  |
582 |  |
583 |  |
584 |  |
585 |  |
586 |  |
587 |  |
588 |  |
589 |  |
         /**
590 |  |
          * If this collection has already been initialized with
591 |  |
          * an identical criteria, it returns the collection.
592 |  |
          * Otherwise if this TurbineUser is new, it will return
593 |  |
          * an empty collection; or if this TurbineUser has previously
594 |  |
          * been saved, it will retrieve related TurbineUserGroupRoles from storage.
595 |  |
          *
596 |  |
          * This method is protected by default in order to keep the public
597 |  |
          * api reasonable.  You can provide public methods for those you
598 |  |
          * actually need in TurbineUser.
599 |  |
          */
600 |  |
         protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineUser(Criteria criteria)
601 |  |
             throws TorqueException
602 |  |
         {
603 | 0 |
             if (collTurbineUserGroupRoles == null)
604 |  |
             {
605 | 0 |
                 if (isNew())
606 |  |
                 {
607 | 0 |
                    collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
608 |  |
                 }
609 |  |
                 else
610 |  |
                 {
611 | 0 |
                     criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
612 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
613 |  |
                 }
614 |  |
             }
615 |  |
             else
616 |  |
             {
617 |  |
                 // the following code is to determine if a new query is
618 |  |
                 // called for.  If the criteria is the same as the last
619 |  |
                 // one, just return the collection.
620 | 0 |
                 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
621 | 0 |
                 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
622 |  |
                 {
623 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineUser(criteria);
624 |  |
                 }
625 |  |
             }
626 | 0 |
             lastTurbineUserGroupRolesCriteria = criteria;
627 |  |
628 | 0 |
             return collTurbineUserGroupRoles;
629 |  |
         }
630 |  |
631 |  |
632 |  |
633 |  |
634 |  |
635 |  |
636 |  |
637 |  |
638 |  |
639 |  |
         /**
640 |  |
          * If this collection has already been initialized with
641 |  |
          * an identical criteria, it returns the collection.
642 |  |
          * Otherwise if this TurbineUser is new, it will return
643 |  |
          * an empty collection; or if this TurbineUser has previously
644 |  |
          * been saved, it will retrieve related TurbineUserGroupRoles from storage.
645 |  |
          *
646 |  |
          * This method is protected by default in order to keep the public
647 |  |
          * api reasonable.  You can provide public methods for those you
648 |  |
          * actually need in TurbineUser.
649 |  |
          */
650 |  |
         protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineGroup(Criteria criteria)
651 |  |
             throws TorqueException
652 |  |
         {
653 | 0 |
             if (collTurbineUserGroupRoles == null)
654 |  |
             {
655 | 0 |
                 if (isNew())
656 |  |
                 {
657 | 0 |
                    collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
658 |  |
                 }
659 |  |
                 else
660 |  |
                 {
661 | 0 |
                     criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
662 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
663 |  |
                 }
664 |  |
             }
665 |  |
             else
666 |  |
             {
667 |  |
                 // the following code is to determine if a new query is
668 |  |
                 // called for.  If the criteria is the same as the last
669 |  |
                 // one, just return the collection.
670 | 0 |
                 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
671 | 0 |
                 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
672 |  |
                 {
673 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineGroup(criteria);
674 |  |
                 }
675 |  |
             }
676 | 0 |
             lastTurbineUserGroupRolesCriteria = criteria;
677 |  |
678 | 0 |
             return collTurbineUserGroupRoles;
679 |  |
         }
680 |  |
681 |  |
682 |  |
683 |  |
684 |  |
685 |  |
686 |  |
687 |  |
688 |  |
689 |  |
         /**
690 |  |
          * If this collection has already been initialized with
691 |  |
          * an identical criteria, it returns the collection.
692 |  |
          * Otherwise if this TurbineUser is new, it will return
693 |  |
          * an empty collection; or if this TurbineUser has previously
694 |  |
          * been saved, it will retrieve related TurbineUserGroupRoles from storage.
695 |  |
          *
696 |  |
          * This method is protected by default in order to keep the public
697 |  |
          * api reasonable.  You can provide public methods for those you
698 |  |
          * actually need in TurbineUser.
699 |  |
          */
700 |  |
         protected List<TurbineUserGroupRole> getTurbineUserGroupRolesJoinTurbineRole(Criteria criteria)
701 |  |
             throws TorqueException
702 |  |
         {
703 | 0 |
             if (collTurbineUserGroupRoles == null)
704 |  |
             {
705 | 0 |
                 if (isNew())
706 |  |
                 {
707 | 0 |
                    collTurbineUserGroupRoles = new ArrayList<TurbineUserGroupRole>();
708 |  |
                 }
709 |  |
                 else
710 |  |
                 {
711 | 0 |
                     criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
712 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
713 |  |
                 }
714 |  |
             }
715 |  |
             else
716 |  |
             {
717 |  |
                 // the following code is to determine if a new query is
718 |  |
                 // called for.  If the criteria is the same as the last
719 |  |
                 // one, just return the collection.
720 | 0 |
                 criteria.add(TurbineUserGroupRolePeer.USER_ID, getUserId());
721 | 0 |
                 if (!lastTurbineUserGroupRolesCriteria.equals(criteria))
722 |  |
                 {
723 | 0 |
                     collTurbineUserGroupRoles = TurbineUserGroupRolePeer.doSelectJoinTurbineRole(criteria);
724 |  |
                 }
725 |  |
             }
726 | 0 |
             lastTurbineUserGroupRolesCriteria = criteria;
727 |  |
728 | 0 |
             return collTurbineUserGroupRoles;
729 |  |
         }
730 |  |
731 |  |
732 |  |
733 |  |
734 | 0 |
         private static List<String> fieldNames = null;
735 |  |
736 |  |
         /**
737 |  |
          * Generate a list of field names.
738 |  |
          *
739 |  |
          * @return a list of field names
740 |  |
          */
741 |  |
         public static synchronized List<String> getFieldNames()
742 |  |
         {
743 | 0 |
             if (fieldNames == null)
744 |  |
             {
745 | 0 |
                 fieldNames = new ArrayList<String>();
746 | 0 |
                 fieldNames.add("UserId");
747 | 0 |
                 fieldNames.add("UserName");
748 | 0 |
                 fieldNames.add("Password");
749 | 0 |
                 fieldNames.add("FirstName");
750 | 0 |
                 fieldNames.add("LastName");
751 | 0 |
                 fieldNames.add("Email");
752 | 0 |
                 fieldNames.add("Confirmed");
753 | 0 |
                 fieldNames.add("Modified");
754 | 0 |
                 fieldNames.add("CreateDate");
755 | 0 |
                 fieldNames.add("LastLogin");
756 | 0 |
                 fieldNames.add("Objectdata");
757 | 0 |
                 fieldNames = Collections.unmodifiableList(fieldNames);
758 |  |
             }
759 | 0 |
             return fieldNames;
760 |  |
         }
761 |  |
762 |  |
         /**
763 |  |
          * Retrieves a field from the object by field (Java) name passed in as a String.
764 |  |
          *
765 |  |
          * @param name field name
766 |  |
          * @return value
767 |  |
          */
768 |  |
         public Object getByName(String name)
769 |  |
         {
770 | 0 |
             if (name.equals("UserId"))
771 |  |
             {
772 | 0 |
                 return new Integer(getUserId());
773 |  |
             }
774 | 0 |
             if (name.equals("UserName"))
775 |  |
             {
776 | 0 |
                 return getUserName();
777 |  |
             }
778 | 0 |
             if (name.equals("Password"))
779 |  |
             {
780 | 0 |
                 return getPassword();
781 |  |
             }
782 | 0 |
             if (name.equals("FirstName"))
783 |  |
             {
784 | 0 |
                 return getFirstName();
785 |  |
             }
786 | 0 |
             if (name.equals("LastName"))
787 |  |
             {
788 | 0 |
                 return getLastName();
789 |  |
             }
790 | 0 |
             if (name.equals("Email"))
791 |  |
             {
792 | 0 |
                 return getEmail();
793 |  |
             }
794 | 0 |
             if (name.equals("Confirmed"))
795 |  |
             {
796 | 0 |
                 return getConfirmed();
797 |  |
             }
798 | 0 |
             if (name.equals("Modified"))
799 |  |
             {
800 | 0 |
                 return getModified();
801 |  |
             }
802 | 0 |
             if (name.equals("CreateDate"))
803 |  |
             {
804 | 0 |
                 return getCreateDate();
805 |  |
             }
806 | 0 |
             if (name.equals("LastLogin"))
807 |  |
             {
808 | 0 |
                 return getLastLogin();
809 |  |
             }
810 | 0 |
             if (name.equals("Objectdata"))
811 |  |
             {
812 | 0 |
                 return getObjectdata();
813 |  |
             }
814 | 0 |
             return null;
815 |  |
         }
816 |  |
817 |  |
         /**
818 |  |
          * Set a field in the object by field (Java) name.
819 |  |
          *
820 |  |
          * @param name field name
821 |  |
          * @param value field value
822 |  |
          * @return True if value was set, false if not (invalid name / protected field).
823 |  |
          * @throws IllegalArgumentException if object type of value does not match field object type.
824 |  |
          * @throws TorqueException If a problem occurs with the set[Field] method.
825 |  |
          */
826 |  |
         public boolean setByName(String name, Object value )
827 |  |
             throws TorqueException, IllegalArgumentException
828 |  |
         {
829 | 0 |
             if (name.equals("UserId"))
830 |  |
             {
831 | 0 |
                 if (value == null || ! (Integer.class.isInstance(value)))
832 |  |
                 {
833 | 0 |
                     throw new IllegalArgumentException("setByName: value parameter was null or not an Integer object.");
834 |  |
                 }
835 | 0 |
                 setUserId(((Integer) value).intValue());
836 | 0 |
                 return true;
837 |  |
             }
838 | 0 |
             if (name.equals("UserName"))
839 |  |
             {
840 |  |
                 // Object fields can be null
841 | 0 |
                 if (value != null && ! String.class.isInstance(value))
842 |  |
                 {
843 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
844 |  |
                 }
845 | 0 |
                 setUserName((String) value);
846 | 0 |
                 return true;
847 |  |
             }
848 | 0 |
             if (name.equals("Password"))
849 |  |
             {
850 |  |
                 // Object fields can be null
851 | 0 |
                 if (value != null && ! String.class.isInstance(value))
852 |  |
                 {
853 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
854 |  |
                 }
855 | 0 |
                 setPassword((String) value);
856 | 0 |
                 return true;
857 |  |
             }
858 | 0 |
             if (name.equals("FirstName"))
859 |  |
             {
860 |  |
                 // Object fields can be null
861 | 0 |
                 if (value != null && ! String.class.isInstance(value))
862 |  |
                 {
863 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
864 |  |
                 }
865 | 0 |
                 setFirstName((String) value);
866 | 0 |
                 return true;
867 |  |
             }
868 | 0 |
             if (name.equals("LastName"))
869 |  |
             {
870 |  |
                 // Object fields can be null
871 | 0 |
                 if (value != null && ! String.class.isInstance(value))
872 |  |
                 {
873 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
874 |  |
                 }
875 | 0 |
                 setLastName((String) value);
876 | 0 |
                 return true;
877 |  |
             }
878 | 0 |
             if (name.equals("Email"))
879 |  |
             {
880 |  |
                 // Object fields can be null
881 | 0 |
                 if (value != null && ! String.class.isInstance(value))
882 |  |
                 {
883 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
884 |  |
                 }
885 | 0 |
                 setEmail((String) value);
886 | 0 |
                 return true;
887 |  |
             }
888 | 0 |
             if (name.equals("Confirmed"))
889 |  |
             {
890 |  |
                 // Object fields can be null
891 | 0 |
                 if (value != null && ! String.class.isInstance(value))
892 |  |
                 {
893 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
894 |  |
                 }
895 | 0 |
                 setConfirmed((String) value);
896 | 0 |
                 return true;
897 |  |
             }
898 | 0 |
             if (name.equals("Modified"))
899 |  |
             {
900 |  |
                 // Object fields can be null
901 | 0 |
                 if (value != null && ! Date.class.isInstance(value))
902 |  |
                 {
903 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
904 |  |
                 }
905 | 0 |
                 setModified((Date) value);
906 | 0 |
                 return true;
907 |  |
             }
908 | 0 |
             if (name.equals("CreateDate"))
909 |  |
             {
910 |  |
                 // Object fields can be null
911 | 0 |
                 if (value != null && ! Date.class.isInstance(value))
912 |  |
                 {
913 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
914 |  |
                 }
915 | 0 |
                 setCreateDate((Date) value);
916 | 0 |
                 return true;
917 |  |
             }
918 | 0 |
             if (name.equals("LastLogin"))
919 |  |
             {
920 |  |
                 // Object fields can be null
921 | 0 |
                 if (value != null && ! Date.class.isInstance(value))
922 |  |
                 {
923 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
924 |  |
                 }
925 | 0 |
                 setLastLogin((Date) value);
926 | 0 |
                 return true;
927 |  |
             }
928 | 0 |
             if (name.equals("Objectdata"))
929 |  |
             {
930 |  |
                 // Object fields can be null
931 | 0 |
                 if (value != null && ! byte[].class.isInstance(value))
932 |  |
                 {
933 | 0 |
                     throw new IllegalArgumentException("Invalid type of object specified for value in setByName");
934 |  |
                 }
935 | 0 |
                 setObjectdata((byte[]) value);
936 | 0 |
                 return true;
937 |  |
             }
938 | 0 |
             return false;
939 |  |
         }
940 |  |
941 |  |
         /**
942 |  |
          * Retrieves a field from the object by name passed in
943 |  |
          * as a String.  The String must be one of the static
944 |  |
          * Strings defined in this Class' Peer.
945 |  |
          *
946 |  |
          * @param name peer name
947 |  |
          * @return value
948 |  |
          */
949 |  |
         public Object getByPeerName(String name)
950 |  |
         {
951 | 0 |
             if (name.equals(TurbineUserPeer.USER_ID))
952 |  |
             {
953 | 0 |
                 return new Integer(getUserId());
954 |  |
             }
955 | 0 |
             if (name.equals(TurbineUserPeer.LOGIN_NAME))
956 |  |
             {
957 | 0 |
                 return getUserName();
958 |  |
             }
959 | 0 |
             if (name.equals(TurbineUserPeer.PASSWORD_VALUE))
960 |  |
             {
961 | 0 |
                 return getPassword();
962 |  |
             }
963 | 0 |
             if (name.equals(TurbineUserPeer.FIRST_NAME))
964 |  |
             {
965 | 0 |
                 return getFirstName();
966 |  |
             }
967 | 0 |
             if (name.equals(TurbineUserPeer.LAST_NAME))
968 |  |
             {
969 | 0 |
                 return getLastName();
970 |  |
             }
971 | 0 |
             if (name.equals(TurbineUserPeer.EMAIL))
972 |  |
             {
973 | 0 |
                 return getEmail();
974 |  |
             }
975 | 0 |
             if (name.equals(TurbineUserPeer.CONFIRM_VALUE))
976 |  |
             {
977 | 0 |
                 return getConfirmed();
978 |  |
             }
979 | 0 |
             if (name.equals(TurbineUserPeer.MODIFIED))
980 |  |
             {
981 | 0 |
                 return getModified();
982 |  |
             }
983 | 0 |
             if (name.equals(TurbineUserPeer.CREATED))
984 |  |
             {
985 | 0 |
                 return getCreateDate();
986 |  |
             }
987 | 0 |
             if (name.equals(TurbineUserPeer.LAST_LOGIN))
988 |  |
             {
989 | 0 |
                 return getLastLogin();
990 |  |
             }
991 | 0 |
             if (name.equals(TurbineUserPeer.OBJECTDATA))
992 |  |
             {
993 | 0 |
                 return getObjectdata();
994 |  |
             }
995 | 0 |
             return null;
996 |  |
         }
997 |  |
998 |  |
         /**
999 |  |
          * Set field values by Peer Field Name
1000 |  |
          *
1001 |  |
          * @param name field name
1002 |  |
          * @param value field value
1003 |  |
          * @return True if value was set, false if not (invalid name / protected field).
1004 |  |
          * @throws IllegalArgumentException if object type of value does not match field object type.
1005 |  |
          * @throws TorqueException If a problem occurs with the set[Field] method.
1006 |  |
          */
1007 |  |
         public boolean setByPeerName(String name, Object value)
1008 |  |
             throws TorqueException, IllegalArgumentException
1009 |  |
         {
1010 | 0 |
           if (TurbineUserPeer.USER_ID.equals(name))
1011 |  |
             {
1012 | 0 |
                 return setByName("UserId", value);
1013 |  |
             }
1014 | 0 |
           if (TurbineUserPeer.LOGIN_NAME.equals(name))
1015 |  |
             {
1016 | 0 |
                 return setByName("UserName", value);
1017 |  |
             }
1018 | 0 |
           if (TurbineUserPeer.PASSWORD_VALUE.equals(name))
1019 |  |
             {
1020 | 0 |
                 return setByName("Password", value);
1021 |  |
             }
1022 | 0 |
           if (TurbineUserPeer.FIRST_NAME.equals(name))
1023 |  |
             {
1024 | 0 |
                 return setByName("FirstName", value);
1025 |  |
             }
1026 | 0 |
           if (TurbineUserPeer.LAST_NAME.equals(name))
1027 |  |
             {
1028 | 0 |
                 return setByName("LastName", value);
1029 |  |
             }
1030 | 0 |
           if (TurbineUserPeer.EMAIL.equals(name))
1031 |  |
             {
1032 | 0 |
                 return setByName("Email", value);
1033 |  |
             }
1034 | 0 |
           if (TurbineUserPeer.CONFIRM_VALUE.equals(name))
1035 |  |
             {
1036 | 0 |
                 return setByName("Confirmed", value);
1037 |  |
             }
1038 | 0 |
           if (TurbineUserPeer.MODIFIED.equals(name))
1039 |  |
             {
1040 | 0 |
                 return setByName("Modified", value);
1041 |  |
             }
1042 | 0 |
           if (TurbineUserPeer.CREATED.equals(name))
1043 |  |
             {
1044 | 0 |
                 return setByName("CreateDate", value);
1045 |  |
             }
1046 | 0 |
           if (TurbineUserPeer.LAST_LOGIN.equals(name))
1047 |  |
             {
1048 | 0 |
                 return setByName("LastLogin", value);
1049 |  |
             }
1050 | 0 |
           if (TurbineUserPeer.OBJECTDATA.equals(name))
1051 |  |
             {
1052 | 0 |
                 return setByName("Objectdata", value);
1053 |  |
             }
1054 | 0 |
             return false;
1055 |  |
         }
1056 |  |
1057 |  |
         /**
1058 |  |
          * Retrieves a field from the object by Position as specified
1059 |  |
          * in the xml schema.  Zero-based.
1060 |  |
          *
1061 |  |
          * @param pos position in xml schema
1062 |  |
          * @return value
1063 |  |
          */
1064 |  |
         public Object getByPosition(int pos)
1065 |  |
         {
1066 | 0 |
             if (pos == 0)
1067 |  |
             {
1068 | 0 |
                 return new Integer(getUserId());
1069 |  |
             }
1070 | 0 |
             if (pos == 1)
1071 |  |
             {
1072 | 0 |
                 return getUserName();
1073 |  |
             }
1074 | 0 |
             if (pos == 2)
1075 |  |
             {
1076 | 0 |
                 return getPassword();
1077 |  |
             }
1078 | 0 |
             if (pos == 3)
1079 |  |
             {
1080 | 0 |
                 return getFirstName();
1081 |  |
             }
1082 | 0 |
             if (pos == 4)
1083 |  |
             {
1084 | 0 |
                 return getLastName();
1085 |  |
             }
1086 | 0 |
             if (pos == 5)
1087 |  |
             {
1088 | 0 |
                 return getEmail();
1089 |  |
             }
1090 | 0 |
             if (pos == 6)
1091 |  |
             {
1092 | 0 |
                 return getConfirmed();
1093 |  |
             }
1094 | 0 |
             if (pos == 7)
1095 |  |
             {
1096 | 0 |
                 return getModified();
1097 |  |
             }
1098 | 0 |
             if (pos == 8)
1099 |  |
             {
1100 | 0 |
                 return getCreateDate();
1101 |  |
             }
1102 | 0 |
             if (pos == 9)
1103 |  |
             {
1104 | 0 |
                 return getLastLogin();
1105 |  |
             }
1106 | 0 |
             if (pos == 10)
1107 |  |
             {
1108 | 0 |
                 return getObjectdata();
1109 |  |
             }
1110 | 0 |
             return null;
1111 |  |
         }
1112 |  |
1113 |  |
         /**
1114 |  |
          * Set field values by its position (zero based) in the XML schema.
1115 |  |
          *
1116 |  |
          * @param position The field position
1117 |  |
          * @param value field value
1118 |  |
          * @return True if value was set, false if not (invalid position / protected field).
1119 |  |
          * @throws IllegalArgumentException if object type of value does not match field object type.
1120 |  |
          * @throws TorqueException If a problem occurs with the set[Field] method.
1121 |  |
          */
1122 |  |
         public boolean setByPosition(int position, Object value)
1123 |  |
             throws TorqueException, IllegalArgumentException
1124 |  |
         {
1125 | 0 |
         if (position == 0)
1126 |  |
             {
1127 | 0 |
                 return setByName("UserId", value);
1128 |  |
             }
1129 | 0 |
         if (position == 1)
1130 |  |
             {
1131 | 0 |
                 return setByName("UserName", value);
1132 |  |
             }
1133 | 0 |
         if (position == 2)
1134 |  |
             {
1135 | 0 |
                 return setByName("Password", value);
1136 |  |
             }
1137 | 0 |
         if (position == 3)
1138 |  |
             {
1139 | 0 |
                 return setByName("FirstName", value);
1140 |  |
             }
1141 | 0 |
         if (position == 4)
1142 |  |
             {
1143 | 0 |
                 return setByName("LastName", value);
1144 |  |
             }
1145 | 0 |
         if (position == 5)
1146 |  |
             {
1147 | 0 |
                 return setByName("Email", value);
1148 |  |
             }
1149 | 0 |
         if (position == 6)
1150 |  |
             {
1151 | 0 |
                 return setByName("Confirmed", value);
1152 |  |
             }
1153 | 0 |
         if (position == 7)
1154 |  |
             {
1155 | 0 |
                 return setByName("Modified", value);
1156 |  |
             }
1157 | 0 |
         if (position == 8)
1158 |  |
             {
1159 | 0 |
                 return setByName("CreateDate", value);
1160 |  |
             }
1161 | 0 |
         if (position == 9)
1162 |  |
             {
1163 | 0 |
                 return setByName("LastLogin", value);
1164 |  |
             }
1165 | 0 |
         if (position == 10)
1166 |  |
             {
1167 | 0 |
                 return setByName("Objectdata", value);
1168 |  |
             }
1169 | 0 |
             return false;
1170 |  |
         }
1171 |  |
1172 |  |
         /**
1173 |  |
          * Stores the object in the database.  If the object is new,
1174 |  |
          * it inserts it; otherwise an update is performed.
1175 |  |
          *
1176 |  |
          * @throws Exception
1177 |  |
          */
1178 |  |
         public void save() throws Exception
1179 |  |
         {
1180 | 0 |
             save(TurbineUserPeer.DATABASE_NAME);
1181 | 0 |
         }
1182 |  |
1183 |  |
         /**
1184 |  |
          * Stores the object in the database.  If the object is new,
1185 |  |
          * it inserts it; otherwise an update is performed.
1186 |  |
          * Note: this code is here because the method body is
1187 |  |
          * auto-generated conditionally and therefore needs to be
1188 |  |
          * in this file instead of in the super class, BaseObject.
1189 |  |
          *
1190 |  |
          * @param dbName
1191 |  |
          * @throws TorqueException
1192 |  |
          */
1193 |  |
         public void save(String dbName) throws TorqueException
1194 |  |
         {
1195 | 0 |
             Connection con = null;
1196 |  |
             try
1197 |  |
             {
1198 | 0 |
                 con = Transaction.begin(dbName);
1199 | 0 |
                 save(con);
1200 | 0 |
                 Transaction.commit(con);
1201 |  |
             }
1202 | 0 |
             catch(TorqueException e)
1203 |  |
             {
1204 | 0 |
                 Transaction.safeRollback(con);
1205 | 0 |
                 throw e;
1206 | 0 |
             }
1207 | 0 |
         }
1208 |  |
1209 |  |
         /** flag to prevent endless save loop, if this object is referenced
1210 |  |
             by another object which falls in this transaction. */
1211 | 0 |
         private boolean alreadyInSave = false;
1212 |  |
         /**
1213 |  |
          * Stores the object in the database.  If the object is new,
1214 |  |
          * it inserts it; otherwise an update is performed.  This method
1215 |  |
          * is meant to be used as part of a transaction, otherwise use
1216 |  |
          * the save() method and the connection details will be handled
1217 |  |
          * internally
1218 |  |
          *
1219 |  |
          * @param con
1220 |  |
          * @throws TorqueException
1221 |  |
          */
1222 |  |
         public void save(Connection con) throws TorqueException
1223 |  |
         {
1224 | 0 |
             if (!alreadyInSave)
1225 |  |
             {
1226 | 0 |
                 alreadyInSave = true;
1227 |  |
1228 |  |
1229 |  |
1230 |  |
                 // If this object has been modified, then save it to the database.
1231 | 0 |
                 if (isModified())
1232 |  |
                 {
1233 | 0 |
                     if (isNew())
1234 |  |
                     {
1235 | 0 |
                         TurbineUserPeer.doInsert((TurbineUser) this, con);
1236 | 0 |
                         setNew(false);
1237 |  |
                     }
1238 |  |
                     else
1239 |  |
                     {
1240 | 0 |
                         TurbineUserPeer.doUpdate((TurbineUser) this, con);
1241 |  |
                     }
1242 |  |
                 }
1243 |  |
1244 |  |
1245 | 0 |
                 if (collTurbineUserGroupRoles != null)
1246 |  |
                 {
1247 | 0 |
                     for (int i = 0; i < collTurbineUserGroupRoles.size(); i++)
1248 |  |
                     {
1249 | 0 |
                         ((TurbineUserGroupRole) collTurbineUserGroupRoles.get(i)).save(con);
1250 |  |
                     }
1251 |  |
                 }
1252 | 0 |
                 alreadyInSave = false;
1253 |  |
             }
1254 | 0 |
         }
1255 |  |
1256 |  |
1257 |  |
         /**
1258 |  |
          * Set the PrimaryKey using ObjectKey.
1259 |  |
          *
1260 |  |
          * @param key userId ObjectKey
1261 |  |
          */
1262 |  |
         public void setPrimaryKey(ObjectKey key)
1263 |  |
             throws TorqueException
1264 |  |
         {
1265 | 0 |
             setUserId(((NumberKey) key).intValue());
1266 | 0 |
         }
1267 |  |
1268 |  |
         /**
1269 |  |
          * Set the PrimaryKey using a String.
1270 |  |
          *
1271 |  |
          * @param key
1272 |  |
          */
1273 |  |
         public void setPrimaryKey(String key) throws TorqueException
1274 |  |
         {
1275 | 0 |
             setUserId(Integer.parseInt(key));
1276 | 0 |
         }
1277 |  |
1278 |  |
1279 |  |
         /**
1280 |  |
          * returns an id that differentiates this object from others
1281 |  |
          * of its class.
1282 |  |
          */
1283 |  |
         public ObjectKey getPrimaryKey()
1284 |  |
         {
1285 | 0 |
             return SimpleKey.keyFor(getUserId());
1286 |  |
         }
1287 |  |
1288 |  |
1289 |  |
         /**
1290 |  |
          * Makes a copy of this object.
1291 |  |
          * It creates a new object filling in the simple attributes.
1292 |  |
          * It then fills all the association collections and sets the
1293 |  |
          * related objects to isNew=true.
1294 |  |
          */
1295 |  |
         public TurbineUser copy() throws TorqueException
1296 |  |
         {
1297 | 0 |
             return copy(true);
1298 |  |
         }
1299 |  |
1300 |  |
         /**
1301 |  |
          * Makes a copy of this object using connection.
1302 |  |
          * It creates a new object filling in the simple attributes.
1303 |  |
          * It then fills all the association collections and sets the
1304 |  |
          * related objects to isNew=true.
1305 |  |
          *
1306 |  |
          * @param con the database connection to read associated objects.
1307 |  |
          */
1308 |  |
         public TurbineUser copy(Connection con) throws TorqueException
1309 |  |
         {
1310 | 0 |
             return copy(true, con);
1311 |  |
         }
1312 |  |
1313 |  |
         /**
1314 |  |
          * Makes a copy of this object.
1315 |  |
          * It creates a new object filling in the simple attributes.
1316 |  |
          * If the parameter deepcopy is true, it then fills all the
1317 |  |
          * association collections and sets the related objects to
1318 |  |
          * isNew=true.
1319 |  |
          *
1320 |  |
          * @param deepcopy whether to copy the associated objects.
1321 |  |
          */
1322 |  |
         public TurbineUser copy(boolean deepcopy) throws TorqueException
1323 |  |
         {
1324 | 0 |
             return copyInto(new TurbineUser(), deepcopy);
1325 |  |
         }
1326 |  |
1327 |  |
         /**
1328 |  |
          * Makes a copy of this object using connection.
1329 |  |
          * It creates a new object filling in the simple attributes.
1330 |  |
          * If the parameter deepcopy is true, it then fills all the
1331 |  |
          * association collections and sets the related objects to
1332 |  |
          * isNew=true.
1333 |  |
          *
1334 |  |
          * @param deepcopy whether to copy the associated objects.
1335 |  |
          * @param con the database connection to read associated objects.
1336 |  |
          */
1337 |  |
         public TurbineUser copy(boolean deepcopy, Connection con) throws TorqueException
1338 |  |
         {
1339 | 0 |
             return copyInto(new TurbineUser(), deepcopy, con);
1340 |  |
         }
1341 |  |
1342 |  |
         /**
1343 |  |
          * Fills the copyObj with the contents of this object.
1344 |  |
          * The associated objects are also copied and treated as new objects.
1345 |  |
          *
1346 |  |
          * @param copyObj the object to fill.
1347 |  |
          */
1348 |  |
         protected TurbineUser copyInto(TurbineUser copyObj) throws TorqueException
1349 |  |
         {
1350 | 0 |
             return copyInto(copyObj, true);
1351 |  |
         }
1352 |  |
1353 |  |
1354 |  |
         /**
1355 |  |
          * Fills the copyObj with the contents of this object using connection.
1356 |  |
          * The associated objects are also copied and treated as new objects.
1357 |  |
          *
1358 |  |
          * @param copyObj the object to fill.
1359 |  |
          * @param con the database connection to read associated objects.
1360 |  |
          */
1361 |  |
         protected TurbineUser copyInto(TurbineUser copyObj, Connection con) throws TorqueException
1362 |  |
         {
1363 | 0 |
             return copyInto(copyObj, true, con);
1364 |  |
         }
1365 |  |
1366 |  |
         /**
1367 |  |
          * Fills the copyObj with the contents of this object.
1368 |  |
          * If deepcopy is true, The associated objects are also copied
1369 |  |
          * and treated as new objects.
1370 |  |
          *
1371 |  |
          * @param copyObj the object to fill.
1372 |  |
          * @param deepcopy whether the associated objects should be copied.
1373 |  |
          */
1374 |  |
         protected TurbineUser copyInto(TurbineUser copyObj, boolean deepcopy) throws TorqueException
1375 |  |
         {
1376 | 0 |
             copyObj.setUserId(userId);
1377 | 0 |
             copyObj.setUserName(userName);
1378 | 0 |
             copyObj.setPassword(password);
1379 | 0 |
             copyObj.setFirstName(firstName);
1380 | 0 |
             copyObj.setLastName(lastName);
1381 | 0 |
             copyObj.setEmail(email);
1382 | 0 |
             copyObj.setConfirmed(confirmed);
1383 | 0 |
             copyObj.setModified(modified);
1384 | 0 |
             copyObj.setCreateDate(createDate);
1385 | 0 |
             copyObj.setLastLogin(lastLogin);
1386 | 0 |
             copyObj.setObjectdata(objectdata);
1387 |  |
1388 | 0 |
             copyObj.setUserId( 0);
1389 |  |
1390 | 0 |
             if (deepcopy)
1391 |  |
             {
1392 |  |
1393 |  |
1394 | 0 |
             List<TurbineUserGroupRole> vTurbineUserGroupRoles = getTurbineUserGroupRoles();
1395 | 0 |
             if (vTurbineUserGroupRoles != null)
1396 |  |
             {
1397 | 0 |
                 for (int i = 0; i < vTurbineUserGroupRoles.size(); i++)
1398 |  |
                 {
1399 | 0 |
                     TurbineUserGroupRole obj =  vTurbineUserGroupRoles.get(i);
1400 | 0 |
                     copyObj.addTurbineUserGroupRole(obj.copy());
1401 |  |
                 }
1402 |  |
             }
1403 |  |
             else
1404 |  |
             {
1405 | 0 |
                 copyObj.collTurbineUserGroupRoles = null;
1406 |  |
             }
1407 |  |
             }
1408 | 0 |
             return copyObj;
1409 |  |
         }
1410 |  |
1411 |  |
1412 |  |
         /**
1413 |  |
          * Fills the copyObj with the contents of this object using connection.
1414 |  |
          * If deepcopy is true, The associated objects are also copied
1415 |  |
          * and treated as new objects.
1416 |  |
          *
1417 |  |
          * @param copyObj the object to fill.
1418 |  |
          * @param deepcopy whether the associated objects should be copied.
1419 |  |
          * @param con the database connection to read associated objects.
1420 |  |
          */
1421 |  |
         protected TurbineUser copyInto(TurbineUser copyObj, boolean deepcopy, Connection con) throws TorqueException
1422 |  |
         {
1423 | 0 |
             copyObj.setUserId(userId);
1424 | 0 |
             copyObj.setUserName(userName);
1425 | 0 |
             copyObj.setPassword(password);
1426 | 0 |
             copyObj.setFirstName(firstName);
1427 | 0 |
             copyObj.setLastName(lastName);
1428 | 0 |
             copyObj.setEmail(email);
1429 | 0 |
             copyObj.setConfirmed(confirmed);
1430 | 0 |
             copyObj.setModified(modified);
1431 | 0 |
             copyObj.setCreateDate(createDate);
1432 | 0 |
             copyObj.setLastLogin(lastLogin);
1433 | 0 |
             copyObj.setObjectdata(objectdata);
1434 |  |
1435 | 0 |
             copyObj.setUserId( 0);
1436 |  |
1437 | 0 |
             if (deepcopy)
1438 |  |
             {
1439 |  |
1440 |  |
1441 | 0 |
             List<TurbineUserGroupRole> vTurbineUserGroupRoles = getTurbineUserGroupRoles(con);
1442 | 0 |
             if (vTurbineUserGroupRoles != null)
1443 |  |
             {
1444 | 0 |
                 for (int i = 0; i < vTurbineUserGroupRoles.size(); i++)
1445 |  |
                 {
1446 | 0 |
                     TurbineUserGroupRole obj =  vTurbineUserGroupRoles.get(i);
1447 | 0 |
                     copyObj.addTurbineUserGroupRole(obj.copy(con), con);
1448 |  |
                 }
1449 |  |
             }
1450 |  |
             else
1451 |  |
             {
1452 | 0 |
                 copyObj.collTurbineUserGroupRoles = null;
1453 |  |
             }
1454 |  |
             }
1455 | 0 |
             return copyObj;
1456 |  |
         }
1457 |  |
1458 |  |
1459 |  |
1460 |  |
         /**
1461 |  |
          * returns a peer instance associated with this om.  Since Peer classes
1462 |  |
          * are not to have any instance attributes, this method returns the
1463 |  |
          * same instance for all member of this class. The method could therefore
1464 |  |
          * be static, but this would prevent one from overriding the behavior.
1465 |  |
          */
1466 |  |
         public TurbineUserPeer getPeer()
1467 |  |
         {
1468 | 0 |
             return peer;
1469 |  |
         }
1470 |  |
1471 |  |
         /**
1472 |  |
          * Retrieves the TableMap object related to this Table data without
1473 |  |
          * compiler warnings of using getPeer().getTableMap().
1474 |  |
          *
1475 |  |
          * @return The associated TableMap object.
1476 |  |
          */
1477 |  |
         public TableMap getTableMap() throws TorqueException
1478 |  |
         {
1479 | 0 |
             return TurbineUserPeer.getTableMap();
1480 |  |
         }
1481 |  |
1482 |  |
1483 |  |
         public String toString()
1484 |  |
         {
1485 | 0 |
             StringBuffer str = new StringBuffer();
1486 | 0 |
             str.append("TurbineUser:\n");
1487 | 0 |
             str.append("UserId = ")
1488 |  |
                .append(getUserId())
1489 |  |
                .append("\n");
1490 | 0 |
             str.append("UserName = ")
1491 |  |
                .append(getUserName())
1492 |  |
                .append("\n");
1493 | 0 |
             str.append("Password = ")
1494 |  |
                .append(getPassword())
1495 |  |
                .append("\n");
1496 | 0 |
             str.append("FirstName = ")
1497 |  |
                .append(getFirstName())
1498 |  |
                .append("\n");
1499 | 0 |
             str.append("LastName = ")
1500 |  |
                .append(getLastName())
1501 |  |
                .append("\n");
1502 | 0 |
             str.append("Email = ")
1503 |  |
                .append(getEmail())
1504 |  |
                .append("\n");
1505 | 0 |
             str.append("Confirmed = ")
1506 |  |
                .append(getConfirmed())
1507 |  |
                .append("\n");
1508 | 0 |
             str.append("Modified = ")
1509 |  |
                .append(getModified())
1510 |  |
                .append("\n");
1511 | 0 |
             str.append("CreateDate = ")
1512 |  |
                .append(getCreateDate())
1513 |  |
                .append("\n");
1514 | 0 |
             str.append("LastLogin = ")
1515 |  |
                .append(getLastLogin())
1516 |  |
                .append("\n");
1517 | 0 |
             str.append("Objectdata = ")
1518 |  |
                .append("<binary>")
1519 |  |
                .append("\n");
1520 | 0 |
             return(str.toString());
1521 |  |
         }
1522 |  |
     }