KickJava   Java API By Example, From Geeks To Geeks.

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


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     
28     
29   
30 /**
31  * This class was autogenerated by Torque on:
32  *
33  * [Wed May 04 09:10:56 CEST 2005]
34  *
35  * You should not use this class directly. It should not even be
36  * extended all references should be to Payment
37  */

38 public abstract class BasePayment extends BaseObject
39     implements org.apache.turbine.om.Retrievable
40 {
41     /** The Peer class */
42     private static final PaymentPeer peer =
43         new PaymentPeer();
44
45         
46     /** The value for the paymentId field */
47     private int paymentId;
48                                                 
49     /** The value for the paymentCode field */
50     private String JavaDoc paymentCode = "AUTO";
51                                           
52     /** The value for the status field */
53     private int status = 30;
54                                           
55     /** The value for the priority field */
56     private int priority = 30;
57       
58     /** The value for the issuedDate field */
59     private Date JavaDoc issuedDate;
60       
61     /** The value for the closedDate field */
62     private Date JavaDoc closedDate;
63                                           
64     /** The value for the customerId field */
65     private int customerId = 1000;
66                                           
67     /** The value for the projectId field */
68     private int projectId = 1000;
69                                           
70     /** The value for the sorderId field */
71     private int sorderId = 1000;
72       
73     /** The value for the invoiceCode field */
74     private String JavaDoc invoiceCode;
75                                           
76     /** The value for the payTerm field */
77     private int payTerm = 10;
78                                           
79     /** The value for the payMethod field */
80     private int payMethod = 10;
81                                           
82     /** The value for the currencyId field */
83     private int currencyId = 1000;
84                                   
85     /** The value for the currencyRate field */
86     private BigDecimal JavaDoc currencyRate= new BigDecimal JavaDoc(1);
87                                   
88     /** The value for the currencyAmount field */
89     private BigDecimal JavaDoc currencyAmount= new BigDecimal JavaDoc(0);
90                                   
91     /** The value for the totalAmount field */
92     private BigDecimal JavaDoc totalAmount= new BigDecimal JavaDoc(0);
93                                                 
94     /** The value for the subject field */
95     private String JavaDoc subject = "---";
96       
97     /** The value for the notes field */
98     private String JavaDoc notes;
99       
100     /** The value for the created field */
101     private Date JavaDoc created;
102       
103     /** The value for the modified field */
104     private Date JavaDoc modified;
105       
106     /** The value for the createdBy field */
107     private String JavaDoc createdBy;
108       
109     /** The value for the modifiedBy field */
110     private String JavaDoc modifiedBy;
111   
112     
113     /**
114      * Get the PaymentId
115      *
116      * @return int
117      */

118     public int getPaymentId()
119     {
120         return paymentId;
121     }
122
123                                               
124     /**
125      * Set the value of PaymentId
126      *
127      * @param v new value
128      */

129     public void setPaymentId(int v) throws TorqueException
130     {
131     
132                   if (this.paymentId != v)
133               {
134             this.paymentId = v;
135             setModified(true);
136         }
137     
138           
139                                   
140                   // update associated PaymentItem
141
if (collPaymentItems != null)
142         {
143             for (int i = 0; i < collPaymentItems.size(); i++)
144             {
145                 ((PaymentItem) collPaymentItems.get(i))
146                     .setPaymentId(v);
147             }
148         }
149                                 }
150   
151     /**
152      * Get the PaymentCode
153      *
154      * @return String
155      */

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

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

184     public int getStatus()
185     {
186         return status;
187     }
188
189                         
190     /**
191      * Set the value of Status
192      *
193      * @param v new value
194      */

195     public void setStatus(int v)
196     {
197     
198                   if (this.status != v)
199               {
200             this.status = v;
201             setModified(true);
202         }
203     
204           
205               }
206   
207     /**
208      * Get the Priority
209      *
210      * @return int
211      */

212     public int getPriority()
213     {
214         return priority;
215     }
216
217                         
218     /**
219      * Set the value of Priority
220      *
221      * @param v new value
222      */

223     public void setPriority(int v)
224     {
225     
226                   if (this.priority != v)
227               {
228             this.priority = v;
229             setModified(true);
230         }
231     
232           
233               }
234   
235     /**
236      * Get the IssuedDate
237      *
238      * @return Date
239      */

240     public Date JavaDoc getIssuedDate()
241     {
242         return issuedDate;
243     }
244
245                         
246     /**
247      * Set the value of IssuedDate
248      *
249      * @param v new value
250      */

251     public void setIssuedDate(Date JavaDoc v)
252     {
253     
254                   if (!ObjectUtils.equals(this.issuedDate, v))
255               {
256             this.issuedDate = v;
257             setModified(true);
258         }
259     
260           
261               }
262   
263     /**
264      * Get the ClosedDate
265      *
266      * @return Date
267      */

268     public Date JavaDoc getClosedDate()
269     {
270         return closedDate;
271     }
272
273                         
274     /**
275      * Set the value of ClosedDate
276      *
277      * @param v new value
278      */

279     public void setClosedDate(Date JavaDoc v)
280     {
281     
282                   if (!ObjectUtils.equals(this.closedDate, v))
283               {
284             this.closedDate = v;
285             setModified(true);
286         }
287     
288           
289               }
290   
291     /**
292      * Get the CustomerId
293      *
294      * @return int
295      */

296     public int getCustomerId()
297     {
298         return customerId;
299     }
300
301                               
302     /**
303      * Set the value of CustomerId
304      *
305      * @param v new value
306      */

307     public void setCustomerId(int v) throws TorqueException
308     {
309     
310                   if (this.customerId != v)
311               {
312             this.customerId = v;
313             setModified(true);
314         }
315     
316                           
317                 if (aCustomer != null && !(aCustomer.getCustomerId() == v))
318                 {
319             aCustomer = null;
320         }
321       
322               }
323   
324     /**
325      * Get the ProjectId
326      *
327      * @return int
328      */

329     public int getProjectId()
330     {
331         return projectId;
332     }
333
334                               
335     /**
336      * Set the value of ProjectId
337      *
338      * @param v new value
339      */

340     public void setProjectId(int v) throws TorqueException
341     {
342     
343                   if (this.projectId != v)
344               {
345             this.projectId = v;
346             setModified(true);
347         }
348     
349                           
350                 if (aProject != null && !(aProject.getProjectId() == v))
351                 {
352             aProject = null;
353         }
354       
355               }
356   
357     /**
358      * Get the SorderId
359      *
360      * @return int
361      */

362     public int getSorderId()
363     {
364         return sorderId;
365     }
366
367                               
368     /**
369      * Set the value of SorderId
370      *
371      * @param v new value
372      */

373     public void setSorderId(int v) throws TorqueException
374     {
375     
376                   if (this.sorderId != v)
377               {
378             this.sorderId = v;
379             setModified(true);
380         }
381     
382                           
383                 if (aSorder != null && !(aSorder.getSorderId() == v))
384                 {
385             aSorder = null;
386         }
387       
388               }
389   
390     /**
391      * Get the InvoiceCode
392      *
393      * @return String
394      */

395     public String JavaDoc getInvoiceCode()
396     {
397         return invoiceCode;
398     }
399
400                         
401     /**
402      * Set the value of InvoiceCode
403      *
404      * @param v new value
405      */

406     public void setInvoiceCode(String JavaDoc v)
407     {
408     
409                   if (!ObjectUtils.equals(this.invoiceCode, v))
410               {
411             this.invoiceCode = v;
412             setModified(true);
413         }
414     
415           
416               }
417   
418     /**
419      * Get the PayTerm
420      *
421      * @return int
422      */

423     public int getPayTerm()
424     {
425         return payTerm;
426     }
427
428                         
429     /**
430      * Set the value of PayTerm
431      *
432      * @param v new value
433      */

434     public void setPayTerm(int v)
435     {
436     
437                   if (this.payTerm != v)
438               {
439             this.payTerm = v;
440             setModified(true);
441         }
442     
443           
444               }
445   
446     /**
447      * Get the PayMethod
448      *
449      * @return int
450      */

451     public int getPayMethod()
452     {
453         return payMethod;
454     }
455
456                         
457     /**
458      * Set the value of PayMethod
459      *
460      * @param v new value
461      */

462     public void setPayMethod(int v)
463     {
464     
465                   if (this.payMethod != v)
466               {
467             this.payMethod = v;
468             setModified(true);
469         }
470     
471           
472               }
473   
474     /**
475      * Get the CurrencyId
476      *
477      * @return int
478      */

479     public int getCurrencyId()
480     {
481         return currencyId;
482     }
483
484                               
485     /**
486      * Set the value of CurrencyId
487      *
488      * @param v new value
489      */

490     public void setCurrencyId(int v) throws TorqueException
491     {
492     
493                   if (this.currencyId != v)
494               {
495             this.currencyId = v;
496             setModified(true);
497         }
498     
499                           
500                 if (aCurrency != null && !(aCurrency.getCurrencyId() == v))
501                 {
502             aCurrency = null;
503         }
504       
505               }
506   
507     /**
508      * Get the CurrencyRate
509      *
510      * @return BigDecimal
511      */

512     public BigDecimal JavaDoc getCurrencyRate()
513     {
514         return currencyRate;
515     }
516
517                         
518     /**
519      * Set the value of CurrencyRate
520      *
521      * @param v new value
522      */

523     public void setCurrencyRate(BigDecimal JavaDoc v)
524     {
525     
526                   if (!ObjectUtils.equals(this.currencyRate, v))
527               {
528             this.currencyRate = v;
529             setModified(true);
530         }
531     
532           
533               }
534   
535     /**
536      * Get the CurrencyAmount
537      *
538      * @return BigDecimal
539      */

540     public BigDecimal JavaDoc getCurrencyAmount()
541     {
542         return currencyAmount;
543     }
544
545                         
546     /**
547      * Set the value of CurrencyAmount
548      *
549      * @param v new value
550      */

551     public void setCurrencyAmount(BigDecimal JavaDoc v)
552     {
553     
554                   if (!ObjectUtils.equals(this.currencyAmount, v))
555               {
556             this.currencyAmount = v;
557             setModified(true);
558         }
559     
560           
561               }
562   
563     /**
564      * Get the TotalAmount
565      *
566      * @return BigDecimal
567      */

568     public BigDecimal JavaDoc getTotalAmount()
569     {
570         return totalAmount;
571     }
572
573                         
574     /**
575      * Set the value of TotalAmount
576      *
577      * @param v new value
578      */

579     public void setTotalAmount(BigDecimal JavaDoc v)
580     {
581     
582                   if (!ObjectUtils.equals(this.totalAmount, v))
583               {
584             this.totalAmount = v;
585             setModified(true);
586         }
587     
588           
589               }
590   
591     /**
592      * Get the Subject
593      *
594      * @return String
595      */

596     public String JavaDoc getSubject()
597     {
598         return subject;
599     }
600
601                         
602     /**
603      * Set the value of Subject
604      *
605      * @param v new value
606      */

607     public void setSubject(String JavaDoc v)
608     {
609     
610                   if (!ObjectUtils.equals(this.subject, v))
611               {
612             this.subject = v;
613             setModified(true);
614         }
615     
616           
617               }
618   
619     /**
620      * Get the Notes
621      *
622      * @return String
623      */

624     public String JavaDoc getNotes()
625     {
626         return notes;
627     }
628
629                         
630     /**
631      * Set the value of Notes
632      *
633      * @param v new value
634      */

635     public void setNotes(String JavaDoc v)
636     {
637     
638                   if (!ObjectUtils.equals(this.notes, v))
639               {
640             this.notes = v;
641             setModified(true);
642         }
643     
644           
645               }
646   
647     /**
648      * Get the Created
649      *
650      * @return Date
651      */

652     public Date JavaDoc getCreated()
653     {
654         return created;
655     }
656
657                         
658     /**
659      * Set the value of Created
660      *
661      * @param v new value
662      */

663     public void setCreated(Date JavaDoc v)
664     {
665     
666                   if (!ObjectUtils.equals(this.created, v))
667               {
668             this.created = v;
669             setModified(true);
670         }
671     
672           
673               }
674   
675     /**
676      * Get the Modified
677      *
678      * @return Date
679      */

680     public Date JavaDoc getModified()
681     {
682         return modified;
683     }
684
685                         
686     /**
687      * Set the value of Modified
688      *
689      * @param v new value
690      */

691     public void setModified(Date JavaDoc v)
692     {
693     
694                   if (!ObjectUtils.equals(this.modified, v))
695               {
696             this.modified = v;
697             setModified(true);
698         }
699     
700           
701               }
702   
703     /**
704      * Get the CreatedBy
705      *
706      * @return String
707      */

708     public String JavaDoc getCreatedBy()
709     {
710         return createdBy;
711     }
712
713                         
714     /**
715      * Set the value of CreatedBy
716      *
717      * @param v new value
718      */

719     public void setCreatedBy(String JavaDoc v)
720     {
721     
722                   if (!ObjectUtils.equals(this.createdBy, v))
723               {
724             this.createdBy = v;
725             setModified(true);
726         }
727     
728           
729               }
730   
731     /**
732      * Get the ModifiedBy
733      *
734      * @return String
735      */

736     public String JavaDoc getModifiedBy()
737     {
738         return modifiedBy;
739     }
740
741                         
742     /**
743      * Set the value of ModifiedBy
744      *
745      * @param v new value
746      */

747     public void setModifiedBy(String JavaDoc v)
748     {
749     
750                   if (!ObjectUtils.equals(this.modifiedBy, v))
751               {
752             this.modifiedBy = v;
753             setModified(true);
754         }
755     
756           
757               }
758   
759       
760     
761                   
762     
763         private Customer aCustomer;
764
765     /**
766      * Declares an association between this object and a Customer object
767      *
768      * @param v Customer
769      * @throws TorqueException
770      */

771     public void setCustomer(Customer v) throws TorqueException
772     {
773             if (v == null)
774         {
775                           setCustomerId( 1000);
776               }
777         else
778         {
779             setCustomerId(v.getCustomerId());
780         }
781             aCustomer = v;
782     }
783
784                                             
785     /**
786      * Get the associated Customer object
787      *
788      * @return the associated Customer object
789      * @throws TorqueException
790      */

791     public Customer getCustomer() throws TorqueException
792     {
793         if (aCustomer == null && (this.customerId != 0))
794         {
795                           aCustomer = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId));
796               
797             /* The following can be used instead of the line above to
798                guarantee the related object contains a reference
799                to this object, but this level of coupling
800                may be undesirable in many circumstances.
801                As it can lead to a db query with many results that may
802                never be used.
803                Customer obj = CustomerPeer.retrieveByPK(this.customerId);
804                obj.addPayments(this);
805             */

806         }
807         return aCustomer;
808     }
809
810     /**
811      * Provides convenient way to set a relationship based on a
812      * ObjectKey, for example
813      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
814      *
815          */

