KickJava   Java API By Example, From Geeks To Geeks.

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


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

34 public abstract class BaseCurrency extends BaseObject
35     implements org.apache.turbine.om.Retrievable
36 {
37     /** The Peer class */
38     private static final CurrencyPeer peer =
39         new CurrencyPeer();
40
41         
42     /** The value for the currencyId field */
43     private int currencyId;
44       
45     /** The value for the currencyName field */
46     private String JavaDoc currencyName;
47       
48     /** The value for the currencyCode field */
49     private String JavaDoc currencyCode;
50                                   
51     /** The value for the currencyRate field */
52     private BigDecimal JavaDoc currencyRate= new BigDecimal JavaDoc(1);
53   
54     
55     /**
56      * Get the CurrencyId
57      *
58      * @return int
59      */

60     public int getCurrencyId()
61     {
62         return currencyId;
63     }
64
65                                               
66     /**
67      * Set the value of CurrencyId
68      *
69      * @param v new value
70      */

71     public void setCurrencyId(int v) throws TorqueException
72     {
73     
74                   if (this.currencyId != v)
75               {
76             this.currencyId = v;
77             setModified(true);
78         }
79     
80           
81                                   
82                   // update associated Sorder
83
if (collSorders != null)
84         {
85             for (int i = 0; i < collSorders.size(); i++)
86             {
87                 ((Sorder) collSorders.get(i))
88                     .setCurrencyId(v);
89             }
90         }
91                                                     
92                   // update associated Payment
93
if (collPayments != null)
94         {
95             for (int i = 0; i < collPayments.size(); i++)
96             {
97                 ((Payment) collPayments.get(i))
98                     .setCurrencyId(v);
99             }
100         }
101                                                     
102                   // update associated SorderItem
103
if (collSorderItems != null)
104         {
105             for (int i = 0; i < collSorderItems.size(); i++)
106             {
107                 ((SorderItem) collSorderItems.get(i))
108                     .setCurrencyId(v);
109             }
110         }
111                                                     
112                   // update associated PaymentItem
113
if (collPaymentItems != null)
114         {
115             for (int i = 0; i < collPaymentItems.size(); i++)
116             {
117                 ((PaymentItem) collPaymentItems.get(i))
118                     .setCurrencyId(v);
119             }
120         }
121                                 }
122   
123     /**
124      * Get the CurrencyName
125      *
126      * @return String
127      */

128     public String JavaDoc getCurrencyName()
129     {
130         return currencyName;
131     }
132
133                         
134     /**
135      * Set the value of CurrencyName
136      *
137      * @param v new value
138      */

139     public void setCurrencyName(String JavaDoc v)
140     {
141     
142                   if (!ObjectUtils.equals(this.currencyName, v))
143               {
144             this.currencyName = v;
145             setModified(true);
146         }
147     
148           
149               }
150   
151     /**
152      * Get the CurrencyCode
153      *
154      * @return String
155      */

156     public String JavaDoc getCurrencyCode()
157     {
158         return currencyCode;
159     }
160
161                         
162     /**
163      * Set the value of CurrencyCode
164      *
165      * @param v new value
166      */

167     public void setCurrencyCode(String JavaDoc v)
168     {
169     
170                   if (!ObjectUtils.equals(this.currencyCode, v))
171               {
172             this.currencyCode = v;
173             setModified(true);
174         }
175     
176           
177               }
178   
179     /**
180      * Get the CurrencyRate
181      *
182      * @return BigDecimal
183      */

184     public BigDecimal JavaDoc getCurrencyRate()
185     {
186         return currencyRate;
187     }
188
189                         
190     /**
191      * Set the value of CurrencyRate
192      *
193      * @param v new value
194      */

195     public void setCurrencyRate(BigDecimal JavaDoc v)
196     {
197     
198                   if (!ObjectUtils.equals(this.currencyRate, v))
199               {
200             this.currencyRate = v;
201             setModified(true);
202         }
203     
204           
205               }
206   
207          
208                                 
209             
210           /**
211      * Collection to store aggregation of collSorders
212      */

213     protected List JavaDoc collSorders;
214
215     /**
216      * Temporary storage of collSorders to save a possible db hit in
217      * the event objects are add to the collection, but the
218      * complete collection is never requested.
219      */

220     protected void initSorders()
221     {
222         if (collSorders == null)
223         {
224             collSorders = new ArrayList JavaDoc();
225         }
226     }
227
228     /**
229      * Method called to associate a Sorder object to this object
230      * through the Sorder foreign key attribute
231      *
232      * @param l Sorder
233      * @throws TorqueException
234      */

235     public void addSorder(Sorder l) throws TorqueException
236     {
237         getSorders().add(l);
238         l.setCurrency((Currency) this);
239     }
240
241     /**
242      * The criteria used to select the current contents of collSorders
243      */

244     private Criteria lastSordersCriteria = null;
245       
246     /**
247      * If this collection has already been initialized, returns
248      * the collection. Otherwise returns the results of
249      * getSorders(new Criteria())
250      *
251      * @throws TorqueException
252      */

253     public List JavaDoc getSorders() throws TorqueException
254     {
255               if (collSorders == null)
256         {
257             collSorders = getSorders(new Criteria(10));
258         }
259         return collSorders;
260           }
261
262     /**
263      * If this collection has already been initialized with
264      * an identical criteria, it returns the collection.
265      * Otherwise if this Currency has previously
266      * been saved, it will retrieve related Sorders from storage.
267      * If this Currency is new, it will return
268      * an empty collection or the current collection, the criteria
269      * is ignored on a new object.
270      *
271      * @throws TorqueException
272      */

273     public List JavaDoc getSorders(Criteria criteria) throws TorqueException
274     {
275               if (collSorders == null)
276         {
277             if (isNew())
278             {
279                collSorders = new ArrayList JavaDoc();
280             }
281             else
282             {
283                         criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId() );
284                         collSorders = SorderPeer.doSelect(criteria);
285             }
286         }
287         else
288         {
289             // criteria has no effect for a new object
290
if (!isNew())
291             {
292                 // the following code is to determine if a new query is
293
// called for. If the criteria is the same as the last
294
// one, just return the collection.
295
criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
296                             if (!lastSordersCriteria.equals(criteria))
297                 {
298                     collSorders = SorderPeer.doSelect(criteria);
299                 }
300             }
301         }
302         lastSordersCriteria = criteria;
303
304         return collSorders;
305           }
306
307     /**
308      * If this collection has already been initialized, returns
309      * the collection. Otherwise returns the results of
310      * getSorders(new Criteria(),Connection)
311      * This method takes in the Connection also as input so that
312      * referenced objects can also be obtained using a Connection
313      * that is taken as input
314      */

315     public List JavaDoc getSorders(Connection JavaDoc con) throws TorqueException
316     {
317               if (collSorders == null)
318         {
319             collSorders = getSorders(new Criteria(10), con);
320         }
321         return collSorders;
322           }
323
324     /**
325      * If this collection has already been initialized with
326      * an identical criteria, it returns the collection.
327      * Otherwise if this Currency has previously
328      * been saved, it will retrieve related Sorders from storage.
329      * If this Currency is new, it will return
330      * an empty collection or the current collection, the criteria
331      * is ignored on a new object.
332      * This method takes in the Connection also as input so that
333      * referenced objects can also be obtained using a Connection
334      * that is taken as input
335      */

