KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

113     public int getOnlineSubsId()
114     {
115         return onlineSubsId;
116     }
117
118                         
119     /**
120      * Set the value of OnlineSubsId
121      *
122      * @param v new value
123      */

124     public void setOnlineSubsId(int v)
125     {
126     
127                   if (this.onlineSubsId != v)
128               {
129             this.onlineSubsId = v;
130             setModified(true);
131         }
132     
133           
134               }
135   
136     /**
137      * Get the OnlineSubsCode
138      *
139      * @return String
140      */

141     public String JavaDoc getOnlineSubsCode()
142     {
143         return onlineSubsCode;
144     }
145
146                         
147     /**
148      * Set the value of OnlineSubsCode
149      *
150      * @param v new value
151      */

152     public void setOnlineSubsCode(String JavaDoc v)
153     {
154     
155                   if (!ObjectUtils.equals(this.onlineSubsCode, v))
156               {
157             this.onlineSubsCode = v;
158             setModified(true);
159         }
160     
161           
162               }
163   
164     /**
165      * Get the Status
166      *
167      * @return int
168      */

169     public int getStatus()
170     {
171         return status;
172     }
173
174                         
175     /**
176      * Set the value of Status
177      *
178      * @param v new value
179      */

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

197     public int getPriority()
198     {
199         return priority;
200     }
201
202                         
203     /**
204      * Set the value of Priority
205      *
206      * @param v new value
207      */

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

225     public Date JavaDoc getIssuedDate()
226     {
227         return issuedDate;
228     }
229
230                         
231     /**
232      * Set the value of IssuedDate
233      *
234      * @param v new value
235      */

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

253     public Date JavaDoc getClosedDate()
254     {
255         return closedDate;
256     }
257
258                         
259     /**
260      * Set the value of ClosedDate
261      *
262      * @param v new value
263      */

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

281     public int getSorderId()
282     {
283         return sorderId;
284     }
285
286                               
287     /**
288      * Set the value of SorderId
289      *
290      * @param v new value
291      */

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

314     public int getCustomerId()
315     {
316         return customerId;
317     }
318
319                               
320     /**
321      * Set the value of CustomerId
322      *
323      * @param v new value
324      */

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

347     public int getRecipientId()
348     {
349         return recipientId;
350     }
351
352                               
353     /**
354      * Set the value of RecipientId
355      *
356      * @param v new value
357      */

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

380     public int getProjectId()
381     {
382         return projectId;
383     }
384
385                               
386     /**
387      * Set the value of ProjectId
388      *
389      * @param v new value
390      */

391     public void setProjectId(int v) throws TorqueException
392     {
393     
394                   if (this.projectId != v)
395               {
396             this.projectId = v;
397             setModified(true);
398         }
399     
400                           
401                 if (aProject != null && !(aProject.getProjectId() == v))
402                 {
403             aProject = null;
404         }
405       
406               }
407   
408     /**
409      * Get the ProductId
410      *
411      * @return int
412      */

413     public int getProductId()
414     {
415         return productId;
416     }
417
418                               
419     /**
420      * Set the value of ProductId
421      *
422      * @param v new value
423      */

424     public void setProductId(int v) throws TorqueException
425     {
426     
427                   if (this.productId != v)
428               {
429             this.productId = v;
430             setModified(true);
431         }
432     
433                           
434                 if (aProduct != null && !(aProduct.getProductId() == v))
435                 {
436             aProduct = null;
437         }
438       
439               }
440   
441     /**
442      * Get the Quantity
443      *
444      * @return int
445      */

446     public int getQuantity()
447     {
448         return quantity;
449     }
450
451                         
452     /**
453      * Set the value of Quantity
454      *
455      * @param v new value
456      */

457     public void setQuantity(int v)
458     {
459     
460                   if (this.quantity != v)
461               {
462             this.quantity = v;
463             setModified(true);
464         }
465     
466           
467               }
468   
469     /**
470      * Get the StartDate
471      *
472      * @return Date
473      */

