KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

117     public int getPrintSubsId()
118     {
119         return printSubsId;
120     }
121
122                         
123     /**
124      * Set the value of PrintSubsId
125      *
126      * @param v new value
127      */

128     public void setPrintSubsId(int v)
129     {
130     
131                   if (this.printSubsId != v)
132               {
133             this.printSubsId = v;
134             setModified(true);
135         }
136     
137           
138               }
139   
140     /**
141      * Get the PrintSubsCode
142      *
143      * @return String
144      */

145     public String JavaDoc getPrintSubsCode()
146     {
147         return printSubsCode;
148     }
149
150                         
151     /**
152      * Set the value of PrintSubsCode
153      *
154      * @param v new value
155      */

156     public void setPrintSubsCode(String JavaDoc v)
157     {
158     
159                   if (!ObjectUtils.equals(this.printSubsCode, v))
160               {
161             this.printSubsCode = v;
162             setModified(true);
163         }
164     
165           
166               }
167   
168     /**
169      * Get the Status
170      *
171      * @return int
172      */

173     public int getStatus()
174     {
175         return status;
176     }
177
178                         
179     /**
180      * Set the value of Status
181      *
182      * @param v new value
183      */

184     public void setStatus(int v)
185     {
186     
187                   if (this.status != v)
188               {
189             this.status = v;
190             setModified(true);
191         }
192     
193           
194               }
195   
196     /**
197      * Get the Priority
198      *
199      * @return int
200      */

201     public int getPriority()
202     {
203         return priority;
204     }
205
206                         
207     /**
208      * Set the value of Priority
209      *
210      * @param v new value
211      */

212     public void setPriority(int v)
213     {
214     
215                   if (this.priority != v)
216               {
217             this.priority = v;
218             setModified(true);
219         }
220     
221           
222               }
223   
224     /**
225      * Get the IssuedDate
226      *
227      * @return Date
228      */

229     public Date JavaDoc getIssuedDate()
230     {
231         return issuedDate;
232     }
233
234                         
235     /**
236      * Set the value of IssuedDate
237      *
238      * @param v new value
239      */

240     public void setIssuedDate(Date JavaDoc v)
241     {
242     
243                   if (!ObjectUtils.equals(this.issuedDate, v))
244               {
245             this.issuedDate = v;
246             setModified(true);
247         }
248     
249           
250               }
251   
252     /**
253      * Get the ClosedDate
254      *
255      * @return Date
256      */

257     public Date JavaDoc getClosedDate()
258     {
259         return closedDate;
260     }
261
262                         
263     /**
264      * Set the value of ClosedDate
265      *
266      * @param v new value
267      */

268     public void setClosedDate(Date JavaDoc v)
269     {
270     
271                   if (!ObjectUtils.equals(this.closedDate, v))
272               {
273             this.closedDate = v;
274             setModified(true);
275         }
276     
277           
278               }
279   
280     /**
281      * Get the SorderId
282      *
283      * @return int
284      */

285     public int getSorderId()
286     {
287         return sorderId;
288     }
289
290                               
291     /**
292      * Set the value of SorderId
293      *
294      * @param v new value
295      */

296     public void setSorderId(int v) throws TorqueException
297     {
298     
299                   if (this.sorderId != v)
300               {
301             this.sorderId = v;
302             setModified(true);
303         }
304     
305                           
306                 if (aSorder != null && !(aSorder.getSorderId() == v))
307                 {
308             aSorder = null;
309         }
310       
311               }
312   
313     /**
314      * Get the CustomerId
315      *
316      * @return int
317      */

318     public int getCustomerId()
319     {
320         return customerId;
321     }
322
323                               
324     /**
325      * Set the value of CustomerId
326      *
327      * @param v new value
328      */

329     public void setCustomerId(int v) throws TorqueException
330     {
331     
332                   if (this.customerId != v)
333               {
334             this.customerId = v;
335             setModified(true);
336         }
337     
338                                                                   
339                 if (aCustomerRelatedByCustomerId != null && !(aCustomerRelatedByCustomerId.getCustomerId() == v))
340                 {
341             aCustomerRelatedByCustomerId = null;
342         }
343       
344               }
345   
346     /**
347      * Get the RecipientId
348      *
349      * @return int
350      */

351     public int getRecipientId()
352     {
353         return recipientId;
354     }
355
356                               
357     /**
358      * Set the value of RecipientId
359      *
360      * @param v new value
361      */

