KickJava   Java API By Example, From Geeks To Geeks.

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


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 InboxEvent
36  */

37 public abstract class BaseInboxEvent extends BaseObject
38     implements org.apache.turbine.om.Retrievable
39 {
40     /** The Peer class */
41     private static final InboxEventPeer peer =
42         new InboxEventPeer();
43
44         
45     /** The value for the inboxEventId field */
46     private int inboxEventId;
47                                                 
48     /** The value for the inboxEventCode field */
49     private String JavaDoc inboxEventCode = "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 eventChannel field */
64     private int eventChannel = 20;
65                                           
66     /** The value for the eventType field */
67     private int eventType = 30;
68                                           
69     /** The value for the emailFormat field */
70     private int emailFormat = 10;
71                                           
72     /** The value for the customerId field */
73     private int customerId = 1000;
74                                           
75     /** The value for the projectId field */
76     private int projectId = 1000;
77                                           
78     /** The value for the productId field */
79     private int productId = 1000;
80       
81     /** The value for the senderName field */
82     private String JavaDoc senderName;
83       
84     /** The value for the senderEmail field */
85     private String JavaDoc senderEmail;
86       
87     /** The value for the senderReplyTo field */
88     private String JavaDoc senderReplyTo;
89       
90     /** The value for the sentTime field */
91     private Date JavaDoc sentTime;
92       
93     /** The value for the senderTo field */
94     private String JavaDoc senderTo;
95       
96     /** The value for the senderCc field */
97     private String JavaDoc senderCc;
98       
99     /** The value for the subject field */
100     private String JavaDoc subject;
101       
102     /** The value for the body field */
103     private String JavaDoc body;
104       
105     /** The value for the notes field */
106     private String JavaDoc notes;
107       
108     /** The value for the created field */
109     private Date JavaDoc created;
110       
111     /** The value for the modified field */
112     private Date JavaDoc modified;
113       
114     /** The value for the createdBy field */
115     private String JavaDoc createdBy;
116       
117     /** The value for the modifiedBy field */
118     private String JavaDoc modifiedBy;
119   
120     
121     /**
122      * Get the InboxEventId
123      *
124      * @return int
125      */

126     public int getInboxEventId()
127     {
128         return inboxEventId;
129     }
130
131                                               
132     /**
133      * Set the value of InboxEventId
134      *
135      * @param v new value
136      */

137     public void setInboxEventId(int v) throws TorqueException
138     {
139     
140                   if (this.inboxEventId != v)
141               {
142             this.inboxEventId = v;
143             setModified(true);
144         }
145     
146           
147                                   
148                   // update associated InboxAttachment
149
if (collInboxAttachments != null)
150         {
151             for (int i = 0; i < collInboxAttachments.size(); i++)
152             {
153                 ((InboxAttachment) collInboxAttachments.get(i))
154                     .setInboxEventId(v);
155             }
156         }
157                                 }
158   
159     /**
160      * Get the InboxEventCode
161      *
162      * @return String
163      */

164     public String JavaDoc getInboxEventCode()
165     {
166         return inboxEventCode;
167     }
168
169                         
170     /**
171      * Set the value of InboxEventCode
172      *
173      * @param v new value
174      */

175     public void setInboxEventCode(String JavaDoc v)
176     {
177     
178                   if (!ObjectUtils.equals(this.inboxEventCode, v))
179               {
180             this.inboxEventCode = v;
181             setModified(true);
182         }
183     
184           
185               }
186   
187     /**
188      * Get the Status
189      *
190      * @return int
191      */

192     public int getStatus()
193     {
194         return status;
195     }
196
197                         
198     /**
199      * Set the value of Status
200      *
201      * @param v new value
202      */

203     public void setStatus(int v)
204     {
205     
206                   if (this.status != v)
207               {
208             this.status = v;
209             setModified(true);
210         }
211     
212           
213               }
214   
215     /**
216      * Get the Priority
217      *
218      * @return int
219      */

220     public int getPriority()
221     {
222         return priority;
223     }
224
225                         
226     /**
227      * Set the value of Priority
228      *
229      * @param v new value
230      */

231     public void setPriority(int v)
232     {
233     
234                   if (this.priority != v)
235               {
236             this.priority = v;
237             setModified(true);
238         }
239     
240           
241               }
242   
243     /**
244      * Get the IssuedDate
245      *
246      * @return Date
247      */

248     public Date JavaDoc getIssuedDate()
249     {
250         return issuedDate;
251     }
252
253                         
254     /**
255      * Set the value of IssuedDate
256      *
257      * @param v new value
258      */

259     public void setIssuedDate(Date JavaDoc v)
260     {
261     
262                   if (!ObjectUtils.equals(this.issuedDate, v))
263               {
264             this.issuedDate = v;
265             setModified(true);
266         }
267     
268           
269               }
270   
271     /**
272      * Get the ClosedDate
273      *
274      * @return Date
275      */

276     public Date JavaDoc getClosedDate()
277     {
278         return closedDate;
279     }
280
281                         
282     /**
283      * Set the value of ClosedDate
284      *
285      * @param v new value
286      */

287     public void setClosedDate(Date JavaDoc v)
288     {
289     
290                   if (!ObjectUtils.equals(this.closedDate, v))
291               {
292             this.closedDate = v;
293             setModified(true);
294         }
295     
296           
297               }
298   
299     /**
300      * Get the EventChannel
301      *
302      * @return int
303      */

304     public int getEventChannel()
305     {
306         return eventChannel;
307     }
308
309                         
310     /**
311      * Set the value of EventChannel
312      *
313      * @param v new value
314      */

315     public void setEventChannel(int v)
316     {
317     
318                   if (this.eventChannel != v)
319               {
320             this.eventChannel = v;
321             setModified(true);
322         }
323     
324           
325               }
326   
327     /**
328      * Get the EventType
329      *
330      * @return int
331      */

332     public int getEventType()
333     {
334         return eventType;
335     }
336
337                         
338     /**
339      * Set the value of EventType
340      *
341      * @param v new value
342      */

343     public void setEventType(int v)
344     {
345     
346                   if (this.eventType != v)
347               {
348             this.eventType = v;
349             setModified(true);
350         }
351     
352           
353               }
354   
355     /**
356      * Get the EmailFormat
357      *
358      * @return int
359      */

360     public int getEmailFormat()
361     {
362         return emailFormat;
363     }
364
365                         
366     /**
367      * Set the value of EmailFormat
368      *
369      * @param v new value
370      */

371     public void setEmailFormat(int v)
372     {
373     
374                   if (this.emailFormat != v)
375               {
376             this.emailFormat = v;
377             setModified(true);
378         }
379     
380           
381               }
382   
383     /**
384      * Get the CustomerId
385      *
386      * @return int
387      */

388     public int getCustomerId()
389     {
390         return customerId;
391     }
392
393                               
394     /**
395      * Set the value of CustomerId
396      *
397      * @param v new value
398      */

399     public void setCustomerId(int v) throws TorqueException
400     {
401     
402                   if (this.customerId != v)
403               {
404             this.customerId = v;
405             setModified(true);
406         }
407     
408                           
409                 if (aCustomer != null && !(aCustomer.getCustomerId() == v))
410                 {
411             aCustomer = null;
412         }
413       
414               }
415   
416     /**
417      * Get the ProjectId
418      *
419      * @return int
420      */

421     public int getProjectId()
422     {
423         return projectId;
424     }
425
426                               
427     /**
428      * Set the value of ProjectId
429      *
430      * @param v new value
431      */

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

454     public int getProductId()
455     {
456         return productId;
457     }
458
459                               
460     /**
461      * Set the value of ProductId
462      *
463      * @param v new value
464      */

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

487     public String JavaDoc getSenderName()
488     {
489         return senderName;
490     }
491
492                         
493     /**
494      * Set the value of SenderName
495      *
496      * @param v new value
497      */

498     public void setSenderName(String JavaDoc v)
499     {
500     
501                   if (!ObjectUtils.equals(this.senderName, v))
502               {
503             this.senderName = v;
504             setModified(true);
505         }
506     
507           
508               }
509   
510     /**
511      * Get the SenderEmail
512      *
513      * @return String
514      */

515     public String JavaDoc getSenderEmail()
516     {
517         return senderEmail;
518     }
519
520                         
521     /**
522      * Set the value of SenderEmail
523      *
524      * @param v new value
525      */

526     public void setSenderEmail(String JavaDoc v)
527     {
528     
529                   if (!ObjectUtils.equals(this.senderEmail, v))
530               {
531             this.senderEmail = v;
532             setModified(true);
533         }
534     
535           
536               }
537   
538     /**
539      * Get the SenderReplyTo
540      *
541      * @return String
542      */

543     public String JavaDoc getSenderReplyTo()
544     {
545         return senderReplyTo;
546     }
547
548                         
549     /**
550      * Set the value of SenderReplyTo
551      *
552      * @param v new value
553      */

554     public void setSenderReplyTo(String JavaDoc v)
555     {
556     
557                   if (!ObjectUtils.equals(this.senderReplyTo, v))
558               {
559             this.senderReplyTo = v;
560             setModified(true);
561         }
562     
563           
564               }
565   
566     /**
567      * Get the SentTime
568      *
569      * @return Date
570      */

571     public Date JavaDoc getSentTime()
572     {
573         return sentTime;
574     }
575
576                         
577     /**
578      * Set the value of SentTime
579      *
580      * @param v new value
581      */

582     public void setSentTime(Date JavaDoc v)
583     {
584     
585                   if (!ObjectUtils.equals(this.sentTime, v))
586               {
587             this.sentTime = v;
588             setModified(true);
589         }
590     
591           
592               }
593   
594     /**
595      * Get the SenderTo
596      *
597      * @return String
598      */

599     public String JavaDoc getSenderTo()
600     {
601         return senderTo;
602     }
603
604                         
605     /**
606      * Set the value of SenderTo
607      *
608      * @param v new value
609      */

610     public void setSenderTo(String JavaDoc v)
611     {
612     
613                   if (!ObjectUtils.equals(this.senderTo, v))
614               {
615             this.senderTo = v;
616             setModified(true);
617         }
618     
619           
620               }
621   
622     /**
623      * Get the SenderCc
624      *
625      * @return String
626      */

627     public String JavaDoc getSenderCc()
628     {
629         return senderCc;
630     }
631
632                         
633     /**
634      * Set the value of SenderCc
635      *
636      * @param v new value
637      */

638     public void setSenderCc(String JavaDoc v)
639     {
640     
641                   if (!ObjectUtils.equals(this.senderCc, v))
642               {
643             this.senderCc = v;
644             setModified(true);
645         }
646     
647           
648               }
649   
650     /**
651      * Get the Subject
652      *
653      * @return String
654      */

655     public String JavaDoc getSubject()
656     {
657         return subject;
658     }
659
660                         
661     /**
662      * Set the value of Subject
663      *
664      * @param v new value
665      */

666     public void setSubject(String JavaDoc v)
667     {
668     
669                   if (!ObjectUtils.equals(this.subject, v))
670               {
671             this.subject = v;
672             setModified(true);
673         }
674     
675           
676               }
677   
678     /**
679      * Get the Body
680      *
681      * @return String
682      */

683     public String JavaDoc getBody()
684     {
685         return body;
686     }
687
688                         
689     /**
690      * Set the value of Body
691      *
692      * @param v new value
693      */

694     public void setBody(String JavaDoc v)
695     {
696     
697                   if (!ObjectUtils.equals(this.body, v))
698               {
699             this.body = v;
700             setModified(true);
701         }
702     
703           
704               }
705   
706     /**
707      * Get the Notes
708      *
709      * @return String
710      */

711     public String JavaDoc getNotes()
712     {
713         return notes;
714     }
715
716                         
717     /**
718      * Set the value of Notes
719      *
720      * @param v new value
721      */

722     public void setNotes(String JavaDoc v)
723     {
724     
725                   if (!ObjectUtils.equals(this.notes, v))
726               {
727             this.notes = v;
728             setModified(true);
729         }
730     
731           
732               }
733   
734     /**
735      * Get the Created
736      *
737      * @return Date
738      */

739     public Date JavaDoc getCreated()
740     {
741         return created;
742     }
743
744                         
745     /**
746      * Set the value of Created
747      *
748      * @param v new value
749      */

750     public void setCreated(Date JavaDoc v)
751     {
752     
753                   if (!ObjectUtils.equals(this.created, v))
754               {
755             this.created = v;
756             setModified(true);
757         }
758     
759           
760               }
761   
762     /**
763      * Get the Modified
764      *
765      * @return Date
766      */

767     public Date JavaDoc getModified()
768     {
769         return modified;
770     }
771
772                         
773     /**
774      * Set the value of Modified
775      *
776      * @param v new value
777      */

778     public void setModified(Date JavaDoc v)
779     {
780     
781                   if (!ObjectUtils.equals(this.modified, v))
782               {
783             this.modified = v;
784             setModified(true);
785         }
786     
787           
788               }
789   
790     /**
791      * Get the CreatedBy
792      *
793      * @return String
794      */

795     public String JavaDoc getCreatedBy()
796     {
797         return createdBy;
798     }
799
800                         
801     /**
802      * Set the value of CreatedBy
803      *
804      * @param v new value
805      */

806     public void setCreatedBy(String JavaDoc v)
807     {
808     
809                   if (!ObjectUtils.equals(this.createdBy, v))
810               {
811             this.createdBy = v;
812             setModified(true);
813         }
814     
815           
816               }
817   
818     /**
819      * Get the ModifiedBy
820      *
821      * @return String
822      */

823     public String JavaDoc getModifiedBy()
824     {
825         return modifiedBy;
826     }
827
828                         
829     /**
830      * Set the value of ModifiedBy
831      *
832      * @param v new value
833      */

834     public void setModifiedBy(String JavaDoc v)
835     {
836     
837                   if (!ObjectUtils.equals(this.modifiedBy, v))
838               {
839             this.modifiedBy = v;
840             setModified(true);
841         }
842     
843           
844               }
845   
846       
847     
848                   
849     
850         private Customer aCustomer;
851
852     /**
853      * Declares an association between this object and a Customer object
854      *
855      * @param v Customer
856      * @throws TorqueException
857      */

858     public void setCustomer(Customer v) throws TorqueException
859     {
860             if (v == null)
861         {
862                           setCustomerId( 1000);
863               }
864         else
865         {
866             setCustomerId(v.getCustomerId());
867         }
868             aCustomer = v;
869     }
870
871                                             
872     /**
873      * Get the associated Customer object
874      *
875      * @return the associated Customer object
876      * @throws TorqueException
877      */

878     public Customer getCustomer() throws TorqueException
879     {
880         if (aCustomer == null && (this.customerId != 0))
881         {
882                           aCustomer = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId));
883               
884             /* The following can be used instead of the line above to
885                guarantee the related object contains a reference
886                to this object, but this level of coupling
887                may be undesirable in many circumstances.
888                As it can lead to a db query with many results that may
889                never be used.
890                Customer obj = CustomerPeer.retrieveByPK(this.customerId);
891                obj.addInboxEvents(this);
892             */

893         }
894         return aCustomer;
895     }
896
897     /**
898      * Provides convenient way to set a relationship based on a
899      * ObjectKey, for example
900      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
901      *
902          */