474     public Date JavaDoc getStartDate()
475     {
476         return startDate;
477     }
478
479                         
480     /**
481      * Set the value of StartDate
482      *
483      * @param v new value
484      */

485     public void setStartDate(Date JavaDoc v)
486     {
487     
488                   if (!ObjectUtils.equals(this.startDate, v))
489               {
490             this.startDate = v;
491             setModified(true);
492         }
493     
494           
495               }
496   
497     /**
498      * Get the EndDate
499      *
500      * @return Date
501      */

502     public Date JavaDoc getEndDate()
503     {
504         return endDate;
505     }
506
507                         
508     /**
509      * Set the value of EndDate
510      *
511      * @param v new value
512      */

513     public void setEndDate(Date JavaDoc v)
514     {
515     
516                   if (!ObjectUtils.equals(this.endDate, v))
517               {
518             this.endDate = v;
519             setModified(true);
520         }
521     
522           
523               }
524   
525     /**
526      * Get the Subject
527      *
528      * @return String
529      */

530     public String JavaDoc getSubject()
531     {
532         return subject;
533     }
534
535                         
536     /**
537      * Set the value of Subject
538      *
539      * @param v new value
540      */

541     public void setSubject(String JavaDoc v)
542     {
543     
544                   if (!ObjectUtils.equals(this.subject, v))
545               {
546             this.subject = v;
547             setModified(true);
548         }
549     
550           
551               }
552   
553     /**
554      * Get the Notes
555      *
556      * @return String
557      */

558     public String JavaDoc getNotes()
559     {
560         return notes;
561     }
562
563                         
564     /**
565      * Set the value of Notes
566      *
567      * @param v new value
568      */

569     public void setNotes(String JavaDoc v)
570     {
571     
572                   if (!ObjectUtils.equals(this.notes, v))
573               {
574             this.notes = v;
575             setModified(true);
576         }
577     
578           
579               }
580   
581     /**
582      * Get the Created
583      *
584      * @return Date
585      */

586     public Date JavaDoc getCreated()
587     {
588         return created;
589     }
590
591                         
592     /**
593      * Set the value of Created
594      *
595      * @param v new value
596      */

597     public void setCreated(Date JavaDoc v)
598     {
599     
600                   if (!ObjectUtils.equals(this.created, v))
601               {
602             this.created = v;
603             setModified(true);
604         }
605     
606           
607               }
608   
609     /**
610      * Get the Modified
611      *
612      * @return Date
613      */

614     public Date JavaDoc getModified()
615     {
616         return modified;
617     }
618
619                         
620     /**
621      * Set the value of Modified
622      *
623      * @param v new value
624      */

625     public void setModified(Date JavaDoc v)
626     {
627     
628                   if (!ObjectUtils.equals(this.modified, v))
629               {
630             this.modified = v;
631             setModified(true);
632         }
633     
634           
635               }
636   
637     /**
638      * Get the CreatedBy
639      *
640      * @return String
641      */

642     public String JavaDoc getCreatedBy()
643     {
644         return createdBy;
645     }
646
647                         
648     /**
649      * Set the value of CreatedBy
650      *
651      * @param v new value
652      */

653     public void setCreatedBy(String JavaDoc v)
654     {
655     
656                   if (!ObjectUtils.equals(this.createdBy, v))
657               {
658             this.createdBy = v;
659             setModified(true);
660         }
661     
662           
663               }
664   
665     /**
666      * Get the ModifiedBy
667      *
668      * @return String
669      */

670     public String JavaDoc getModifiedBy()
671     {
672         return modifiedBy;
673     }
674
675                         
676     /**
677      * Set the value of ModifiedBy
678      *
679      * @param v new value
680      */