336     public List JavaDoc getSorders(Criteria criteria, Connection JavaDoc con)
337             throws TorqueException
338     {
339               if (collSorders == null)
340         {
341             if (isNew())
342             {
343                collSorders = new ArrayList JavaDoc();
344             }
345             else
346             {
347                          criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
348                          collSorders = SorderPeer.doSelect(criteria, con);
349              }
350          }
351          else
352          {
353              // criteria has no effect for a new object
354
if (!isNew())
355              {
356                  // the following code is to determine if a new query is
357
// called for. If the criteria is the same as the last
358
// one, just return the collection.
359
criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
360                              if (!lastSordersCriteria.equals(criteria))
361                  {
362                      collSorders = SorderPeer.doSelect(criteria, con);
363                  }
364              }
365          }
366          lastSordersCriteria = criteria;
367
368          return collSorders;
369            }
370
371                                           
372               
373                     
374                     
375                                             
376                                                                           
377                                         
378                     
379                     
380           
381     /**
382      * If this collection has already been initialized with
383      * an identical criteria, it returns the collection.
384      * Otherwise if this Currency is new, it will return
385      * an empty collection; or if this Currency has previously
386      * been saved, it will retrieve related Sorders from storage.
387      *
388      * This method is protected by default in order to keep the public
389      * api reasonable. You can provide public methods for those you
390      * actually need in Currency.
391      */

392     protected List JavaDoc getSordersJoinCustomerRelatedByCustomerId(Criteria criteria)
393         throws TorqueException
394     {
395                     if (collSorders == null)
396         {
397             if (isNew())
398             {
399                collSorders = new ArrayList JavaDoc();
400             }
401             else
402             {
403                               criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
404                               collSorders = SorderPeer.doSelectJoinCustomerRelatedByCustomerId(criteria);
405             }
406         }
407         else
408         {
409             // the following code is to determine if a new query is
410
// called for. If the criteria is the same as the last
411
// one, just return the collection.
412

413                         criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
414                                     if (!lastSordersCriteria.equals(criteria))
415             {
416                 collSorders = SorderPeer.doSelectJoinCustomerRelatedByCustomerId(criteria);
417             }
418         }
419         lastSordersCriteria = criteria;
420
421         return collSorders;
422                 }
423                   
424                     
425                     
426                                             
427                                                                           
428                                         
429                     
430                     
431           
432     /**
433      * If this collection has already been initialized with
434      * an identical criteria, it returns the collection.
435      * Otherwise if this Currency is new, it will return
436      * an empty collection; or if this Currency has previously
437      * been saved, it will retrieve related Sorders from storage.
438      *
439      * This method is protected by default in order to keep the public
440      * api reasonable. You can provide public methods for those you
441      * actually need in Currency.
442      */

443     protected List JavaDoc getSordersJoinCustomerRelatedByRecipientId(Criteria criteria)
444         throws TorqueException
445     {
446                     if (collSorders == null)
447         {
448             if (isNew())
449             {
450                collSorders = new ArrayList JavaDoc();
451             }
452             else
453             {
454                               criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
455                               collSorders = SorderPeer.doSelectJoinCustomerRelatedByRecipientId(criteria);
456             }
457         }
458         else
459         {
460             // the following code is to determine if a new query is
461
// called for. If the criteria is the same as the last
462
// one, just return the collection.
463

464                         criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
465                                     if (!lastSordersCriteria.equals(criteria))
466             {
467                 collSorders = SorderPeer.doSelectJoinCustomerRelatedByRecipientId(criteria);
468             }
469         }
470         lastSordersCriteria = criteria;
471
472         return collSorders;
473                 }
474                   
475                     
476                     
477                                 
478                                                               
479                                         
480                     
481                     
482           
483     /**
484      * If this collection has already been initialized with
485      * an identical criteria, it returns the collection.
486      * Otherwise if this Currency is new, it will return
487      * an empty collection; or if this Currency has previously
488      * been saved, it will retrieve related Sorders from storage.
489      *
490      * This method is protected by default in order to keep the public
491      * api reasonable. You can provide public methods for those you
492      * actually need in Currency.
493      */

494     protected List JavaDoc getSordersJoinProject(Criteria criteria)
495         throws TorqueException
496     {
497                     if (collSorders == null)
498         {
499             if (isNew())
500             {
501                collSorders = new ArrayList JavaDoc();
502             }
503             else
504             {
505                               criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
506                               collSorders = SorderPeer.doSelectJoinProject(criteria);
507             }
508         }
509         else
510         {
511             // the following code is to determine if a new query is
512
// called for. If the criteria is the same as the last
513
// one, just return the collection.
514

515                         criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
516                                     if (!lastSordersCriteria.equals(criteria))
517             {
518                 collSorders = SorderPeer.doSelectJoinProject(criteria);
519             }
520         }
521         lastSordersCriteria = criteria;
522
523         return collSorders;
524                 }
525                   
526                     
527                     
528                                 
529                                                               
530                                         
531                     
532                     
533           
534     /**
535      * If this collection has already been initialized with
536      * an identical criteria, it returns the collection.
537      * Otherwise if this Currency is new, it will return
538      * an empty collection; or if this Currency has previously
539      * been saved, it will retrieve related Sorders from storage.
540      *
541      * This method is protected by default in order to keep the public
542      * api reasonable. You can provide public methods for those you
543      * actually need in Currency.
544      */

545     protected List JavaDoc getSordersJoinCarrier(Criteria criteria)
546         throws TorqueException
547     {
548                     if (collSorders == null)
549         {
550             if (isNew())
551             {
552                collSorders = new ArrayList JavaDoc();
553             }
554             else
555             {
556                               criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
557                               collSorders = SorderPeer.doSelectJoinCarrier(criteria);
558             }
559         }
560         else
561         {
562             // the following code is to determine if a new query is
563
// called for. If the criteria is the same as the last
564
// one, just return the collection.
565

566                         criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
567                                     if (!lastSordersCriteria.equals(criteria))
568             {
569                 collSorders = SorderPeer.doSelectJoinCarrier(criteria);
570             }
571         }
572         lastSordersCriteria = criteria;
573
574         return collSorders;
575                 }
576                   
577                     
578                               
579                                 
580                                                               
581                                         
582                     
583                     
584           
585     /**
586      * If this collection has already been initialized with
587      * an identical criteria, it returns the collection.
588      * Otherwise if this Currency is new, it will return
589      * an empty collection; or if this Currency has previously
590      * been saved, it will retrieve related Sorders from storage.
591      *
592      * This method is protected by default in order to keep the public
593      * api reasonable. You can provide public methods for those you
594      * actually need in Currency.
595      */

596     protected List JavaDoc getSordersJoinCurrency(Criteria criteria)
597         throws TorqueException
598     {
599                     if (collSorders == null)
600         {
601             if (isNew())
602             {
603                collSorders = new ArrayList JavaDoc();
604             }
605             else
606             {
607                               criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
608                               collSorders = SorderPeer.doSelectJoinCurrency(criteria);
609             }
610         }
611         else
612         {
613             // the following code is to determine if a new query is
614
// called for. If the criteria is the same as the last
615
// one, just return the collection.
616

617                         criteria.add(SorderPeer.CURRENCY_ID, getCurrencyId());
618                                     if (!lastSordersCriteria.equals(criteria))
619             {
620                 collSorders = SorderPeer.doSelectJoinCurrency(criteria);
621             }
622         }
623         lastSordersCriteria = criteria;
624
625         return collSorders;
626                 }
627                             
628
629
630                           
631             
632           /**
633      * Collection to store aggregation of collPayments
634      */

635     protected List JavaDoc collPayments;
636
637     /**
638      * Temporary storage of collPayments to save a possible db hit in
639      * the event objects are add to the collection, but the
640      * complete collection is never requested.
641      */

642     protected void initPayments()
643     {
644         if (collPayments == null)
645         {
646             collPayments = new ArrayList JavaDoc();
647         }
648     }
649
650     /**
651      * Method called to associate a Payment object to this object
652      * through the Payment foreign key attribute
653      *
654      * @param l Payment
655      * @throws TorqueException
656      */

657     public void addPayment(Payment l) throws TorqueException
658     {
659         getPayments().add(l);
660         l.setCurrency((Currency) this);
661     }
662
663     /**
664      * The criteria used to select the current contents of collPayments
665      */

