KickJava   Java API By Example, From Geeks To Geeks.

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


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

37 public abstract class BaseOutboxEvent extends BaseObject
38     implements org.apache.turbine.om.Retrievable
39 {
40     /** The Peer class */
41     private static final OutboxEventPeer peer =
42         new OutboxEventPeer();
43
44         
45     /** The value for the outboxEventId field */
46     private int outboxEventId;
47                                                 
48     /** The value for the outboxEventCode field */
49     private String JavaDoc outboxEventCode = "AUTO";
50                                           
51     /** The value for the status field */
52     private int status = 30;
53                                           
54     /** The value for the priority field */
55     private int priority = 30;
56       
57     /** The value for the issuedDate field */
58     private Date JavaDoc issuedDate;
59       
60     /** The value for the closedDate field */
61     private Date JavaDoc closedDate;
62       
63     /** The value for the sentTime field */
64     private Date JavaDoc sentTime;
65                                           
66     /** The value for the eventChannel field */
67     private int eventChannel = 10;
68                                           
69     /** The value for the eventType field */
70     private int eventType = 20;
71                                           
72     /** The value for the emailFormat field */
73     private int emailFormat = 10;
74                                           
75     /** The value for the customerId field */
76     private int customerId = 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 receiverTo field */
85     private String JavaDoc receiverTo;
86       
87     /** The value for the receiverCc field */
88     private String JavaDoc receiverCc;
89       
90     /** The value for the subject field */
91     private String JavaDoc subject;
92       
93     /** The value for the body field */
94     private String JavaDoc body;
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 OutboxEventId
114      *
115      * @return int
116      */

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

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

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

156     public void setOutboxEventCode(String JavaDoc v)
157     {
158     
159                   if (!ObjectUtils.equals(this.outboxEventCode, v))
160               {
161             this.outboxEventCode = 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 SentTime
282      *
283      * @return Date
284      */

285     public Date JavaDoc getSentTime()
286     {
287         return sentTime;
288     }
289
290                         
291     /**
292      * Set the value of SentTime
293      *
294      * @param v new value
295      */

296     public void setSentTime(Date JavaDoc v)
297     {
298     
299                   if (!ObjectUtils.equals(this.sentTime, v))
300               {
301             this.sentTime = v;
302             setModified(true);
303         }
304     
305           
306               }
307   
308     /**
309      * Get the EventChannel
310      *
311      * @return int
312      */

313     public int getEventChannel()
314     {
315         return eventChannel;
316     }
317
318                         
319     /**
320      * Set the value of EventChannel
321      *
322      * @param v new value
323      */

324     public void setEventChannel(int v)
325     {
326     
327                   if (this.eventChannel != v)
328               {
329             this.eventChannel = v;
330             setModified(true);
331         }
332     
333           
334               }
335   
336     /**
337      * Get the EventType
338      *
339      * @return int
340      */

341     public int getEventType()
342     {
343         return eventType;
344     }
345
346                         
347     /**
348      * Set the value of EventType
349      *
350      * @param v new value
351      */

352     public void setEventType(int v)
353     {
354     
355                   if (this.eventType != v)
356               {
357             this.eventType = v;
358             setModified(true);
359         }
360     
361           
362               }
363   
364     /**
365      * Get the EmailFormat
366      *
367      * @return int
368      */

369     public int getEmailFormat()
370     {
371         return emailFormat;
372     }
373
374                         
375     /**
376      * Set the value of EmailFormat
377      *
378      * @param v new value
379      */

380     public void setEmailFormat(int v)
381     {
382     
383                   if (this.emailFormat != v)
384               {
385             this.emailFormat = v;
386             setModified(true);
387         }
388     
389           
390               }
391   
392     /**
393      * Get the CustomerId
394      *
395      * @return int
396      */

397     public int getCustomerId()
398     {
399         return customerId;
400     }
401
402                               
403     /**
404      * Set the value of CustomerId
405      *
406      * @param v new value
407      */

408     public void setCustomerId(int v) throws TorqueException
409     {
410     
411                   if (this.customerId != v)
412               {
413             this.customerId = v;
414             setModified(true);
415         }
416     
417                           
418                 if (aCustomer != null && !(aCustomer.getCustomerId() == v))
419                 {
420             aCustomer = null;
421         }
422       
423               }
424   
425     /**
426      * Get the ProjectId
427      *
428      * @return int
429      */

430     public int getProjectId()
431     {
432         return projectId;
433     }
434
435                               
436     /**
437      * Set the value of ProjectId
438      *
439      * @param v new value
440      */

441     public void setProjectId(int v) throws TorqueException
442     {
443     
444                   if (this.projectId != v)
445               {
446             this.projectId = v;
447             setModified(true);
448         }
449     
450                           
451                 if (aProject != null && !(aProject.getProjectId() == v))
452                 {
453             aProject = null;
454         }
455       
456               }
457   
458     /**
459      * Get the ProductId
460      *
461      * @return int
462      */

463     public int getProductId()
464     {
465         return productId;
466     }
467
468                               
469     /**
470      * Set the value of ProductId
471      *
472      * @param v new value
473      */

474     public void setProductId(int v) throws TorqueException
475     {
476     
477                   if (this.productId != v)
478               {
479             this.productId = v;
480             setModified(true);
481         }
482     
483                           
484                 if (aProduct != null && !(aProduct.getProductId() == v))
485                 {
486             aProduct = null;
487         }
488       
489               }
490   
491     /**
492      * Get the ReceiverTo
493      *
494      * @return String
495      */

496     public String JavaDoc getReceiverTo()
497     {
498         return receiverTo;
499     }
500
501                         
502     /**
503      * Set the value of ReceiverTo
504      *
505      * @param v new value
506      */

507     public void setReceiverTo(String JavaDoc v)
508     {
509     
510                   if (!ObjectUtils.equals(this.receiverTo, v))
511               {
512             this.receiverTo = v;
513             setModified(true);
514         }
515     
516           
517               }
518   
519     /**
520      * Get the ReceiverCc
521      *
522      * @return String
523      */

524     public String JavaDoc getReceiverCc()
525     {
526         return receiverCc;
527     }
528
529                         
530     /**
531      * Set the value of ReceiverCc
532      *
533      * @param v new value
534      */

535     public void setReceiverCc(String JavaDoc v)
536     {
537     
538                   if (!ObjectUtils.equals(this.receiverCc, v))
539               {
540             this.receiverCc = v;
541             setModified(true);
542         }
543     
544           
545               }
546   
547     /**
548      * Get the Subject
549      *
550      * @return String
551      */

552     public String JavaDoc getSubject()
553     {
554         return subject;
555     }
556
557                         
558     /**
559      * Set the value of Subject
560      *
561      * @param v new value
562      */

563     public void setSubject(String JavaDoc v)
564     {
565     
566                   if (!ObjectUtils.equals(this.subject, v))
567               {
568             this.subject = v;
569             setModified(true);
570         }
571     
572           
573               }
574   
575     /**
576      * Get the Body
577      *
578      * @return String
579      */

580     public String JavaDoc getBody()
581     {
582         return body;
583     }
584
585                         
586     /**
587      * Set the value of Body
588      *
589      * @param v new value
590      */

591     public void setBody(String JavaDoc v)
592     {
593     
594                   if (!ObjectUtils.equals(this.body, v))
595               {
596             this.body = v;
597             setModified(true);
598         }
599     
600           
601               }
602   
603     /**
604      * Get the Notes
605      *
606      * @return String
607      */

608     public String JavaDoc getNotes()
609     {
610         return notes;
611     }
612
613                         
614     /**
615      * Set the value of Notes
616      *
617      * @param v new value
618      */

619     public void setNotes(String JavaDoc v)
620     {
621     
622                   if (!ObjectUtils.equals(this.notes, v))
623               {
624             this.notes = v;
625             setModified(true);
626         }
627     
628           
629               }
630   
631     /**
632      * Get the Created
633      *
634      * @return Date
635      */

636     public Date JavaDoc getCreated()
637     {
638         return created;
639     }
640
641                         
642     /**
643      * Set the value of Created
644      *
645      * @param v new value
646      */

647     public void setCreated(Date JavaDoc v)
648     {
649     
650                   if (!ObjectUtils.equals(this.created, v))
651               {
652             this.created = v;
653             setModified(true);
654         }
655     
656           
657               }
658   
659     /**
660      * Get the Modified
661      *
662      * @return Date
663      */

664     public Date JavaDoc getModified()
665     {
666         return modified;
667     }
668
669                         
670     /**
671      * Set the value of Modified
672      *
673      * @param v new value
674      */

675     public void setModified(Date JavaDoc v)
676     {
677     
678                   if (!ObjectUtils.equals(this.modified, v))
679               {
680             this.modified = v;
681             setModified(true);
682         }
683     
684           
685               }
686   
687     /**
688      * Get the CreatedBy
689      *
690      * @return String
691      */

692     public String JavaDoc getCreatedBy()
693     {
694         return createdBy;
695     }
696
697                         
698     /**
699      * Set the value of CreatedBy
700      *
701      * @param v new value
702      */

703     public void setCreatedBy(String JavaDoc v)
704     {
705     
706                   if (!ObjectUtils.equals(this.createdBy, v))
707               {
708             this.createdBy = v;
709             setModified(true);
710         }
711     
712           
713               }
714   
715     /**
716      * Get the ModifiedBy
717      *
718      * @return String
719      */

720     public String JavaDoc getModifiedBy()
721     {
722         return modifiedBy;
723     }
724
725                         
726     /**
727      * Set the value of ModifiedBy
728      *
729      * @param v new value
730      */

731     public void setModifiedBy(String JavaDoc v)
732     {
733     
734                   if (!ObjectUtils.equals(this.modifiedBy, v))
735               {
736             this.modifiedBy = v;
737             setModified(true);
738         }
739     
740           
741               }
742   
743       
744     
745                   
746     
747         private Customer aCustomer;
748
749     /**
750      * Declares an association between this object and a Customer object
751      *
752      * @param v Customer
753      * @throws TorqueException
754      */

755     public void setCustomer(Customer v) throws TorqueException
756     {
757             if (v == null)
758         {
759                           setCustomerId( 1000);
760               }
761         else
762         {
763             setCustomerId(v.getCustomerId());
764         }
765             aCustomer = v;
766     }
767
768                                             
769     /**
770      * Get the associated Customer object
771      *
772      * @return the associated Customer object
773      * @throws TorqueException
774      */

775     public Customer getCustomer() throws TorqueException
776     {
777         if (aCustomer == null && (this.customerId != 0))
778         {
779                           aCustomer = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId));
780               
781             /* The following can be used instead of the line above to
782                guarantee the related object contains a reference
783                to this object, but this level of coupling
784                may be undesirable in many circumstances.
785                As it can lead to a db query with many results that may
786                never be used.
787                Customer obj = CustomerPeer.retrieveByPK(this.customerId);
788                obj.addOutboxEvents(this);
789             */

790         }
791         return aCustomer;
792     }
793
794     /**
795      * Provides convenient way to set a relationship based on a
796      * ObjectKey, for example
797      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
798      *
799          */

800     public void setCustomerKey(ObjectKey key) throws TorqueException
801     {
802       
803                         setCustomerId(((NumberKey) key).intValue());
804                   }
805     
806     
807                   
808     
809         private Project aProject;
810
811     /**
812      * Declares an association between this object and a Project object
813      *
814      * @param v Project
815      * @throws TorqueException
816      */

817     public void setProject(Project v) throws TorqueException
818     {
819             if (v == null)
820         {
821                           setProjectId( 1000);
822               }
823         else
824         {
825             setProjectId(v.getProjectId());
826         }
827             aProject = v;
828     }
829
830                                             
831     /**
832      * Get the associated Project object
833      *
834      * @return the associated Project object
835      * @throws TorqueException
836      */

837     public Project getProject() throws TorqueException
838     {
839         if (aProject == null && (this.projectId != 0))
840         {
841                           aProject = ProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectId));
842               
843             /* The following can be used instead of the line above to
844                guarantee the related object contains a reference
845                to this object, but this level of coupling
846                may be undesirable in many circumstances.
847                As it can lead to a db query with many results that may
848                never be used.
849                Project obj = ProjectPeer.retrieveByPK(this.projectId);
850                obj.addOutboxEvents(this);
851             */

852         }
853         return aProject;
854     }
855
856     /**
857      * Provides convenient way to set a relationship based on a
858      * ObjectKey, for example
859      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
860      *
861          */