903     public void setCustomerKey(ObjectKey key) throws TorqueException
904     {
905       
906                         setCustomerId(((NumberKey) key).intValue());
907                   }
908     
909     
910                   
911     
912         private Project aProject;
913
914     /**
915      * Declares an association between this object and a Project object
916      *
917      * @param v Project
918      * @throws TorqueException
919      */

920     public void setProject(Project v) throws TorqueException
921     {
922             if (v == null)
923         {
924                           setProjectId( 1000);
925               }
926         else
927         {
928             setProjectId(v.getProjectId());
929         }
930             aProject = v;
931     }
932
933                                             
934     /**
935      * Get the associated Project object
936      *
937      * @return the associated Project object
938      * @throws TorqueException
939      */

940     public Project getProject() throws TorqueException
941     {
942         if (aProject == null && (this.projectId != 0))
943         {
944                           aProject = ProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectId));
945               
946             /* The following can be used instead of the line above to
947                guarantee the related object contains a reference
948                to this object, but this level of coupling
949                may be undesirable in many circumstances.
950                As it can lead to a db query with many results that may
951                never be used.
952                Project obj = ProjectPeer.retrieveByPK(this.projectId);
953                obj.addInboxEvents(this);
954             */

955         }
956         return aProject;
957     }
958
959     /**
960      * Provides convenient way to set a relationship based on a
961      * ObjectKey, for example
962      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
963      *
964          */