666     private Criteria lastPaymentsCriteria = null;
667       
668     /**
669      * If this collection has already been initialized, returns
670      * the collection. Otherwise returns the results of
671      * getPayments(new Criteria())
672      *
673      * @throws TorqueException
674      */

675     public List JavaDoc getPayments() throws TorqueException
676     {
677               if (collPayments == null)
678         {
679             collPayments = getPayments(new Criteria(10));
680         }
681         return collPayments;
682           }
683
684     /**
685      * If this collection has already been initialized with
686      * an identical criteria, it returns the collection.
687      * Otherwise if this Currency has previously
688      * been saved, it will retrieve related Payments from storage.
689      * If this Currency is new, it will return
690      * an empty collection or the current collection, the criteria
691      * is ignored on a new object.
692      *
693      * @throws TorqueException
694      */

695     public List JavaDoc getPayments(Criteria criteria) throws TorqueException
696     {
697               if (collPayments == null)
698         {
699             if (isNew())
700             {
701                collPayments = new ArrayList JavaDoc();
702             }
703             else
704             {
705                         criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId() );
706                         collPayments = PaymentPeer.doSelect(criteria);
707             }
708         }
709         else
710         {
711             // criteria has no effect for a new object
712
if (!isNew())
713             {
714                 // the following code is to determine if a new query is
715
// called for. If the criteria is the same as the last
716
// one, just return the collection.
717
criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
718                             if (!lastPaymentsCriteria.equals(criteria))
719                 {
720                     collPayments = PaymentPeer.doSelect(criteria);
721                 }
722             }
723         }
724         lastPaymentsCriteria = criteria;
725
726         return collPayments;
727           }
728
729     /**
730      * If this collection has already been initialized, returns
731      * the collection. Otherwise returns the results of
732      * getPayments(new Criteria(),Connection)
733      * This method takes in the Connection also as input so that
734      * referenced objects can also be obtained using a Connection
735      * that is taken as input
736      */

737     public List JavaDoc getPayments(Connection JavaDoc con) throws TorqueException
738     {
739               if (collPayments == null)
740         {
741             collPayments = getPayments(new Criteria(10), con);
742         }
743         return collPayments;
744           }
745
746     /**
747      * If this collection has already been initialized with
748      * an identical criteria, it returns the collection.
749      * Otherwise if this Currency has previously
750      * been saved, it will retrieve related Payments from storage.
751      * If this Currency is new, it will return
752      * an empty collection or the current collection, the criteria
753      * is ignored on a new object.
754      * This method takes in the Connection also as input so that
755      * referenced objects can also be obtained using a Connection
756      * that is taken as input
757      */

758     public List JavaDoc getPayments(Criteria criteria, Connection JavaDoc con)
759             throws TorqueException
760     {
761               if (collPayments == null)
762         {
763             if (isNew())
764             {
765                collPayments = new ArrayList JavaDoc();
766             }
767             else
768             {
769                          criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
770                          collPayments = PaymentPeer.doSelect(criteria, con);
771              }
772          }
773          else
774          {
775              // criteria has no effect for a new object
776
if (!isNew())
777              {
778                  // the following code is to determine if a new query is
779
// called for. If the criteria is the same as the last
780
// one, just return the collection.
781
criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
782                              if (!lastPaymentsCriteria.equals(criteria))
783                  {
784                      collPayments = PaymentPeer.doSelect(criteria, con);
785                  }
786              }
787          }
788          lastPaymentsCriteria = criteria;
789
790          return collPayments;
791            }
792
793                                     
794               
795                     
796                     
797                                 
798                                                               
799                                         
800                     
801                     
802           
803     /**
804      * If this collection has already been initialized with
805      * an identical criteria, it returns the collection.
806      * Otherwise if this Currency is new, it will return
807      * an empty collection; or if this Currency has previously
808      * been saved, it will retrieve related Payments from storage.
809      *
810      * This method is protected by default in order to keep the public
811      * api reasonable. You can provide public methods for those you
812      * actually need in Currency.
813      */

814     protected List JavaDoc getPaymentsJoinCustomer(Criteria criteria)
815         throws TorqueException
816     {
817                     if (collPayments == null)
818         {
819             if (isNew())
820             {
821                collPayments = new ArrayList JavaDoc();
822             }
823             else
824             {
825                               criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
826                               collPayments = PaymentPeer.doSelectJoinCustomer(criteria);
827             }
828         }
829         else
830         {
831             // the following code is to determine if a new query is
832
// called for. If the criteria is the same as the last
833
// one, just return the collection.
834

835                         criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
836                                     if (!lastPaymentsCriteria.equals(criteria))
837             {
838                 collPayments = PaymentPeer.doSelectJoinCustomer(criteria);
839             }
840         }
841         lastPaymentsCriteria = criteria;
842
843         return collPayments;
844                 }
845                   
846                     
847                     
848                                 
849                                                               
850                                         
851                     
852                     
853           
854     /**
855      * If this collection has already been initialized with
856      * an identical criteria, it returns the collection.
857      * Otherwise if this Currency is new, it will return
858      * an empty collection; or if this Currency has previously
859      * been saved, it will retrieve related Payments from storage.
860      *
861      * This method is protected by default in order to keep the public
862      * api reasonable. You can provide public methods for those you
863      * actually need in Currency.
864      */

865     protected List JavaDoc getPaymentsJoinProject(Criteria criteria)
866         throws TorqueException
867     {
868                     if (collPayments == null)
869         {
870             if (isNew())
871             {
872                collPayments = new ArrayList JavaDoc();
873             }
874             else
875             {
876                               criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
877                               collPayments = PaymentPeer.doSelectJoinProject(criteria);
878             }
879         }
880         else
881         {
882             // the following code is to determine if a new query is
883
// called for. If the criteria is the same as the last
884
// one, just return the collection.
885

886                         criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
887                                     if (!lastPaymentsCriteria.equals(criteria))
888             {
889                 collPayments = PaymentPeer.doSelectJoinProject(criteria);
890             }
891         }
892         lastPaymentsCriteria = criteria;
893
894         return collPayments;
895                 }
896                   
897                     
898                     
899                                 
900                                                               
901                                         
902                     
903                     
904           
905     /**
906      * If this collection has already been initialized with
907      * an identical criteria, it returns the collection.
908      * Otherwise if this Currency is new, it will return
909      * an empty collection; or if this Currency has previously
910      * been saved, it will retrieve related Payments from storage.
911      *
912      * This method is protected by default in order to keep the public
913      * api reasonable. You can provide public methods for those you
914      * actually need in Currency.
915      */

916     protected List JavaDoc getPaymentsJoinSorder(Criteria criteria)
917         throws TorqueException
918     {
919                     if (collPayments == null)
920         {
921             if (isNew())
922             {
923                collPayments = new ArrayList JavaDoc();
924             }
925             else
926             {
927                               criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
928                               collPayments = PaymentPeer.doSelectJoinSorder(criteria);
929             }
930         }
931         else
932         {
933             // the following code is to determine if a new query is
934
// called for. If the criteria is the same as the last
935
// one, just return the collection.
936

937                         criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
938                                     if (!lastPaymentsCriteria.equals(criteria))
939             {
940                 collPayments = PaymentPeer.doSelectJoinSorder(criteria);
941             }
942         }
943         lastPaymentsCriteria = criteria;
944
945         return collPayments;
946                 }
947                   
948                     
949                               
950                                 
951                                                               
952                                         
953                     
954                     
955           
956     /**
957      * If this collection has already been initialized with
958      * an identical criteria, it returns the collection.
959      * Otherwise if this Currency is new, it will return
960      * an empty collection; or if this Currency has previously
961      * been saved, it will retrieve related Payments from storage.
962      *
963      * This method is protected by default in order to keep the public
964      * api reasonable. You can provide public methods for those you
965      * actually need in Currency.
966      */