862     public void setProjectKey(ObjectKey key) throws TorqueException
863     {
864       
865                         setProjectId(((NumberKey) key).intValue());
866                   }
867     
868     
869                   
870     
871         private Product aProduct;
872
873     /**
874      * Declares an association between this object and a Product object
875      *
876      * @param v Product
877      * @throws TorqueException
878      */

879     public void setProduct(Product v) throws TorqueException
880     {
881             if (v == null)
882         {
883                           setProductId( 1000);
884               }
885         else
886         {
887             setProductId(v.getProductId());
888         }
889             aProduct = v;
890     }
891
892                                             
893     /**
894      * Get the associated Product object
895      *
896      * @return the associated Product object
897      * @throws TorqueException
898      */

899     public Product getProduct() throws TorqueException
900     {
901         if (aProduct == null && (this.productId != 0))
902         {
903                           aProduct = ProductPeer.retrieveByPK(SimpleKey.keyFor(this.productId));
904               
905             /* The following can be used instead of the line above to
906                guarantee the related object contains a reference
907                to this object, but this level of coupling
908                may be undesirable in many circumstances.
909                As it can lead to a db query with many results that may
910                never be used.
911                Product obj = ProductPeer.retrieveByPK(this.productId);
912                obj.addOutboxEvents(this);
913             */

914         }
915         return aProduct;
916     }
917
918     /**
919      * Provides convenient way to set a relationship based on a
920      * ObjectKey, for example
921      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
922      *
923          */

