KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.campware.cream.om;
2
3
4 import java.math.BigDecimal JavaDoc;
5 import java.sql.Connection JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.Collections JavaDoc;
8 import java.util.Date JavaDoc;
9 import java.util.List JavaDoc;
10
11 import org.apache.commons.lang.ObjectUtils;
12 import org.apache.turbine.om.Retrievable;
13 import org.apache.torque.TorqueException;
14 import org.apache.torque.om.BaseObject;
15 import org.apache.torque.om.ComboKey;
16 import org.apache.torque.om.DateKey;
17 import org.apache.torque.om.NumberKey;
18 import org.apache.torque.om.ObjectKey;
19 import org.apache.torque.om.SimpleKey;
20 import org.apache.torque.om.StringKey;
21 import org.apache.torque.om.Persistent;
22 import org.apache.torque.util.Criteria;
23 import org.apache.torque.util.Transaction;
24
25   
26     
27     
28     
29     
30     
31   
32 /**
33  * This class was autogenerated by Torque on:
34  *
35  * [Wed May 04 09:10:56 CEST 2005]
36  *
37  * You should not use this class directly. It should not even be
38  * extended all references should be to ServiceItem
39  */

40 public abstract class BaseServiceItem extends BaseObject
41     implements org.apache.turbine.om.Retrievable
42 {
43     /** The Peer class */
44     private static final ServiceItemPeer peer =
45         new ServiceItemPeer();
46
47         
48     /** The value for the serviceItemId field */
49     private int serviceItemId;
50                                           
51     /** The value for the sorderId field */
52     private int sorderId = 1000;
53                                           
54     /** The value for the customerId field */
55     private int customerId = 1000;
56                                           
57     /** The value for the recipientId field */
58     private int recipientId = 1000;
59                                           
60     /** The value for the projectId field */
61     private int projectId = 1000;
62                                           
63     /** The value for the serviceId field */
64     private int serviceId = 1000;
65                                           
66     /** The value for the productId field */
67     private int productId = 1000;
68       
69     /** The value for the description field */
70     private String JavaDoc description;
71                                           
72     /** The value for the quantity field */
73     private int quantity = 1;
74   
75     
76     /**
77      * Get the ServiceItemId
78      *
79      * @return int
80      */

81     public int getServiceItemId()
82     {
83         return serviceItemId;
84     }
85
86                         
87     /**
88      * Set the value of ServiceItemId
89      *
90      * @param v new value
91      */

92     public void setServiceItemId(int v)
93     {
94     
95                   if (this.serviceItemId != v)
96               {
97             this.serviceItemId = v;
98             setModified(true);
99         }
100     
101           
102               }
103   
104     /**
105      * Get the SorderId
106      *
107      * @return int
108      */

109     public int getSorderId()
110     {
111         return sorderId;
112     }
113
114                               
115     /**
116      * Set the value of SorderId
117      *
118      * @param v new value
119      */

120     public void setSorderId(int v) throws TorqueException
121     {
122     
123                   if (this.sorderId != v)
124               {
125             this.sorderId = v;
126             setModified(true);
127         }
128     
129                           
130                 if (aSorder != null && !(aSorder.getSorderId() == v))
131                 {
132             aSorder = null;
133         }
134       
135               }
136   
137     /**
138      * Get the CustomerId
139      *
140      * @return int
141      */

142     public int getCustomerId()
143     {
144         return customerId;
145     }
146
147                               
148     /**
149      * Set the value of CustomerId
150      *
151      * @param v new value
152      */

153     public void setCustomerId(int v) throws TorqueException
154     {
155     
156                   if (this.customerId != v)
157               {
158             this.customerId = v;
159             setModified(true);
160         }
161     
162                                                                   
163                 if (aCustomerRelatedByCustomerId != null && !(aCustomerRelatedByCustomerId.getCustomerId() == v))
164                 {
165             aCustomerRelatedByCustomerId = null;
166         }
167       
168               }
169   
170     /**
171      * Get the RecipientId
172      *
173      * @return int
174      */

175     public int getRecipientId()
176     {
177         return recipientId;
178     }
179
180                               
181     /**
182      * Set the value of RecipientId
183      *
184      * @param v new value
185      */

186     public void setRecipientId(int v) throws TorqueException
187     {
188     
189                   if (this.recipientId != v)
190               {
191             this.recipientId = v;
192             setModified(true);
193         }
194     
195                                                                   
196                 if (aCustomerRelatedByRecipientId != null && !(aCustomerRelatedByRecipientId.getCustomerId() == v))
197                 {
198             aCustomerRelatedByRecipientId = null;
199         }
200       
201               }
202   
203     /**
204      * Get the ProjectId
205      *
206      * @return int
207      */

208     public int getProjectId()
209     {
210         return projectId;
211     }
212
213                               
214     /**
215      * Set the value of ProjectId
216      *
217      * @param v new value
218      */

219     public void setProjectId(int v) throws TorqueException
220     {
221     
222                   if (this.projectId != v)
223               {
224             this.projectId = v;
225             setModified(true);
226         }
227     
228                           
229                 if (aProject != null && !(aProject.getProjectId() == v))
230                 {
231             aProject = null;
232         }
233       
234               }
235   
236     /**
237      * Get the ServiceId
238      *
239      * @return int
240      */

241     public int getServiceId()
242     {
243         return serviceId;
244     }
245
246                               
247     /**
248      * Set the value of ServiceId
249      *
250      * @param v new value
251      */

252     public void setServiceId(int v) throws TorqueException
253     {
254     
255                   if (this.serviceId != v)
256               {
257             this.serviceId = v;
258             setModified(true);
259         }
260     
261                           
262                 if (aService != null && !(aService.getServiceId() == v))
263                 {
264             aService = null;
265         }
266       
267               }
268   
269     /**
270      * Get the ProductId
271      *
272      * @return int
273      */

274     public int getProductId()
275     {
276         return productId;
277     }
278
279                               
280     /**
281      * Set the value of ProductId
282      *
283      * @param v new value
284      */

285     public void setProductId(int v) throws TorqueException
286     {
287     
288                   if (this.productId != v)
289               {
290             this.productId = v;
291             setModified(true);
292         }
293     
294                           
295                 if (aProduct != null && !(aProduct.getProductId() == v))
296                 {
297             aProduct = null;
298         }
299       
300               }
301   
302     /**
303      * Get the Description
304      *
305      * @return String
306      */

307     public String JavaDoc getDescription()
308     {
309         return description;
310     }
311
312                         
313     /**
314      * Set the value of Description
315      *
316      * @param v new value
317      */

318     public void setDescription(String JavaDoc v)
319     {
320     
321                   if (!ObjectUtils.equals(this.description, v))
322               {
323             this.description = v;
324             setModified(true);
325         }
326     
327           
328               }
329   
330     /**
331      * Get the Quantity
332      *
333      * @return int
334      */

335     public int getQuantity()
336     {
337         return quantity;
338     }
339
340                         
341     /**
342      * Set the value of Quantity
343      *
344      * @param v new value
345      */

346     public void setQuantity(int v)
347     {
348     
349                   if (this.quantity != v)
350               {
351             this.quantity = v;
352             setModified(true);
353         }
354     
355           
356               }
357   
358       
359     
360                   
361     
362         private Service aService;
363
364     /**
365      * Declares an association between this object and a Service object
366      *
367      * @param v Service
368      * @throws TorqueException
369      */

370     public void setService(Service v) throws TorqueException
371     {
372             if (v == null)
373         {
374                           setServiceId( 1000);
375               }
376         else
377         {
378             setServiceId(v.getServiceId());
379         }
380             aService = v;
381     }
382
383                                             
384     /**
385      * Get the associated Service object
386      *
387      * @return the associated Service object
388      * @throws TorqueException
389      */

390     public Service getService() throws TorqueException
391     {
392         if (aService == null && (this.serviceId != 0))
393         {
394                           aService = ServicePeer.retrieveByPK(SimpleKey.keyFor(this.serviceId));
395               
396             /* The following can be used instead of the line above to
397                guarantee the related object contains a reference
398                to this object, but this level of coupling
399                may be undesirable in many circumstances.
400                As it can lead to a db query with many results that may
401                never be used.
402                Service obj = ServicePeer.retrieveByPK(this.serviceId);
403                obj.addServiceItems(this);
404             */

405         }
406         return aService;
407     }
408
409     /**
410      * Provides convenient way to set a relationship based on a
411      * ObjectKey, for example
412      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
413      *
414          */

415     public void setServiceKey(ObjectKey key) throws TorqueException
416     {
417       
418                         setServiceId(((NumberKey) key).intValue());
419                   }
420     
421     
422                   
423     
424         private Sorder aSorder;
425
426     /**
427      * Declares an association between this object and a Sorder object
428      *
429      * @param v Sorder
430      * @throws TorqueException
431      */

432     public void setSorder(Sorder v) throws TorqueException
433     {
434             if (v == null)
435         {
436                           setSorderId( 1000);
437               }
438         else
439         {
440             setSorderId(v.getSorderId());
441         }
442             aSorder = v;
443     }
444
445                                             
446     /**
447      * Get the associated Sorder object
448      *
449      * @return the associated Sorder object
450      * @throws TorqueException
451      */

452     public Sorder getSorder() throws TorqueException
453     {
454         if (aSorder == null && (this.sorderId != 0))
455         {
456                           aSorder = SorderPeer.retrieveByPK(SimpleKey.keyFor(this.sorderId));
457               
458             /* The following can be used instead of the line above to
459                guarantee the related object contains a reference
460                to this object, but this level of coupling
461                may be undesirable in many circumstances.
462                As it can lead to a db query with many results that may
463                never be used.
464                Sorder obj = SorderPeer.retrieveByPK(this.sorderId);
465                obj.addServiceItems(this);
466             */

467         }
468         return aSorder;
469     }
470
471     /**
472      * Provides convenient way to set a relationship based on a
473      * ObjectKey, for example
474      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
475      *
476          */

477     public void setSorderKey(ObjectKey key) throws TorqueException
478     {
479       
480                         setSorderId(((NumberKey) key).intValue());
481                   }
482     
483     
484                   
485     
486         private Product aProduct;
487
488     /**
489      * Declares an association between this object and a Product object
490      *
491      * @param v Product
492      * @throws TorqueException
493      */

494     public void setProduct(Product v) throws TorqueException
495     {
496             if (v == null)
497         {
498                           setProductId( 1000);
499               }
500         else
501         {
502             setProductId(v.getProductId());
503         }
504             aProduct = v;
505     }
506
507                                             
508     /**
509      * Get the associated Product object
510      *
511      * @return the associated Product object
512      * @throws TorqueException
513      */

514     public Product getProduct() throws TorqueException
515     {
516         if (aProduct == null && (this.productId != 0))
517         {
518                           aProduct = ProductPeer.retrieveByPK(SimpleKey.keyFor(this.productId));
519               
520             /* The following can be used instead of the line above to
521                guarantee the related object contains a reference
522                to this object, but this level of coupling
523                may be undesirable in many circumstances.
524                As it can lead to a db query with many results that may
525                never be used.
526                Product obj = ProductPeer.retrieveByPK(this.productId);
527                obj.addServiceItems(this);
528             */

529         }
530         return aProduct;
531     }
532
533     /**
534      * Provides convenient way to set a relationship based on a
535      * ObjectKey, for example
536      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
537      *
538          */

539     public void setProductKey(ObjectKey key) throws TorqueException
540     {
541       
542                         setProductId(((NumberKey) key).intValue());
543                   }
544     
545     
546                         
547         
548         private Customer aCustomerRelatedByCustomerId;
549
550     /**
551      * Declares an association between this object and a Customer object
552      *
553      * @param v Customer
554      * @throws TorqueException
555      */

556     public void setCustomerRelatedByCustomerId(Customer v) throws TorqueException
557     {
558             if (v == null)
559         {
560                           setCustomerId( 1000);
561               }
562         else
563         {
564             setCustomerId(v.getCustomerId());
565         }
566             aCustomerRelatedByCustomerId = v;
567     }
568
569                                             
570     /**
571      * Get the associated Customer object
572      *
573      * @return the associated Customer object
574      * @throws TorqueException
575      */

576     public Customer getCustomerRelatedByCustomerId() throws TorqueException
577     {
578         if (aCustomerRelatedByCustomerId == null && (this.customerId != 0))
579         {
580                           aCustomerRelatedByCustomerId = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.customerId));
581               
582             /* The following can be used instead of the line above to
583                guarantee the related object contains a reference
584                to this object, but this level of coupling
585                may be undesirable in many circumstances.
586                As it can lead to a db query with many results that may
587                never be used.
588                Customer obj = CustomerPeer.retrieveByPK(this.customerId);
589                obj.addServiceItemsRelatedByCustomerId(this);
590             */

591         }
592         return aCustomerRelatedByCustomerId;
593     }
594
595     /**
596      * Provides convenient way to set a relationship based on a
597      * ObjectKey, for example
598      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
599      *
600          */