965     public void setProjectKey(ObjectKey key) throws TorqueException
966     {
967       
968                         setProjectId(((NumberKey) key).intValue());
969                   }
970     
971     
972                   
973     
974         private Product aProduct;
975
976     /**
977      * Declares an association between this object and a Product object
978      *
979      * @param v Product
980      * @throws TorqueException
981      */

982     public void setProduct(Product v) throws TorqueException
983     {
984             if (v == null)
985         {
986                           setProductId( 1000);
987               }
988         else
989         {
990             setProductId(v.getProductId());
991         }
992             aProduct = v;
993     }
994
995                                             
996     /**
997      * Get the associated Product object
998      *
999      * @return the associated Product object
1000     * @throws TorqueException
1001     */

1002    public Product getProduct() throws TorqueException
1003    {
1004        if (aProduct == null && (this.productId != 0))
1005        {
1006                          aProduct = ProductPeer.retrieveByPK(SimpleKey.keyFor(this.productId));
1007              
1008            /* The following can be used instead of the line above to
1009               guarantee the related object contains a reference
1010               to this object, but this level of coupling
1011               may be undesirable in many circumstances.
1012               As it can lead to a db query with many results that may
1013               never be used.
1014               Product obj = ProductPeer.retrieveByPK(this.productId);
1015               obj.addInboxEvents(this);
1016            */

1017        }
1018        return aProduct;
1019    }
1020
1021    /**
1022     * Provides convenient way to set a relationship based on a
1023     * ObjectKey, for example
1024     * <code>bar.setFooKey(foo.getPrimaryKey())</code>
1025     *
1026         */