924     public void setProductKey(ObjectKey key) throws TorqueException
925     {
926       
927                         setProductId(((NumberKey) key).intValue());
928                   }
929        
930                 
931     private static List JavaDoc fieldNames = null;
932
933     /**
934      * Generate a list of field names.
935      *
936      * @return a list of field names
937      */

938     public static synchronized List JavaDoc getFieldNames()
939     {
940         if (fieldNames == null)
941         {
942             fieldNames = new ArrayList JavaDoc();
943               fieldNames.add("OutboxEventId");
944               fieldNames.add("OutboxEventCode");
945               fieldNames.add("Status");
946               fieldNames.add("Priority");
947               fieldNames.add("IssuedDate");
948               fieldNames.add("ClosedDate");
949               fieldNames.add("SentTime");
950               fieldNames.add("EventChannel");
951               fieldNames.add("EventType");
952               fieldNames.add("EmailFormat");
953               fieldNames.add("CustomerId");
954               fieldNames.add("ProjectId");
955               fieldNames.add("ProductId");
956               fieldNames.add("ReceiverTo");
957               fieldNames.add("ReceiverCc");
958               fieldNames.add("Subject");
959               fieldNames.add("Body");
960               fieldNames.add("Notes");
961               fieldNames.add("Created");
962               fieldNames.add("Modified");
963               fieldNames.add("CreatedBy");
964               fieldNames.add("ModifiedBy");
965               fieldNames = Collections.unmodifiableList(fieldNames);
966         }
967         return fieldNames;
968     }
969
970     /**
971      * Retrieves a field from the object by name passed in as a String.
972      *
973      * @param name field name
974      * @return value
975      */