681     public void setModifiedBy(String JavaDoc v)
682     {
683     
684                   if (!ObjectUtils.equals(this.modifiedBy, v))
685               {
686             this.modifiedBy = v;
687             setModified(true);
688         }
689     
690           
691               }
692   
693       
694     
695                         
696         
697         private Customer aCustomerRelatedByCustomerId;
698
699     /**
700      * Declares an association between this object and a Customer object
701      *
702      * @param v Customer
703      * @throws TorqueException
704      */

705     public void setCustomerRelatedByCustomerId(Customer v) throws TorqueException
706     {
707             if (v == null)
708         {
709                           setCustomerId( 1000);
710               }
711         else
712         {
713             setCustomerId(v.getCustomerId());
714         }
715             aCustomerRelatedByCustomerId = v;
716     }
717
718                                             
719     /**
720      * Get the associated Customer object
721      *
722      * @return the associated Customer object
723      * @throws TorqueException
724      */

725     public Customer getCustomerRelatedByCustomerId() throws TorqueException
726     {
727         if (aCustomerRelatedByCustomerId == null && (this.customerId != 0))
728         {
729                           aCustomerRelatedByCustomerId = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId));
730               
731             /* The following can be used instead of the line above to
732                guarantee the related object contains a reference
733                to this object, but this level of coupling
734                may be undesirable in many circumstances.
735                As it can lead to a db query with many results that may
736                never be used.
737                Customer obj = CustomerPeer.retrieveByPK(this.customerId);
738                obj.addOnlineSubscriptionsRelatedByCustomerId(this);
739             */

740         }
741         return aCustomerRelatedByCustomerId;
742     }
743
744     /**
745      * Provides convenient way to set a relationship based on a
746      * ObjectKey, for example
747      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
748      *
749          */

750     public void setCustomerRelatedByCustomerIdKey(ObjectKey key) throws TorqueException
751     {
752       
753                         setCustomerId(((NumberKey) key).intValue());
754                   }
755     
756     
757                         
758         
759         private Customer aCustomerRelatedByRecipientId;
760
761     /**
762      * Declares an association between this object and a Customer object
763      *
764      * @param v Customer
765      * @throws TorqueException
766      */

767     public void setCustomerRelatedByRecipientId(Customer v) throws TorqueException
768     {
769             if (v == null)
770         {
771                           setRecipientId( 1000);
772               }
773         else
774         {
775             setRecipientId(v.getCustomerId());
776         }
777             aCustomerRelatedByRecipientId = v;
778     }
779
780                                             
781     /**
782      * Get the associated Customer object
783      *
784      * @return the associated Customer object
785      * @throws TorqueException
786      */

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

802         }
803         return aCustomerRelatedByRecipientId;
804     }
805
806     /**
807      * Provides convenient way to set a relationship based on a
808      * ObjectKey, for example
809      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
810      *
811          */

812     public void setCustomerRelatedByRecipientIdKey(ObjectKey key) throws TorqueException
813     {
814       
815                         setRecipientId(((NumberKey) key).intValue());
816                   }
817     
818     
819                   
820     
821         private Project aProject;
822
823     /**
824      * Declares an association between this object and a Project object
825      *
826      * @param v Project
827      * @throws TorqueException
828      */

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

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

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

874     public void setProjectKey(ObjectKey key) throws TorqueException
875     {
876       
877                         setProjectId(((NumberKey) key).intValue());
878                   }
879     
880     
881                   
882     
883         private Product aProduct;
884
885     /**
886      * Declares an association between this object and a Product object
887      *
888      * @param v Product
889      * @throws TorqueException
890      */

891     public void setProduct(Product v) throws TorqueException
892     {
893             if (v == null)
894         {
895                           setProductId( 1000);
896               }
897         else
898         {
899             setProductId(v.getProductId());
900         }
901             aProduct = v;
902     }
903
904                                             
905     /**
906      * Get the associated Product object
907      *
908      * @return the associated Product object
909      * @throws TorqueException
910      */