362     public void setRecipientId(int v) throws TorqueException
363     {
364     
365                   if (this.recipientId != v)
366               {
367             this.recipientId = v;
368             setModified(true);
369         }
370     
371                                                                   
372                 if (aCustomerRelatedByRecipientId != null && !(aCustomerRelatedByRecipientId.getCustomerId() == v))
373                 {
374             aCustomerRelatedByRecipientId = null;
375         }
376       
377               }
378   
379     /**
380      * Get the CarrierId
381      *
382      * @return int
383      */

384     public int getCarrierId()
385     {
386         return carrierId;
387     }
388
389                               
390     /**
391      * Set the value of CarrierId
392      *
393      * @param v new value
394      */

395     public void setCarrierId(int v) throws TorqueException
396     {
397     
398                   if (this.carrierId != v)
399               {
400             this.carrierId = v;
401             setModified(true);
402         }
403     
404                           
405                 if (aCarrier != null && !(aCarrier.getCarrierId() == v))
406                 {
407             aCarrier = null;
408         }
409       
410               }
411   
412     /**
413      * Get the ProjectId
414      *
415      * @return int
416      */

417     public int getProjectId()
418     {
419         return projectId;
420     }
421
422                               
423     /**
424      * Set the value of ProjectId
425      *
426      * @param v new value
427      */

428     public void setProjectId(int v) throws TorqueException
429     {
430     
431                   if (this.projectId != v)
432               {
433             this.projectId = v;
434             setModified(true);
435         }
436     
437                           
438                 if (aProject != null && !(aProject.getProjectId() == v))
439                 {
440             aProject = null;
441         }
442       
443               }
444   
445     /**
446      * Get the ProductId
447      *
448      * @return int
449      */

450     public int getProductId()
451     {
452         return productId;
453     }
454
455                               
456     /**
457      * Set the value of ProductId
458      *
459      * @param v new value
460      */

461     public void setProductId(int v) throws TorqueException
462     {
463     
464                   if (this.productId != v)
465               {
466             this.productId = v;
467             setModified(true);
468         }
469     
470                           
471                 if (aProduct != null && !(aProduct.getProductId() == v))
472                 {
473             aProduct = null;
474         }
475       
476               }
477   
478     /**
479      * Get the Quantity
480      *
481      * @return int
482      */

483     public int getQuantity()
484     {
485         return quantity;
486     }
487
488                         
489     /**
490      * Set the value of Quantity
491      *
492      * @param v new value
493      */

494     public void setQuantity(int v)
495     {
496     
497                   if (this.quantity != v)
498               {
499             this.quantity = v;
500             setModified(true);
501         }
502     
503           
504               }
505   
506     /**
507      * Get the StartDate
508      *
509      * @return Date
510      */

511     public Date JavaDoc getStartDate()
512     {
513         return startDate;
514     }
515
516                         
517     /**
518      * Set the value of StartDate
519      *
520      * @param v new value
521      */

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

539     public Date JavaDoc getEndDate()
540     {
541         return endDate;
542     }
543
544                         
545     /**
546      * Set the value of EndDate
547      *
548      * @param v new value
549      */

550     public void setEndDate(Date JavaDoc v)
551     {
552     
553                   if (!ObjectUtils.equals(this.endDate, v))
554               {
555             this.endDate = v;
556             setModified(true);
557         }
558     
559           
560               }
561   
562     /**
563      * Get the Subject
564      *
565      * @return String
566      */

567     public String JavaDoc getSubject()
568     {
569         return subject;
570     }
571
572                         
573     /**
574      * Set the value of Subject
575      *
576      * @param v new value
577      */

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

595     public String JavaDoc getNotes()
596     {
597         return notes;
598     }
599
600                         
601     /**
602      * Set the value of Notes
603      *
604      * @param v new value
605      */

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

623     public Date JavaDoc getCreated()
624     {
625         return created;
626     }
627
628                         
629     /**
630      * Set the value of Created
631      *
632      * @param v new value
633      */

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

651     public Date JavaDoc getModified()
652     {
653         return modified;
654     }
655
656                         
657     /**
658      * Set the value of Modified
659      *
660      * @param v new value
661      */

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

679     public String JavaDoc getCreatedBy()
680     {
681         return createdBy;
682     }
683
684                         
685     /**
686      * Set the value of CreatedBy
687      *
688      * @param v new value
689      */

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

707     public String JavaDoc getModifiedBy()
708     {
709         return modifiedBy;
710     }
711
712                         
713     /**
714      * Set the value of ModifiedBy
715      *
716      * @param v new value
717      */