1027    public void setProductKey(ObjectKey key) throws TorqueException
1028    {
1029      
1030                        setProductId(((NumberKey) key).intValue());
1031                  }
1032       
1033                                
1034            
1035          /**
1036     * Collection to store aggregation of collInboxAttachments
1037     */

1038    protected List JavaDoc collInboxAttachments;
1039
1040    /**
1041     * Temporary storage of collInboxAttachments to save a possible db hit in
1042     * the event objects are add to the collection, but the
1043     * complete collection is never requested.
1044     */

1045    protected void initInboxAttachments()
1046    {
1047        if (collInboxAttachments == null)
1048        {
1049            collInboxAttachments = new ArrayList JavaDoc();
1050        }
1051    }
1052
1053    /**
1054     * Method called to associate a InboxAttachment object to this object
1055     * through the InboxAttachment foreign key attribute
1056     *
1057     * @param l InboxAttachment
1058     * @throws TorqueException
1059     */

1060    public void addInboxAttachment(InboxAttachment l) throws TorqueException
1061    {
1062        getInboxAttachments().add(l);
1063        l.setInboxEvent((InboxEvent) this);
1064    }
1065
1066    /**
1067     * The criteria used to select the current contents of collInboxAttachments
1068     */

1069    private Criteria lastInboxAttachmentsCriteria = null;
1070      
1071    /**
1072     * If this collection has already been initialized, returns
1073     * the collection. Otherwise returns the results of
1074     * getInboxAttachments(new Criteria())
1075     *
1076     * @throws TorqueException
1077     */

1078    public List JavaDoc getInboxAttachments() throws TorqueException
1079    {
1080              if (collInboxAttachments == null)
1081        {
1082            collInboxAttachments = getInboxAttachments(new Criteria(10));
1083        }
1084        return collInboxAttachments;
1085          }
1086
1087    /**
1088     * If this collection has already been initialized with
1089     * an identical criteria, it returns the collection.
1090     * Otherwise if this InboxEvent has previously
1091     * been saved, it will retrieve related InboxAttachments from storage.
1092     * If this InboxEvent is new, it will return
1093     * an empty collection or the current collection, the criteria
1094     * is ignored on a new object.
1095     *
1096     * @throws TorqueException
1097     */

1098    public List JavaDoc getInboxAttachments(Criteria criteria) throws TorqueException
1099    {
1100              if (collInboxAttachments == null)
1101        {
1102            if (isNew())
1103            {
1104               collInboxAttachments = new ArrayList JavaDoc();
1105            }
1106            else
1107            {
1108                        criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId() );
1109                        collInboxAttachments = InboxAttachmentPeer.doSelect(criteria);
1110            }
1111        }
1112        else
1113        {
1114            // criteria has no effect for a new object
1115
if (!isNew())
1116            {
1117                // the following code is to determine if a new query is
1118
// called for. If the criteria is the same as the last
1119
// one, just return the collection.
1120
criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId());
1121                            if (!lastInboxAttachmentsCriteria.equals(criteria))
1122                {
1123                    collInboxAttachments = InboxAttachmentPeer.doSelect(criteria);
1124                }
1125            }
1126        }
1127        lastInboxAttachmentsCriteria = criteria;
1128
1129        return collInboxAttachments;
1130          }
1131
1132    /**
1133     * If this collection has already been initialized, returns
1134     * the collection. Otherwise returns the results of
1135     * getInboxAttachments(new Criteria(),Connection)
1136     * This method takes in the Connection also as input so that
1137     * referenced objects can also be obtained using a Connection
1138     * that is taken as input
1139     */

1140    public List JavaDoc getInboxAttachments(Connection JavaDoc con) throws TorqueException
1141    {
1142              if (collInboxAttachments == null)
1143        {
1144            collInboxAttachments = getInboxAttachments(new Criteria(10), con);
1145        }
1146        return collInboxAttachments;
1147          }
1148
1149    /**
1150     * If this collection has already been initialized with
1151     * an identical criteria, it returns the collection.
1152     * Otherwise if this InboxEvent has previously
1153     * been saved, it will retrieve related InboxAttachments from storage.
1154     * If this InboxEvent is new, it will return
1155     * an empty collection or the current collection, the criteria
1156     * is ignored on a new object.
1157     * This method takes in the Connection also as input so that
1158     * referenced objects can also be obtained using a Connection
1159     * that is taken as input
1160     */