976     public Object JavaDoc getByName(String JavaDoc name)
977     {
978           if (name.equals("OutboxEventId"))
979         {
980                 return new Integer JavaDoc(getOutboxEventId());
981             }
982           if (name.equals("OutboxEventCode"))
983         {
984                 return getOutboxEventCode();
985             }
986           if (name.equals("Status"))
987         {
988                 return new Integer JavaDoc(getStatus());
989             }
990           if (name.equals("Priority"))
991         {
992                 return new Integer JavaDoc(getPriority());
993             }
994           if (name.equals("IssuedDate"))
995         {
996                 return getIssuedDate();
997             }
998           if (name.equals("ClosedDate"))
999         {
1000                return getClosedDate();
1001            }
1002          if (name.equals("SentTime"))
1003        {
1004                return getSentTime();
1005            }
1006          if (name.equals("EventChannel"))
1007        {
1008                return new Integer JavaDoc(getEventChannel());
1009            }
1010          if (name.equals("EventType"))
1011        {
1012                return new Integer JavaDoc(getEventType());
1013            }
1014          if (name.equals("EmailFormat"))
1015        {
1016                return new Integer JavaDoc(getEmailFormat());
1017            }
1018          if (name.equals("CustomerId"))
1019        {
1020                return new Integer JavaDoc(getCustomerId());
1021            }
1022          if (name.equals("ProjectId"))
1023        {
1024                return new Integer JavaDoc(getProjectId());
1025            }
1026          if (name.equals("ProductId"))
1027        {
1028                return new Integer JavaDoc(getProductId());
1029            }
1030          if (name.equals("ReceiverTo"))
1031        {
1032                return getReceiverTo();
1033            }
1034          if (name.equals("ReceiverCc"))
1035        {
1036                return getReceiverCc();
1037            }
1038          if (name.equals("Subject"))
1039        {
1040                return getSubject();
1041            }
1042          if (name.equals("Body"))
1043        {
1044                return getBody();
1045            }
1046          if (name.equals("Notes"))
1047        {
1048                return getNotes();
1049            }
1050          if (name.equals("Created"))
1051        {
1052                return getCreated();
1053            }
1054          if (name.equals("Modified"))
1055        {
1056                return getModified();
1057            }
1058          if (name.equals("CreatedBy"))
1059        {
1060                return getCreatedBy();
1061            }
1062          if (name.equals("ModifiedBy"))
1063        {
1064                return getModifiedBy();
1065            }
1066          return null;
1067    }
1068    
1069    /**
1070     * Retrieves a field from the object by name passed in
1071     * as a String. The String must be one of the static
1072     * Strings defined in this Class' Peer.
1073     *
1074     * @param name peer name
1075     * @return value
1076     */