718     public void setModifiedBy(String JavaDoc v)
719     {
720     
721                   if (!ObjectUtils.equals(this.modifiedBy, v))
722               {
723             this.modifiedBy = v;
724             setModified(true);
725         }
726     
727           
728               }
729   
730       
731     
732                         
733         
734         private Customer aCustomerRelatedByCustomerId;
735
736     /**
737      * Declares an association between this object and a Customer object
738      *
739      * @param v Customer
740      * @throws TorqueException
741      */

742     public void setCustomerRelatedByCustomerId(Customer v) throws TorqueException
743     {
744             if (v == null)
745         {
746                           setCustomerId( 1000);
747               }
748         else
749         {
750             setCustomerId(v.getCustomerId());
751         }
752             aCustomerRelatedByCustomerId = v;
753     }
754
755                                             
756     /**
757      * Get the associated Customer object
758      *
759      * @return the associated Customer object
760      * @throws TorqueException
761      */

762     public Customer getCustomerRelatedByCustomerId() throws TorqueException
763     {
764         if (aCustomerRelatedByCustomerId == null && (this.customerId != 0))
765         {
766                           aCustomerRelatedByCustomerId = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId));
767               
768             /* The following can be used instead of the line above to
769                guarantee the related object contains a reference
770                to this object, but this level of coupling
771                may be undesirable in many circumstances.
772                As it can lead to a db query with many results that may
773                never be used.
774                Customer obj = CustomerPeer.retrieveByPK(this.customerId);
775                obj.addPrintSubscriptionsRelatedByCustomerId(this);
776             */

777         }
778         return aCustomerRelatedByCustomerId;
779     }
780
781     /**
782      * Provides convenient way to set a relationship based on a
783      * ObjectKey, for example
784      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
785      *
786          */

787     public void setCustomerRelatedByCustomerIdKey(ObjectKey key) throws TorqueException
788     {
789       
790                         setCustomerId(((NumberKey) key).intValue());
791                   }
792     
793     
794                         
795         
796         private Customer aCustomerRelatedByRecipientId;
797
798     /**
799      * Declares an association between this object and a Customer object
800      *
801      * @param v Customer
802      * @throws TorqueException
803      */

804     public void setCustomerRelatedByRecipientId(Customer v) throws TorqueException
805     {
806             if (v == null)
807         {
808                           setRecipientId( 1000);
809               }
810         else
811         {
812             setRecipientId(v.getCustomerId());
813         }
814             aCustomerRelatedByRecipientId = v;
815     }
816
817                                             
818     /**
819      * Get the associated Customer object
820      *
821      * @return the associated Customer object
822      * @throws TorqueException
823      */

824     public Customer getCustomerRelatedByRecipientId() throws TorqueException
825     {
826         if (aCustomerRelatedByRecipientId == null && (this.recipientId != 0))
827         {
828                           aCustomerRelatedByRecipientId = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.recipientId));
829               
830             /* The following can be used instead of the line above to
831                guarantee the related object contains a reference
832                to this object, but this level of coupling
833                may be undesirable in many circumstances.
834                As it can lead to a db query with many results that may
835                never be used.
836                Customer obj = CustomerPeer.retrieveByPK(this.recipientId);
837                obj.addPrintSubscriptionsRelatedByRecipientId(this);
838             */

839         }
840         return aCustomerRelatedByRecipientId;
841     }
842
843     /**
844      * Provides convenient way to set a relationship based on a
845      * ObjectKey, for example
846      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
847      *
848          */

849     public void setCustomerRelatedByRecipientIdKey(ObjectKey key) throws TorqueException
850     {
851       
852                         setRecipientId(((NumberKey) key).intValue());
853                   }
854     
855     
856                   
857     
858         private Carrier aCarrier;
859
860     /**
861      * Declares an association between this object and a Carrier object
862      *
863      * @param v Carrier
864      * @throws TorqueException
865      */

866     public void setCarrier(Carrier v) throws TorqueException
867     {
868             if (v == null)
869         {
870                           setCarrierId( 1000);
871               }
872         else
873         {
874             setCarrierId(v.getCarrierId());
875         }
876             aCarrier = v;
877     }
878
879                                             
880     /**
881      * Get the associated Carrier object
882      *
883      * @return the associated Carrier object
884      * @throws TorqueException
885      */

886     public Carrier getCarrier() throws TorqueException
887     {
888         if (aCarrier == null && (this.carrierId != 0))
889         {
890                           aCarrier = CarrierPeer.retrieveByPK(SimpleKey.keyFor(this.carrierId));
891               
892             /* The following can be used instead of the line above to
893                guarantee the related object contains a reference
894                to this object, but this level of coupling
895                may be undesirable in many circumstances.
896                As it can lead to a db query with many results that may
897                never be used.
898                Carrier obj = CarrierPeer.retrieveByPK(this.carrierId);
899                obj.addPrintSubscriptions(this);
900             */

901         }
902         return aCarrier;
903     }
904
905     /**
906      * Provides convenient way to set a relationship based on a
907      * ObjectKey, for example
908      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
909      *
910          */