816     public void setCustomerKey(ObjectKey key) throws TorqueException
817     {
818       
819                         setCustomerId(((NumberKey) key).intValue());
820                   }
821     
822     
823                   
824     
825         private Project aProject;
826
827     /**
828      * Declares an association between this object and a Project object
829      *
830      * @param v Project
831      * @throws TorqueException
832      */

833     public void setProject(Project v) throws TorqueException
834     {
835             if (v == null)
836         {
837                           setProjectId( 1000);
838               }
839         else
840         {
841             setProjectId(v.getProjectId());
842         }
843             aProject = v;
844     }
845
846                                             
847     /**
848      * Get the associated Project object
849      *
850      * @return the associated Project object
851      * @throws TorqueException
852      */

853     public Project getProject() throws TorqueException
854     {
855         if (aProject == null && (this.projectId != 0))
856         {
857                           aProject = ProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectId));
858               
859             /* The following can be used instead of the line above to
860                guarantee the related object contains a reference
861                to this object, but this level of coupling
862                may be undesirable in many circumstances.
863                As it can lead to a db query with many results that may
864                never be used.
865                Project obj = ProjectPeer.retrieveByPK(this.projectId);
866                obj.addPayments(this);
867             */

868         }
869         return aProject;
870     }
871
872     /**
873      * Provides convenient way to set a relationship based on a
874      * ObjectKey, for example
875      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
876      *
877          */