601     public void setCustomerRelatedByCustomerIdKey(ObjectKey key) throws TorqueException
602     {
603       
604                         setCustomerId(((NumberKey) key).intValue());
605                   }
606     
607     
608                         
609         
610         private Customer aCustomerRelatedByRecipientId;
611
612     /**
613      * Declares an association between this object and a Customer object
614      *
615      * @param v Customer
616      * @throws TorqueException
617      */

618     public void setCustomerRelatedByRecipientId(Customer v) throws TorqueException
619     {
620             if (v == null)
621         {
622                           setRecipientId( 1000);
623               }
624         else
625         {
626             setRecipientId(v.getCustomerId());
627         }
628             aCustomerRelatedByRecipientId = v;
629     }
630
631                                             
632     /**
633      * Get the associated Customer object
634      *
635      * @return the associated Customer object
636      * @throws TorqueException
637      */

638     public Customer getCustomerRelatedByRecipientId() throws TorqueException
639     {
640         if (aCustomerRelatedByRecipientId == null && (this.recipientId != 0))
641         {
642                           aCustomerRelatedByRecipientId = CustomerPeer.retrieveByPK(SimpleKey.keyFor(this.recipientId));
643               
644             /* The following can be used instead of the line above to
645                guarantee the related object contains a reference
646                to this object, but this level of coupling
647                may be undesirable in many circumstances.
648                As it can lead to a db query with many results that may
649                never be used.
650                Customer obj = CustomerPeer.retrieveByPK(this.recipientId);
651                obj.addServiceItemsRelatedByRecipientId(this);
652             */

653         }
654         return aCustomerRelatedByRecipientId;
655     }
656
657     /**
658      * Provides convenient way to set a relationship based on a
659      * ObjectKey, for example
660      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
661      *
662          */