967     protected List JavaDoc getPaymentsJoinCurrency(Criteria criteria)
968         throws TorqueException
969     {
970                     if (collPayments == null)
971         {
972             if (isNew())
973             {
974                collPayments = new ArrayList JavaDoc();
975             }
976             else
977             {
978                               criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
979                               collPayments = PaymentPeer.doSelectJoinCurrency(criteria);
980             }
981         }
982         else
983         {
984             // the following code is to determine if a new query is
985
// called for. If the criteria is the same as the last
986
// one, just return the collection.
987

988                         criteria.add(PaymentPeer.CURRENCY_ID, getCurrencyId());
989                                     if (!lastPaymentsCriteria.equals(criteria))
990             {
991                 collPayments = PaymentPeer.doSelectJoinCurrency(criteria);
992             }
993         }
994         lastPaymentsCriteria = criteria;
995
996         return collPayments;
997                 }
998                             
999
1000
1001                          
1002            
1003          /**
1004     * Collection to store aggregation of collSorderItems
1005     */

1006    protected List JavaDoc collSorderItems;
1007
1008    /**
1009     * Temporary storage of collSorderItems to save a possible db hit in
1010     * the event objects are add to the collection, but the
1011     * complete collection is never requested.
1012     */

1013    protected void initSorderItems()
1014    {
1015        if (collSorderItems == null)
1016        {
1017            collSorderItems = new ArrayList JavaDoc();
1018        }
1019    }
1020
1021    /**
1022     * Method called to associate a SorderItem object to this object
1023     * through the SorderItem foreign key attribute
1024     *
1025     * @param l SorderItem
1026     * @throws TorqueException
1027     */

1028    public void addSorderItem(SorderItem l) throws TorqueException
1029    {
1030        getSorderItems().add(l);
1031        l.setCurrency((Currency) this);
1032    }
1033
1034    /**
1035     * The criteria used to select the current contents of collSorderItems
1036     */

1037    private Criteria lastSorderItemsCriteria = null;
1038      
1039    /**
1040     * If this collection has already been initialized, returns
1041     * the collection. Otherwise returns the results of
1042     * getSorderItems(new Criteria())
1043     *
1044     * @throws TorqueException
1045     */

1046    public List JavaDoc getSorderItems() throws TorqueException
1047    {
1048              if (collSorderItems == null)
1049        {
1050            collSorderItems = getSorderItems(new Criteria(10));
1051        }
1052        return collSorderItems;
1053          }
1054
1055    /**
1056     * If this collection has already been initialized with
1057     * an identical criteria, it returns the collection.
1058     * Otherwise if this Currency has previously
1059     * been saved, it will retrieve related SorderItems from storage.
1060     * If this Currency is new, it will return
1061     * an empty collection or the current collection, the criteria
1062     * is ignored on a new object.
1063     *
1064     * @throws TorqueException
1065     */

1066    public List JavaDoc getSorderItems(Criteria criteria) throws TorqueException
1067    {
1068              if (collSorderItems == null)
1069        {
1070            if (isNew())
1071            {
1072               collSorderItems = new ArrayList JavaDoc();
1073            }
1074            else
1075            {
1076                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId() );
1077                        collSorderItems = SorderItemPeer.doSelect(criteria);
1078            }
1079        }
1080        else
1081        {
1082            // criteria has no effect for a new object
1083
if (!isNew())
1084            {
1085                // the following code is to determine if a new query is
1086
// called for. If the criteria is the same as the last
1087
// one, just return the collection.
1088
criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1089                            if (!lastSorderItemsCriteria.equals(criteria))
1090                {
1091                    collSorderItems = SorderItemPeer.doSelect(criteria);
1092                }
1093            }
1094        }
1095        lastSorderItemsCriteria = criteria;
1096
1097        return collSorderItems;
1098          }
1099
1100    /**
1101     * If this collection has already been initialized, returns
1102     * the collection. Otherwise returns the results of
1103     * getSorderItems(new Criteria(),Connection)
1104     * This method takes in the Connection also as input so that
1105     * referenced objects can also be obtained using a Connection
1106     * that is taken as input
1107     */

1108    public List JavaDoc getSorderItems(Connection JavaDoc con) throws TorqueException
1109    {
1110              if (collSorderItems == null)
1111        {
1112            collSorderItems = getSorderItems(new Criteria(10), con);
1113        }
1114        return collSorderItems;
1115          }
1116
1117    /**
1118     * If this collection has already been initialized with
1119     * an identical criteria, it returns the collection.
1120     * Otherwise if this Currency has previously
1121     * been saved, it will retrieve related SorderItems from storage.
1122     * If this Currency is new, it will return
1123     * an empty collection or the current collection, the criteria
1124     * is ignored on a new object.
1125     * This method takes in the Connection also as input so that
1126     * referenced objects can also be obtained using a Connection
1127     * that is taken as input
1128     */

1129    public List JavaDoc getSorderItems(Criteria criteria, Connection JavaDoc con)
1130            throws TorqueException
1131    {
1132              if (collSorderItems == null)
1133        {
1134            if (isNew())
1135            {
1136               collSorderItems = new ArrayList JavaDoc();
1137            }
1138            else
1139            {
1140                         criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1141                         collSorderItems = SorderItemPeer.doSelect(criteria, con);
1142             }
1143         }
1144         else
1145         {
1146             // criteria has no effect for a new object
1147
if (!isNew())
1148             {
1149                 // the following code is to determine if a new query is
1150
// called for. If the criteria is the same as the last
1151
// one, just return the collection.
1152
criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1153                             if (!lastSorderItemsCriteria.equals(criteria))
1154                 {
1155                     collSorderItems = SorderItemPeer.doSelect(criteria, con);
1156                 }
1157             }
1158         }
1159         lastSorderItemsCriteria = criteria;
1160
1161         return collSorderItems;
1162           }
1163
1164                                                
1165              
1166                    
1167                    
1168                                
1169                                                              
1170                                        
1171                    
1172                    
1173          
1174    /**
1175     * If this collection has already been initialized with
1176     * an identical criteria, it returns the collection.
1177     * Otherwise if this Currency is new, it will return
1178     * an empty collection; or if this Currency has previously
1179     * been saved, it will retrieve related SorderItems from storage.
1180     *
1181     * This method is protected by default in order to keep the public
1182     * api reasonable. You can provide public methods for those you
1183     * actually need in Currency.
1184     */

1185    protected List JavaDoc getSorderItemsJoinSorder(Criteria criteria)
1186        throws TorqueException
1187    {
1188                    if (collSorderItems == null)
1189        {
1190            if (isNew())
1191            {
1192               collSorderItems = new ArrayList JavaDoc();
1193            }
1194            else
1195            {
1196                              criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1197                              collSorderItems = SorderItemPeer.doSelectJoinSorder(criteria);
1198            }
1199        }
1200        else
1201        {
1202            // the following code is to determine if a new query is
1203
// called for. If the criteria is the same as the last
1204
// one, just return the collection.
1205

1206                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1207                                    if (!lastSorderItemsCriteria.equals(criteria))
1208            {
1209                collSorderItems = SorderItemPeer.doSelectJoinSorder(criteria);
1210            }
1211        }
1212        lastSorderItemsCriteria = criteria;
1213
1214        return collSorderItems;
1215                }
1216                  
1217                    
1218                    
1219                                
1220                                                              
1221                                        
1222                    
1223                    
1224          
1225    /**
1226     * If this collection has already been initialized with
1227     * an identical criteria, it returns the collection.
1228     * Otherwise if this Currency is new, it will return
1229     * an empty collection; or if this Currency has previously
1230     * been saved, it will retrieve related SorderItems from storage.
1231     *
1232     * This method is protected by default in order to keep the public
1233     * api reasonable. You can provide public methods for those you
1234     * actually need in Currency.
1235     */