878     public void setProjectKey(ObjectKey key) throws TorqueException
879     {
880       
881                         setProjectId(((NumberKey) key).intValue());
882                   }
883     
884     
885                   
886     
887         private Sorder aSorder;
888
889     /**
890      * Declares an association between this object and a Sorder object
891      *
892      * @param v Sorder
893      * @throws TorqueException
894      */

895     public void setSorder(Sorder v) throws TorqueException
896     {
897             if (v == null)
898         {
899                           setSorderId( 1000);
900               }
901         else
902         {
903             setSorderId(v.getSorderId());
904         }
905             aSorder = v;
906     }
907
908                                             
909     /**
910      * Get the associated Sorder object
911      *
912      * @return the associated Sorder object
913      * @throws TorqueException
914      */

915     public Sorder getSorder() throws TorqueException
916     {
917         if (aSorder == null && (this.sorderId != 0))
918         {
919                           aSorder = SorderPeer.retrieveByPK(SimpleKey.keyFor(this.sorderId));
920               
921             /* The following can be used instead of the line above to
922                guarantee the related object contains a reference
923                to this object, but this level of coupling
924                may be undesirable in many circumstances.
925                As it can lead to a db query with many results that may
926                never be used.
927                Sorder obj = SorderPeer.retrieveByPK(this.sorderId);
928                obj.addPayments(this);
929             */

930         }
931         return aSorder;
932     }
933
934     /**
935      * Provides convenient way to set a relationship based on a
936      * ObjectKey, for example
937      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
938      *
939          */

940     public void setSorderKey(ObjectKey key) throws TorqueException
941     {
942       
943                         setSorderId(((NumberKey) key).intValue());
944                   }
945     
946     
947                   
948     
949         private Currency aCurrency;
950
951     /**
952      * Declares an association between this object and a Currency object
953      *
954      * @param v Currency
955      * @throws TorqueException
956      */