663     public void setCustomerRelatedByRecipientIdKey(ObjectKey key) throws TorqueException
664     {
665       
666                         setRecipientId(((NumberKey) key).intValue());
667                   }
668     
669     
670                   
671     
672         private Project aProject;
673
674     /**
675      * Declares an association between this object and a Project object
676      *
677      * @param v Project
678      * @throws TorqueException
679      */

680     public void setProject(Project v) throws TorqueException
681     {
682             if (v == null)
683         {
684                           setProjectId( 1000);
685               }
686         else
687         {
688             setProjectId(v.getProjectId());
689         }
690             aProject = v;
691     }
692
693                                             
694     /**
695      * Get the associated Project object
696      *
697      * @return the associated Project object
698      * @throws TorqueException
699      */

700     public Project getProject() throws TorqueException
701     {
702         if (aProject == null && (this.projectId != 0))
703         {
704                           aProject = ProjectPeer.retrieveByPK(SimpleKey.keyFor(this.projectId));
705               
706             /* The following can be used instead of the line above to
707                guarantee the related object contains a reference
708                to this object, but this level of coupling
709                may be undesirable in many circumstances.
710                As it can lead to a db query with many results that may
711                never be used.
712                Project obj = ProjectPeer.retrieveByPK(this.projectId);
713                obj.addServiceItems(this);
714             */

715         }
716         return aProject;
717     }
718
719     /**
720      * Provides convenient way to set a relationship based on a
721      * ObjectKey, for example
722      * <code>bar.setFooKey(foo.getPrimaryKey())</code>
723      *
724          */