1236    protected List JavaDoc getSorderItemsJoinProduct(Criteria criteria)
1237        throws TorqueException
1238    {
1239                    if (collSorderItems == null)
1240        {
1241            if (isNew())
1242            {
1243               collSorderItems = new ArrayList JavaDoc();
1244            }
1245            else
1246            {
1247                              criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1248                              collSorderItems = SorderItemPeer.doSelectJoinProduct(criteria);
1249            }
1250        }
1251        else
1252        {
1253            // the following code is to determine if a new query is
1254
// called for. If the criteria is the same as the last
1255
// one, just return the collection.
1256

1257                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1258                                    if (!lastSorderItemsCriteria.equals(criteria))
1259            {
1260                collSorderItems = SorderItemPeer.doSelectJoinProduct(criteria);
1261            }
1262        }
1263        lastSorderItemsCriteria = criteria;
1264
1265        return collSorderItems;
1266                }
1267                  
1268                    
1269                    
1270                                            
1271                                                                          
1272                                        
1273                    
1274                    
1275          
1276    /**
1277     * If this collection has already been initialized with
1278     * an identical criteria, it returns the collection.
1279     * Otherwise if this Currency is new, it will return
1280     * an empty collection; or if this Currency has previously
1281     * been saved, it will retrieve related SorderItems from storage.
1282     *
1283     * This method is protected by default in order to keep the public
1284     * api reasonable. You can provide public methods for those you
1285     * actually need in Currency.
1286     */

1287    protected List JavaDoc getSorderItemsJoinCustomerRelatedByCustomerId(Criteria criteria)
1288        throws TorqueException
1289    {
1290                    if (collSorderItems == null)
1291        {
1292            if (isNew())
1293            {
1294               collSorderItems = new ArrayList JavaDoc();
1295            }
1296            else
1297            {
1298                              criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1299                              collSorderItems = SorderItemPeer.doSelectJoinCustomerRelatedByCustomerId(criteria);
1300            }
1301        }
1302        else
1303        {
1304            // the following code is to determine if a new query is
1305
// called for. If the criteria is the same as the last
1306
// one, just return the collection.
1307

1308                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1309                                    if (!lastSorderItemsCriteria.equals(criteria))
1310            {
1311                collSorderItems = SorderItemPeer.doSelectJoinCustomerRelatedByCustomerId(criteria);
1312            }
1313        }
1314        lastSorderItemsCriteria = criteria;
1315
1316        return collSorderItems;
1317                }
1318                  
1319                    
1320                    
1321                                            
1322                                                                          
1323                                        
1324                    
1325                    
1326          
1327    /**
1328     * If this collection has already been initialized with
1329     * an identical criteria, it returns the collection.
1330     * Otherwise if this Currency is new, it will return
1331     * an empty collection; or if this Currency has previously
1332     * been saved, it will retrieve related SorderItems from storage.
1333     *
1334     * This method is protected by default in order to keep the public
1335     * api reasonable. You can provide public methods for those you
1336     * actually need in Currency.
1337     */

1338    protected List JavaDoc getSorderItemsJoinCustomerRelatedByRecipientId(Criteria criteria)
1339        throws TorqueException
1340    {
1341                    if (collSorderItems == null)
1342        {
1343            if (isNew())
1344            {
1345               collSorderItems = new ArrayList JavaDoc();
1346            }
1347            else
1348            {
1349                              criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1350                              collSorderItems = SorderItemPeer.doSelectJoinCustomerRelatedByRecipientId(criteria);
1351            }
1352        }
1353        else
1354        {
1355            // the following code is to determine if a new query is
1356
// called for. If the criteria is the same as the last
1357
// one, just return the collection.
1358

1359                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1360                                    if (!lastSorderItemsCriteria.equals(criteria))
1361            {
1362                collSorderItems = SorderItemPeer.doSelectJoinCustomerRelatedByRecipientId(criteria);
1363            }
1364        }
1365        lastSorderItemsCriteria = criteria;
1366
1367        return collSorderItems;
1368                }
1369                  
1370                    
1371                    
1372                                
1373                                                              
1374                                        
1375                    
1376                    
1377          
1378    /**
1379     * If this collection has already been initialized with
1380     * an identical criteria, it returns the collection.
1381     * Otherwise if this Currency is new, it will return
1382     * an empty collection; or if this Currency has previously
1383     * been saved, it will retrieve related SorderItems from storage.
1384     *
1385     * This method is protected by default in order to keep the public
1386     * api reasonable. You can provide public methods for those you
1387     * actually need in Currency.
1388     */

1389    protected List JavaDoc getSorderItemsJoinProject(Criteria criteria)
1390        throws TorqueException
1391    {
1392                    if (collSorderItems == null)
1393        {
1394            if (isNew())
1395            {
1396               collSorderItems = new ArrayList JavaDoc();
1397            }
1398            else
1399            {
1400                              criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1401                              collSorderItems = SorderItemPeer.doSelectJoinProject(criteria);
1402            }
1403        }
1404        else
1405        {
1406            // the following code is to determine if a new query is
1407
// called for. If the criteria is the same as the last
1408
// one, just return the collection.
1409

1410                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1411                                    if (!lastSorderItemsCriteria.equals(criteria))
1412            {
1413                collSorderItems = SorderItemPeer.doSelectJoinProject(criteria);
1414            }
1415        }
1416        lastSorderItemsCriteria = criteria;
1417
1418        return collSorderItems;
1419                }
1420                  
1421                    
1422                              
1423                                
1424                                                              
1425                                        
1426                    
1427                    
1428          
1429    /**
1430     * If this collection has already been initialized with
1431     * an identical criteria, it returns the collection.
1432     * Otherwise if this Currency is new, it will return
1433     * an empty collection; or if this Currency has previously
1434     * been saved, it will retrieve related SorderItems from storage.
1435     *
1436     * This method is protected by default in order to keep the public
1437     * api reasonable. You can provide public methods for those you
1438     * actually need in Currency.
1439     */

1440    protected List JavaDoc getSorderItemsJoinCurrency(Criteria criteria)
1441        throws TorqueException
1442    {
1443                    if (collSorderItems == null)
1444        {
1445            if (isNew())
1446            {
1447               collSorderItems = new ArrayList JavaDoc();
1448            }
1449            else
1450            {
1451                              criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1452                              collSorderItems = SorderItemPeer.doSelectJoinCurrency(criteria);
1453            }
1454        }
1455        else
1456        {
1457            // the following code is to determine if a new query is
1458
// called for. If the criteria is the same as the last
1459
// one, just return the collection.
1460

1461                        criteria.add(SorderItemPeer.CURRENCY_ID, getCurrencyId());
1462                                    if (!lastSorderItemsCriteria.equals(criteria))
1463            {
1464                collSorderItems = SorderItemPeer.doSelectJoinCurrency(criteria);
1465            }
1466        }
1467        lastSorderItemsCriteria = criteria;
1468
1469        return collSorderItems;
1470                }
1471                            
1472
1473
1474                          
1475            
1476          /**
1477     * Collection to store aggregation of collPaymentItems
1478     */

1479    protected List JavaDoc collPaymentItems;
1480
1481    /**
1482     * Temporary storage of collPaymentItems to save a possible db hit in
1483     * the event objects are add to the collection, but the
1484     * complete collection is never requested.
1485     */

1486    protected void initPaymentItems()
1487    {
1488        if (collPaymentItems == null)
1489        {
1490            collPaymentItems = new ArrayList JavaDoc();
1491        }
1492    }
1493
1494    /**
1495     * Method called to associate a PaymentItem object to this object
1496     * through the PaymentItem foreign key attribute
1497     *
1498     * @param l PaymentItem
1499     * @throws TorqueException
1500     */