1077    public Object JavaDoc getByPeerName(String JavaDoc name)
1078    {
1079          if (name.equals(OutboxEventPeer.OUTBOX_EVENT_ID))
1080        {
1081                return new Integer JavaDoc(getOutboxEventId());
1082            }
1083          if (name.equals(OutboxEventPeer.OUTBOX_EVENT_CODE))
1084        {
1085                return getOutboxEventCode();
1086            }
1087          if (name.equals(OutboxEventPeer.STATUS))
1088        {
1089                return new Integer JavaDoc(getStatus());
1090            }
1091          if (name.equals(OutboxEventPeer.PRIORITY))
1092        {
1093                return new Integer JavaDoc(getPriority());
1094            }
1095          if (name.equals(OutboxEventPeer.ISSUED_DATE))
1096        {
1097                return getIssuedDate();
1098            }
1099          if (name.equals(OutboxEventPeer.CLOSED_DATE))
1100        {
1101                return getClosedDate();
1102            }
1103          if (name.equals(OutboxEventPeer.SENT_TIME))
1104        {
1105                return getSentTime();
1106            }
1107          if (name.equals(OutboxEventPeer.EVENT_CHANNEL))
1108        {
1109                return new Integer JavaDoc(getEventChannel());
1110            }
1111          if (name.equals(OutboxEventPeer.EVENT_TYPE))
1112        {
1113                return new Integer JavaDoc(getEventType());
1114            }
1115          if (name.equals(OutboxEventPeer.EMAIL_FORMAT))
1116        {
1117                return new Integer JavaDoc(getEmailFormat());
1118            }
1119          if (name.equals(OutboxEventPeer.CUSTOMER_ID))
1120        {
1121                return new Integer JavaDoc(getCustomerId());
1122            }
1123          if (name.equals(OutboxEventPeer.PROJECT_ID))
1124        {
1125                return new Integer JavaDoc(getProjectId());
1126            }
1127          if (name.equals(OutboxEventPeer.PRODUCT_ID))
1128        {
1129                return new Integer JavaDoc(getProductId());
1130            }
1131          if (name.equals(OutboxEventPeer.RECEIVER_TO))
1132        {
1133                return getReceiverTo();
1134            }
1135          if (name.equals(OutboxEventPeer.RECEIVER_CC))
1136        {
1137                return getReceiverCc();
1138            }
1139          if (name.equals(OutboxEventPeer.SUBJECT))
1140        {
1141                return getSubject();
1142            }
1143          if (name.equals(OutboxEventPeer.BODY))
1144        {
1145                return getBody();
1146            }
1147          if (name.equals(OutboxEventPeer.NOTES))
1148        {
1149                return getNotes();
1150            }
1151          if (name.equals(OutboxEventPeer.CREATED))
1152        {
1153                return getCreated();
1154            }
1155          if (name.equals(OutboxEventPeer.MODIFIED))
1156        {
1157                return getModified();
1158            }
1159          if (name.equals(OutboxEventPeer.CREATED_BY))
1160        {
1161                return getCreatedBy();
1162            }
1163          if (name.equals(OutboxEventPeer.MODIFIED_BY))
1164        {
1165                return getModifiedBy();
1166            }
1167          return null;
1168    }
1169
1170    /**
1171     * Retrieves a field from the object by Position as specified
1172     * in the xml schema. Zero-based.
1173     *
1174     * @param pos position in xml schema
1175     * @return value
1176     */