725     public void setProjectKey(ObjectKey key) throws TorqueException
726     {
727       
728                         setProjectId(((NumberKey) key).intValue());
729                   }
730        
731                 
732     private static List JavaDoc fieldNames = null;
733
734     /**
735      * Generate a list of field names.
736      *
737      * @return a list of field names
738      */

739     public static synchronized List JavaDoc getFieldNames()
740     {
741         if (fieldNames == null)
742         {
743             fieldNames = new ArrayList JavaDoc();
744               fieldNames.add("ServiceItemId");
745               fieldNames.add("SorderId");
746               fieldNames.add("CustomerId");
747               fieldNames.add("RecipientId");
748               fieldNames.add("ProjectId");
749               fieldNames.add("ServiceId");
750               fieldNames.add("ProductId");
751               fieldNames.add("Description");
752               fieldNames.add("Quantity");
753               fieldNames = Collections.unmodifiableList(fieldNames);
754         }
755         return fieldNames;
756     }
757
758     /**
759      * Retrieves a field from the object by name passed in as a String.
760      *
761      * @param name field name
762      * @return value
763      */

764     public Object JavaDoc getByName(String JavaDoc name)
765     {
766           if (name.equals("ServiceItemId"))
767         {
768                 return new Integer JavaDoc(getServiceItemId());
769             }
770           if (name.equals("SorderId"))
771         {
772                 return new Integer JavaDoc(getSorderId());
773             }
774           if (name.equals("CustomerId"))
775         {
776                 return new Integer JavaDoc(getCustomerId());
777             }
778           if (name.equals("RecipientId"))
779         {
780                 return new Integer JavaDoc(getRecipientId());
781             }
782           if (name.equals("ProjectId"))
783         {
784                 return new Integer JavaDoc(getProjectId());
785             }
786           if (name.equals("ServiceId"))
787         {
788                 return new Integer JavaDoc(getServiceId());
789             }
790           if (name.equals("ProductId"))
791         {
792                 return new Integer JavaDoc(getProductId());
793             }
794           if (name.equals("Description"))
795         {
796                 return getDescription();
797             }
798           if (name.equals("Quantity"))
799         {
800                 return new Integer JavaDoc(getQuantity());
801             }
802           return null;
803     }
804     
805     /**
806      * Retrieves a field from the object by name passed in
807      * as a String. The String must be one of the static
808      * Strings defined in this Class' Peer.
809      *
810      * @param name peer name
811      * @return value
812      */