957     public void setCurrency(Currency v) throws TorqueException
958     {
959             if (v == null)
960         {
961                           setCurrencyId( 1000);
962               }
963         else
964         {
965             setCurrencyId(v.getCurrencyId());
966         }
967             aCurrency = v;
968     }
969
970                                             
971     /**
972      * Get the associated Currency object
973      *
974      * @return the associated Currency object
975      * @throws TorqueException
976      */

977     public Currency getCurrency() throws TorqueException
978     {
979         if (aCurrency == null && (this.currencyId != 0))
980         {
981                           aCurrency = CurrencyPeer.retrieveByPK(SimpleKey.keyFor(this.currencyId));
982               
983             /* The following can be used instead of the line above to
984                guarantee the related object contains a reference
985                to this object, but this level of coupling
986                may be undesirable in many circumstances.
987                As it can lead to a db query with many results that may
988                never be used.
989                Currency obj = CurrencyPeer.retrieveByPK(this.currencyId);
990                obj.addPayments(this);
991             */

992         }
993         return aCurrency;
994     }
995
996     /**
997      * Provides convenient way to set a relationship based on a
998      * ObjectKey, for example
999      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
1000     *
1001         */

1002    public void setCurrencyKey(ObjectKey key) throws TorqueException
1003    {
1004      
1005                        setCurrencyId(((NumberKey) key).intValue());
1006                  }
1007       
1008                                
1009            
1010          /**
1011     * Collection to store aggregation of collPaymentItems
1012     */

1013    protected List JavaDoc collPaymentItems;
1014
1015    /**
1016     * Temporary storage of collPaymentItems to save a possible db hit in
1017     * the event objects are add to the collection, but the
1018     * complete collection is never requested.
1019     */

1020    protected void initPaymentItems()
1021    {
1022        if (collPaymentItems == null)
1023        {
1024            collPaymentItems = new ArrayList JavaDoc();
1025        }
1026    }
1027
1028    /**
1029     * Method called to associate a PaymentItem object to this object
1030     * through the PaymentItem foreign key attribute
1031     *
1032     * @param l PaymentItem
1033     * @throws TorqueException
1034     */

1035    public void addPaymentItem(PaymentItem l) throws TorqueException
1036    {
1037        getPaymentItems().add(l);
1038        l.setPayment((Payment) this);
1039    }
1040
1041    /**
1042     * The criteria used to select the current contents of collPaymentItems
1043     */

1044    private Criteria lastPaymentItemsCriteria = null;
1045      
1046    /**
1047     * If this collection has already been initialized, returns
1048     * the collection. Otherwise returns the results of
1049     * getPaymentItems(new Criteria())
1050     *
1051     * @throws TorqueException
1052     */

1053    public List JavaDoc getPaymentItems() throws TorqueException
1054    {
1055              if (collPaymentItems == null)
1056        {
1057            collPaymentItems = getPaymentItems(new Criteria(10));
1058        }
1059        return collPaymentItems;
1060          }
1061
1062    /**
1063     * If this collection has already been initialized with
1064     * an identical criteria, it returns the collection.
1065     * Otherwise if this Payment has previously
1066     * been saved, it will retrieve related PaymentItems from storage.
1067     * If this Payment is new, it will return
1068     * an empty collection or the current collection, the criteria
1069     * is ignored on a new object.
1070     *
1071     * @throws TorqueException
1072     */

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

1115    public List JavaDoc getPaymentItems(Connection JavaDoc con) throws TorqueException
1116    {
1117              if (collPaymentItems == null)
1118        {
1119            collPaymentItems = getPaymentItems(new Criteria(10), con);
1120        }
1121        return collPaymentItems;
1122          }
1123
1124    /**
1125     * If this collection has already been initialized with
1126     * an identical criteria, it returns the collection.
1127     * Otherwise if this Payment has previously
1128     * been saved, it will retrieve related PaymentItems from storage.
1129     * If this Payment is new, it will return
1130     * an empty collection or the current collection, the criteria
1131     * is ignored on a new object.
1132     * This method takes in the Connection also as input so that
1133     * referenced objects can also be obtained using a Connection
1134     * that is taken as input
1135     */

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

1192    protected List JavaDoc getPaymentItemsJoinPayment(Criteria criteria)
1193        throws TorqueException
1194    {
1195                    if (collPaymentItems == null)
1196        {
1197            if (isNew())
1198            {
1199               collPaymentItems = new ArrayList JavaDoc();
1200            }
1201            else
1202            {
1203                              criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1204                              collPaymentItems = PaymentItemPeer.doSelectJoinPayment(criteria);
1205            }
1206        }
1207        else
1208        {
1209            // the following code is to determine if a new query is
1210
// called for. If the criteria is the same as the last
1211
// one, just return the collection.
1212

1213                        criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1214                                    if (!lastPaymentItemsCriteria.equals(criteria))
1215            {
1216                collPaymentItems = PaymentItemPeer.doSelectJoinPayment(criteria);
1217            }
1218        }
1219        lastPaymentItemsCriteria = criteria;
1220
1221        return collPaymentItems;
1222                }
1223                  
1224                    
1225                    
1226                                
1227                                                              
1228                                        
1229                    
1230                    
1231          
1232    /**
1233     * If this collection has already been initialized with
1234     * an identical criteria, it returns the collection.
1235     * Otherwise if this Payment is new, it will return
1236     * an empty collection; or if this Payment has previously
1237     * been saved, it will retrieve related PaymentItems from storage.
1238     *
1239     * This method is protected by default in order to keep the public
1240     * api reasonable. You can provide public methods for those you
1241     * actually need in Payment.
1242     */