1177    public Object JavaDoc getByPosition(int pos)
1178    {
1179            if (pos == 0)
1180        {
1181                return new Integer JavaDoc(getOutboxEventId());
1182            }
1183              if (pos == 1)
1184        {
1185                return getOutboxEventCode();
1186            }
1187              if (pos == 2)
1188        {
1189                return new Integer JavaDoc(getStatus());
1190            }
1191              if (pos == 3)
1192        {
1193                return new Integer JavaDoc(getPriority());
1194            }
1195              if (pos == 4)
1196        {
1197                return getIssuedDate();
1198            }
1199              if (pos == 5)
1200        {
1201                return getClosedDate();
1202            }
1203              if (pos == 6)
1204        {
1205                return getSentTime();
1206            }
1207              if (pos == 7)
1208        {
1209                return new Integer JavaDoc(getEventChannel());
1210            }
1211              if (pos == 8)
1212        {
1213                return new Integer JavaDoc(getEventType());
1214            }
1215              if (pos == 9)
1216        {
1217                return new Integer JavaDoc(getEmailFormat());
1218            }
1219              if (pos == 10)
1220        {
1221                return new Integer JavaDoc(getCustomerId());
1222            }
1223              if (pos == 11)
1224        {
1225                return new Integer JavaDoc(getProjectId());
1226            }
1227              if (pos == 12)
1228        {
1229                return new Integer JavaDoc(getProductId());
1230            }
1231              if (pos == 13)
1232        {
1233                return getReceiverTo();
1234            }
1235              if (pos == 14)
1236        {
1237                return getReceiverCc();
1238            }
1239              if (pos == 15)
1240        {
1241                return getSubject();
1242            }
1243              if (pos == 16)
1244        {
1245                return getBody();
1246            }
1247              if (pos == 17)
1248        {
1249                return getNotes();
1250            }
1251              if (pos == 18)
1252        {
1253                return getCreated();
1254            }
1255              if (pos == 19)
1256        {
1257                return getModified();
1258            }
1259              if (pos == 20)
1260        {
1261                return getCreatedBy();
1262            }
1263              if (pos == 21)
1264        {
1265                return getModifiedBy();
1266            }
1267              return null;
1268    }
1269     
1270    /**
1271     * Stores the object in the database. If the object is new,
1272     * it inserts it; otherwise an update is performed.
1273     *
1274     * @throws Exception
1275     */