813     public Object JavaDoc getByPeerName(String JavaDoc name)
814     {
815           if (name.equals(ServiceItemPeer.SERVICE_ITEM_ID))
816         {
817                 return new Integer JavaDoc(getServiceItemId());
818             }
819           if (name.equals(ServiceItemPeer.SORDER_ID))
820         {
821                 return new Integer JavaDoc(getSorderId());
822             }
823           if (name.equals(ServiceItemPeer.CUSTOMER_ID))
824         {
825                 return new Integer JavaDoc(getCustomerId());
826             }
827           if (name.equals(ServiceItemPeer.RECIPIENT_ID))
828         {
829                 return new Integer JavaDoc(getRecipientId());
830             }
831           if (name.equals(ServiceItemPeer.PROJECT_ID))
832         {
833                 return new Integer JavaDoc(getProjectId());
834             }
835           if (name.equals(ServiceItemPeer.SERVICE_ID))
836         {
837                 return new Integer JavaDoc(getServiceId());
838             }
839           if (name.equals(ServiceItemPeer.PRODUCT_ID))
840         {
841                 return new Integer JavaDoc(getProductId());
842             }
843           if (name.equals(ServiceItemPeer.DESCRIPTION))
844         {
845                 return getDescription();
846             }
847           if (name.equals(ServiceItemPeer.QUANTITY))
848         {
849                 return new Integer JavaDoc(getQuantity());
850             }
851           return null;
852     }
853
854     /**
855      * Retrieves a field from the object by Position as specified
856      * in the xml schema. Zero-based.
857      *
858      * @param pos position in xml schema
859      * @return value
860      */