911     public void setCarrierKey(ObjectKey key) throws TorqueException
912     {
913       
914                         setCarrierId(((NumberKey) key).intValue());
915                   }
916     
917     
918                   
919     
920         private Project aProject;
921
922     /**
923      * Declares an association between this object and a Project object
924      *
925      * @param v Project
926      * @throws TorqueException
927      */

928     public void setProject(Project v) throws TorqueException
929     {
930             if (v == null)
931         {
932                           setProjectId( 1000);
933               }
934         else
935         {
936             setProjectId(v.getProjectId());
937         }
938             aProject = v;
939     }
940
941                                             
942     /**
943      * Get the associated Project object
944      *
945      * @return the associated Project object
946      * @throws TorqueException
947      */

948     public Project getProject() throws TorqueException
949     {
950         if (aProject == null && (this.projectId != 0))
951         {
952                           aProject = ProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectId));
953               
954             /* The following can be used instead of the line above to
955                guarantee the related object contains a reference
956                to this object, but this level of coupling
957                may be undesirable in many circumstances.
958                As it can lead to a db query with many results that may
959                never be used.
960                Project obj = ProjectPeer.retrieveByPK(this.projectId);
961                obj.addPrintSubscriptions(this);
962             */

963         }
964         return aProject;
965     }
966
967     /**
968      * Provides convenient way to set a relationship based on a
969      * ObjectKey, for example
970      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
971      *
972          */

973     public void setProjectKey(ObjectKey key) throws TorqueException
974     {
975       
976                         setProjectId(((NumberKey) key).intValue());
977                   }
978     
979     
980                   
981     
982         private Product aProduct;
983
984     /**
985      * Declares an association between this object and a Product object
986      *
987      * @param v Product
988      * @throws TorqueException
989      */

990     public void setProduct(Product v) throws TorqueException
991     {
992             if (v == null)
993         {
994                           setProductId( 1000);
995               }
996         else
997         {
998             setProductId(v.getProductId());
999         }
1000            aProduct = v;
1001    }
1002
1003                                            
1004    /**
1005     * Get the associated Product object
1006     *
1007     * @return the associated Product object
1008     * @throws TorqueException
1009     */

1010    public Product getProduct() throws TorqueException
1011    {
1012        if (aProduct == null && (this.productId != 0))
1013        {
1014                          aProduct = ProductPeer.retrieveByPK(SimpleKey.keyFor(this.productId));
1015              
1016            /* The following can be used instead of the line above to
1017               guarantee the related object contains a reference
1018               to this object, but this level of coupling
1019               may be undesirable in many circumstances.
1020               As it can lead to a db query with many results that may
1021               never be used.
1022               Product obj = ProductPeer.retrieveByPK(this.productId);
1023               obj.addPrintSubscriptions(this);
1024            */

1025        }
1026        return aProduct;
1027    }
1028
1029    /**
1030     * Provides convenient way to set a relationship based on a
1031     * ObjectKey, for example
1032     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
1033     *
1034         */

1035    public void setProductKey(ObjectKey key) throws TorqueException
1036    {
1037      
1038                        setProductId(((NumberKey) key).intValue());
1039                  }
1040    
1041    
1042                  
1043    
1044        private Sorder aSorder;
1045
1046    /**
1047     * Declares an association between this object and a Sorder object
1048     *
1049     * @param v Sorder
1050     * @throws TorqueException
1051     */

1052    public void setSorder(Sorder v) throws TorqueException
1053    {
1054            if (v == null)
1055        {
1056                          setSorderId( 1000);
1057              }
1058        else
1059        {
1060            setSorderId(v.getSorderId());
1061        }
1062            aSorder = v;
1063    }
1064
1065                                            
1066    /**
1067     * Get the associated Sorder object
1068     *
1069     * @return the associated Sorder object
1070     * @throws TorqueException
1071     */