1161    public List JavaDoc getInboxAttachments(Criteria criteria, Connection JavaDoc con)
1162            throws TorqueException
1163    {
1164              if (collInboxAttachments == null)
1165        {
1166            if (isNew())
1167            {
1168               collInboxAttachments = new ArrayList JavaDoc();
1169            }
1170            else
1171            {
1172                         criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId());
1173                         collInboxAttachments = InboxAttachmentPeer.doSelect(criteria, con);
1174             }
1175         }
1176         else
1177         {
1178             // criteria has no effect for a new object
1179
if (!isNew())
1180             {
1181                 // the following code is to determine if a new query is
1182
// called for. If the criteria is the same as the last
1183
// one, just return the collection.
1184
criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId());
1185                             if (!lastInboxAttachmentsCriteria.equals(criteria))
1186                 {
1187                     collInboxAttachments = InboxAttachmentPeer.doSelect(criteria, con);
1188                 }
1189             }
1190         }
1191         lastInboxAttachmentsCriteria = criteria;
1192
1193         return collInboxAttachments;
1194           }
1195
1196                  
1197              
1198                    
1199                              
1200                                
1201                                                              
1202                                        
1203                    
1204                    
1205          
1206    /**
1207     * If this collection has already been initialized with
1208     * an identical criteria, it returns the collection.
1209     * Otherwise if this InboxEvent is new, it will return
1210     * an empty collection; or if this InboxEvent has previously
1211     * been saved, it will retrieve related InboxAttachments from storage.
1212     *
1213     * This method is protected by default in order to keep the public
1214     * api reasonable. You can provide public methods for those you
1215     * actually need in InboxEvent.
1216     */

1217    protected List JavaDoc getInboxAttachmentsJoinInboxEvent(Criteria criteria)
1218        throws TorqueException
1219    {
1220                    if (collInboxAttachments == null)
1221        {
1222            if (isNew())
1223            {
1224               collInboxAttachments = new ArrayList JavaDoc();
1225            }
1226            else
1227            {
1228                              criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId());
1229                              collInboxAttachments = InboxAttachmentPeer.doSelectJoinInboxEvent(criteria);
1230            }
1231        }
1232        else
1233        {
1234            // the following code is to determine if a new query is
1235
// called for. If the criteria is the same as the last
1236
// one, just return the collection.
1237

1238                        criteria.add(InboxAttachmentPeer.INBOX_EVENT_ID, getInboxEventId());
1239                                    if (!lastInboxAttachmentsCriteria.equals(criteria))
1240            {
1241                collInboxAttachments = InboxAttachmentPeer.doSelectJoinInboxEvent(criteria);
1242            }
1243        }
1244        lastInboxAttachmentsCriteria = criteria;
1245
1246        return collInboxAttachments;
1247                }
1248                            
1249
1250
1251          
1252    private static List JavaDoc fieldNames = null;
1253
1254    /**
1255     * Generate a list of field names.
1256     *
1257     * @return a list of field names
1258     */

1259    public static synchronized List JavaDoc getFieldNames()
1260    {
1261        if (fieldNames == null)
1262        {
1263            fieldNames = new ArrayList JavaDoc();
1264              fieldNames.add("InboxEventId");
1265              fieldNames.add("InboxEventCode");
1266              fieldNames.add("Status");
1267              fieldNames.add("Priority");
1268              fieldNames.add("IssuedDate");
1269              fieldNames.add("ClosedDate");
1270              fieldNames.add("EventChannel");
1271              fieldNames.add("EventType");
1272              fieldNames.add("EmailFormat");
1273              fieldNames.add("CustomerId");
1274              fieldNames.add("ProjectId");
1275              fieldNames.add("ProductId");
1276              fieldNames.add("SenderName");
1277              fieldNames.add("SenderEmail");
1278              fieldNames.add("SenderReplyTo");
1279              fieldNames.add("SentTime");
1280              fieldNames.add("SenderTo");
1281              fieldNames.add("SenderCc");
1282              fieldNames.add("Subject");
1283              fieldNames.add("Body");
1284              fieldNames.add("Notes");
1285              fieldNames.add("Created");
1286              fieldNames.add("Modified");
1287              fieldNames.add("CreatedBy");
1288              fieldNames.add("ModifiedBy");
1289              fieldNames = Collections.unmodifiableList(fieldNames);
1290        }
1291        return fieldNames;
1292    }
1293
1294    /**
1295     * Retrieves a field from the object by name passed in as a String.
1296     *
1297     * @param name field name
1298     * @return value
1299     */