861     public Object JavaDoc getByPosition(int pos)
862     {
863             if (pos == 0)
864         {
865                 return new Integer JavaDoc(getServiceItemId());
866             }
867               if (pos == 1)
868         {
869                 return new Integer JavaDoc(getSorderId());
870             }
871               if (pos == 2)
872         {
873                 return new Integer JavaDoc(getCustomerId());
874             }
875               if (pos == 3)
876         {
877                 return new Integer JavaDoc(getRecipientId());
878             }
879               if (pos == 4)
880         {
881                 return new Integer JavaDoc(getProjectId());
882             }
883               if (pos == 5)
884         {
885                 return new Integer JavaDoc(getServiceId());
886             }
887               if (pos == 6)
888         {
889                 return new Integer JavaDoc(getProductId());
890             }
891               if (pos == 7)
892         {
893                 return getDescription();
894             }
895               if (pos == 8)
896         {
897                 return new Integer JavaDoc(getQuantity());
898             }
899               return null;
900     }
901      
902     /**
903      * Stores the object in the database. If the object is new,
904      * it inserts it; otherwise an update is performed.
905      *
906      * @throws Exception
907      */

908     public void save() throws Exception JavaDoc
909     {
910           save(ServiceItemPeer.getMapBuilder()
911                 .getDatabaseMap().getName());
912       }
913
914     /**
915      * Stores the object in the database. If the object is new,
916      * it inserts it; otherwise an update is performed.
917        * Note: this code is here because the method body is
918      * auto-generated conditionally and therefore needs to be
919      * in this file instead of in the super class, BaseObject.
920        *
921      * @param dbName
922      * @throws TorqueException
923      */

924     public void save(String JavaDoc dbName) throws TorqueException
925     {
926         Connection JavaDoc con = null;
927           try
928         {
929             con = Transaction.begin(dbName);
930             save(con);
931             Transaction.commit(con);
932         }
933         catch(TorqueException e)
934         {
935             Transaction.safeRollback(con);
936             throw e;
937         }
938       }
939
940       /** flag to prevent endless save loop, if this object is referenced
941         by another object which falls in this transaction. */

942     private boolean alreadyInSave = false;
943       /**
944      * Stores the object in the database. If the object is new,
945      * it inserts it; otherwise an update is performed. This method
946      * is meant to be used as part of a transaction, otherwise use
947      * the save() method and the connection details will be handled
948      * internally
949      *
950      * @param con
951      * @throws TorqueException
952      */

953     public void save(Connection JavaDoc con) throws TorqueException
954     {
955           if (!alreadyInSave)
956         {
957             alreadyInSave = true;
958
959
960   
961             // If this object has been modified, then save it to the database.
962
if (isModified())
963             {
964                 if (isNew())
965                 {
966                     ServiceItemPeer.doInsert((ServiceItem) this, con);
967                     setNew(false);
968                 }
969                 else
970                 {
971                     ServiceItemPeer.doUpdate((ServiceItem) this, con);
972                 }
973             }
974
975                       alreadyInSave = false;
976         }
977       }
978
979                   
980       /**
981      * Set the PrimaryKey using ObjectKey.
982      *
983      * @param key serviceItemId ObjectKey
984      */