1276    public void save() throws Exception JavaDoc
1277    {
1278          save(OutboxEventPeer.getMapBuilder()
1279                .getDatabaseMap().getName());
1280      }
1281
1282    /**
1283     * Stores the object in the database. If the object is new,
1284     * it inserts it; otherwise an update is performed.
1285       * Note: this code is here because the method body is
1286     * auto-generated conditionally and therefore needs to be
1287     * in this file instead of in the super class, BaseObject.
1288       *
1289     * @param dbName
1290     * @throws TorqueException
1291     */

1292    public void save(String JavaDoc dbName) throws TorqueException
1293    {
1294        Connection JavaDoc con = null;
1295          try
1296        {
1297            con = Transaction.begin(dbName);
1298            save(con);
1299            Transaction.commit(con);
1300        }
1301        catch(TorqueException e)
1302        {
1303            Transaction.safeRollback(con);
1304            throw e;
1305        }
1306      }
1307
1308      /** flag to prevent endless save loop, if this object is referenced
1309        by another object which falls in this transaction. */

1310    private boolean alreadyInSave = false;
1311      /**
1312     * Stores the object in the database. If the object is new,
1313     * it inserts it; otherwise an update is performed. This method
1314     * is meant to be used as part of a transaction, otherwise use
1315     * the save() method and the connection details will be handled
1316     * internally
1317     *
1318     * @param con
1319     * @throws TorqueException
1320     */

1321    public void save(Connection JavaDoc con) throws TorqueException
1322    {
1323          if (!alreadyInSave)
1324        {
1325            alreadyInSave = true;
1326
1327
1328  
1329            // If this object has been modified, then save it to the database.
1330
if (isModified())
1331            {
1332                if (isNew())
1333                {
1334                    OutboxEventPeer.doInsert((OutboxEvent) this, con);
1335                    setNew(false);
1336                }
1337                else
1338                {
1339                    OutboxEventPeer.doUpdate((OutboxEvent) this, con);
1340                }
1341            }
1342
1343                      alreadyInSave = false;
1344        }
1345      }
1346
1347                  
1348      /**
1349     * Set the PrimaryKey using ObjectKey.
1350     *
1351     * @param key outboxEventId ObjectKey
1352     */

1353    public void setPrimaryKey(ObjectKey key)
1354        
1355    {
1356            setOutboxEventId(((NumberKey) key).intValue());
1357        }
1358
1359    /**
1360     * Set the PrimaryKey using a String.
1361     *
1362     * @param key
1363     */

1364    public void setPrimaryKey(String JavaDoc key)
1365    {
1366            setOutboxEventId(Integer.parseInt(key));
1367        }
1368
1369  
1370    /**
1371     * returns an id that differentiates this object from others
1372     * of its class.
1373     */

1374    public ObjectKey getPrimaryKey()
1375    {
1376          return SimpleKey.keyFor(getOutboxEventId());
1377      }
1378 
1379    /**
1380     * get an id that differentiates this object from others
1381     * of its class.
1382     */

1383    public String JavaDoc getQueryKey()
1384    {
1385        if (getPrimaryKey() == null)
1386        {
1387            return "";
1388        }
1389        else
1390        {
1391            return getPrimaryKey().toString();
1392        }
1393    }
1394
1395    /**
1396     * set an id that differentiates this object from others
1397     * of its class.
1398     */

1399    public void setQueryKey(String JavaDoc key)
1400        throws TorqueException
1401    {
1402        setPrimaryKey(key);
1403    }
1404
1405    /**
1406     * Makes a copy of this object.
1407     * It creates a new object filling in the simple attributes.
1408       * It then fills all the association collections and sets the
1409     * related objects to isNew=true.
1410       */