911     public Product getProduct() throws TorqueException
912     {
913         if (aProduct == null && (this.productId != 0))
914         {
915                           aProduct = ProductPeer.retrieveByPK(SimpleKey.keyFor(this.productId));
916               
917             /* The following can be used instead of the line above to
918                guarantee the related object contains a reference
919                to this object, but this level of coupling
920                may be undesirable in many circumstances.
921                As it can lead to a db query with many results that may
922                never be used.
923                Product obj = ProductPeer.retrieveByPK(this.productId);
924                obj.addOnlineSubscriptions(this);
925             */

926         }
927         return aProduct;
928     }
929
930     /**
931      * Provides convenient way to set a relationship based on a
932      * ObjectKey, for example
933      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
934      *
935          */

936     public void setProductKey(ObjectKey key) throws TorqueException
937     {
938       
939                         setProductId(((NumberKey) key).intValue());
940                   }
941     
942     
943                   
944     
945         private Sorder aSorder;
946
947     /**
948      * Declares an association between this object and a Sorder object
949      *
950      * @param v Sorder
951      * @throws TorqueException
952      */

953     public void setSorder(Sorder v) throws TorqueException
954     {
955             if (v == null)
956         {
957                           setSorderId( 1000);
958               }
959         else
960         {
961             setSorderId(v.getSorderId());
962         }
963             aSorder = v;
964     }
965
966                                             
967     /**
968      * Get the associated Sorder object
969      *
970      * @return the associated Sorder object
971      * @throws TorqueException
972      */

973     public Sorder getSorder() throws TorqueException
974     {
975         if (aSorder == null && (this.sorderId != 0))
976         {
977                           aSorder = SorderPeer.retrieveByPK(SimpleKey.keyFor(this.sorderId));
978               
979             /* The following can be used instead of the line above to
980                guarantee the related object contains a reference
981                to this object, but this level of coupling
982                may be undesirable in many circumstances.
983                As it can lead to a db query with many results that may
984                never be used.
985                Sorder obj = SorderPeer.retrieveByPK(this.sorderId);
986                obj.addOnlineSubscriptions(this);
987             */

988         }
989         return aSorder;
990     }
991
992     /**
993      * Provides convenient way to set a relationship based on a
994      * ObjectKey, for example
995      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
996      *
997          */

998     public void setSorderKey(ObjectKey key) throws TorqueException
999     {
1000      
1001                        setSorderId(((NumberKey) key).intValue());
1002                  }
1003       
1004                
1005    private static List JavaDoc fieldNames = null;
1006
1007    /**
1008     * Generate a list of field names.
1009     *
1010     * @return a list of field names
1011     */

1012    public static synchronized List JavaDoc getFieldNames()
1013    {
1014        if (fieldNames == null)
1015        {
1016            fieldNames = new ArrayList JavaDoc();
1017              fieldNames.add("OnlineSubsId");
1018              fieldNames.add("OnlineSubsCode");
1019              fieldNames.add("Status");
1020              fieldNames.add("Priority");
1021              fieldNames.add("IssuedDate");
1022              fieldNames.add("ClosedDate");
1023              fieldNames.add("SorderId");
1024              fieldNames.add("CustomerId");
1025              fieldNames.add("RecipientId");
1026              fieldNames.add("ProjectId");
1027              fieldNames.add("ProductId");
1028              fieldNames.add("Quantity");
1029              fieldNames.add("StartDate");
1030              fieldNames.add("EndDate");
1031              fieldNames.add("Subject");
1032              fieldNames.add("Notes");
1033              fieldNames.add("Created");
1034              fieldNames.add("Modified");
1035              fieldNames.add("CreatedBy");
1036              fieldNames.add("ModifiedBy");
1037              fieldNames = Collections.unmodifiableList(fieldNames);
1038        }
1039        return fieldNames;
1040    }
1041
1042    /**
1043     * Retrieves a field from the object by name passed in as a String.
1044     *
1045     * @param name field name
1046     * @return value
1047     */