1501    public void addPaymentItem(PaymentItem l) throws TorqueException
1502    {
1503        getPaymentItems().add(l);
1504        l.setCurrency((Currency) this);
1505    }
1506
1507    /**
1508     * The criteria used to select the current contents of collPaymentItems
1509     */

1510    private Criteria lastPaymentItemsCriteria = null;
1511      
1512    /**
1513     * If this collection has already been initialized, returns
1514     * the collection. Otherwise returns the results of
1515     * getPaymentItems(new Criteria())
1516     *
1517     * @throws TorqueException
1518     */

1519    public List JavaDoc getPaymentItems() throws TorqueException
1520    {
1521              if (collPaymentItems == null)
1522        {
1523            collPaymentItems = getPaymentItems(new Criteria(10));
1524        }
1525        return collPaymentItems;
1526          }
1527
1528    /**
1529     * If this collection has already been initialized with
1530     * an identical criteria, it returns the collection.
1531     * Otherwise if this Currency has previously
1532     * been saved, it will retrieve related PaymentItems from storage.
1533     * If this Currency is new, it will return
1534     * an empty collection or the current collection, the criteria
1535     * is ignored on a new object.
1536     *
1537     * @throws TorqueException
1538     */

1539    public List JavaDoc getPaymentItems(Criteria criteria) throws TorqueException
1540    {
1541              if (collPaymentItems == null)
1542        {
1543            if (isNew())
1544            {
1545               collPaymentItems = new ArrayList JavaDoc();
1546            }
1547            else
1548            {
1549                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId() );
1550                        collPaymentItems = PaymentItemPeer.doSelect(criteria);
1551            }
1552        }
1553        else
1554        {
1555            // criteria has no effect for a new object
1556
if (!isNew())
1557            {
1558                // the following code is to determine if a new query is
1559
// called for. If the criteria is the same as the last
1560
// one, just return the collection.
1561
criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1562                            if (!lastPaymentItemsCriteria.equals(criteria))
1563                {
1564                    collPaymentItems = PaymentItemPeer.doSelect(criteria);
1565                }
1566            }
1567        }
1568        lastPaymentItemsCriteria = criteria;
1569
1570        return collPaymentItems;
1571          }
1572
1573    /**
1574     * If this collection has already been initialized, returns
1575     * the collection. Otherwise returns the results of
1576     * getPaymentItems(new Criteria(),Connection)
1577     * This method takes in the Connection also as input so that
1578     * referenced objects can also be obtained using a Connection
1579     * that is taken as input
1580     */

1581    public List JavaDoc getPaymentItems(Connection JavaDoc con) throws TorqueException
1582    {
1583              if (collPaymentItems == null)
1584        {
1585            collPaymentItems = getPaymentItems(new Criteria(10), con);
1586        }
1587        return collPaymentItems;
1588          }
1589
1590    /**
1591     * If this collection has already been initialized with
1592     * an identical criteria, it returns the collection.
1593     * Otherwise if this Currency has previously
1594     * been saved, it will retrieve related PaymentItems from storage.
1595     * If this Currency is new, it will return
1596     * an empty collection or the current collection, the criteria
1597     * is ignored on a new object.
1598     * This method takes in the Connection also as input so that
1599     * referenced objects can also be obtained using a Connection
1600     * that is taken as input
1601     */

1602    public List JavaDoc getPaymentItems(Criteria criteria, Connection JavaDoc con)
1603            throws TorqueException
1604    {
1605              if (collPaymentItems == null)
1606        {
1607            if (isNew())
1608            {
1609               collPaymentItems = new ArrayList JavaDoc();
1610            }
1611            else
1612            {
1613                         criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1614                         collPaymentItems = PaymentItemPeer.doSelect(criteria, con);
1615             }
1616         }
1617         else
1618         {
1619             // criteria has no effect for a new object
1620
if (!isNew())
1621             {
1622                 // the following code is to determine if a new query is
1623
// called for. If the criteria is the same as the last
1624
// one, just return the collection.
1625
criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1626                             if (!lastPaymentItemsCriteria.equals(criteria))
1627                 {
1628                     collPaymentItems = PaymentItemPeer.doSelect(criteria, con);
1629                 }
1630             }
1631         }
1632         lastPaymentItemsCriteria = criteria;
1633
1634         return collPaymentItems;
1635           }
1636
1637                                                
1638              
1639                    
1640                    
1641                                
1642                                                              
1643                                        
1644                    
1645                    
1646          
1647    /**
1648     * If this collection has already been initialized with
1649     * an identical criteria, it returns the collection.
1650     * Otherwise if this Currency is new, it will return
1651     * an empty collection; or if this Currency has previously
1652     * been saved, it will retrieve related PaymentItems from storage.
1653     *
1654     * This method is protected by default in order to keep the public
1655     * api reasonable. You can provide public methods for those you
1656     * actually need in Currency.
1657     */

1658    protected List JavaDoc getPaymentItemsJoinPayment(Criteria criteria)
1659        throws TorqueException
1660    {
1661                    if (collPaymentItems == null)
1662        {
1663            if (isNew())
1664            {
1665               collPaymentItems = new ArrayList JavaDoc();
1666            }
1667            else
1668            {
1669                              criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1670                              collPaymentItems = PaymentItemPeer.doSelectJoinPayment(criteria);
1671            }
1672        }
1673        else
1674        {
1675            // the following code is to determine if a new query is
1676
// called for. If the criteria is the same as the last
1677
// one, just return the collection.
1678

1679                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1680                                    if (!lastPaymentItemsCriteria.equals(criteria))
1681            {
1682                collPaymentItems = PaymentItemPeer.doSelectJoinPayment(criteria);
1683            }
1684        }
1685        lastPaymentItemsCriteria = criteria;
1686
1687        return collPaymentItems;
1688                }
1689                  
1690                    
1691                    
1692                                
1693                                                              
1694                                        
1695                    
1696                    
1697          
1698    /**
1699     * If this collection has already been initialized with
1700     * an identical criteria, it returns the collection.
1701     * Otherwise if this Currency is new, it will return
1702     * an empty collection; or if this Currency has previously
1703     * been saved, it will retrieve related PaymentItems from storage.
1704     *
1705     * This method is protected by default in order to keep the public
1706     * api reasonable. You can provide public methods for those you
1707     * actually need in Currency.
1708     */

1709    protected List JavaDoc getPaymentItemsJoinSorder(Criteria criteria)
1710        throws TorqueException
1711    {
1712                    if (collPaymentItems == null)
1713        {
1714            if (isNew())
1715            {
1716               collPaymentItems = new ArrayList JavaDoc();
1717            }
1718            else
1719            {
1720                              criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1721                              collPaymentItems = PaymentItemPeer.doSelectJoinSorder(criteria);
1722            }
1723        }
1724        else
1725        {
1726            // the following code is to determine if a new query is
1727
// called for. If the criteria is the same as the last
1728
// one, just return the collection.
1729

1730                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1731                                    if (!lastPaymentItemsCriteria.equals(criteria))
1732            {
1733                collPaymentItems = PaymentItemPeer.doSelectJoinSorder(criteria);
1734            }
1735        }
1736        lastPaymentItemsCriteria = criteria;
1737
1738        return collPaymentItems;
1739                }
1740                  
1741                    
1742                    
1743                                
1744                                                              
1745                                        
1746                    
1747                    
1748          
1749    /**
1750     * If this collection has already been initialized with
1751     * an identical criteria, it returns the collection.
1752     * Otherwise if this Currency is new, it will return
1753     * an empty collection; or if this Currency has previously
1754     * been saved, it will retrieve related PaymentItems from storage.
1755     *
1756     * This method is protected by default in order to keep the public
1757     * api reasonable. You can provide public methods for those you
1758     * actually need in Currency.
1759     */