1300    public Object JavaDoc getByName(String JavaDoc name)
1301    {
1302          if (name.equals("InboxEventId"))
1303        {
1304                return new Integer JavaDoc(getInboxEventId());
1305            }
1306          if (name.equals("InboxEventCode"))
1307        {
1308                return getInboxEventCode();
1309            }
1310          if (name.equals("Status"))
1311        {
1312                return new Integer JavaDoc(getStatus());
1313            }
1314          if (name.equals("Priority"))
1315        {
1316                return new Integer JavaDoc(getPriority());
1317            }
1318          if (name.equals("IssuedDate"))
1319        {
1320                return getIssuedDate();
1321            }
1322          if (name.equals("ClosedDate"))
1323        {
1324                return getClosedDate();
1325            }
1326          if (name.equals("EventChannel"))
1327        {
1328                return new Integer JavaDoc(getEventChannel());
1329            }
1330          if (name.equals("EventType"))
1331        {
1332                return new Integer JavaDoc(getEventType());
1333            }
1334          if (name.equals("EmailFormat"))
1335        {
1336                return new Integer JavaDoc(getEmailFormat());
1337            }
1338          if (name.equals("CustomerId"))
1339        {
1340                return new Integer JavaDoc(getCustomerId());
1341            }
1342          if (name.equals("ProjectId"))
1343        {
1344                return new Integer JavaDoc(getProjectId());
1345            }
1346          if (name.equals("ProductId"))
1347        {
1348                return new Integer JavaDoc(getProductId());
1349            }
1350          if (name.equals("SenderName"))
1351        {
1352                return getSenderName();
1353            }
1354          if (name.equals("SenderEmail"))
1355        {
1356                return getSenderEmail();
1357            }
1358          if (name.equals("SenderReplyTo"))
1359        {
1360                return getSenderReplyTo();
1361            }
1362          if (name.equals("SentTime"))
1363        {
1364                return getSentTime();
1365            }
1366          if (name.equals("SenderTo"))
1367        {
1368                return getSenderTo();
1369            }
1370          if (name.equals("SenderCc"))
1371        {
1372                return getSenderCc();
1373            }
1374          if (name.equals("Subject"))
1375        {
1376                return getSubject();
1377            }
1378          if (name.equals("Body"))
1379        {
1380                return getBody();
1381            }
1382          if (name.equals("Notes"))
1383        {
1384                return getNotes();
1385            }
1386          if (name.equals("Created"))
1387        {
1388                return getCreated();
1389            }
1390          if (name.equals("Modified"))
1391        {
1392                return getModified();
1393            }
1394          if (name.equals("CreatedBy"))
1395        {
1396                return getCreatedBy();
1397            }
1398          if (name.equals("ModifiedBy"))
1399        {
1400                return getModifiedBy();
1401            }
1402          return null;
1403    }
1404    
1405    /**
1406     * Retrieves a field from the object by name passed in
1407     * as a String. The String must be one of the static
1408     * Strings defined in this Class' Peer.
1409     *
1410     * @param name peer name
1411     * @return value
1412     */

1413    public Object JavaDoc getByPeerName(String JavaDoc name)
1414    {
1415          if (name.equals(InboxEventPeer.INBOX_EVENT_ID))
1416        {
1417                return new Integer JavaDoc(getInboxEventId());
1418            }
1419          if (name.equals(InboxEventPeer.INBOX_EVENT_CODE))
1420        {
1421                return getInboxEventCode();
1422            }
1423          if (name.equals(InboxEventPeer.STATUS))
1424        {
1425                return new Integer JavaDoc(getStatus());
1426            }
1427          if (name.equals(InboxEventPeer.PRIORITY))
1428        {
1429                return new Integer JavaDoc(getPriority());
1430            }
1431          if (name.equals(InboxEventPeer.ISSUED_DATE))
1432        {
1433                return getIssuedDate();
1434            }
1435          if (name.equals(InboxEventPeer.CLOSED_DATE))
1436        {
1437                return getClosedDate();
1438            }
1439          if (name.equals(InboxEventPeer.EVENT_CHANNEL))
1440        {
1441                return new Integer JavaDoc(getEventChannel());
1442            }
1443          if (name.equals(InboxEventPeer.EVENT_TYPE))
1444        {
1445                return new Integer JavaDoc(getEventType());
1446            }
1447          if (name.equals(InboxEventPeer.EMAIL_FORMAT))
1448        {
1449                return new Integer JavaDoc(getEmailFormat());
1450            }
1451          if (name.equals(InboxEventPeer.CUSTOMER_ID))
1452        {
1453                return new Integer JavaDoc(getCustomerId());
1454            }
1455          if (name.equals(InboxEventPeer.PROJECT_ID))
1456        {
1457                return new Integer JavaDoc(getProjectId());
1458            }
1459          if (name.equals(InboxEventPeer.PRODUCT_ID))
1460        {
1461                return new Integer JavaDoc(getProductId());
1462            }
1463          if (name.equals(InboxEventPeer.SENDER_NAME))
1464        {
1465                return getSenderName();
1466            }
1467          if (name.equals(InboxEventPeer.SENDER_EMAIL))
1468        {
1469                return getSenderEmail();
1470            }
1471          if (name.equals(InboxEventPeer.SENDER_REPLY_TO))
1472        {
1473                return getSenderReplyTo();
1474            }
1475          if (name.equals(InboxEventPeer.SENT_TIME))
1476        {
1477                return getSentTime();
1478            }
1479          if (name.equals(InboxEventPeer.SENDER_TO))
1480        {
1481                return getSenderTo();
1482            }
1483          if (name.equals(InboxEventPeer.SENDER_CC))
1484        {
1485                return getSenderCc();
1486            }
1487          if (name.equals(InboxEventPeer.SUBJECT))
1488        {
1489                return getSubject();
1490            }
1491          if (name.equals(InboxEventPeer.BODY))
1492        {
1493                return getBody();
1494            }
1495          if (name.equals(InboxEventPeer.NOTES))
1496        {
1497                return getNotes();
1498            }
1499          if (name.equals(InboxEventPeer.CREATED))
1500        {
1501                return getCreated();
1502            }
1503          if (name.equals(InboxEventPeer.MODIFIED))
1504        {
1505                return getModified();
1506            }
1507          if (name.equals(InboxEventPeer.CREATED_BY))
1508        {
1509                return getCreatedBy();
1510            }
1511          if (name.equals(InboxEventPeer.MODIFIED_BY))
1512        {
1513                return getModifiedBy();
1514            }
1515          return null;
1516    }
1517
1518    /**
1519     * Retrieves a field from the object by Position as specified
1520     * in the xml schema. Zero-based.
1521     *
1522     * @param pos position in xml schema
1523     * @return value
1524     */