1048    public Object JavaDoc getByName(String JavaDoc name)
1049    {
1050          if (name.equals("OnlineSubsId"))
1051        {
1052                return new Integer JavaDoc(getOnlineSubsId());
1053            }
1054          if (name.equals("OnlineSubsCode"))
1055        {
1056                return getOnlineSubsCode();
1057            }
1058          if (name.equals("Status"))
1059        {
1060                return new Integer JavaDoc(getStatus());
1061            }
1062          if (name.equals("Priority"))
1063        {
1064                return new Integer JavaDoc(getPriority());
1065            }
1066          if (name.equals("IssuedDate"))
1067        {
1068                return getIssuedDate();
1069            }
1070          if (name.equals("ClosedDate"))
1071        {
1072                return getClosedDate();
1073            }
1074          if (name.equals("SorderId"))
1075        {
1076                return new Integer JavaDoc(getSorderId());
1077            }
1078          if (name.equals("CustomerId"))
1079        {
1080                return new Integer JavaDoc(getCustomerId());
1081            }
1082          if (name.equals("RecipientId"))
1083        {
1084                return new Integer JavaDoc(getRecipientId());
1085            }
1086          if (name.equals("ProjectId"))
1087        {
1088                return new Integer JavaDoc(getProjectId());
1089            }
1090          if (name.equals("ProductId"))
1091        {
1092                return new Integer JavaDoc(getProductId());
1093            }
1094          if (name.equals("Quantity"))
1095        {
1096                return new Integer JavaDoc(getQuantity());
1097            }
1098          if (name.equals("StartDate"))
1099        {
1100                return getStartDate();
1101            }
1102          if (name.equals("EndDate"))
1103        {
1104                return getEndDate();
1105            }
1106          if (name.equals("Subject"))
1107        {
1108                return getSubject();
1109            }
1110          if (name.equals("Notes"))
1111        {
1112                return getNotes();
1113            }
1114          if (name.equals("Created"))
1115        {
1116                return getCreated();
1117            }
1118          if (name.equals("Modified"))
1119        {
1120                return getModified();
1121            }
1122          if (name.equals("CreatedBy"))
1123        {
1124                return getCreatedBy();
1125            }
1126          if (name.equals("ModifiedBy"))
1127        {
1128                return getModifiedBy();
1129            }
1130          return null;
1131    }
1132    
1133    /**
1134     * Retrieves a field from the object by name passed in
1135     * as a String. The String must be one of the static
1136     * Strings defined in this Class' Peer.
1137     *
1138     * @param name peer name
1139     * @return value
1140     */