985     public void setPrimaryKey(ObjectKey key)
986         
987     {
988             setServiceItemId(((NumberKey) key).intValue());
989         }
990
991     /**
992      * Set the PrimaryKey using a String.
993      *
994      * @param key
995      */

996     public void setPrimaryKey(String JavaDoc key)
997     {
998             setServiceItemId(Integer.parseInt(key));
999         }
1000
1001  
1002    /**
1003     * returns an id that differentiates this object from others
1004     * of its class.
1005     */

1006    public ObjectKey getPrimaryKey()
1007    {
1008          return SimpleKey.keyFor(getServiceItemId());
1009      }
1010 
1011    /**
1012     * get an id that differentiates this object from others
1013     * of its class.
1014     */

1015    public String JavaDoc getQueryKey()
1016    {
1017        if (getPrimaryKey() == null)
1018        {
1019            return "";
1020        }
1021        else
1022        {
1023            return getPrimaryKey().toString();
1024        }
1025    }
1026
1027    /**
1028     * set an id that differentiates this object from others
1029     * of its class.
1030     */

1031    public void setQueryKey(String JavaDoc key)
1032        throws TorqueException
1033    {
1034        setPrimaryKey(key);
1035    }
1036
1037    /**
1038     * Makes a copy of this object.
1039     * It creates a new object filling in the simple attributes.
1040       * It then fills all the association collections and sets the
1041     * related objects to isNew=true.
1042       */

1043      public ServiceItem copy() throws TorqueException
1044    {
1045        return copyInto(new ServiceItem());
1046    }
1047  
1048    protected ServiceItem copyInto(ServiceItem copyObj) throws TorqueException
1049    {
1050          copyObj.setServiceItemId(serviceItemId);
1051          copyObj.setSorderId(sorderId);
1052          copyObj.setCustomerId(customerId);
1053          copyObj.setRecipientId(recipientId);
1054          copyObj.setProjectId(projectId);
1055          copyObj.setServiceId(serviceId);
1056          copyObj.setProductId(productId);
1057          copyObj.setDescription(description);
1058          copyObj.setQuantity(quantity);
1059  
1060                            copyObj.setServiceItemId( 0);
1061                                                            
1062                return copyObj;
1063    }
1064
1065    /**
1066     * returns a peer instance associated with this om. Since Peer classes
1067     * are not to have any instance attributes, this method returns the
1068     * same instance for all member of this class. The method could therefore
1069     * be static, but this would prevent one from overriding the behavior.
1070     */

1071    public ServiceItemPeer getPeer()
1072    {
1073        return peer;
1074    }
1075
1076    public String JavaDoc toString()
1077    {
1078        StringBuffer JavaDoc str = new StringBuffer JavaDoc();
1079        str.append("ServiceItem:\n");
1080        str.append("ServiceItemId = ")
1081               .append(getServiceItemId())
1082             .append("\n");
1083        str.append("SorderId = ")
1084               .append(getSorderId())
1085             .append("\n");
1086        str.append("CustomerId = ")
1087               .append(getCustomerId())
1088             .append("\n");
1089        str.append("RecipientId = ")
1090               .append(getRecipientId())
1091             .append("\n");
1092        str.append("ProjectId = ")
1093               .append(getProjectId())
1094             .append("\n");
1095        str.append("ServiceId = ")
1096               .append(getServiceId())
1097             .append("\n");
1098        str.append("ProductId = ")
1099               .append(getProductId())
1100             .append("\n");
1101        str.append("Description = ")
1102               .append(getDescription())
1103             .append("\n");
1104        str.append("Quantity = ")
1105               .append(getQuantity())
1106             .append("\n");
1107        return(str.toString());
1108    }
1109}
1110
Popular Tags