1525    public Object JavaDoc getByPosition(int pos)
1526    {
1527            if (pos == 0)
1528        {
1529                return new Integer JavaDoc(getInboxEventId());
1530            }
1531              if (pos == 1)
1532        {
1533                return getInboxEventCode();
1534            }
1535              if (pos == 2)
1536        {
1537                return new Integer JavaDoc(getStatus());
1538            }
1539              if (pos == 3)
1540        {
1541                return new Integer JavaDoc(getPriority());
1542            }
1543              if (pos == 4)
1544        {
1545                return getIssuedDate();
1546            }
1547              if (pos == 5)
1548        {
1549                return getClosedDate();
1550            }
1551              if (pos == 6)
1552        {
1553                return new Integer JavaDoc(getEventChannel());
1554            }
1555              if (pos == 7)
1556        {
1557                return new Integer JavaDoc(getEventType());
1558            }
1559              if (pos == 8)
1560        {
1561                return new Integer JavaDoc(getEmailFormat());
1562            }
1563              if (pos == 9)
1564        {
1565                return new Integer JavaDoc(getCustomerId());
1566            }
1567              if (pos == 10)
1568        {
1569                return new Integer JavaDoc(getProjectId());
1570            }
1571              if (pos == 11)
1572        {
1573                return new Integer JavaDoc(getProductId());
1574            }
1575              if (pos == 12)
1576        {
1577                return getSenderName();
1578            }
1579              if (pos == 13)
1580        {
1581                return getSenderEmail();
1582            }
1583              if (pos == 14)
1584        {
1585                return getSenderReplyTo();
1586            }
1587              if (pos == 15)
1588        {
1589                return getSentTime();
1590            }
1591              if (pos == 16)
1592        {
1593                return getSenderTo();
1594            }
1595              if (pos == 17)
1596        {
1597                return getSenderCc();
1598            }
1599              if (pos == 18)
1600        {
1601                return getSubject();
1602            }
1603              if (pos == 19)
1604        {
1605                return getBody();
1606            }
1607              if (pos == 20)
1608        {
1609                return getNotes();
1610            }
1611              if (pos == 21)
1612        {
1613                return getCreated();
1614            }
1615              if (pos == 22)
1616        {
1617                return getModified();
1618            }
1619              if (pos == 23)
1620        {
1621                return getCreatedBy();
1622            }
1623              if (pos == 24)
1624        {
1625                return getModifiedBy();
1626            }
1627              return null;
1628    }
1629     
1630    /**
1631     * Stores the object in the database. If the object is new,
1632     * it inserts it; otherwise an update is performed.
1633     *
1634     * @throws Exception
1635     */

1636    public void save() throws Exception JavaDoc
1637    {
1638          save(InboxEventPeer.getMapBuilder()
1639                .getDatabaseMap().getName());
1640      }
1641
1642    /**
1643     * Stores the object in the database. If the object is new,
1644     * it inserts it; otherwise an update is performed.
1645       * Note: this code is here because the method body is
1646     * auto-generated conditionally and therefore needs to be
1647     * in this file instead of in the super class, BaseObject.
1648       *
1649     * @param dbName
1650     * @throws TorqueException
1651     */

1652    public void save(String JavaDoc dbName) throws TorqueException
1653    {
1654        Connection JavaDoc con = null;
1655          try
1656        {
1657            con = Transaction.begin(dbName);
1658            save(con);
1659            Transaction.commit(con);
1660        }
1661        catch(TorqueException e)
1662        {
1663            Transaction.safeRollback(con);
1664            throw e;
1665        }
1666      }
1667
1668      /** flag to prevent endless save loop, if this object is referenced
1669        by another object which falls in this transaction. */

1670    private boolean alreadyInSave = false;
1671      /**
1672     * Stores the object in the database. If the object is new,
1673     * it inserts it; otherwise an update is performed. This method
1674     * is meant to be used as part of a transaction, otherwise use
1675     * the save() method and the connection details will be handled
1676     * internally
1677     *
1678     * @param con
1679     * @throws TorqueException
1680     */

1681    public void save(Connection JavaDoc con) throws TorqueException
1682    {
1683          if (!alreadyInSave)
1684        {
1685            alreadyInSave = true;
1686
1687
1688  
1689            // If this object has been modified, then save it to the database.
1690
if (isModified())
1691            {
1692                if (isNew())
1693                {
1694                    InboxEventPeer.doInsert((InboxEvent) this, con);
1695                    setNew(false);
1696                }
1697                else
1698                {
1699                    InboxEventPeer.doUpdate((InboxEvent) this, con);
1700                }
1701            }
1702
1703                                      
1704                
1705                    if (collInboxAttachments != null)
1706            {
1707                for (int i = 0; i < collInboxAttachments.size(); i++)
1708                {
1709                    ((InboxAttachment) collInboxAttachments.get(i)).save(con);
1710                }
1711            }
1712                                  alreadyInSave = false;
1713        }
1714      }
1715
1716                        
1717      /**
1718     * Set the PrimaryKey using ObjectKey.
1719     *
1720     * @param key inboxEventId ObjectKey
1721     */

1722    public void setPrimaryKey(ObjectKey key)
1723        throws TorqueException
1724    {
1725            setInboxEventId(((NumberKey) key).intValue());
1726        }
1727
1728    /**
1729     * Set the PrimaryKey using a String.
1730     *
1731     * @param key
1732     */

1733    public void setPrimaryKey(String JavaDoc key) throws TorqueException
1734    {
1735            setInboxEventId(Integer.parseInt(key));
1736        }
1737
1738  
1739    /**
1740     * returns an id that differentiates this object from others
1741     * of its class.
1742     */

1743    public ObjectKey getPrimaryKey()
1744    {
1745          return SimpleKey.keyFor(getInboxEventId());
1746      }
1747 
1748    /**
1749     * get an id that differentiates this object from others
1750     * of its class.
1751     */