1411      public OutboxEvent copy() throws TorqueException
1412    {
1413        return copyInto(new OutboxEvent());
1414    }
1415  
1416    protected OutboxEvent copyInto(OutboxEvent copyObj) throws TorqueException
1417    {
1418          copyObj.setOutboxEventId(outboxEventId);
1419          copyObj.setOutboxEventCode(outboxEventCode);
1420          copyObj.setStatus(status);
1421          copyObj.setPriority(priority);
1422          copyObj.setIssuedDate(issuedDate);
1423          copyObj.setClosedDate(closedDate);
1424          copyObj.setSentTime(sentTime);
1425          copyObj.setEventChannel(eventChannel);
1426          copyObj.setEventType(eventType);
1427          copyObj.setEmailFormat(emailFormat);
1428          copyObj.setCustomerId(customerId);
1429          copyObj.setProjectId(projectId);
1430          copyObj.setProductId(productId);
1431          copyObj.setReceiverTo(receiverTo);
1432          copyObj.setReceiverCc(receiverCc);
1433          copyObj.setSubject(subject);
1434          copyObj.setBody(body);
1435          copyObj.setNotes(notes);
1436          copyObj.setCreated(created);
1437          copyObj.setModified(modified);
1438          copyObj.setCreatedBy(createdBy);
1439          copyObj.setModifiedBy(modifiedBy);
1440  
1441                            copyObj.setOutboxEventId( 0);
1442                                                                                                                                          
1443                return copyObj;
1444    }
1445
1446    /**
1447     * returns a peer instance associated with this om. Since Peer classes
1448     * are not to have any instance attributes, this method returns the
1449     * same instance for all member of this class. The method could therefore
1450     * be static, but this would prevent one from overriding the behavior.
1451     */

1452    public OutboxEventPeer getPeer()
1453    {
1454        return peer;
1455    }
1456
1457    public String JavaDoc toString()
1458    {
1459        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1460        str.append("OutboxEvent:\n");
1461        str.append("OutboxEventId = ")
1462               .append(getOutboxEventId())
1463             .append("\n");
1464        str.append("OutboxEventCode = ")
1465               .append(getOutboxEventCode())
1466             .append("\n");
1467        str.append("Status = ")
1468               .append(getStatus())
1469             .append("\n");
1470        str.append("Priority = ")
1471               .append(getPriority())
1472             .append("\n");
1473        str.append("IssuedDate = ")
1474               .append(getIssuedDate())
1475             .append("\n");
1476        str.append("ClosedDate = ")
1477               .append(getClosedDate())
1478             .append("\n");
1479        str.append("SentTime = ")
1480               .append(getSentTime())
1481             .append("\n");
1482        str.append("EventChannel = ")
1483               .append(getEventChannel())
1484             .append("\n");
1485        str.append("EventType = ")
1486               .append(getEventType())
1487             .append("\n");
1488        str.append("EmailFormat = ")
1489               .append(getEmailFormat())
1490             .append("\n");
1491        str.append("CustomerId = ")
1492               .append(getCustomerId())
1493             .append("\n");
1494        str.append("ProjectId = ")
1495               .append(getProjectId())
1496             .append("\n");
1497        str.append("ProductId = ")
1498               .append(getProductId())
1499             .append("\n");
1500        str.append("ReceiverTo = ")
1501               .append(getReceiverTo())
1502             .append("\n");
1503        str.append("ReceiverCc = ")
1504               .append(getReceiverCc())
1505             .append("\n");
1506        str.append("Subject = ")
1507               .append(getSubject())
1508             .append("\n");
1509        str.append("Body = ")
1510               .append(getBody())
1511             .append("\n");
1512        str.append("Notes = ")
1513               .append(getNotes())
1514             .append("\n");
1515        str.append("Created = ")
1516               .append(getCreated())
1517             .append("\n");
1518        str.append("Modified = ")
1519               .append(getModified())
1520             .append("\n");
1521        str.append("CreatedBy = ")
1522               .append(getCreatedBy())
1523             .append("\n");
1524        str.append("ModifiedBy = ")
1525               .append(getModifiedBy())
1526             .append("\n");
1527        return(str.toString());
1528    }
1529}
1530
Popular Tags