1243    protected List JavaDoc getPaymentItemsJoinSorder(Criteria criteria)
1244        throws TorqueException
1245    {
1246                    if (collPaymentItems == null)
1247        {
1248            if (isNew())
1249            {
1250               collPaymentItems = new ArrayList JavaDoc();
1251            }
1252            else
1253            {
1254                              criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1255                              collPaymentItems = PaymentItemPeer.doSelectJoinSorder(criteria);
1256            }
1257        }
1258        else
1259        {
1260            // the following code is to determine if a new query is
1261
// called for. If the criteria is the same as the last
1262
// one, just return the collection.
1263

1264                        criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1265                                    if (!lastPaymentItemsCriteria.equals(criteria))
1266            {
1267                collPaymentItems = PaymentItemPeer.doSelectJoinSorder(criteria);
1268            }
1269        }
1270        lastPaymentItemsCriteria = criteria;
1271
1272        return collPaymentItems;
1273                }
1274                  
1275                    
1276                    
1277                                
1278                                                              
1279                                        
1280                    
1281                    
1282          
1283    /**
1284     * If this collection has already been initialized with
1285     * an identical criteria, it returns the collection.
1286     * Otherwise if this Payment is new, it will return
1287     * an empty collection; or if this Payment has previously
1288     * been saved, it will retrieve related PaymentItems from storage.
1289     *
1290     * This method is protected by default in order to keep the public
1291     * api reasonable. You can provide public methods for those you
1292     * actually need in Payment.
1293     */

1294    protected List JavaDoc getPaymentItemsJoinProduct(Criteria criteria)
1295        throws TorqueException
1296    {
1297                    if (collPaymentItems == null)
1298        {
1299            if (isNew())
1300            {
1301               collPaymentItems = new ArrayList JavaDoc();
1302            }
1303            else
1304            {
1305                              criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1306                              collPaymentItems = PaymentItemPeer.doSelectJoinProduct(criteria);
1307            }
1308        }
1309        else
1310        {
1311            // the following code is to determine if a new query is
1312
// called for. If the criteria is the same as the last
1313
// one, just return the collection.
1314

1315                        criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1316                                    if (!lastPaymentItemsCriteria.equals(criteria))
1317            {
1318                collPaymentItems = PaymentItemPeer.doSelectJoinProduct(criteria);
1319            }
1320        }
1321        lastPaymentItemsCriteria = criteria;
1322
1323        return collPaymentItems;
1324                }
1325                  
1326                    
1327                    
1328                                
1329                                                              
1330                                        
1331                    
1332                    
1333          
1334    /**
1335     * If this collection has already been initialized with
1336     * an identical criteria, it returns the collection.
1337     * Otherwise if this Payment is new, it will return
1338     * an empty collection; or if this Payment has previously
1339     * been saved, it will retrieve related PaymentItems from storage.
1340     *
1341     * This method is protected by default in order to keep the public
1342     * api reasonable. You can provide public methods for those you
1343     * actually need in Payment.
1344     */

1345    protected List JavaDoc getPaymentItemsJoinCurrency(Criteria criteria)
1346        throws TorqueException
1347    {
1348                    if (collPaymentItems == null)
1349        {
1350            if (isNew())
1351            {
1352               collPaymentItems = new ArrayList JavaDoc();
1353            }
1354            else
1355            {
1356                              criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1357                              collPaymentItems = PaymentItemPeer.doSelectJoinCurrency(criteria);
1358            }
1359        }
1360        else
1361        {
1362            // the following code is to determine if a new query is
1363
// called for. If the criteria is the same as the last
1364
// one, just return the collection.
1365

1366                        criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1367                                    if (!lastPaymentItemsCriteria.equals(criteria))
1368            {
1369                collPaymentItems = PaymentItemPeer.doSelectJoinCurrency(criteria);
1370            }
1371        }
1372        lastPaymentItemsCriteria = criteria;
1373
1374        return collPaymentItems;
1375                }
1376                  
1377                    
1378                    
1379                                
1380                                                              
1381                                        
1382                    
1383                    
1384          
1385    /**
1386     * If this collection has already been initialized with
1387     * an identical criteria, it returns the collection.
1388     * Otherwise if this Payment is new, it will return
1389     * an empty collection; or if this Payment has previously
1390     * been saved, it will retrieve related PaymentItems from storage.
1391     *
1392     * This method is protected by default in order to keep the public
1393     * api reasonable. You can provide public methods for those you
1394     * actually need in Payment.
1395     */

1396    protected List JavaDoc getPaymentItemsJoinCustomer(Criteria criteria)
1397        throws TorqueException
1398    {
1399                    if (collPaymentItems == null)
1400        {
1401            if (isNew())
1402            {
1403               collPaymentItems = new ArrayList JavaDoc();
1404            }
1405            else
1406            {
1407                              criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1408                              collPaymentItems = PaymentItemPeer.doSelectJoinCustomer(criteria);
1409            }
1410        }
1411        else
1412        {
1413            // the following code is to determine if a new query is
1414
// called for. If the criteria is the same as the last
1415
// one, just return the collection.
1416

1417                        criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1418                                    if (!lastPaymentItemsCriteria.equals(criteria))
1419            {
1420                collPaymentItems = PaymentItemPeer.doSelectJoinCustomer(criteria);
1421            }
1422        }
1423        lastPaymentItemsCriteria = criteria;
1424
1425        return collPaymentItems;
1426                }
1427                  
1428                    
1429                    
1430                                
1431                                                              
1432                                        
1433                    
1434                    
1435          
1436    /**
1437     * If this collection has already been initialized with
1438     * an identical criteria, it returns the collection.
1439     * Otherwise if this Payment is new, it will return
1440     * an empty collection; or if this Payment has previously
1441     * been saved, it will retrieve related PaymentItems from storage.
1442     *
1443     * This method is protected by default in order to keep the public
1444     * api reasonable. You can provide public methods for those you
1445     * actually need in Payment.
1446     */

1447    protected List JavaDoc getPaymentItemsJoinProject(Criteria criteria)
1448        throws TorqueException
1449    {
1450                    if (collPaymentItems == null)
1451        {
1452            if (isNew())
1453            {
1454               collPaymentItems = new ArrayList JavaDoc();
1455            }
1456            else
1457            {
1458                              criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1459                              collPaymentItems = PaymentItemPeer.doSelectJoinProject(criteria);
1460            }
1461        }
1462        else
1463        {
1464            // the following code is to determine if a new query is
1465
// called for. If the criteria is the same as the last
1466
// one, just return the collection.
1467

1468                        criteria.add(PaymentItemPeer.PAYMENT_ID, getPaymentId());
1469                                    if (!lastPaymentItemsCriteria.equals(criteria))
1470            {
1471                collPaymentItems = PaymentItemPeer.doSelectJoinProject(criteria);
1472            }
1473        }
1474        lastPaymentItemsCriteria = criteria;
1475
1476        return collPaymentItems;
1477                }
1478                            
1479
1480
1481          
1482    private static List JavaDoc fieldNames = null;
1483
1484    /**
1485     * Generate a list of field names.
1486     *
1487     * @return a list of field names
1488     */