1072    public Sorder getSorder() throws TorqueException
1073    {
1074        if (aSorder == null && (this.sorderId != 0))
1075        {
1076                          aSorder = SorderPeer.retrieveByPK(SimpleKey.keyFor(this.sorderId));
1077              
1078            /* The following can be used instead of the line above to
1079               guarantee the related object contains a reference
1080               to this object, but this level of coupling
1081               may be undesirable in many circumstances.
1082               As it can lead to a db query with many results that may
1083               never be used.
1084               Sorder obj = SorderPeer.retrieveByPK(this.sorderId);
1085               obj.addPrintSubscriptions(this);
1086            */

1087        }
1088        return aSorder;
1089    }
1090
1091    /**
1092     * Provides convenient way to set a relationship based on a
1093     * ObjectKey, for example
1094     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
1095     *
1096         */

1097    public void setSorderKey(ObjectKey key) throws TorqueException
1098    {
1099      
1100                        setSorderId(((NumberKey) key).intValue());
1101                  }
1102       
1103                
1104    private static List JavaDoc fieldNames = null;
1105
1106    /**
1107     * Generate a list of field names.
1108     *
1109     * @return a list of field names
1110     */

1111    public static synchronized List JavaDoc getFieldNames()
1112    {
1113        if (fieldNames == null)
1114        {
1115            fieldNames = new ArrayList JavaDoc();
1116              fieldNames.add("PrintSubsId");
1117              fieldNames.add("PrintSubsCode");
1118              fieldNames.add("Status");
1119              fieldNames.add("Priority");
1120              fieldNames.add("IssuedDate");
1121              fieldNames.add("ClosedDate");
1122              fieldNames.add("SorderId");
1123              fieldNames.add("CustomerId");
1124              fieldNames.add("RecipientId");
1125              fieldNames.add("CarrierId");
1126              fieldNames.add("ProjectId");
1127              fieldNames.add("ProductId");
1128              fieldNames.add("Quantity");
1129              fieldNames.add("StartDate");
1130              fieldNames.add("EndDate");
1131              fieldNames.add("Subject");
1132              fieldNames.add("Notes");
1133              fieldNames.add("Created");
1134              fieldNames.add("Modified");
1135              fieldNames.add("CreatedBy");
1136              fieldNames.add("ModifiedBy");
1137              fieldNames = Collections.unmodifiableList(fieldNames);
1138        }
1139        return fieldNames;
1140    }
1141
1142    /**
1143     * Retrieves a field from the object by name passed in as a String.
1144     *
1145     * @param name field name
1146     * @return value
1147     */

1148    public Object JavaDoc getByName(String JavaDoc name)
1149    {
1150          if (name.equals("PrintSubsId"))
1151        {
1152                return new Integer JavaDoc(getPrintSubsId());
1153            }
1154          if (name.equals("PrintSubsCode"))
1155        {
1156                return getPrintSubsCode();
1157            }
1158          if (name.equals("Status"))
1159        {
1160                return new Integer JavaDoc(getStatus());
1161            }
1162          if (name.equals("Priority"))
1163        {
1164                return new Integer JavaDoc(getPriority());
1165            }
1166          if (name.equals("IssuedDate"))
1167        {
1168                return getIssuedDate();
1169            }
1170          if (name.equals("ClosedDate"))
1171        {
1172                return getClosedDate();
1173            }
1174          if (name.equals("SorderId"))
1175        {
1176                return new Integer JavaDoc(getSorderId());
1177            }
1178          if (name.equals("CustomerId"))
1179        {
1180                return new Integer JavaDoc(getCustomerId());
1181            }
1182          if (name.equals("RecipientId"))
1183        {
1184                return new Integer JavaDoc(getRecipientId());
1185            }
1186          if (name.equals("CarrierId"))
1187        {
1188                return new Integer JavaDoc(getCarrierId());
1189            }
1190          if (name.equals("ProjectId"))
1191        {
1192                return new Integer JavaDoc(getProjectId());
1193            }
1194          if (name.equals("ProductId"))
1195        {
1196                return new Integer JavaDoc(getProductId());
1197            }
1198          if (name.equals("Quantity"))
1199        {
1200                return new Integer JavaDoc(getQuantity());
1201            }
1202          if (name.equals("StartDate"))
1203        {
1204                return getStartDate();
1205            }
1206          if (name.equals("EndDate"))
1207        {
1208                return getEndDate();
1209            }
1210          if (name.equals("Subject"))
1211        {
1212                return getSubject();
1213            }
1214          if (name.equals("Notes"))
1215        {
1216                return getNotes();
1217            }
1218          if (name.equals("Created"))
1219        {
1220                return getCreated();
1221            }
1222          if (name.equals("Modified"))
1223        {
1224                return getModified();
1225            }
1226          if (name.equals("CreatedBy"))
1227        {
1228                return getCreatedBy();
1229            }
1230          if (name.equals("ModifiedBy"))
1231        {
1232                return getModifiedBy();
1233            }
1234          return null;
1235    }
1236    
1237    /**
1238     * Retrieves a field from the object by name passed in
1239     * as a String. The String must be one of the static
1240     * Strings defined in this Class' Peer.
1241     *
1242     * @param name peer name
1243     * @return value
1244     */