1141    public Object JavaDoc getByPeerName(String JavaDoc name)
1142    {
1143          if (name.equals(OnlineSubscriptionPeer.ONLINE_SUBS_ID))
1144        {
1145                return new Integer JavaDoc(getOnlineSubsId());
1146            }
1147          if (name.equals(OnlineSubscriptionPeer.ONLINE_SUBS_CODE))
1148        {
1149                return getOnlineSubsCode();
1150            }
1151          if (name.equals(OnlineSubscriptionPeer.STATUS))
1152        {
1153                return new Integer JavaDoc(getStatus());
1154            }
1155          if (name.equals(OnlineSubscriptionPeer.PRIORITY))
1156        {
1157                return new Integer JavaDoc(getPriority());
1158            }
1159          if (name.equals(OnlineSubscriptionPeer.ISSUED_DATE))
1160        {
1161                return getIssuedDate();
1162            }
1163          if (name.equals(OnlineSubscriptionPeer.CLOSED_DATE))
1164        {
1165                return getClosedDate();
1166            }
1167          if (name.equals(OnlineSubscriptionPeer.SORDER_ID))
1168        {
1169                return new Integer JavaDoc(getSorderId());
1170            }
1171          if (name.equals(OnlineSubscriptionPeer.CUSTOMER_ID))
1172        {
1173                return new Integer JavaDoc(getCustomerId());
1174            }
1175          if (name.equals(OnlineSubscriptionPeer.RECIPIENT_ID))
1176        {
1177                return new Integer JavaDoc(getRecipientId());
1178            }
1179          if (name.equals(OnlineSubscriptionPeer.PROJECT_ID))
1180        {
1181                return new Integer JavaDoc(getProjectId());
1182            }
1183          if (name.equals(OnlineSubscriptionPeer.PRODUCT_ID))
1184        {
1185                return new Integer JavaDoc(getProductId());
1186            }
1187          if (name.equals(OnlineSubscriptionPeer.QUANTITY))
1188        {
1189                return new Integer JavaDoc(getQuantity());
1190            }
1191          if (name.equals(OnlineSubscriptionPeer.START_DATE))
1192        {
1193                return getStartDate();
1194            }
1195          if (name.equals(OnlineSubscriptionPeer.END_DATE))
1196        {
1197                return getEndDate();
1198            }
1199          if (name.equals(OnlineSubscriptionPeer.SUBJECT))
1200        {
1201                return getSubject();
1202            }
1203          if (name.equals(OnlineSubscriptionPeer.NOTES))
1204        {
1205                return getNotes();
1206            }
1207          if (name.equals(OnlineSubscriptionPeer.CREATED))
1208        {
1209                return getCreated();
1210            }
1211          if (name.equals(OnlineSubscriptionPeer.MODIFIED))
1212        {
1213                return getModified();
1214            }
1215          if (name.equals(OnlineSubscriptionPeer.CREATED_BY))
1216        {
1217                return getCreatedBy();
1218            }
1219          if (name.equals(OnlineSubscriptionPeer.MODIFIED_BY))
1220        {
1221                return getModifiedBy();
1222            }
1223          return null;
1224    }
1225
1226    /**
1227     * Retrieves a field from the object by Position as specified
1228     * in the xml schema. Zero-based.
1229     *
1230     * @param pos position in xml schema
1231     * @return value
1232     */

1233    public Object JavaDoc getByPosition(int pos)
1234    {
1235            if (pos == 0)
1236        {
1237                return new Integer JavaDoc(getOnlineSubsId());
1238            }
1239              if (pos == 1)
1240        {
1241                return getOnlineSubsCode();
1242            }
1243              if (pos == 2)
1244        {
1245                return new Integer JavaDoc(getStatus());
1246            }
1247              if (pos == 3)
1248        {
1249                return new Integer JavaDoc(getPriority());
1250            }
1251              if (pos == 4)
1252        {
1253                return getIssuedDate();
1254            }
1255              if (pos == 5)
1256        {
1257                return getClosedDate();
1258            }
1259              if (pos == 6)
1260        {
1261                return new Integer JavaDoc(getSorderId());
1262            }
1263              if (pos == 7)
1264        {
1265                return new Integer JavaDoc(getCustomerId());
1266            }
1267              if (pos == 8)
1268        {
1269                return new Integer JavaDoc(getRecipientId());
1270            }
1271              if (pos == 9)
1272        {
1273                return new Integer JavaDoc(getProjectId());
1274            }
1275              if (pos == 10)
1276        {
1277                return new Integer JavaDoc(getProductId());
1278            }
1279              if (pos == 11)
1280        {
1281                return new Integer JavaDoc(getQuantity());
1282            }
1283              if (pos == 12)
1284        {
1285                return getStartDate();
1286            }
1287              if (pos == 13)
1288        {
1289                return getEndDate();
1290            }
1291              if (pos == 14)
1292        {
1293                return getSubject();
1294            }
1295              if (pos == 15)
1296        {
1297                return getNotes();
1298            }
1299              if (pos == 16)
1300        {
1301                return getCreated();
1302            }
1303              if (pos == 17)
1304        {
1305                return getModified();
1306            }
1307              if (pos == 18)
1308        {
1309                return getCreatedBy();
1310            }
1311              if (pos == 19)
1312        {
1313                return getModifiedBy();
1314            }
1315              return null;
1316    }
1317     
1318    /**
1319     * Stores the object in the database. If the object is new,
1320     * it inserts it; otherwise an update is performed.
1321     *
1322     * @throws Exception
1323     */

