KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > om > BaseMITList


1 package org.tigris.scarab.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.fulcrum.intake.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 /**
28  * You should not use this class directly. It should not even be
29  * extended all references should be to MITList
30  */

31 public abstract class BaseMITList extends BaseObject
32     implements org.apache.fulcrum.intake.Retrievable
33 {
34     /** The Peer class */
35     private static final MITListPeer peer =
36         new MITListPeer();
37
38         
39     /** The value for the listId field */
40     private Long JavaDoc listId;
41       
42     /** The value for the name field */
43     private String JavaDoc name;
44                                                                 
45     /** The value for the active field */
46     private boolean active = true;
47                                                                 
48     /** The value for the modifiable field */
49     private boolean modifiable = true;
50       
51     /** The value for the userId field */
52     private Integer JavaDoc userId;
53   
54     
55     /**
56      * Get the ListId
57      *
58      * @return Long
59      */

60     public Long JavaDoc getListId()
61     {
62         return listId;
63     }
64
65                                               
66     /**
67      * Set the value of ListId
68      *
69      * @param v new value
70      */

71     public void setListId(Long JavaDoc v) throws TorqueException
72     {
73     
74                   if (!ObjectUtils.equals(this.listId, v))
75               {
76             this.listId = v;
77             setModified(true);
78         }
79     
80           
81                                   
82         // update associated MITListItem
83
if (collMITListItems != null)
84         {
85             for (int i = 0; i < collMITListItems.size(); i++)
86             {
87                 ((MITListItem) collMITListItems.get(i))
88                         .setListId(v);
89             }
90         }
91                                           
92         // update associated RModuleUserAttribute
93
if (collRModuleUserAttributes != null)
94         {
95             for (int i = 0; i < collRModuleUserAttributes.size(); i++)
96             {
97                 ((RModuleUserAttribute) collRModuleUserAttributes.get(i))
98                         .setListId(v);
99             }
100         }
101                                           
102         // update associated Query
103
if (collQuerys != null)
104         {
105             for (int i = 0; i < collQuerys.size(); i++)
106             {
107                 ((Query) collQuerys.get(i))
108                         .setListId(v);
109             }
110         }
111                       }
112   
113     /**
114      * Get the Name
115      *
116      * @return String
117      */

118     public String JavaDoc getName()
119     {
120         return name;
121     }
122
123                         
124     /**
125      * Set the value of Name
126      *
127      * @param v new value
128      */

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

146     public boolean getActive()
147     {
148         return active;
149     }
150
151                         
152     /**
153      * Set the value of Active
154      *
155      * @param v new value
156      */

157     public void setActive(boolean v)
158     {
159     
160                   if (this.active != v)
161               {
162             this.active = v;
163             setModified(true);
164         }
165     
166           
167               }
168   
169     /**
170      * Get the Modifiable
171      *
172      * @return boolean
173      */

174     public boolean getModifiable()
175     {
176         return modifiable;
177     }
178
179                         
180     /**
181      * Set the value of Modifiable
182      *
183      * @param v new value
184      */

185     public void setModifiable(boolean v)
186     {
187     
188                   if (this.modifiable != v)
189               {
190             this.modifiable = v;
191             setModified(true);
192         }
193     
194           
195               }
196   
197     /**
198      * Get the UserId
199      *
200      * @return Integer
201      */

202     public Integer JavaDoc getUserId()
203     {
204         return userId;
205     }
206
207                               
208     /**
209      * Set the value of UserId
210      *
211      * @param v new value
212      */

213     public void setUserId(Integer JavaDoc v) throws TorqueException
214     {
215     
216                   if (!ObjectUtils.equals(this.userId, v))
217               {
218             this.userId = v;
219             setModified(true);
220         }
221     
222                                           
223                 if (aScarabUser != null && !ObjectUtils.equals(aScarabUser.getUserId(), v))
224                 {
225             aScarabUser = null;
226         }
227       
228               }
229   
230       
231             
232                   
233         private ScarabUser aScarabUser;
234
235     /**
236      * Declares an association between this object and a ScarabUser object
237      *
238      * @param v ScarabUser
239      * @throws TorqueException
240      */

241     public void setScarabUser(ScarabUser v) throws TorqueException
242     {
243             if (v == null)
244         {
245                   setUserId((Integer JavaDoc) null);
246               }
247         else
248         {
249             setUserId(v.getUserId());
250         }
251             aScarabUser = v;
252     }
253
254                         
255     /**
256      * Get the associated ScarabUser object
257      *
258      * @return the associated ScarabUser object
259      * @throws TorqueException
260      */

261     public ScarabUser getScarabUser() throws TorqueException
262     {
263         if ( !ObjectUtils.equals(getUserId(), null) )
264         {
265                 return ScarabUserManager.getInstance(SimpleKey.keyFor(getUserId()));
266             }
267         return aScarabUser;
268     }
269
270     /**
271      * Provides convenient way to set a relationship based on a
272      * ObjectKey, for example
273      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
274      *
275          */

276     public void setScarabUserKey(ObjectKey key) throws TorqueException
277     {
278     
279                     setUserId(new Integer JavaDoc(((NumberKey) key).intValue()));
280               }
281      
282                                 
283             
284     /**
285      * Collection to store aggregation of collMITListItems
286      */

287     protected List JavaDoc collMITListItems;
288
289     /**
290      * Temporary storage of collMITListItems to save a possible db hit in
291      * the event objects are add to the collection, but the
292      * complete collection is never requested.
293      */

294     protected void initMITListItems()
295     {
296         if (collMITListItems == null)
297         {
298             collMITListItems = new ArrayList JavaDoc();
299         }
300     }
301
302             
303     /**
304      * Method called to associate a MITListItem object to this object
305      * through the MITListItem foreign key attribute
306      *
307      * @param l MITListItem
308      * @throws TorqueException
309      */

310     public void addMITListItem(MITListItem l) throws TorqueException
311     {
312         getMITListItems().add(l);
313         l.setMITList((MITList)this);
314     }
315
316     /**
317      * The criteria used to select the current contents of collMITListItems
318      */

319     private Criteria lastMITListItemsCriteria = null;
320
321     /**
322      * If this collection has already been initialized, returns
323      * the collection. Otherwise returns the results of
324      * getMITListItems(new Criteria())
325      *
326      * @throws TorqueException
327      */

328     public List JavaDoc getMITListItems() throws TorqueException
329     {
330         if (collMITListItems == null)
331         {
332             collMITListItems = getMITListItems(new Criteria(10));
333         }
334         return collMITListItems;
335     }
336
337     /**
338      * If this collection has already been initialized with
339      * an identical criteria, it returns the collection.
340      * Otherwise if this MITList has previously
341      * been saved, it will retrieve related MITListItems from storage.
342      * If this MITList is new, it will return
343      * an empty collection or the current collection, the criteria
344      * is ignored on a new object.
345      *
346      * @throws TorqueException
347      */

348     public List JavaDoc getMITListItems(Criteria criteria) throws TorqueException
349     {
350         if (collMITListItems == null)
351         {
352             if (isNew())
353             {
354                collMITListItems = new ArrayList JavaDoc();
355             }
356             else
357             {
358                       criteria.add(MITListItemPeer.LIST_ID, getListId() );
359                       collMITListItems = MITListItemPeer.doSelect(criteria);
360             }
361         }
362         else
363         {
364             // criteria has no effect for a new object
365
if (!isNew())
366             {
367                 // the following code is to determine if a new query is
368
// called for. If the criteria is the same as the last
369
// one, just return the collection.
370
criteria.add(MITListItemPeer.LIST_ID, getListId() );
371                       if (!lastMITListItemsCriteria.equals(criteria))
372                 {
373                     collMITListItems = MITListItemPeer.doSelect(criteria);
374                 }
375             }
376         }
377         lastMITListItemsCriteria = criteria;
378
379         return collMITListItems;
380     }
381
382     /**
383      * If this collection has already been initialized, returns
384      * the collection. Otherwise returns the results of
385      * getMITListItems(new Criteria(),Connection)
386      * This method takes in the Connection also as input so that
387      * referenced objects can also be obtained using a Connection
388      * that is taken as input
389      */

390     public List JavaDoc getMITListItems(Connection JavaDoc con) throws TorqueException
391     {
392         if (collMITListItems == null)
393         {
394             collMITListItems = getMITListItems(new Criteria(10),con);
395         }
396         return collMITListItems;
397     }
398
399     /**
400      * If this collection has already been initialized with
401      * an identical criteria, it returns the collection.
402      * Otherwise if this MITList has previously
403      * been saved, it will retrieve related MITListItems from storage.
404      * If this MITList is new, it will return
405      * an empty collection or the current collection, the criteria
406      * is ignored on a new object.
407      * This method takes in the Connection also as input so that
408      * referenced objects can also be obtained using a Connection
409      * that is taken as input
410      */

411     public List JavaDoc getMITListItems(Criteria criteria,Connection JavaDoc con) throws TorqueException
412     {
413         if (collMITListItems == null)
414         {
415             if (isNew())
416             {
417                collMITListItems = new ArrayList JavaDoc();
418             }
419             else
420             {
421                        criteria.add(MITListItemPeer.LIST_ID, getListId() );
422                        collMITListItems = MITListItemPeer.doSelect(criteria,con);
423              }
424          }
425          else
426          {
427              // criteria has no effect for a new object
428
if (!isNew())
429              {
430                  // the following code is to determine if a new query is
431
// called for. If the criteria is the same as the last
432
// one, just return the collection.
433
criteria.add(MITListItemPeer.LIST_ID, getListId() );
434                      if (!lastMITListItemsCriteria.equals(criteria))
435                  {
436                      collMITListItems = MITListItemPeer.doSelect(criteria,con);
437                  }
438              }
439          }
440          lastMITListItemsCriteria = criteria;
441
442          return collMITListItems;
443      }
444
445                               
446               
447                     
448                               
449                                 
450                                                               
451                                         
452                     
453                     
454           
455     /**
456      * If this collection has already been initialized with
457      * an identical criteria, it returns the collection.
458      * Otherwise if this MITList is new, it will return
459      * an empty collection; or if this MITList has previously
460      * been saved, it will retrieve related MITListItems from storage.
461      *
462      * This method is protected by default in order to keep the public
463      * api reasonable. You can provide public methods for those you
464      * actually need in MITList.
465      */

466     protected List JavaDoc getMITListItemsJoinMITList(Criteria criteria)
467         throws TorqueException
468     {
469         if (collMITListItems == null)
470         {
471             if (isNew())
472             {
473                collMITListItems = new ArrayList JavaDoc();
474             }
475             else
476             {
477                             criteria.add(MITListItemPeer.LIST_ID, getListId() );
478                             collMITListItems = MITListItemPeer.doSelectJoinMITList(criteria);
479             }
480         }
481         else
482         {
483             // the following code is to determine if a new query is
484
// called for. If the criteria is the same as the last
485
// one, just return the collection.
486

487                             criteria.add(MITListItemPeer.LIST_ID, getListId() );
488                         if (!lastMITListItemsCriteria.equals(criteria))
489             {
490                 collMITListItems = MITListItemPeer.doSelectJoinMITList(criteria);
491             }
492         }
493         lastMITListItemsCriteria = criteria;
494
495         return collMITListItems;
496     }
497                   
498                     
499                     
500                                 
501                                                               
502                                         
503                     
504                     
505           
506     /**
507      * If this collection has already been initialized with
508      * an identical criteria, it returns the collection.
509      * Otherwise if this MITList is new, it will return
510      * an empty collection; or if this MITList has previously
511      * been saved, it will retrieve related MITListItems from storage.
512      *
513      * This method is protected by default in order to keep the public
514      * api reasonable. You can provide public methods for those you
515      * actually need in MITList.
516      */

517     protected List JavaDoc getMITListItemsJoinScarabModule(Criteria criteria)
518         throws TorqueException
519     {
520         if (collMITListItems == null)
521         {
522             if (isNew())
523             {
524                collMITListItems = new ArrayList JavaDoc();
525             }
526             else
527             {
528                             criteria.add(MITListItemPeer.LIST_ID, getListId() );
529                             collMITListItems = MITListItemPeer.doSelectJoinScarabModule(criteria);
530             }
531         }
532         else
533         {
534             // the following code is to determine if a new query is
535
// called for. If the criteria is the same as the last
536
// one, just return the collection.
537

538                             criteria.add(MITListItemPeer.LIST_ID, getListId() );
539                         if (!lastMITListItemsCriteria.equals(criteria))
540             {
541                 collMITListItems = MITListItemPeer.doSelectJoinScarabModule(criteria);
542             }
543         }
544         lastMITListItemsCriteria = criteria;
545
546         return collMITListItems;
547     }
548                   
549                     
550                     
551                                 
552                                                               
553                                         
554                     
555                     
556           
557     /**
558      * If this collection has already been initialized with
559      * an identical criteria, it returns the collection.
560      * Otherwise if this MITList is new, it will return
561      * an empty collection; or if this MITList has previously
562      * been saved, it will retrieve related MITListItems from storage.
563      *
564      * This method is protected by default in order to keep the public
565      * api reasonable. You can provide public methods for those you
566      * actually need in MITList.
567      */

568     protected List JavaDoc getMITListItemsJoinIssueType(Criteria criteria)
569         throws TorqueException
570     {
571         if (collMITListItems == null)
572         {
573             if (isNew())
574             {
575                collMITListItems = new ArrayList JavaDoc();
576             }
577             else
578             {
579                             criteria.add(MITListItemPeer.LIST_ID, getListId() );
580                             collMITListItems = MITListItemPeer.doSelectJoinIssueType(criteria);
581             }
582         }
583         else
584         {
585             // the following code is to determine if a new query is
586
// called for. If the criteria is the same as the last
587
// one, just return the collection.
588

589                             criteria.add(MITListItemPeer.LIST_ID, getListId() );
590                         if (!lastMITListItemsCriteria.equals(criteria))
591             {
592                 collMITListItems = MITListItemPeer.doSelectJoinIssueType(criteria);
593             }
594         }
595         lastMITListItemsCriteria = criteria;
596
597         return collMITListItems;
598     }
599                             
600
601
602                           
603             
604     /**
605      * Collection to store aggregation of collRModuleUserAttributes
606      */

607     protected List JavaDoc collRModuleUserAttributes;
608
609     /**
610      * Temporary storage of collRModuleUserAttributes to save a possible db hit in
611      * the event objects are add to the collection, but the
612      * complete collection is never requested.
613      */

614     protected void initRModuleUserAttributes()
615     {
616         if (collRModuleUserAttributes == null)
617         {
618             collRModuleUserAttributes = new ArrayList JavaDoc();
619         }
620     }
621
622             
623     /**
624      * Method called to associate a RModuleUserAttribute object to this object
625      * through the RModuleUserAttribute foreign key attribute
626      *
627      * @param l RModuleUserAttribute
628      * @throws TorqueException
629      */

630     public void addRModuleUserAttribute(RModuleUserAttribute l) throws TorqueException
631     {
632         getRModuleUserAttributes().add(l);
633         l.setMITList((MITList)this);
634     }
635
636     /**
637      * The criteria used to select the current contents of collRModuleUserAttributes
638      */

639     private Criteria lastRModuleUserAttributesCriteria = null;
640
641     /**
642      * If this collection has already been initialized, returns
643      * the collection. Otherwise returns the results of
644      * getRModuleUserAttributes(new Criteria())
645      *
646      * @throws TorqueException
647      */

648     public List JavaDoc getRModuleUserAttributes() throws TorqueException
649     {
650         if (collRModuleUserAttributes == null)
651         {
652             collRModuleUserAttributes = getRModuleUserAttributes(new Criteria(10));
653         }
654         return collRModuleUserAttributes;
655     }
656
657     /**
658      * If this collection has already been initialized with
659      * an identical criteria, it returns the collection.
660      * Otherwise if this MITList has previously
661      * been saved, it will retrieve related RModuleUserAttributes from storage.
662      * If this MITList is new, it will return
663      * an empty collection or the current collection, the criteria
664      * is ignored on a new object.
665      *
666      * @throws TorqueException
667      */

668     public List JavaDoc getRModuleUserAttributes(Criteria criteria) throws TorqueException
669     {
670         if (collRModuleUserAttributes == null)
671         {
672             if (isNew())
673             {
674                collRModuleUserAttributes = new ArrayList JavaDoc();
675             }
676             else
677             {
678                       criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
679                       collRModuleUserAttributes = RModuleUserAttributePeer.doSelect(criteria);
680             }
681         }
682         else
683         {
684             // criteria has no effect for a new object
685
if (!isNew())
686             {
687                 // the following code is to determine if a new query is
688
// called for. If the criteria is the same as the last
689
// one, just return the collection.
690
criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
691                       if (!lastRModuleUserAttributesCriteria.equals(criteria))
692                 {
693                     collRModuleUserAttributes = RModuleUserAttributePeer.doSelect(criteria);
694                 }
695             }
696         }
697         lastRModuleUserAttributesCriteria = criteria;
698
699         return collRModuleUserAttributes;
700     }
701
702     /**
703      * If this collection has already been initialized, returns
704      * the collection. Otherwise returns the results of
705      * getRModuleUserAttributes(new Criteria(),Connection)
706      * This method takes in the Connection also as input so that
707      * referenced objects can also be obtained using a Connection
708      * that is taken as input
709      */

710     public List JavaDoc getRModuleUserAttributes(Connection JavaDoc con) throws TorqueException
711     {
712         if (collRModuleUserAttributes == null)
713         {
714             collRModuleUserAttributes = getRModuleUserAttributes(new Criteria(10),con);
715         }
716         return collRModuleUserAttributes;
717     }
718
719     /**
720      * If this collection has already been initialized with
721      * an identical criteria, it returns the collection.
722      * Otherwise if this MITList has previously
723      * been saved, it will retrieve related RModuleUserAttributes from storage.
724      * If this MITList is new, it will return
725      * an empty collection or the current collection, the criteria
726      * is ignored on a new object.
727      * This method takes in the Connection also as input so that
728      * referenced objects can also be obtained using a Connection
729      * that is taken as input
730      */

731     public List JavaDoc getRModuleUserAttributes(Criteria criteria,Connection JavaDoc con) throws TorqueException
732     {
733         if (collRModuleUserAttributes == null)
734         {
735             if (isNew())
736             {
737                collRModuleUserAttributes = new ArrayList JavaDoc();
738             }
739             else
740             {
741                        criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
742                        collRModuleUserAttributes = RModuleUserAttributePeer.doSelect(criteria,con);
743              }
744          }
745          else
746          {
747              // criteria has no effect for a new object
748
if (!isNew())
749              {
750                  // the following code is to determine if a new query is
751
// called for. If the criteria is the same as the last
752
// one, just return the collection.
753
criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
754                      if (!lastRModuleUserAttributesCriteria.equals(criteria))
755                  {
756                      collRModuleUserAttributes = RModuleUserAttributePeer.doSelect(criteria,con);
757                  }
758              }
759          }
760          lastRModuleUserAttributesCriteria = criteria;
761
762          return collRModuleUserAttributes;
763      }
764
765                                           
766               
767                     
768                               
769                                 
770                                                               
771                                         
772                     
773                     
774           
775     /**
776      * If this collection has already been initialized with
777      * an identical criteria, it returns the collection.
778      * Otherwise if this MITList is new, it will return
779      * an empty collection; or if this MITList has previously
780      * been saved, it will retrieve related RModuleUserAttributes from storage.
781      *
782      * This method is protected by default in order to keep the public
783      * api reasonable. You can provide public methods for those you
784      * actually need in MITList.
785      */

786     protected List JavaDoc getRModuleUserAttributesJoinMITList(Criteria criteria)
787         throws TorqueException
788     {
789         if (collRModuleUserAttributes == null)
790         {
791             if (isNew())
792             {
793                collRModuleUserAttributes = new ArrayList JavaDoc();
794             }
795             else
796             {
797                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
798                             collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinMITList(criteria);
799             }
800         }
801         else
802         {
803             // the following code is to determine if a new query is
804
// called for. If the criteria is the same as the last
805
// one, just return the collection.
806

807                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
808                         if (!lastRModuleUserAttributesCriteria.equals(criteria))
809             {
810                 collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinMITList(criteria);
811             }
812         }
813         lastRModuleUserAttributesCriteria = criteria;
814
815         return collRModuleUserAttributes;
816     }
817                   
818                     
819                     
820                                 
821                                                               
822                                         
823                     
824                     
825           
826     /**
827      * If this collection has already been initialized with
828      * an identical criteria, it returns the collection.
829      * Otherwise if this MITList is new, it will return
830      * an empty collection; or if this MITList has previously
831      * been saved, it will retrieve related RModuleUserAttributes from storage.
832      *
833      * This method is protected by default in order to keep the public
834      * api reasonable. You can provide public methods for those you
835      * actually need in MITList.
836      */

837     protected List JavaDoc getRModuleUserAttributesJoinScarabModule(Criteria criteria)
838         throws TorqueException
839     {
840         if (collRModuleUserAttributes == null)
841         {
842             if (isNew())
843             {
844                collRModuleUserAttributes = new ArrayList JavaDoc();
845             }
846             else
847             {
848                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
849                             collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinScarabModule(criteria);
850             }
851         }
852         else
853         {
854             // the following code is to determine if a new query is
855
// called for. If the criteria is the same as the last
856
// one, just return the collection.
857

858                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
859                         if (!lastRModuleUserAttributesCriteria.equals(criteria))
860             {
861                 collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinScarabModule(criteria);
862             }
863         }
864         lastRModuleUserAttributesCriteria = criteria;
865
866         return collRModuleUserAttributes;
867     }
868                   
869                     
870                     
871                                 
872                                                               
873                                         
874                     
875                     
876           
877     /**
878      * If this collection has already been initialized with
879      * an identical criteria, it returns the collection.
880      * Otherwise if this MITList is new, it will return
881      * an empty collection; or if this MITList has previously
882      * been saved, it will retrieve related RModuleUserAttributes from storage.
883      *
884      * This method is protected by default in order to keep the public
885      * api reasonable. You can provide public methods for those you
886      * actually need in MITList.
887      */

888     protected List JavaDoc getRModuleUserAttributesJoinScarabUserImpl(Criteria criteria)
889         throws TorqueException
890     {
891         if (collRModuleUserAttributes == null)
892         {
893             if (isNew())
894             {
895                collRModuleUserAttributes = new ArrayList JavaDoc();
896             }
897             else
898             {
899                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
900                             collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinScarabUserImpl(criteria);
901             }
902         }
903         else
904         {
905             // the following code is to determine if a new query is
906
// called for. If the criteria is the same as the last
907
// one, just return the collection.
908

909                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
910                         if (!lastRModuleUserAttributesCriteria.equals(criteria))
911             {
912                 collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinScarabUserImpl(criteria);
913             }
914         }
915         lastRModuleUserAttributesCriteria = criteria;
916
917         return collRModuleUserAttributes;
918     }
919                   
920                     
921                     
922                                 
923                                                               
924                                         
925                     
926                     
927           
928     /**
929      * If this collection has already been initialized with
930      * an identical criteria, it returns the collection.
931      * Otherwise if this MITList is new, it will return
932      * an empty collection; or if this MITList has previously
933      * been saved, it will retrieve related RModuleUserAttributes from storage.
934      *
935      * This method is protected by default in order to keep the public
936      * api reasonable. You can provide public methods for those you
937      * actually need in MITList.
938      */

939     protected List JavaDoc getRModuleUserAttributesJoinIssueType(Criteria criteria)
940         throws TorqueException
941     {
942         if (collRModuleUserAttributes == null)
943         {
944             if (isNew())
945             {
946                collRModuleUserAttributes = new ArrayList JavaDoc();
947             }
948             else
949             {
950                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
951                             collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinIssueType(criteria);
952             }
953         }
954         else
955         {
956             // the following code is to determine if a new query is
957
// called for. If the criteria is the same as the last
958
// one, just return the collection.
959

960                             criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
961                         if (!lastRModuleUserAttributesCriteria.equals(criteria))
962             {
963                 collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinIssueType(criteria);
964             }
965         }
966         lastRModuleUserAttributesCriteria = criteria;
967
968         return collRModuleUserAttributes;
969     }
970                   
971                     
972                     
973                                 
974                                                               
975                                         
976                     
977                     
978           
979     /**
980      * If this collection has already been initialized with
981      * an identical criteria, it returns the collection.
982      * Otherwise if this MITList is new, it will return
983      * an empty collection; or if this MITList has previously
984      * been saved, it will retrieve related RModuleUserAttributes from storage.
985      *
986      * This method is protected by default in order to keep the public
987      * api reasonable. You can provide public methods for those you
988      * actually need in MITList.
989      */

990     protected List JavaDoc getRModuleUserAttributesJoinAttribute(Criteria criteria)
991         throws TorqueException
992     {
993         if (collRModuleUserAttributes == null)
994         {
995             if (isNew())
996             {
997                collRModuleUserAttributes = new ArrayList JavaDoc();
998             }
999             else
1000            {
1001                            criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
1002                            collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinAttribute(criteria);
1003            }
1004        }
1005        else
1006        {
1007            // the following code is to determine if a new query is
1008
// called for. If the criteria is the same as the last
1009
// one, just return the collection.
1010

1011                            criteria.add(RModuleUserAttributePeer.LIST_ID, getListId() );
1012                        if (!lastRModuleUserAttributesCriteria.equals(criteria))
1013            {
1014                collRModuleUserAttributes = RModuleUserAttributePeer.doSelectJoinAttribute(criteria);
1015            }
1016        }
1017        lastRModuleUserAttributesCriteria = criteria;
1018
1019        return collRModuleUserAttributes;
1020    }
1021                            
1022
1023
1024                          
1025            
1026    /**
1027     * Collection to store aggregation of collQuerys
1028     */

1029    protected List JavaDoc collQuerys;
1030
1031    /**
1032     * Temporary storage of collQuerys to save a possible db hit in
1033     * the event objects are add to the collection, but the
1034     * complete collection is never requested.
1035     */

1036    protected void initQuerys()
1037    {
1038        if (collQuerys == null)
1039        {
1040            collQuerys = new ArrayList JavaDoc();
1041        }
1042    }
1043
1044            
1045    /**
1046     * Method called to associate a Query object to this object
1047     * through the Query foreign key attribute
1048     *
1049     * @param l Query
1050     * @throws TorqueException
1051     */

1052    public void addQuery(Query l) throws TorqueException
1053    {
1054        getQuerys().add(l);
1055        l.setMITList((MITList)this);
1056    }
1057
1058    /**
1059     * The criteria used to select the current contents of collQuerys
1060     */

1061    private Criteria lastQuerysCriteria = null;
1062
1063    /**
1064     * If this collection has already been initialized, returns
1065     * the collection. Otherwise returns the results of
1066     * getQuerys(new Criteria())
1067     *
1068     * @throws TorqueException
1069     */

1070    public List JavaDoc getQuerys() throws TorqueException
1071    {
1072        if (collQuerys == null)
1073        {
1074            collQuerys = getQuerys(new Criteria(10));
1075        }
1076        return collQuerys;
1077    }
1078
1079    /**
1080     * If this collection has already been initialized with
1081     * an identical criteria, it returns the collection.
1082     * Otherwise if this MITList has previously
1083     * been saved, it will retrieve related Querys from storage.
1084     * If this MITList is new, it will return
1085     * an empty collection or the current collection, the criteria
1086     * is ignored on a new object.
1087     *
1088     * @throws TorqueException
1089     */

1090    public List JavaDoc getQuerys(Criteria criteria) throws TorqueException
1091    {
1092        if (collQuerys == null)
1093        {
1094            if (isNew())
1095            {
1096               collQuerys = new ArrayList JavaDoc();
1097            }
1098            else
1099            {
1100                      criteria.add(QueryPeer.LIST_ID, getListId() );
1101                      collQuerys = QueryPeer.doSelect(criteria);
1102            }
1103        }
1104        else
1105        {
1106            // criteria has no effect for a new object
1107
if (!isNew())
1108            {
1109                // the following code is to determine if a new query is
1110
// called for. If the criteria is the same as the last
1111
// one, just return the collection.
1112
criteria.add(QueryPeer.LIST_ID, getListId() );
1113                      if (!lastQuerysCriteria.equals(criteria))
1114                {
1115                    collQuerys = QueryPeer.doSelect(criteria);
1116                }
1117            }
1118        }
1119        lastQuerysCriteria = criteria;
1120
1121        return collQuerys;
1122    }
1123
1124    /**
1125     * If this collection has already been initialized, returns
1126     * the collection. Otherwise returns the results of
1127     * getQuerys(new Criteria(),Connection)
1128     * This method takes in the Connection also as input so that
1129     * referenced objects can also be obtained using a Connection
1130     * that is taken as input
1131     */

1132    public List JavaDoc getQuerys(Connection JavaDoc con) throws TorqueException
1133    {
1134        if (collQuerys == null)
1135        {
1136            collQuerys = getQuerys(new Criteria(10),con);
1137        }
1138        return collQuerys;
1139    }
1140
1141    /**
1142     * If this collection has already been initialized with
1143     * an identical criteria, it returns the collection.
1144     * Otherwise if this MITList has previously
1145     * been saved, it will retrieve related Querys from storage.
1146     * If this MITList is new, it will return
1147     * an empty collection or the current collection, the criteria
1148     * is ignored on a new object.
1149     * This method takes in the Connection also as input so that
1150     * referenced objects can also be obtained using a Connection
1151     * that is taken as input
1152     */

1153    public List JavaDoc getQuerys(Criteria criteria,Connection JavaDoc con) throws TorqueException
1154    {
1155        if (collQuerys == null)
1156        {
1157            if (isNew())
1158            {
1159               collQuerys = new ArrayList JavaDoc();
1160            }
1161            else
1162            {
1163                       criteria.add(QueryPeer.LIST_ID, getListId() );
1164                       collQuerys = QueryPeer.doSelect(criteria,con);
1165             }
1166         }
1167         else
1168         {
1169             // criteria has no effect for a new object
1170
if (!isNew())
1171             {
1172                 // the following code is to determine if a new query is
1173
// called for. If the criteria is the same as the last
1174
// one, just return the collection.
1175
criteria.add(QueryPeer.LIST_ID, getListId() );
1176                     if (!lastQuerysCriteria.equals(criteria))
1177                 {
1178                     collQuerys = QueryPeer.doSelect(criteria,con);
1179                 }
1180             }
1181         }
1182         lastQuerysCriteria = criteria;
1183
1184         return collQuerys;
1185     }
1186
1187                                                
1188              
1189                    
1190                    
1191                                
1192                                                              
1193                                        
1194                    
1195                    
1196          
1197    /**
1198     * If this collection has already been initialized with
1199     * an identical criteria, it returns the collection.
1200     * Otherwise if this MITList is new, it will return
1201     * an empty collection; or if this MITList has previously
1202     * been saved, it will retrieve related Querys from storage.
1203     *
1204     * This method is protected by default in order to keep the public
1205     * api reasonable. You can provide public methods for those you
1206     * actually need in MITList.
1207     */

1208    protected List JavaDoc getQuerysJoinScarabUserImpl(Criteria criteria)
1209        throws TorqueException
1210    {
1211        if (collQuerys == null)
1212        {
1213            if (isNew())
1214            {
1215               collQuerys = new ArrayList JavaDoc();
1216            }
1217            else
1218            {
1219                            criteria.add(QueryPeer.LIST_ID, getListId() );
1220                            collQuerys = QueryPeer.doSelectJoinScarabUserImpl(criteria);
1221            }
1222        }
1223        else
1224        {
1225            // the following code is to determine if a new query is
1226
// called for. If the criteria is the same as the last
1227
// one, just return the collection.
1228

1229                            criteria.add(QueryPeer.LIST_ID, getListId() );
1230                        if (!lastQuerysCriteria.equals(criteria))
1231            {
1232                collQuerys = QueryPeer.doSelectJoinScarabUserImpl(criteria);
1233            }
1234        }
1235        lastQuerysCriteria = criteria;
1236
1237        return collQuerys;
1238    }
1239                  
1240                    
1241                    
1242                                
1243                                                              
1244                                        
1245                    
1246                    
1247          
1248    /**
1249     * If this collection has already been initialized with
1250     * an identical criteria, it returns the collection.
1251     * Otherwise if this MITList is new, it will return
1252     * an empty collection; or if this MITList has previously
1253     * been saved, it will retrieve related Querys from storage.
1254     *
1255     * This method is protected by default in order to keep the public
1256     * api reasonable. You can provide public methods for those you
1257     * actually need in MITList.
1258     */

1259    protected List JavaDoc getQuerysJoinScope(Criteria criteria)
1260        throws TorqueException
1261    {
1262        if (collQuerys == null)
1263        {
1264            if (isNew())
1265            {
1266               collQuerys = new ArrayList JavaDoc();
1267            }
1268            else
1269            {
1270                            criteria.add(QueryPeer.LIST_ID, getListId() );
1271                            collQuerys = QueryPeer.doSelectJoinScope(criteria);
1272            }
1273        }
1274        else
1275        {
1276            // the following code is to determine if a new query is
1277
// called for. If the criteria is the same as the last
1278
// one, just return the collection.
1279

1280                            criteria.add(QueryPeer.LIST_ID, getListId() );
1281                        if (!lastQuerysCriteria.equals(criteria))
1282            {
1283                collQuerys = QueryPeer.doSelectJoinScope(criteria);
1284            }
1285        }
1286        lastQuerysCriteria = criteria;
1287
1288        return collQuerys;
1289    }
1290                  
1291                    
1292                    
1293                                
1294                                                              
1295                                        
1296                    
1297                    
1298          
1299    /**
1300     * If this collection has already been initialized with
1301     * an identical criteria, it returns the collection.
1302     * Otherwise if this MITList is new, it will return
1303     * an empty collection; or if this MITList has previously
1304     * been saved, it will retrieve related Querys from storage.
1305     *
1306     * This method is protected by default in order to keep the public
1307     * api reasonable. You can provide public methods for those you
1308     * actually need in MITList.
1309     */

1310    protected List JavaDoc getQuerysJoinScarabModule(Criteria criteria)
1311        throws TorqueException
1312    {
1313        if (collQuerys == null)
1314        {
1315            if (isNew())
1316            {
1317               collQuerys = new ArrayList JavaDoc();
1318            }
1319            else
1320            {
1321                            criteria.add(QueryPeer.LIST_ID, getListId() );
1322                            collQuerys = QueryPeer.doSelectJoinScarabModule(criteria);
1323            }
1324        }
1325        else
1326        {
1327            // the following code is to determine if a new query is
1328
// called for. If the criteria is the same as the last
1329
// one, just return the collection.
1330

1331                            criteria.add(QueryPeer.LIST_ID, getListId() );
1332                        if (!lastQuerysCriteria.equals(criteria))
1333            {
1334                collQuerys = QueryPeer.doSelectJoinScarabModule(criteria);
1335            }
1336        }
1337        lastQuerysCriteria = criteria;
1338
1339        return collQuerys;
1340    }
1341                  
1342                    
1343                    
1344                                
1345                                                              
1346                                        
1347                    
1348                    
1349          
1350    /**
1351     * If this collection has already been initialized with
1352     * an identical criteria, it returns the collection.
1353     * Otherwise if this MITList is new, it will return
1354     * an empty collection; or if this MITList has previously
1355     * been saved, it will retrieve related Querys from storage.
1356     *
1357     * This method is protected by default in order to keep the public
1358     * api reasonable. You can provide public methods for those you
1359     * actually need in MITList.
1360     */

1361    protected List JavaDoc getQuerysJoinIssueType(Criteria criteria)
1362        throws TorqueException
1363    {
1364        if (collQuerys == null)
1365        {
1366            if (isNew())
1367            {
1368               collQuerys = new ArrayList JavaDoc();
1369            }
1370            else
1371            {
1372                            criteria.add(QueryPeer.LIST_ID, getListId() );
1373                            collQuerys = QueryPeer.doSelectJoinIssueType(criteria);
1374            }
1375        }
1376        else
1377        {
1378            // the following code is to determine if a new query is
1379
// called for. If the criteria is the same as the last
1380
// one, just return the collection.
1381

1382                            criteria.add(QueryPeer.LIST_ID, getListId() );
1383                        if (!lastQuerysCriteria.equals(criteria))
1384            {
1385                collQuerys = QueryPeer.doSelectJoinIssueType(criteria);
1386            }
1387        }
1388        lastQuerysCriteria = criteria;
1389
1390        return collQuerys;
1391    }
1392                  
1393                    
1394                              
1395                                
1396                                                              
1397                                        
1398                    
1399                    
1400          
1401    /**
1402     * If this collection has already been initialized with
1403     * an identical criteria, it returns the collection.
1404     * Otherwise if this MITList is new, it will return
1405     * an empty collection; or if this MITList has previously
1406     * been saved, it will retrieve related Querys from storage.
1407     *
1408     * This method is protected by default in order to keep the public
1409     * api reasonable. You can provide public methods for those you
1410     * actually need in MITList.
1411     */

1412    protected List JavaDoc getQuerysJoinMITList(Criteria criteria)
1413        throws TorqueException
1414    {
1415        if (collQuerys == null)
1416        {
1417            if (isNew())
1418            {
1419               collQuerys = new ArrayList JavaDoc();
1420            }
1421            else
1422            {
1423                            criteria.add(QueryPeer.LIST_ID, getListId() );
1424                            collQuerys = QueryPeer.doSelectJoinMITList(criteria);
1425            }
1426        }
1427        else
1428        {
1429            // the following code is to determine if a new query is
1430
// called for. If the criteria is the same as the last
1431
// one, just return the collection.
1432

1433                            criteria.add(QueryPeer.LIST_ID, getListId() );
1434                        if (!lastQuerysCriteria.equals(criteria))
1435            {
1436                collQuerys = QueryPeer.doSelectJoinMITList(criteria);
1437            }
1438        }
1439        lastQuerysCriteria = criteria;
1440
1441        return collQuerys;
1442    }
1443                  
1444                    
1445                    
1446                                
1447                                                              
1448                                        
1449                    
1450                    
1451          
1452    /**
1453     * If this collection has already been initialized with
1454     * an identical criteria, it returns the collection.
1455     * Otherwise if this MITList is new, it will return
1456     * an empty collection; or if this MITList has previously
1457     * been saved, it will retrieve related Querys from storage.
1458     *
1459     * This method is protected by default in order to keep the public
1460     * api reasonable. You can provide public methods for those you
1461     * actually need in MITList.
1462     */

1463    protected List JavaDoc getQuerysJoinFrequency(Criteria criteria)
1464        throws TorqueException
1465    {
1466        if (collQuerys == null)
1467        {
1468            if (isNew())
1469            {
1470               collQuerys = new ArrayList JavaDoc();
1471            }
1472            else
1473            {
1474                            criteria.add(QueryPeer.LIST_ID, getListId() );
1475                            collQuerys = QueryPeer.doSelectJoinFrequency(criteria);
1476            }
1477        }
1478        else
1479        {
1480            // the following code is to determine if a new query is
1481
// called for. If the criteria is the same as the last
1482
// one, just return the collection.
1483

1484                            criteria.add(QueryPeer.LIST_ID, getListId() );
1485                        if (!lastQuerysCriteria.equals(criteria))
1486            {
1487                collQuerys = QueryPeer.doSelectJoinFrequency(criteria);
1488            }
1489        }
1490        lastQuerysCriteria = criteria;
1491
1492        return collQuerys;
1493    }
1494                            
1495
1496
1497          
1498    private static List JavaDoc fieldNames = null;
1499
1500    /**
1501     * Generate a list of field names.
1502     *
1503     * @return a list of field names
1504     */

1505    public static synchronized List JavaDoc getFieldNames()
1506    {
1507        if (fieldNames == null)
1508        {
1509            fieldNames = new ArrayList JavaDoc();
1510              fieldNames.add("ListId");
1511              fieldNames.add("Name");
1512              fieldNames.add("Active");
1513              fieldNames.add("Modifiable");
1514              fieldNames.add("UserId");
1515              fieldNames = Collections.unmodifiableList(fieldNames);
1516        }
1517        return fieldNames;
1518    }
1519
1520    /**
1521     * Retrieves a field from the object by name passed in as a String.
1522     *
1523     * @param name field name
1524     * @return value
1525     */

1526    public Object JavaDoc getByName(String JavaDoc name)
1527    {
1528          if (name.equals("ListId"))
1529        {
1530                return getListId();
1531            }
1532          if (name.equals("Name"))
1533        {
1534                return getName();
1535            }
1536          if (name.equals("Active"))
1537        {
1538                return Boolean.valueOf(getActive());
1539            }
1540          if (name.equals("Modifiable"))
1541        {
1542                return Boolean.valueOf(getModifiable());
1543            }
1544          if (name.equals("UserId"))
1545        {
1546                return getUserId();
1547            }
1548          return null;
1549    }
1550    
1551    /**
1552     * Retrieves a field from the object by name passed in
1553     * as a String. The String must be one of the static
1554     * Strings defined in this Class' Peer.
1555     *
1556     * @param name peer name
1557     * @return value
1558     */

1559    public Object JavaDoc getByPeerName(String JavaDoc name)
1560    {
1561          if (name.equals(MITListPeer.LIST_ID))
1562        {
1563                return getListId();
1564            }
1565          if (name.equals(MITListPeer.NAME))
1566        {
1567                return getName();
1568            }
1569          if (name.equals(MITListPeer.ACTIVE))
1570        {
1571                return Boolean.valueOf(getActive());
1572            }
1573          if (name.equals(MITListPeer.MODIFIABLE))
1574        {
1575                return Boolean.valueOf(getModifiable());
1576            }
1577          if (name.equals(MITListPeer.USER_ID))
1578        {
1579                return getUserId();
1580            }
1581          return null;
1582    }
1583
1584    /**
1585     * Retrieves a field from the object by Position as specified
1586     * in the xml schema. Zero-based.
1587     *
1588     * @param pos position in xml schema
1589     * @return value
1590     */

1591    public Object JavaDoc getByPosition(int pos)
1592    {
1593            if (pos == 0)
1594        {
1595                return getListId();
1596            }
1597              if (pos == 1)
1598        {
1599                return getName();
1600            }
1601              if (pos == 2)
1602        {
1603                return Boolean.valueOf(getActive());
1604            }
1605              if (pos == 3)
1606        {
1607                return Boolean.valueOf(getModifiable());
1608            }
1609              if (pos == 4)
1610        {
1611                return getUserId();
1612            }
1613              return null;
1614    }
1615     
1616    /**
1617     * Stores the object in the database. If the object is new,
1618     * it inserts it; otherwise an update is performed.
1619     *
1620     * @throws Exception
1621     */

1622    public void save() throws Exception JavaDoc
1623    {
1624          save(MITListPeer.getMapBuilder()
1625                .getDatabaseMap().getName());
1626      }
1627
1628    /**
1629     * Stores the object in the database. If the object is new,
1630     * it inserts it; otherwise an update is performed.
1631       * Note: this code is here because the method body is
1632     * auto-generated conditionally and therefore needs to be
1633     * in this file instead of in the super class, BaseObject.
1634       *
1635     * @param dbName
1636     * @throws TorqueException
1637     */

1638    public void save(String JavaDoc dbName) throws TorqueException
1639    {
1640        Connection JavaDoc con = null;
1641          try
1642        {
1643            con = Transaction.begin(dbName);
1644            save(con);
1645            Transaction.commit(con);
1646        }
1647        catch(TorqueException e)
1648        {
1649            Transaction.safeRollback(con);
1650            throw e;
1651        }
1652      }
1653
1654      /** flag to prevent endless save loop, if this object is referenced
1655        by another object which falls in this transaction. */

1656    private boolean alreadyInSave = false;
1657      /**
1658     * Stores the object in the database. If the object is new,
1659     * it inserts it; otherwise an update is performed. This method
1660     * is meant to be used as part of a transaction, otherwise use
1661     * the save() method and the connection details will be handled
1662     * internally
1663     *
1664     * @param con
1665     * @throws TorqueException
1666     */

1667    public void save(Connection JavaDoc con) throws TorqueException
1668    {
1669          if (!alreadyInSave)
1670        {
1671            alreadyInSave = true;
1672
1673
1674  
1675            // If this object has been modified, then save it to the database.
1676
if (isModified())
1677            {
1678                if (isNew())
1679                {
1680                    MITListPeer.doInsert((MITList)this, con);
1681                    setNew(false);
1682                }
1683                else
1684                {
1685                    MITListPeer.doUpdate((MITList)this, con);
1686                }
1687
1688                      if (isCacheOnSave())
1689                {
1690                    MITListManager.putInstance(this);
1691                }
1692              }
1693
1694                                      
1695                            if (collMITListItems != null)
1696            {
1697                for (int i = 0; i < collMITListItems.size(); i++)
1698                {
1699                    ((MITListItem)collMITListItems.get(i)).save(con);
1700                }
1701            }
1702                                          
1703                            if (collRModuleUserAttributes != null)
1704            {
1705                for (int i = 0; i < collRModuleUserAttributes.size(); i++)
1706                {
1707                    ((RModuleUserAttribute)collRModuleUserAttributes.get(i)).save(con);
1708                }
1709            }
1710                                          
1711                            if (collQuerys != null)
1712            {
1713                for (int i = 0; i < collQuerys.size(); i++)
1714                {
1715                    ((Query)collQuerys.get(i)).save(con);
1716                }
1717            }
1718                          alreadyInSave = false;
1719        }
1720      }
1721
1722    /**
1723     * Specify whether to cache the object after saving to the db.
1724     * This method returns false
1725     */

1726    protected boolean isCacheOnSave()
1727    {
1728        return true;
1729    }
1730
1731                        
1732      /**
1733     * Set the PrimaryKey using ObjectKey.
1734     *
1735     * @param listId ObjectKey
1736     */

1737    public void setPrimaryKey(ObjectKey listId)
1738        throws TorqueException {
1739            setListId(new Long JavaDoc(((NumberKey)listId).longValue()));
1740        }
1741
1742    /**
1743     * Set the PrimaryKey using a String.
1744     *
1745     * @param key
1746     */

1747    public void setPrimaryKey(String JavaDoc key) throws TorqueException
1748    {
1749            setListId(new Long JavaDoc(key));
1750        }
1751
1752  
1753    /**
1754     * returns an id that differentiates this object from others
1755     * of its class.
1756     */

1757    public ObjectKey getPrimaryKey()
1758    {
1759          return SimpleKey.keyFor(getListId());
1760      }
1761 
1762    /**
1763     * get an id that differentiates this object from others
1764     * of its class.
1765     */

1766    public String JavaDoc getQueryKey()
1767    {
1768        if (getPrimaryKey() == null)
1769        {
1770            return "";
1771        }
1772        else
1773        {
1774            return getPrimaryKey().toString();
1775        }
1776    }
1777
1778    /**
1779     * set an id that differentiates this object from others
1780     * of its class.
1781     */

1782    public void setQueryKey(String JavaDoc key)
1783        throws TorqueException
1784    {
1785        setPrimaryKey(key);
1786    }
1787
1788    /**
1789     * Makes a copy of this object.
1790     * It creates a new object filling in the simple attributes.
1791       * It then fills all the association collections and sets the
1792     * related objects to isNew=true.
1793       */

1794      public MITList copy() throws TorqueException
1795    {
1796        MITList copyObj = new MITList();
1797            copyObj.setListId(listId);
1798          copyObj.setName(name);
1799          copyObj.setActive(active);
1800          copyObj.setModifiable(modifiable);
1801          copyObj.setUserId(userId);
1802  
1803                      copyObj.setListId((Long JavaDoc)null);
1804                                    
1805                                      
1806                
1807        List JavaDoc v = getMITListItems();
1808        for (int i = 0; i < v.size(); i++)
1809        {
1810            MITListItem obj = (MITListItem) v.get(i);
1811            copyObj.addMITListItem(obj.copy());
1812        }
1813                                                  
1814                
1815        v = getRModuleUserAttributes();
1816        for (int i = 0; i < v.size(); i++)
1817        {
1818            RModuleUserAttribute obj = (RModuleUserAttribute) v.get(i);
1819            copyObj.addRModuleUserAttribute(obj.copy());
1820        }
1821                                                  
1822                
1823        v = getQuerys();
1824        for (int i = 0; i < v.size(); i++)
1825        {
1826            Query obj = (Query) v.get(i);
1827            copyObj.addQuery(obj.copy());
1828        }
1829                            return copyObj;
1830    }
1831
1832    /**
1833     * returns a peer instance associated with this om. Since Peer classes
1834     * are not to have any instance attributes, this method returns the
1835     * same instance for all member of this class. The method could therefore
1836     * be static, but this would prevent one from overriding the behavior.
1837     */

1838    public MITListPeer getPeer()
1839    {
1840        return peer;
1841    }
1842
1843    public String JavaDoc toString()
1844    {
1845        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1846        str.append("MITList:\n");
1847        str.append("ListId = ")
1848               .append(getListId())
1849             .append("\n");
1850        str.append("Name = ")
1851               .append(getName())
1852             .append("\n");
1853        str.append("Active = ")
1854               .append(getActive())
1855             .append("\n");
1856        str.append("Modifiable = ")
1857               .append(getModifiable())
1858             .append("\n");
1859        str.append("UserId = ")
1860               .append(getUserId())
1861             .append("\n");
1862        return(str.toString());
1863    }
1864}
1865
Popular Tags