1245    public Object JavaDoc getByPeerName(String JavaDoc name)
1246    {
1247          if (name.equals(PrintSubscriptionPeer.PRINT_SUBS_ID))
1248        {
1249                return new Integer JavaDoc(getPrintSubsId());
1250            }
1251          if (name.equals(PrintSubscriptionPeer.PRINT_SUBS_CODE))
1252        {
1253                return getPrintSubsCode();
1254            }
1255          if (name.equals(PrintSubscriptionPeer.STATUS))
1256        {
1257                return new Integer JavaDoc(getStatus());
1258            }
1259          if (name.equals(PrintSubscriptionPeer.PRIORITY))
1260        {
1261                return new Integer JavaDoc(getPriority());
1262            }
1263          if (name.equals(PrintSubscriptionPeer.ISSUED_DATE))
1264        {
1265                return getIssuedDate();
1266            }
1267          if (name.equals(PrintSubscriptionPeer.CLOSED_DATE))
1268        {
1269                return getClosedDate();
1270            }
1271          if (name.equals(PrintSubscriptionPeer.SORDER_ID))
1272        {
1273                return new Integer JavaDoc(getSorderId());
1274            }
1275          if (name.equals(PrintSubscriptionPeer.CUSTOMER_ID))
1276        {
1277                return new Integer JavaDoc(getCustomerId());
1278            }
1279          if (name.equals(PrintSubscriptionPeer.RECIPIENT_ID))
1280        {
1281                return new Integer JavaDoc(getRecipientId());
1282            }
1283          if (name.equals(PrintSubscriptionPeer.CARRIER_ID))
1284        {
1285                return new Integer JavaDoc(getCarrierId());
1286            }
1287          if (name.equals(PrintSubscriptionPeer.PROJECT_ID))
1288        {
1289                return new Integer JavaDoc(getProjectId());
1290            }
1291          if (name.equals(PrintSubscriptionPeer.PRODUCT_ID))
1292        {
1293                return new Integer JavaDoc(getProductId());
1294            }
1295          if (name.equals(PrintSubscriptionPeer.QUANTITY))
1296        {
1297                return new Integer JavaDoc(getQuantity());
1298            }
1299          if (name.equals(PrintSubscriptionPeer.START_DATE))
1300        {
1301                return getStartDate();
1302            }
1303          if (name.equals(PrintSubscriptionPeer.END_DATE))
1304        {
1305                return getEndDate();
1306            }
1307          if (name.equals(PrintSubscriptionPeer.SUBJECT))
1308        {
1309                return getSubject();
1310            }
1311          if (name.equals(PrintSubscriptionPeer.NOTES))
1312        {
1313                return getNotes();
1314            }
1315          if (name.equals(PrintSubscriptionPeer.CREATED))
1316        {
1317                return getCreated();
1318            }
1319          if (name.equals(PrintSubscriptionPeer.MODIFIED))
1320        {
1321                return getModified();
1322            }
1323          if (name.equals(PrintSubscriptionPeer.CREATED_BY))
1324        {
1325                return getCreatedBy();
1326            }
1327          if (name.equals(PrintSubscriptionPeer.MODIFIED_BY))
1328        {
1329                return getModifiedBy();
1330            }
1331          return null;
1332    }
1333
1334    /**
1335     * Retrieves a field from the object by Position as specified
1336     * in the xml schema. Zero-based.
1337     *
1338     * @param pos position in xml schema
1339     * @return value
1340     */