1324    public void save() throws Exception JavaDoc
1325    {
1326          save(OnlineSubscriptionPeer.getMapBuilder()
1327                .getDatabaseMap().getName());
1328      }
1329
1330    /**
1331     * Stores the object in the database. If the object is new,
1332     * it inserts it; otherwise an update is performed.
1333       * Note: this code is here because the method body is
1334     * auto-generated conditionally and therefore needs to be
1335     * in this file instead of in the super class, BaseObject.
1336       *
1337     * @param dbName
1338     * @throws TorqueException
1339     */

1340    public void save(String JavaDoc dbName) throws TorqueException
1341    {
1342        Connection JavaDoc con = null;
1343          try
1344        {
1345            con = Transaction.begin(dbName);
1346            save(con);
1347            Transaction.commit(con);
1348        }
1349        catch(TorqueException e)
1350        {
1351            Transaction.safeRollback(con);
1352            throw e;
1353        }
1354      }
1355
1356      /** flag to prevent endless save loop, if this object is referenced
1357        by another object which falls in this transaction. */

1358    private boolean alreadyInSave = false;
1359      /**
1360     * Stores the object in the database. If the object is new,
1361     * it inserts it; otherwise an update is performed. This method
1362     * is meant to be used as part of a transaction, otherwise use
1363     * the save() method and the connection details will be handled
1364     * internally
1365     *
1366     * @param con
1367     * @throws TorqueException
1368     */

1369    public void save(Connection JavaDoc con) throws TorqueException
1370    {
1371          if (!alreadyInSave)
1372        {
1373            alreadyInSave = true;
1374
1375
1376  
1377            // If this object has been modified, then save it to the database.
1378
if (isModified())
1379            {
1380                if (isNew())
1381                {
1382                    OnlineSubscriptionPeer.doInsert((OnlineSubscription) this, con);
1383                    setNew(false);
1384                }
1385                else
1386                {
1387                    OnlineSubscriptionPeer.doUpdate((OnlineSubscription) this, con);
1388                }
1389            }
1390
1391                      alreadyInSave = false;
1392        }
1393      }
1394
1395                  
1396      /**
1397     * Set the PrimaryKey using ObjectKey.
1398     *
1399     * @param key onlineSubsId ObjectKey
1400     */

1401    public void setPrimaryKey(ObjectKey key)
1402        
1403    {
1404            setOnlineSubsId(((NumberKey) key).intValue());
1405        }
1406
1407    /**
1408     * Set the PrimaryKey using a String.
1409     *
1410     * @param key
1411     */

1412    public void setPrimaryKey(String JavaDoc key)
1413    {
1414            setOnlineSubsId(Integer.parseInt(key));
1415        }
1416
1417  
1418    /**
1419     * returns an id that differentiates this object from others
1420     * of its class.
1421     */

1422    public ObjectKey getPrimaryKey()
1423    {
1424          return SimpleKey.keyFor(getOnlineSubsId());
1425      }
1426 
1427    /**
1428     * get an id that differentiates this object from others
1429     * of its class.
1430     */

1431    public String JavaDoc getQueryKey()
1432    {
1433        if (getPrimaryKey() == null)
1434        {
1435            return "";
1436        }
1437        else
1438        {
1439            return getPrimaryKey().toString();
1440        }
1441    }
1442
1443    /**
1444     * set an id that differentiates this object from others
1445     * of its class.
1446     */

1447    public void setQueryKey(String JavaDoc key)
1448        throws TorqueException
1449    {
1450        setPrimaryKey(key);
1451    }
1452
1453    /**
1454     * Makes a copy of this object.
1455     * It creates a new object filling in the simple attributes.
1456       * It then fills all the association collections and sets the
1457     * related objects to isNew=true.
1458       */