1489    public static synchronized List JavaDoc getFieldNames()
1490    {
1491        if (fieldNames == null)
1492        {
1493            fieldNames = new ArrayList JavaDoc();
1494              fieldNames.add("PaymentId");
1495              fieldNames.add("PaymentCode");
1496              fieldNames.add("Status");
1497              fieldNames.add("Priority");
1498              fieldNames.add("IssuedDate");
1499              fieldNames.add("ClosedDate");
1500              fieldNames.add("CustomerId");
1501              fieldNames.add("ProjectId");
1502              fieldNames.add("SorderId");
1503              fieldNames.add("InvoiceCode");
1504              fieldNames.add("PayTerm");
1505              fieldNames.add("PayMethod");
1506              fieldNames.add("CurrencyId");
1507              fieldNames.add("CurrencyRate");
1508              fieldNames.add("CurrencyAmount");
1509              fieldNames.add("TotalAmount");
1510              fieldNames.add("Subject");
1511              fieldNames.add("Notes");
1512              fieldNames.add("Created");
1513              fieldNames.add("Modified");
1514              fieldNames.add("CreatedBy");
1515              fieldNames.add("ModifiedBy");
1516              fieldNames = Collections.unmodifiableList(fieldNames);
1517        }
1518        return fieldNames;
1519    }
1520
1521    /**
1522     * Retrieves a field from the object by name passed in as a String.
1523     *
1524     * @param name field name
1525     * @return value
1526     */

1527    public Object JavaDoc getByName(String JavaDoc name)
1528    {
1529          if (name.equals("PaymentId"))
1530        {
1531                return new Integer JavaDoc(getPaymentId());
1532            }
1533          if (name.equals("PaymentCode"))
1534        {
1535                return getPaymentCode();
1536            }
1537          if (name.equals("Status"))
1538        {
1539                return new Integer JavaDoc(getStatus());
1540            }
1541          if (name.equals("Priority"))
1542        {
1543                return new Integer JavaDoc(getPriority());
1544            }
1545          if (name.equals("IssuedDate"))
1546        {
1547                return getIssuedDate();
1548            }
1549          if (name.equals("ClosedDate"))
1550        {
1551                return getClosedDate();
1552            }
1553          if (name.equals("CustomerId"))
1554        {
1555                return new Integer JavaDoc(getCustomerId());
1556            }
1557          if (name.equals("ProjectId"))
1558        {
1559                return new Integer JavaDoc(getProjectId());
1560            }
1561          if (name.equals("SorderId"))
1562        {
1563                return new Integer JavaDoc(getSorderId());
1564            }
1565          if (name.equals("InvoiceCode"))
1566        {
1567                return getInvoiceCode();
1568            }
1569          if (name.equals("PayTerm"))
1570        {
1571                return new Integer JavaDoc(getPayTerm());
1572            }
1573          if (name.equals("PayMethod"))
1574        {
1575                return new Integer JavaDoc(getPayMethod());
1576            }
1577          if (name.equals("CurrencyId"))
1578        {
1579                return new Integer JavaDoc(getCurrencyId());
1580            }
1581          if (name.equals("CurrencyRate"))
1582        {
1583                return getCurrencyRate();
1584            }
1585          if (name.equals("CurrencyAmount"))
1586        {
1587                return getCurrencyAmount();
1588            }
1589          if (name.equals("TotalAmount"))
1590        {
1591                return getTotalAmount();
1592            }
1593          if (name.equals("Subject"))
1594        {
1595                return getSubject();
1596            }
1597          if (name.equals("Notes"))
1598        {
1599                return getNotes();
1600            }
1601          if (name.equals("Created"))
1602        {
1603                return getCreated();
1604            }
1605          if (name.equals("Modified"))
1606        {
1607                return getModified();
1608            }
1609          if (name.equals("CreatedBy"))
1610        {
1611                return getCreatedBy();
1612            }
1613          if (name.equals("ModifiedBy"))
1614        {
1615                return getModifiedBy();
1616            }
1617          return null;
1618    }
1619    
1620    /**
1621     * Retrieves a field from the object by name passed in
1622     * as a String. The String must be one of the static
1623     * Strings defined in this Class' Peer.
1624     *
1625     * @param name peer name
1626     * @return value
1627     */

1628    public Object JavaDoc getByPeerName(String JavaDoc name)
1629    {
1630          if (name.equals(PaymentPeer.PAYMENT_ID))
1631        {
1632                return new Integer JavaDoc(getPaymentId());
1633            }
1634          if (name.equals(PaymentPeer.PAYMENT_CODE))
1635        {
1636                return getPaymentCode();
1637            }
1638          if (name.equals(PaymentPeer.STATUS))
1639        {
1640                return new Integer JavaDoc(getStatus());
1641            }
1642          if (name.equals(PaymentPeer.PRIORITY))
1643        {
1644                return new Integer JavaDoc(getPriority());
1645            }
1646          if (name.equals(PaymentPeer.ISSUED_DATE))
1647        {
1648                return getIssuedDate();
1649            }
1650          if (name.equals(PaymentPeer.CLOSED_DATE))
1651        {
1652                return getClosedDate();
1653            }
1654          if (name.equals(PaymentPeer.CUSTOMER_ID))
1655        {
1656                return new Integer JavaDoc(getCustomerId());
1657            }
1658          if (name.equals(PaymentPeer.PROJECT_ID))
1659        {
1660                return new Integer JavaDoc(getProjectId());
1661            }
1662          if (name.equals(PaymentPeer.SORDER_ID))
1663        {
1664                return new Integer JavaDoc(getSorderId());
1665            }
1666          if (name.equals(PaymentPeer.INVOICE_CODE))
1667        {
1668                return getInvoiceCode();
1669            }
1670          if (name.equals(PaymentPeer.PAY_TERM))
1671        {
1672                return new Integer JavaDoc(getPayTerm());
1673            }
1674          if (name.equals(PaymentPeer.PAY_METHOD))
1675        {
1676                return new Integer JavaDoc(getPayMethod());
1677            }
1678          if (name.equals(PaymentPeer.CURRENCY_ID))
1679        {
1680                return new Integer JavaDoc(getCurrencyId());
1681            }
1682          if (name.equals(PaymentPeer.CURRENCY_RATE))
1683        {
1684                return getCurrencyRate();
1685            }
1686          if (name.equals(PaymentPeer.CURRENCY_AMOUNT))
1687        {
1688                return getCurrencyAmount();
1689            }
1690          if (name.equals(PaymentPeer.TOTAL_AMOUNT))
1691        {
1692                return getTotalAmount();
1693            }
1694          if (name.equals(PaymentPeer.SUBJECT))
1695        {
1696                return getSubject();
1697            }
1698          if (name.equals(PaymentPeer.NOTES))
1699        {
1700                return getNotes();
1701            }
1702          if (name.equals(PaymentPeer.CREATED))
1703        {
1704                return getCreated();
1705            }
1706          if (name.equals(PaymentPeer.MODIFIED))
1707        {
1708                return getModified();
1709            }
1710          if (name.equals(PaymentPeer.CREATED_BY))
1711        {
1712                return getCreatedBy();
1713            }
1714          if (name.equals(PaymentPeer.MODIFIED_BY))
1715        {
1716                return getModifiedBy();
1717            }
1718          return null;
1719    }
1720
1721    /**
1722     * Retrieves a field from the object by Position as specified
1723     * in the xml schema. Zero-based.
1724     *
1725     * @param pos position in xml schema
1726     * @return value
1727     */