1341    public Object JavaDoc getByPosition(int pos)
1342    {
1343            if (pos == 0)
1344        {
1345                return new Integer JavaDoc(getPrintSubsId());
1346            }
1347              if (pos == 1)
1348        {
1349                return getPrintSubsCode();
1350            }
1351              if (pos == 2)
1352        {
1353                return new Integer JavaDoc(getStatus());
1354            }
1355              if (pos == 3)
1356        {
1357                return new Integer JavaDoc(getPriority());
1358            }
1359              if (pos == 4)
1360        {
1361                return getIssuedDate();
1362            }
1363              if (pos == 5)
1364        {
1365                return getClosedDate();
1366            }
1367              if (pos == 6)
1368        {
1369                return new Integer JavaDoc(getSorderId());
1370            }
1371              if (pos == 7)
1372        {
1373                return new Integer JavaDoc(getCustomerId());
1374            }
1375              if (pos == 8)
1376        {
1377                return new Integer JavaDoc(getRecipientId());
1378            }
1379              if (pos == 9)
1380        {
1381                return new Integer JavaDoc(getCarrierId());
1382            }
1383              if (pos == 10)
1384        {
1385                return new Integer JavaDoc(getProjectId());
1386            }
1387              if (pos == 11)
1388        {
1389                return new Integer JavaDoc(getProductId());
1390            }
1391              if (pos == 12)
1392        {
1393                return new Integer JavaDoc(getQuantity());
1394            }
1395              if (pos == 13)
1396        {
1397                return getStartDate();
1398            }
1399              if (pos == 14)
1400        {
1401                return getEndDate();
1402            }
1403              if (pos == 15)
1404        {
1405                return getSubject();
1406            }
1407              if (pos == 16)
1408        {
1409                return getNotes();
1410            }
1411              if (pos == 17)
1412        {
1413                return getCreated();
1414            }
1415              if (pos == 18)
1416        {
1417                return getModified();
1418            }
1419              if (pos == 19)
1420        {
1421                return getCreatedBy();
1422            }
1423              if (pos == 20)
1424        {
1425                return getModifiedBy();
1426            }
1427              return null;
1428    }
1429     
1430    /**
1431     * Stores the object in the database. If the object is new,
1432     * it inserts it; otherwise an update is performed.
1433     *
1434     * @throws Exception
1435     */

1436    public void save() throws Exception JavaDoc
1437    {
1438          save(PrintSubscriptionPeer.getMapBuilder()
1439                .getDatabaseMap().getName());
1440      }
1441
1442    /**
1443     * Stores the object in the database. If the object is new,
1444     * it inserts it; otherwise an update is performed.
1445       * Note: this code is here because the method body is
1446     * auto-generated conditionally and therefore needs to be
1447     * in this file instead of in the super class, BaseObject.
1448       *
1449     * @param dbName
1450     * @throws TorqueException
1451     */

1452    public void save(String JavaDoc dbName) throws TorqueException
1453    {
1454        Connection JavaDoc con = null;
1455          try
1456        {
1457            con = Transaction.begin(dbName);
1458            save(con);
1459            Transaction.commit(con);
1460        }
1461        catch(TorqueException e)
1462        {
1463            Transaction.safeRollback(con);
1464            throw e;
1465        }
1466      }
1467
1468      /** flag to prevent endless save loop, if this object is referenced
1469        by another object which falls in this transaction. */

1470    private boolean alreadyInSave = false;
1471      /**
1472     * Stores the object in the database. If the object is new,
1473     * it inserts it; otherwise an update is performed. This method
1474     * is meant to be used as part of a transaction, otherwise use
1475     * the save() method and the connection details will be handled
1476     * internally
1477     *
1478     * @param con
1479     * @throws TorqueException
1480     */

1481    public void save(Connection JavaDoc con) throws TorqueException
1482    {
1483          if (!alreadyInSave)
1484        {
1485            alreadyInSave = true;
1486
1487
1488  
1489            // If this object has been modified, then save it to the database.
1490
if (isModified())
1491            {
1492                if (isNew())
1493                {
1494                    PrintSubscriptionPeer.doInsert((PrintSubscription) this, con);
1495                    setNew(false);
1496                }
1497                else
1498                {
1499                    PrintSubscriptionPeer.doUpdate((PrintSubscription) this, con);
1500                }
1501            }
1502
1503                      alreadyInSave = false;
1504        }
1505      }
1506
1507                  
1508      /**
1509     * Set the PrimaryKey using ObjectKey.
1510     *
1511     * @param key printSubsId ObjectKey
1512     */

1513    public void setPrimaryKey(ObjectKey key)
1514        
1515    {
1516            setPrintSubsId(((NumberKey) key).intValue());
1517        }
1518
1519    /**
1520     * Set the PrimaryKey using a String.
1521     *
1522     * @param key
1523     */

1524    public void setPrimaryKey(String JavaDoc key)
1525    {
1526            setPrintSubsId(Integer.parseInt(key));
1527        }
1528
1529  
1530    /**
1531     * returns an id that differentiates this object from others
1532     * of its class.
1533     */

1534    public ObjectKey getPrimaryKey()
1535    {
1536          return SimpleKey.keyFor(getPrintSubsId());
1537      }
1538 
1539    /**
1540     * get an id that differentiates this object from others
1541     * of its class.
1542     */