1752    public String JavaDoc getQueryKey()
1753    {
1754        if (getPrimaryKey() == null)
1755        {
1756            return "";
1757        }
1758        else
1759        {
1760            return getPrimaryKey().toString();
1761        }
1762    }
1763
1764    /**
1765     * set an id that differentiates this object from others
1766     * of its class.
1767     */

1768    public void setQueryKey(String JavaDoc key)
1769        throws TorqueException
1770    {
1771        setPrimaryKey(key);
1772    }
1773
1774    /**
1775     * Makes a copy of this object.
1776     * It creates a new object filling in the simple attributes.
1777       * It then fills all the association collections and sets the
1778     * related objects to isNew=true.
1779       */

1780      public InboxEvent copy() throws TorqueException
1781    {
1782        return copyInto(new InboxEvent());
1783    }
1784  
1785    protected InboxEvent copyInto(InboxEvent copyObj) throws TorqueException
1786    {
1787          copyObj.setInboxEventId(inboxEventId);
1788          copyObj.setInboxEventCode(inboxEventCode);
1789          copyObj.setStatus(status);
1790          copyObj.setPriority(priority);
1791          copyObj.setIssuedDate(issuedDate);
1792          copyObj.setClosedDate(closedDate);
1793          copyObj.setEventChannel(eventChannel);
1794          copyObj.setEventType(eventType);
1795          copyObj.setEmailFormat(emailFormat);
1796          copyObj.setCustomerId(customerId);
1797          copyObj.setProjectId(projectId);
1798          copyObj.setProductId(productId);
1799          copyObj.setSenderName(senderName);
1800          copyObj.setSenderEmail(senderEmail);
1801          copyObj.setSenderReplyTo(senderReplyTo);
1802          copyObj.setSentTime(sentTime);
1803          copyObj.setSenderTo(senderTo);
1804          copyObj.setSenderCc(senderCc);
1805          copyObj.setSubject(subject);
1806          copyObj.setBody(body);
1807          copyObj.setNotes(notes);
1808          copyObj.setCreated(created);
1809          copyObj.setModified(modified);
1810          copyObj.setCreatedBy(createdBy);
1811          copyObj.setModifiedBy(modifiedBy);
1812  
1813                            copyObj.setInboxEventId( 0);
1814                                                                                                                                                            
1815                                      
1816                            
1817        List JavaDoc v = getInboxAttachments();
1818        for (int i = 0; i < v.size(); i++)
1819        {
1820            InboxAttachment obj = (InboxAttachment) v.get(i);
1821            copyObj.addInboxAttachment(obj.copy());
1822        }
1823                            return copyObj;
1824    }
1825
1826    /**
1827     * returns a peer instance associated with this om. Since Peer classes
1828     * are not to have any instance attributes, this method returns the
1829     * same instance for all member of this class. The method could therefore
1830     * be static, but this would prevent one from overriding the behavior.
1831     */

1832    public InboxEventPeer getPeer()
1833    {
1834        return peer;
1835    }
1836
1837    public String JavaDoc toString()
1838    {
1839        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1840        str.append("InboxEvent:\n");
1841        str.append("InboxEventId = ")
1842               .append(getInboxEventId())
1843             .append("\n");
1844        str.append("InboxEventCode = ")
1845               .append(getInboxEventCode())
1846             .append("\n");
1847        str.append("Status = ")
1848               .append(getStatus())
1849             .append("\n");
1850        str.append("Priority = ")
1851               .append(getPriority())
1852             .append("\n");
1853        str.append("IssuedDate = ")
1854               .append(getIssuedDate())
1855             .append("\n");
1856        str.append("ClosedDate = ")
1857               .append(getClosedDate())
1858             .append("\n");
1859        str.append("EventChannel = ")
1860               .append(getEventChannel())
1861             .append("\n");
1862        str.append("EventType = ")
1863               .append(getEventType())
1864             .append("\n");
1865        str.append("EmailFormat = ")
1866               .append(getEmailFormat())
1867             .append("\n");
1868        str.append("CustomerId = ")
1869               .append(getCustomerId())
1870             .append("\n");
1871        str.append("ProjectId = ")
1872               .append(getProjectId())
1873             .append("\n");
1874        str.append("ProductId = ")
1875               .append(getProductId())
1876             .append("\n");
1877        str.append("SenderName = ")
1878               .append(getSenderName())
1879             .append("\n");
1880        str.append("SenderEmail = ")
1881               .append(getSenderEmail())
1882             .append("\n");
1883        str.append("SenderReplyTo = ")
1884               .append(getSenderReplyTo())
1885             .append("\n");
1886        str.append("SentTime = ")
1887               .append(getSentTime())
1888             .append("\n");
1889        str.append("SenderTo = ")
1890               .append(getSenderTo())
1891             .append("\n");
1892        str.append("SenderCc = ")
1893               .append(getSenderCc())
1894             .append("\n");
1895        str.append("Subject = ")
1896               .append(getSubject())
1897             .append("\n");
1898        str.append("Body = ")
1899               .append(getBody())
1900             .append("\n");
1901        str.append("Notes = ")
1902               .append(getNotes())
1903             .append("\n");
1904        str.append("Created = ")
1905               .append(getCreated())
1906             .append("\n");
1907        str.append("Modified = ")
1908               .append(getModified())
1909             .append("\n");
1910        str.append("CreatedBy = ")
1911               .append(getCreatedBy())
1912             .append("\n");
1913        str.append("ModifiedBy = ")
1914               .append(getModifiedBy())
1915             .append("\n");
1916        return(str.toString());
1917    }
1918}
1919
Popular Tags