1728    public Object JavaDoc getByPosition(int pos)
1729    {
1730            if (pos == 0)
1731        {
1732                return new Integer JavaDoc(getPaymentId());
1733            }
1734              if (pos == 1)
1735        {
1736                return getPaymentCode();
1737            }
1738              if (pos == 2)
1739        {
1740                return new Integer JavaDoc(getStatus());
1741            }
1742              if (pos == 3)
1743        {
1744                return new Integer JavaDoc(getPriority());
1745            }
1746              if (pos == 4)
1747        {
1748                return getIssuedDate();
1749            }
1750              if (pos == 5)
1751        {
1752                return getClosedDate();
1753            }
1754              if (pos == 6)
1755        {
1756                return new Integer JavaDoc(getCustomerId());
1757            }
1758              if (pos == 7)
1759        {
1760                return new Integer JavaDoc(getProjectId());
1761            }
1762              if (pos == 8)
1763        {
1764                return new Integer JavaDoc(getSorderId());
1765            }
1766              if (pos == 9)
1767        {
1768                return getInvoiceCode();
1769            }
1770              if (pos == 10)
1771        {
1772                return new Integer JavaDoc(getPayTerm());
1773            }
1774              if (pos == 11)
1775        {
1776                return new Integer JavaDoc(getPayMethod());
1777            }
1778              if (pos == 12)
1779        {
1780                return new Integer JavaDoc(getCurrencyId());
1781            }
1782              if (pos == 13)
1783        {
1784                return getCurrencyRate();
1785            }
1786              if (pos == 14)
1787        {
1788                return getCurrencyAmount();
1789            }
1790              if (pos == 15)
1791        {
1792                return getTotalAmount();
1793            }
1794              if (pos == 16)
1795        {
1796                return getSubject();
1797            }
1798              if (pos == 17)
1799        {
1800                return getNotes();
1801            }
1802              if (pos == 18)
1803        {
1804                return getCreated();
1805            }
1806              if (pos == 19)
1807        {
1808                return getModified();
1809            }
1810              if (pos == 20)
1811        {
1812                return getCreatedBy();
1813            }
1814              if (pos == 21)
1815        {
1816                return getModifiedBy();
1817            }
1818              return null;
1819    }
1820     
1821    /**
1822     * Stores the object in the database. If the object is new,
1823     * it inserts it; otherwise an update is performed.
1824     *
1825     * @throws Exception
1826     */

1827    public void save() throws Exception JavaDoc
1828    {
1829          save(PaymentPeer.getMapBuilder()
1830                .getDatabaseMap().getName());
1831      }
1832
1833    /**
1834     * Stores the object in the database. If the object is new,
1835     * it inserts it; otherwise an update is performed.
1836       * Note: this code is here because the method body is
1837     * auto-generated conditionally and therefore needs to be
1838     * in this file instead of in the super class, BaseObject.
1839       *
1840     * @param dbName
1841     * @throws TorqueException
1842     */

1843    public void save(String JavaDoc dbName) throws TorqueException
1844    {
1845        Connection JavaDoc con = null;
1846          try
1847        {
1848            con = Transaction.begin(dbName);
1849            save(con);
1850            Transaction.commit(con);
1851        }
1852        catch(TorqueException e)
1853        {
1854            Transaction.safeRollback(con);
1855            throw e;
1856        }
1857      }
1858
1859      /** flag to prevent endless save loop, if this object is referenced
1860        by another object which falls in this transaction. */

1861    private boolean alreadyInSave = false;
1862      /**
1863     * Stores the object in the database. If the object is new,
1864     * it inserts it; otherwise an update is performed. This method
1865     * is meant to be used as part of a transaction, otherwise use
1866     * the save() method and the connection details will be handled
1867     * internally
1868     *
1869     * @param con
1870     * @throws TorqueException
1871     */

1872    public void save(Connection JavaDoc con) throws TorqueException
1873    {
1874          if (!alreadyInSave)
1875        {
1876            alreadyInSave = true;
1877
1878
1879  
1880            // If this object has been modified, then save it to the database.
1881
if (isModified())
1882            {
1883                if (isNew())
1884                {
1885                    PaymentPeer.doInsert((Payment) this, con);
1886                    setNew(false);
1887                }
1888                else
1889                {
1890                    PaymentPeer.doUpdate((Payment) this, con);
1891                }
1892            }
1893
1894                                      
1895                
1896                    if (collPaymentItems != null)
1897            {
1898                for (int i = 0; i < collPaymentItems.size(); i++)
1899                {
1900                    ((PaymentItem) collPaymentItems.get(i)).save(con);
1901                }
1902            }
1903                                  alreadyInSave = false;
1904        }
1905      }
1906
1907                        
1908      /**
1909     * Set the PrimaryKey using ObjectKey.
1910     *
1911     * @param key paymentId ObjectKey
1912     */