1543    public String JavaDoc getQueryKey()
1544    {
1545        if (getPrimaryKey() == null)
1546        {
1547            return "";
1548        }
1549        else
1550        {
1551            return getPrimaryKey().toString();
1552        }
1553    }
1554
1555    /**
1556     * set an id that differentiates this object from others
1557     * of its class.
1558     */

1559    public void setQueryKey(String JavaDoc key)
1560        throws TorqueException
1561    {
1562        setPrimaryKey(key);
1563    }
1564
1565    /**
1566     * Makes a copy of this object.
1567     * It creates a new object filling in the simple attributes.
1568       * It then fills all the association collections and sets the
1569     * related objects to isNew=true.
1570       */

1571      public PrintSubscription copy() throws TorqueException
1572    {
1573        return copyInto(new PrintSubscription());
1574    }
1575  
1576    protected PrintSubscription copyInto(PrintSubscription copyObj) throws TorqueException
1577    {
1578          copyObj.setPrintSubsId(printSubsId);
1579          copyObj.setPrintSubsCode(printSubsCode);
1580          copyObj.setStatus(status);
1581          copyObj.setPriority(priority);
1582          copyObj.setIssuedDate(issuedDate);
1583          copyObj.setClosedDate(closedDate);
1584          copyObj.setSorderId(sorderId);
1585          copyObj.setCustomerId(customerId);
1586          copyObj.setRecipientId(recipientId);
1587          copyObj.setCarrierId(carrierId);
1588          copyObj.setProjectId(projectId);
1589          copyObj.setProductId(productId);
1590          copyObj.setQuantity(quantity);
1591          copyObj.setStartDate(startDate);
1592          copyObj.setEndDate(endDate);
1593          copyObj.setSubject(subject);
1594          copyObj.setNotes(notes);
1595          copyObj.setCreated(created);
1596          copyObj.setModified(modified);
1597          copyObj.setCreatedBy(createdBy);
1598          copyObj.setModifiedBy(modifiedBy);
1599  
1600                            copyObj.setPrintSubsId( 0);
1601                                                                                                                                    
1602                return copyObj;
1603    }
1604
1605    /**
1606     * returns a peer instance associated with this om. Since Peer classes
1607     * are not to have any instance attributes, this method returns the
1608     * same instance for all member of this class. The method could therefore
1609     * be static, but this would prevent one from overriding the behavior.
1610     */

1611    public PrintSubscriptionPeer getPeer()
1612    {
1613        return peer;
1614    }
1615
1616    public String JavaDoc toString()
1617    {
1618        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1619        str.append("PrintSubscription:\n");
1620        str.append("PrintSubsId = ")
1621               .append(getPrintSubsId())
1622             .append("\n");
1623        str.append("PrintSubsCode = ")
1624               .append(getPrintSubsCode())
1625             .append("\n");
1626        str.append("Status = ")
1627               .append(getStatus())
1628             .append("\n");
1629        str.append("Priority = ")
1630               .append(getPriority())
1631             .append("\n");
1632        str.append("IssuedDate = ")
1633               .append(getIssuedDate())
1634             .append("\n");
1635        str.append("ClosedDate = ")
1636               .append(getClosedDate())
1637             .append("\n");
1638        str.append("SorderId = ")
1639               .append(getSorderId())
1640             .append("\n");
1641        str.append("CustomerId = ")
1642               .append(getCustomerId())
1643             .append("\n");
1644        str.append("RecipientId = ")
1645               .append(getRecipientId())
1646             .append("\n");
1647        str.append("CarrierId = ")
1648               .append(getCarrierId())
1649             .append("\n");
1650        str.append("ProjectId = ")
1651               .append(getProjectId())
1652             .append("\n");
1653        str.append("ProductId = ")
1654               .append(getProductId())
1655             .append("\n");
1656        str.append("Quantity = ")
1657               .append(getQuantity())
1658             .append("\n");
1659        str.append("StartDate = ")
1660               .append(getStartDate())
1661             .append("\n");
1662        str.append("EndDate = ")
1663               .append(getEndDate())
1664             .append("\n");
1665        str.append("Subject = ")
1666               .append(getSubject())
1667             .append("\n");
1668        str.append("Notes = ")
1669               .append(getNotes())
1670             .append("\n");
1671        str.append("Created = ")
1672               .append(getCreated())
1673             .append("\n");
1674        str.append("Modified = ")
1675               .append(getModified())
1676             .append("\n");
1677        str.append("CreatedBy = ")
1678               .append(getCreatedBy())
1679             .append("\n");
1680        str.append("ModifiedBy = ")
1681               .append(getModifiedBy())
1682             .append("\n");
1683        return(str.toString());
1684    }
1685}
1686
Popular Tags