1459      public OnlineSubscription copy() throws TorqueException
1460    {
1461        return copyInto(new OnlineSubscription());
1462    }
1463  
1464    protected OnlineSubscription copyInto(OnlineSubscription copyObj) throws TorqueException
1465    {
1466          copyObj.setOnlineSubsId(onlineSubsId);
1467          copyObj.setOnlineSubsCode(onlineSubsCode);
1468          copyObj.setStatus(status);
1469          copyObj.setPriority(priority);
1470          copyObj.setIssuedDate(issuedDate);
1471          copyObj.setClosedDate(closedDate);
1472          copyObj.setSorderId(sorderId);
1473          copyObj.setCustomerId(customerId);
1474          copyObj.setRecipientId(recipientId);
1475          copyObj.setProjectId(projectId);
1476          copyObj.setProductId(productId);
1477          copyObj.setQuantity(quantity);
1478          copyObj.setStartDate(startDate);
1479          copyObj.setEndDate(endDate);
1480          copyObj.setSubject(subject);
1481          copyObj.setNotes(notes);
1482          copyObj.setCreated(created);
1483          copyObj.setModified(modified);
1484          copyObj.setCreatedBy(createdBy);
1485          copyObj.setModifiedBy(modifiedBy);
1486  
1487                            copyObj.setOnlineSubsId( 0);
1488                                                                                                                              
1489                return copyObj;
1490    }
1491
1492    /**
1493     * returns a peer instance associated with this om. Since Peer classes
1494     * are not to have any instance attributes, this method returns the
1495     * same instance for all member of this class. The method could therefore
1496     * be static, but this would prevent one from overriding the behavior.
1497     */

1498    public OnlineSubscriptionPeer getPeer()
1499    {
1500        return peer;
1501    }
1502
1503    public String JavaDoc toString()
1504    {
1505        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1506        str.append("OnlineSubscription:\n");
1507        str.append("OnlineSubsId = ")
1508               .append(getOnlineSubsId())
1509             .append("\n");
1510        str.append("OnlineSubsCode = ")
1511               .append(getOnlineSubsCode())
1512             .append("\n");
1513        str.append("Status = ")
1514               .append(getStatus())
1515             .append("\n");
1516        str.append("Priority = ")
1517               .append(getPriority())
1518             .append("\n");
1519        str.append("IssuedDate = ")
1520               .append(getIssuedDate())
1521             .append("\n");
1522        str.append("ClosedDate = ")
1523               .append(getClosedDate())
1524             .append("\n");
1525        str.append("SorderId = ")
1526               .append(getSorderId())
1527             .append("\n");
1528        str.append("CustomerId = ")
1529               .append(getCustomerId())
1530             .append("\n");
1531        str.append("RecipientId = ")
1532               .append(getRecipientId())
1533             .append("\n");
1534        str.append("ProjectId = ")
1535               .append(getProjectId())
1536             .append("\n");
1537        str.append("ProductId = ")
1538               .append(getProductId())
1539             .append("\n");
1540        str.append("Quantity = ")
1541               .append(getQuantity())
1542             .append("\n");
1543        str.append("StartDate = ")
1544               .append(getStartDate())
1545             .append("\n");
1546        str.append("EndDate = ")
1547               .append(getEndDate())
1548             .append("\n");
1549        str.append("Subject = ")
1550               .append(getSubject())
1551             .append("\n");
1552        str.append("Notes = ")
1553               .append(getNotes())
1554             .append("\n");
1555        str.append("Created = ")
1556               .append(getCreated())
1557             .append("\n");
1558        str.append("Modified = ")
1559               .append(getModified())
1560             .append("\n");
1561        str.append("CreatedBy = ")
1562               .append(getCreatedBy())
1563             .append("\n");
1564        str.append("ModifiedBy = ")
1565               .append(getModifiedBy())
1566             .append("\n");
1567        return(str.toString());
1568    }
1569}
1570
Popular Tags