1760    protected List JavaDoc getPaymentItemsJoinProduct(Criteria criteria)
1761        throws TorqueException
1762    {
1763                    if (collPaymentItems == null)
1764        {
1765            if (isNew())
1766            {
1767               collPaymentItems = new ArrayList JavaDoc();
1768            }
1769            else
1770            {
1771                              criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1772                              collPaymentItems = PaymentItemPeer.doSelectJoinProduct(criteria);
1773            }
1774        }
1775        else
1776        {
1777            // the following code is to determine if a new query is
1778
// called for. If the criteria is the same as the last
1779
// one, just return the collection.
1780

1781                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1782                                    if (!lastPaymentItemsCriteria.equals(criteria))
1783            {
1784                collPaymentItems = PaymentItemPeer.doSelectJoinProduct(criteria);
1785            }
1786        }
1787        lastPaymentItemsCriteria = criteria;
1788
1789        return collPaymentItems;
1790                }
1791                  
1792                    
1793                              
1794                                
1795                                                              
1796                                        
1797                    
1798                    
1799          
1800    /**
1801     * If this collection has already been initialized with
1802     * an identical criteria, it returns the collection.
1803     * Otherwise if this Currency is new, it will return
1804     * an empty collection; or if this Currency has previously
1805     * been saved, it will retrieve related PaymentItems from storage.
1806     *
1807     * This method is protected by default in order to keep the public
1808     * api reasonable. You can provide public methods for those you
1809     * actually need in Currency.
1810     */

1811    protected List JavaDoc getPaymentItemsJoinCurrency(Criteria criteria)
1812        throws TorqueException
1813    {
1814                    if (collPaymentItems == null)
1815        {
1816            if (isNew())
1817            {
1818               collPaymentItems = new ArrayList JavaDoc();
1819            }
1820            else
1821            {
1822                              criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1823                              collPaymentItems = PaymentItemPeer.doSelectJoinCurrency(criteria);
1824            }
1825        }
1826        else
1827        {
1828            // the following code is to determine if a new query is
1829
// called for. If the criteria is the same as the last
1830
// one, just return the collection.
1831

1832                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1833                                    if (!lastPaymentItemsCriteria.equals(criteria))
1834            {
1835                collPaymentItems = PaymentItemPeer.doSelectJoinCurrency(criteria);
1836            }
1837        }
1838        lastPaymentItemsCriteria = criteria;
1839
1840        return collPaymentItems;
1841                }
1842                  
1843                    
1844                    
1845                                
1846                                                              
1847                                        
1848                    
1849                    
1850          
1851    /**
1852     * If this collection has already been initialized with
1853     * an identical criteria, it returns the collection.
1854     * Otherwise if this Currency is new, it will return
1855     * an empty collection; or if this Currency has previously
1856     * been saved, it will retrieve related PaymentItems from storage.
1857     *
1858     * This method is protected by default in order to keep the public
1859     * api reasonable. You can provide public methods for those you
1860     * actually need in Currency.
1861     */

1862    protected List JavaDoc getPaymentItemsJoinCustomer(Criteria criteria)
1863        throws TorqueException
1864    {
1865                    if (collPaymentItems == null)
1866        {
1867            if (isNew())
1868            {
1869               collPaymentItems = new ArrayList JavaDoc();
1870            }
1871            else
1872            {
1873                              criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1874                              collPaymentItems = PaymentItemPeer.doSelectJoinCustomer(criteria);
1875            }
1876        }
1877        else
1878        {
1879            // the following code is to determine if a new query is
1880
// called for. If the criteria is the same as the last
1881
// one, just return the collection.
1882

1883                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1884                                    if (!lastPaymentItemsCriteria.equals(criteria))
1885            {
1886                collPaymentItems = PaymentItemPeer.doSelectJoinCustomer(criteria);
1887            }
1888        }
1889        lastPaymentItemsCriteria = criteria;
1890
1891        return collPaymentItems;
1892                }
1893                  
1894                    
1895                    
1896                                
1897                                                              
1898                                        
1899                    
1900                    
1901          
1902    /**
1903     * If this collection has already been initialized with
1904     * an identical criteria, it returns the collection.
1905     * Otherwise if this Currency is new, it will return
1906     * an empty collection; or if this Currency has previously
1907     * been saved, it will retrieve related PaymentItems from storage.
1908     *
1909     * This method is protected by default in order to keep the public
1910     * api reasonable. You can provide public methods for those you
1911     * actually need in Currency.
1912     */

1913    protected List JavaDoc getPaymentItemsJoinProject(Criteria criteria)
1914        throws TorqueException
1915    {
1916                    if (collPaymentItems == null)
1917        {
1918            if (isNew())
1919            {
1920               collPaymentItems = new ArrayList JavaDoc();
1921            }
1922            else
1923            {
1924                              criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1925                              collPaymentItems = PaymentItemPeer.doSelectJoinProject(criteria);
1926            }
1927        }
1928        else
1929        {
1930            // the following code is to determine if a new query is
1931
// called for. If the criteria is the same as the last
1932
// one, just return the collection.
1933

1934                        criteria.add(PaymentItemPeer.CURRENCY_ID, getCurrencyId());
1935                                    if (!lastPaymentItemsCriteria.equals(criteria))
1936            {
1937                collPaymentItems = PaymentItemPeer.doSelectJoinProject(criteria);
1938            }
1939        }
1940        lastPaymentItemsCriteria = criteria;
1941
1942        return collPaymentItems;
1943                }
1944                            
1945
1946
1947          
1948    private static List JavaDoc fieldNames = null;
1949
1950    /**
1951     * Generate a list of field names.
1952     *
1953     * @return a list of field names
1954     */

1955    public static synchronized List JavaDoc getFieldNames()
1956    {
1957        if (fieldNames == null)
1958        {
1959            fieldNames = new ArrayList JavaDoc();
1960              fieldNames.add("CurrencyId");
1961              fieldNames.add("CurrencyName");
1962              fieldNames.add("CurrencyCode");
1963              fieldNames.add("CurrencyRate");
1964              fieldNames = Collections.unmodifiableList(fieldNames);
1965        }
1966        return fieldNames;
1967    }
1968
1969    /**
1970     * Retrieves a field from the object by name passed in as a String.
1971     *
1972     * @param name field name
1973     * @return value
1974     */

1975    public Object JavaDoc getByName(String JavaDoc name)
1976    {
1977          if (name.equals("CurrencyId"))
1978        {
1979                return new Integer JavaDoc(getCurrencyId());
1980            }
1981          if (name.equals("CurrencyName"))
1982        {
1983                return getCurrencyName();
1984            }
1985          if (name.equals("CurrencyCode"))
1986        {
1987                return getCurrencyCode();
1988            }
1989          if (name.equals("CurrencyRate"))
1990        {
1991                return getCurrencyRate();
1992            }
1993          return null;
1994    }
1995    
1996    /**
1997     * Retrieves a field from the object by name passed in
1998     * as a String. The String must be one of the static
1999     * Strings defined in this Class' Peer.
2000     *
2001     * @param name peer name
2002     * @return value
2003     */

2004    public Object JavaDoc getByPeerName(String JavaDoc name)
2005    {
2006          if (name.equals(CurrencyPeer.CURRENCY_ID))
2007        {
2008                return new Integer JavaDoc(getCurrencyId());
2009            }
2010          if (name.equals(CurrencyPeer.CURRENCY_NAME))
2011        {
2012                return getCurrencyName();
2013            }
2014          if (name.equals(CurrencyPeer.CURRENCY_CODE))
2015        {
2016                return getCurrencyCode();
2017            }
2018          if (name.equals(CurrencyPeer.CURRENCY_RATE))
2019        {
2020                return getCurrencyRate();
2021            }
2022          return null;
2023    }
2024
2025    /**
2026     * Retrieves a field from the object by Position as specified
2027     * in the xml schema. Zero-based.
2028     *
2029     * @param pos position in xml schema
2030     * @return value
2031     */