1913    public void setPrimaryKey(ObjectKey key)
1914        throws TorqueException
1915    {
1916            setPaymentId(((NumberKey) key).intValue());
1917        }
1918
1919    /**
1920     * Set the PrimaryKey using a String.
1921     *
1922     * @param key
1923     */

1924    public void setPrimaryKey(String JavaDoc key) throws TorqueException
1925    {
1926            setPaymentId(Integer.parseInt(key));
1927        }
1928
1929  
1930    /**
1931     * returns an id that differentiates this object from others
1932     * of its class.
1933     */

1934    public ObjectKey getPrimaryKey()
1935    {
1936          return SimpleKey.keyFor(getPaymentId());
1937      }
1938 
1939    /**
1940     * get an id that differentiates this object from others
1941     * of its class.
1942     */

1943    public String JavaDoc getQueryKey()
1944    {
1945        if (getPrimaryKey() == null)
1946        {
1947            return "";
1948        }
1949        else
1950        {
1951            return getPrimaryKey().toString();
1952        }
1953    }
1954
1955    /**
1956     * set an id that differentiates this object from others
1957     * of its class.
1958     */

1959    public void setQueryKey(String JavaDoc key)
1960        throws TorqueException
1961    {
1962        setPrimaryKey(key);
1963    }
1964
1965    /**
1966     * Makes a copy of this object.
1967     * It creates a new object filling in the simple attributes.
1968       * It then fills all the association collections and sets the
1969     * related objects to isNew=true.
1970       */

1971      public Payment copy() throws TorqueException
1972    {
1973        return copyInto(new Payment());
1974    }
1975  
1976    protected Payment copyInto(Payment copyObj) throws TorqueException
1977    {
1978          copyObj.setPaymentId(paymentId);
1979          copyObj.setPaymentCode(paymentCode);
1980          copyObj.setStatus(status);
1981          copyObj.setPriority(priority);
1982          copyObj.setIssuedDate(issuedDate);
1983          copyObj.setClosedDate(closedDate);
1984          copyObj.setCustomerId(customerId);
1985          copyObj.setProjectId(projectId);
1986          copyObj.setSorderId(sorderId);
1987          copyObj.setInvoiceCode(invoiceCode);
1988          copyObj.setPayTerm(payTerm);
1989          copyObj.setPayMethod(payMethod);
1990          copyObj.setCurrencyId(currencyId);
1991          copyObj.setCurrencyRate(currencyRate);
1992          copyObj.setCurrencyAmount(currencyAmount);
1993          copyObj.setTotalAmount(totalAmount);
1994          copyObj.setSubject(subject);
1995          copyObj.setNotes(notes);
1996          copyObj.setCreated(created);
1997          copyObj.setModified(modified);
1998          copyObj.setCreatedBy(createdBy);
1999          copyObj.setModifiedBy(modifiedBy);
2000  
2001                            copyObj.setPaymentId( 0);
2002                                                                                                                                          
2003                                      
2004                            
2005        List JavaDoc v = getPaymentItems();
2006        for (int i = 0; i < v.size(); i++)
2007        {
2008            PaymentItem obj = (PaymentItem) v.get(i);
2009            copyObj.addPaymentItem(obj.copy());
2010        }
2011                            return copyObj;
2012    }
2013
2014    /**
2015     * returns a peer instance associated with this om. Since Peer classes
2016     * are not to have any instance attributes, this method returns the
2017     * same instance for all member of this class. The method could therefore
2018     * be static, but this would prevent one from overriding the behavior.
2019     */

2020    public PaymentPeer getPeer()
2021    {
2022        return peer;
2023    }
2024
2025    public String JavaDoc toString()
2026    {
2027        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
2028        str.append("Payment:\n");
2029        str.append("PaymentId = ")
2030               .append(getPaymentId())
2031             .append("\n");
2032        str.append("PaymentCode = ")
2033               .append(getPaymentCode())
2034             .append("\n");
2035        str.append("Status = ")
2036               .append(getStatus())
2037             .append("\n");
2038        str.append("Priority = ")
2039               .append(getPriority())
2040             .append("\n");
2041        str.append("IssuedDate = ")
2042               .append(getIssuedDate())
2043             .append("\n");
2044        str.append("ClosedDate = ")
2045               .append(getClosedDate())
2046             .append("\n");
2047        str.append("CustomerId = ")
2048               .append(getCustomerId())
2049             .append("\n");
2050        str.append("ProjectId = ")
2051               .append(getProjectId())
2052             .append("\n");
2053        str.append("SorderId = ")
2054               .append(getSorderId())
2055             .append("\n");
2056        str.append("InvoiceCode = ")
2057               .append(getInvoiceCode())
2058             .append("\n");
2059        str.append("PayTerm = ")
2060               .append(getPayTerm())
2061             .append("\n");
2062        str.append("PayMethod = ")
2063               .append(getPayMethod())
2064             .append("\n");
2065        str.append("CurrencyId = ")
2066               .append(getCurrencyId())
2067             .append("\n");
2068        str.append("CurrencyRate = ")
2069               .append(getCurrencyRate())
2070             .append("\n");
2071        str.append("CurrencyAmount = ")
2072               .append(getCurrencyAmount())
2073             .append("\n");
2074        str.append("TotalAmount = ")
2075               .append(getTotalAmount())
2076             .append("\n");
2077        str.append("Subject = ")
2078               .append(getSubject())
2079             .append("\n");
2080        str.append("Notes = ")
2081               .append(getNotes())
2082             .append("\n");
2083        str.append("Created = ")
2084               .append(getCreated())
2085             .append("\n");
2086        str.append("Modified = ")
2087               .append(getModified())
2088             .append("\n");
2089        str.append("CreatedBy = ")
2090               .append(getCreatedBy())
2091             .append("\n");
2092        str.append("ModifiedBy = ")
2093               .append(getModifiedBy())
2094             .append("\n");
2095        return(str.toString());
2096    }
2097}
2098
Popular Tags