2032    public Object JavaDoc getByPosition(int pos)
2033    {
2034            if (pos == 0)
2035        {
2036                return new Integer JavaDoc(getCurrencyId());
2037            }
2038              if (pos == 1)
2039        {
2040                return getCurrencyName();
2041            }
2042              if (pos == 2)
2043        {
2044                return getCurrencyCode();
2045            }
2046              if (pos == 3)
2047        {
2048                return getCurrencyRate();
2049            }
2050              return null;
2051    }
2052     
2053    /**
2054     * Stores the object in the database. If the object is new,
2055     * it inserts it; otherwise an update is performed.
2056     *
2057     * @throws Exception
2058     */

2059    public void save() throws Exception JavaDoc
2060    {
2061          save(CurrencyPeer.getMapBuilder()
2062                .getDatabaseMap().getName());
2063      }
2064
2065    /**
2066     * Stores the object in the database. If the object is new,
2067     * it inserts it; otherwise an update is performed.
2068       * Note: this code is here because the method body is
2069     * auto-generated conditionally and therefore needs to be
2070     * in this file instead of in the super class, BaseObject.
2071       *
2072     * @param dbName
2073     * @throws TorqueException
2074     */

2075    public void save(String JavaDoc dbName) throws TorqueException
2076    {
2077        Connection JavaDoc con = null;
2078          try
2079        {
2080            con = Transaction.begin(dbName);
2081            save(con);
2082            Transaction.commit(con);
2083        }
2084        catch(TorqueException e)
2085        {
2086            Transaction.safeRollback(con);
2087            throw e;
2088        }
2089      }
2090
2091      /** flag to prevent endless save loop, if this object is referenced
2092        by another object which falls in this transaction. */

2093    private boolean alreadyInSave = false;
2094      /**
2095     * Stores the object in the database. If the object is new,
2096     * it inserts it; otherwise an update is performed. This method
2097     * is meant to be used as part of a transaction, otherwise use
2098     * the save() method and the connection details will be handled
2099     * internally
2100     *
2101     * @param con
2102     * @throws TorqueException
2103     */

2104    public void save(Connection JavaDoc con) throws TorqueException
2105    {
2106          if (!alreadyInSave)
2107        {
2108            alreadyInSave = true;
2109
2110
2111  
2112            // If this object has been modified, then save it to the database.
2113
if (isModified())
2114            {
2115                if (isNew())
2116                {
2117                    CurrencyPeer.doInsert((Currency) this, con);
2118                    setNew(false);
2119                }
2120                else
2121                {
2122                    CurrencyPeer.doUpdate((Currency) this, con);
2123                }
2124            }
2125
2126                                      
2127                
2128                    if (collSorders != null)
2129            {
2130                for (int i = 0; i < collSorders.size(); i++)
2131                {
2132                    ((Sorder) collSorders.get(i)).save(con);
2133                }
2134            }
2135                                                  
2136                
2137                    if (collPayments != null)
2138            {
2139                for (int i = 0; i < collPayments.size(); i++)
2140                {
2141                    ((Payment) collPayments.get(i)).save(con);
2142                }
2143            }
2144                                                  
2145                
2146                    if (collSorderItems != null)
2147            {
2148                for (int i = 0; i < collSorderItems.size(); i++)
2149                {
2150                    ((SorderItem) collSorderItems.get(i)).save(con);
2151                }
2152            }
2153                                                  
2154                
2155                    if (collPaymentItems != null)
2156            {
2157                for (int i = 0; i < collPaymentItems.size(); i++)
2158                {
2159                    ((PaymentItem) collPaymentItems.get(i)).save(con);
2160                }
2161            }
2162                                  alreadyInSave = false;
2163        }
2164      }
2165
2166                        
2167      /**
2168     * Set the PrimaryKey using ObjectKey.
2169     *
2170     * @param key currencyId ObjectKey
2171     */

2172    public void setPrimaryKey(ObjectKey key)
2173        throws TorqueException
2174    {
2175            setCurrencyId(((NumberKey) key).intValue());
2176        }
2177
2178    /**
2179     * Set the PrimaryKey using a String.
2180     *
2181     * @param key
2182     */

2183    public void setPrimaryKey(String JavaDoc key) throws TorqueException
2184    {
2185            setCurrencyId(Integer.parseInt(key));
2186        }
2187
2188  
2189    /**
2190     * returns an id that differentiates this object from others
2191     * of its class.
2192     */

2193    public ObjectKey getPrimaryKey()
2194    {
2195          return SimpleKey.keyFor(getCurrencyId());
2196      }
2197 
2198    /**
2199     * get an id that differentiates this object from others
2200     * of its class.
2201     */

2202    public String JavaDoc getQueryKey()
2203    {
2204        if (getPrimaryKey() == null)
2205        {
2206            return "";
2207        }
2208        else
2209        {
2210            return getPrimaryKey().toString();
2211        }
2212    }
2213
2214    /**
2215     * set an id that differentiates this object from others
2216     * of its class.
2217     */

2218    public void setQueryKey(String JavaDoc key)
2219        throws TorqueException
2220    {
2221        setPrimaryKey(key);
2222    }
2223
2224    /**
2225     * Makes a copy of this object.
2226     * It creates a new object filling in the simple attributes.
2227       * It then fills all the association collections and sets the
2228     * related objects to isNew=true.
2229       */

2230      public Currency copy() throws TorqueException
2231    {
2232        return copyInto(new Currency());
2233    }
2234  
2235    protected Currency copyInto(Currency copyObj) throws TorqueException
2236    {
2237          copyObj.setCurrencyId(currencyId);
2238          copyObj.setCurrencyName(currencyName);
2239          copyObj.setCurrencyCode(currencyCode);
2240          copyObj.setCurrencyRate(currencyRate);
2241  
2242                            copyObj.setCurrencyId( 0);
2243                              
2244                                      
2245                            
2246        List JavaDoc v = getSorders();
2247        for (int i = 0; i < v.size(); i++)
2248        {
2249            Sorder obj = (Sorder) v.get(i);
2250            copyObj.addSorder(obj.copy());
2251        }
2252                                                  
2253                            
2254        v = getPayments();
2255        for (int i = 0; i < v.size(); i++)
2256        {
2257            Payment obj = (Payment) v.get(i);
2258            copyObj.addPayment(obj.copy());
2259        }
2260                                                  
2261                            
2262        v = getSorderItems();
2263        for (int i = 0; i < v.size(); i++)
2264        {
2265            SorderItem obj = (SorderItem) v.get(i);
2266            copyObj.addSorderItem(obj.copy());
2267        }
2268                                                  
2269                            
2270        v = getPaymentItems();
2271        for (int i = 0; i < v.size(); i++)
2272        {
2273            PaymentItem obj = (PaymentItem) v.get(i);
2274            copyObj.addPaymentItem(obj.copy());
2275        }
2276                            return copyObj;
2277    }
2278
2279    /**
2280     * returns a peer instance associated with this om. Since Peer classes
2281     * are not to have any instance attributes, this method returns the
2282     * same instance for all member of this class. The method could therefore
2283     * be static, but this would prevent one from overriding the behavior.
2284     */

2285    public CurrencyPeer getPeer()
2286    {
2287        return peer;
2288    }
2289
2290    public String JavaDoc toString()
2291    {
2292        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
2293        str.append("Currency:\n");
2294        str.append("CurrencyId = ")
2295               .append(getCurrencyId())
2296             .append("\n");
2297        str.append("CurrencyName = ")
2298               .append(getCurrencyName())
2299             .append("\n");
2300        str.append("CurrencyCode = ")
2301               .append(getCurrencyCode())
2302             .append("\n");
2303        str.append("CurrencyRate = ")
2304               .append(getCurrencyRate())
2305             .append("\n");
2306        return(str.toString());
2307    }
2308}
2309
Popular Tags