KickJava   Java API By Example, From Geeks To Geeks.

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


1 package org.campware.cream.om;
2
3 import java.math.BigDecimal JavaDoc;
4 import java.sql.Connection JavaDoc;
5 import java.sql.SQLException JavaDoc;
6 import java.util.ArrayList JavaDoc;
7 import java.util.Date JavaDoc;
8 import java.util.Iterator JavaDoc;
9 import java.util.LinkedList JavaDoc;
10 import java.util.List JavaDoc;
11
12 import org.apache.torque.NoRowsException;
13 import org.apache.torque.TooManyRowsException;
14 import org.apache.torque.Torque;
15 import org.apache.torque.TorqueException;
16 import org.apache.torque.map.MapBuilder;
17 import org.apache.torque.map.TableMap;
18 import org.apache.torque.om.DateKey;
19 import org.apache.torque.om.NumberKey;
20 import org.apache.torque.om.StringKey;
21 import org.apache.torque.om.ObjectKey;
22 import org.apache.torque.om.SimpleKey;
23 import org.apache.torque.util.BasePeer;
24 import org.apache.torque.util.Criteria;
25
26 import com.workingdogs.village.DataSetException;
27 import com.workingdogs.village.QueryDataSet;
28 import com.workingdogs.village.Record;
29
30 // Local classes
31
import org.campware.cream.om.map.*;
32
33
34   
35   
36   
37   
38   
39   
40 /**
41  * This class was autogenerated by Torque on:
42  *
43  * [Wed May 04 09:10:56 CEST 2005]
44  *
45  */

46 public abstract class BaseServiceItemPeer
47     extends BasePeer
48 {
49
50     /** the default database name for this class */
51     public static final String JavaDoc DATABASE_NAME = "cream";
52
53      /** the table name for this class */
54     public static final String JavaDoc TABLE_NAME = "SERVICE_ITEM";
55
56     /**
57      * @return the map builder for this peer
58      * @throws TorqueException Any exceptions caught during processing will be
59      * rethrown wrapped into a TorqueException.
60      */

61     public static MapBuilder getMapBuilder()
62         throws TorqueException
63     {
64         return getMapBuilder(ServiceItemMapBuilder.CLASS_NAME);
65     }
66
67       /** the column name for the SERVICE_ITEM_ID field */
68     public static final String JavaDoc SERVICE_ITEM_ID;
69       /** the column name for the SORDER_ID field */
70     public static final String JavaDoc SORDER_ID;
71       /** the column name for the CUSTOMER_ID field */
72     public static final String JavaDoc CUSTOMER_ID;
73       /** the column name for the RECIPIENT_ID field */
74     public static final String JavaDoc RECIPIENT_ID;
75       /** the column name for the PROJECT_ID field */
76     public static final String JavaDoc PROJECT_ID;
77       /** the column name for the SERVICE_ID field */
78     public static final String JavaDoc SERVICE_ID;
79       /** the column name for the PRODUCT_ID field */
80     public static final String JavaDoc PRODUCT_ID;
81       /** the column name for the DESCRIPTION field */
82     public static final String JavaDoc DESCRIPTION;
83       /** the column name for the QUANTITY field */
84     public static final String JavaDoc QUANTITY;
85   
86     static
87     {
88           SERVICE_ITEM_ID = "SERVICE_ITEM.SERVICE_ITEM_ID";
89           SORDER_ID = "SERVICE_ITEM.SORDER_ID";
90           CUSTOMER_ID = "SERVICE_ITEM.CUSTOMER_ID";
91           RECIPIENT_ID = "SERVICE_ITEM.RECIPIENT_ID";
92           PROJECT_ID = "SERVICE_ITEM.PROJECT_ID";
93           SERVICE_ID = "SERVICE_ITEM.SERVICE_ID";
94           PRODUCT_ID = "SERVICE_ITEM.PRODUCT_ID";
95           DESCRIPTION = "SERVICE_ITEM.DESCRIPTION";
96           QUANTITY = "SERVICE_ITEM.QUANTITY";
97           if (Torque.isInit())
98         {
99             try
100             {
101                 getMapBuilder(ServiceItemMapBuilder.CLASS_NAME);
102             }
103             catch (Exception JavaDoc e)
104             {
105                 log.error("Could not initialize Peer", e);
106             }
107         }
108         else
109         {
110             Torque.registerMapBuilder(ServiceItemMapBuilder.CLASS_NAME);
111         }
112     }
113  
114     /** number of columns for this peer */
115     public static final int numColumns = 9;
116
117     /** A class that can be returned by this peer. */
118     protected static final String JavaDoc CLASSNAME_DEFAULT =
119         "org.campware.cream.om.ServiceItem";
120
121     /** A class that can be returned by this peer. */
122     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
123
124     /**
125      * Class object initialization method.
126      *
127      * @param className name of the class to initialize
128      * @return the initialized class
129      */

130     private static Class JavaDoc initClass(String JavaDoc className)
131     {
132         Class JavaDoc c = null;
133         try
134         {
135             c = Class.forName(className);
136         }
137         catch (Throwable JavaDoc t)
138         {
139             log.error("A FATAL ERROR has occurred which should not "
140                 + "have happened under any circumstance. Please notify "
141                 + "the Torque developers <torque-dev@db.apache.org> "
142                 + "and give as many details as possible (including the error "
143                 + "stack trace).", t);
144
145             // Error objects should always be propogated.
146
if (t instanceof Error JavaDoc)
147             {
148                 throw (Error JavaDoc) t.fillInStackTrace();
149             }
150         }
151         return c;
152     }
153
154     /**
155      * Get the list of objects for a ResultSet. Please not that your
156      * resultset MUST return columns in the right order. You can use
157      * getFieldNames() in BaseObject to get the correct sequence.
158      *
159      * @param results the ResultSet
160      * @return the list of objects
161      * @throws TorqueException Any exceptions caught during processing will be
162      * rethrown wrapped into a TorqueException.
163      */

164     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
165             throws TorqueException
166     {
167         try
168         {
169             QueryDataSet qds = null;
170             List JavaDoc rows = null;
171             try
172             {
173                 qds = new QueryDataSet(results);
174                 rows = getSelectResults(qds);
175             }
176             finally
177             {
178                 if (qds != null)
179                 {
180                     qds.close();
181                 }
182             }
183
184             return populateObjects(rows);
185         }
186         catch (SQLException JavaDoc e)
187         {
188             throw new TorqueException(e);
189         }
190         catch (DataSetException e)
191         {
192             throw new TorqueException(e);
193         }
194     }
195
196
197   
198     /**
199      * Method to do inserts.
200      *
201      * @param criteria object used to create the INSERT statement.
202      * @throws TorqueException Any exceptions caught during processing will be
203      * rethrown wrapped into a TorqueException.
204      */

205     public static ObjectKey doInsert(Criteria criteria)
206         throws TorqueException
207     {
208         return BaseServiceItemPeer
209             .doInsert(criteria, (Connection JavaDoc) null);
210     }
211
212     /**
213      * Method to do inserts. This method is to be used during a transaction,
214      * otherwise use the doInsert(Criteria) method. It will take care of
215      * the connection details internally.
216      *
217      * @param criteria object used to create the INSERT statement.
218      * @param con the connection to use
219      * @throws TorqueException Any exceptions caught during processing will be
220      * rethrown wrapped into a TorqueException.
221      */

222     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
223         throws TorqueException
224     {
225                                                         
226         setDbName(criteria);
227
228         if (con == null)
229         {
230             return BasePeer.doInsert(criteria);
231         }
232         else
233         {
234             return BasePeer.doInsert(criteria, con);
235         }
236     }
237
238     /**
239      * Add all the columns needed to create a new object.
240      *
241      * @param criteria object containing the columns to add.
242      * @throws TorqueException Any exceptions caught during processing will be
243      * rethrown wrapped into a TorqueException.
244      */

245     public static void addSelectColumns(Criteria criteria)
246             throws TorqueException
247     {
248           criteria.addSelectColumn(SERVICE_ITEM_ID);
249           criteria.addSelectColumn(SORDER_ID);
250           criteria.addSelectColumn(CUSTOMER_ID);
251           criteria.addSelectColumn(RECIPIENT_ID);
252           criteria.addSelectColumn(PROJECT_ID);
253           criteria.addSelectColumn(SERVICE_ID);
254           criteria.addSelectColumn(PRODUCT_ID);
255           criteria.addSelectColumn(DESCRIPTION);
256           criteria.addSelectColumn(QUANTITY);
257       }
258
259     /**
260      * Create a new object of type cls from a resultset row starting
261      * from a specified offset. This is done so that you can select
262      * other rows than just those needed for this object. You may
263      * for example want to create two objects from the same row.
264      *
265      * @throws TorqueException Any exceptions caught during processing will be
266      * rethrown wrapped into a TorqueException.
267      */

268     public static ServiceItem row2Object(Record row,
269                                              int offset,
270                                              Class JavaDoc cls)
271         throws TorqueException
272     {
273         try
274         {
275             ServiceItem obj = (ServiceItem) cls.newInstance();
276             ServiceItemPeer.populateObject(row, offset, obj);
277                   obj.setModified(false);
278               obj.setNew(false);
279
280             return obj;
281         }
282         catch (InstantiationException JavaDoc e)
283         {
284             throw new TorqueException(e);
285         }
286         catch (IllegalAccessException JavaDoc e)
287         {
288             throw new TorqueException(e);
289         }
290     }
291
292     /**
293      * Populates an object from a resultset row starting
294      * from a specified offset. This is done so that you can select
295      * other rows than just those needed for this object. You may
296      * for example want to create two objects from the same row.
297      *
298      * @throws TorqueException Any exceptions caught during processing will be
299      * rethrown wrapped into a TorqueException.
300      */

301     public static void populateObject(Record row,
302                                       int offset,
303                                       ServiceItem obj)
304         throws TorqueException
305     {
306         try
307         {
308                 obj.setServiceItemId(row.getValue(offset + 0).asInt());
309                   obj.setSorderId(row.getValue(offset + 1).asInt());
310                   obj.setCustomerId(row.getValue(offset + 2).asInt());
311                   obj.setRecipientId(row.getValue(offset + 3).asInt());
312                   obj.setProjectId(row.getValue(offset + 4).asInt());
313                   obj.setServiceId(row.getValue(offset + 5).asInt());
314                   obj.setProductId(row.getValue(offset + 6).asInt());
315                   obj.setDescription(row.getValue(offset + 7).asString());
316                   obj.setQuantity(row.getValue(offset + 8).asInt());
317               }
318         catch (DataSetException e)
319         {
320             throw new TorqueException(e);
321         }
322     }
323
324     /**
325      * Method to do selects.
326      *
327      * @param criteria object used to create the SELECT statement.
328      * @return List of selected Objects
329      * @throws TorqueException Any exceptions caught during processing will be
330      * rethrown wrapped into a TorqueException.
331      */

332     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
333     {
334         return populateObjects(doSelectVillageRecords(criteria));
335     }
336
337     /**
338      * Method to do selects within a transaction.
339      *
340      * @param criteria object used to create the SELECT statement.
341      * @param con the connection to use
342      * @return List of selected Objects
343      * @throws TorqueException Any exceptions caught during processing will be
344      * rethrown wrapped into a TorqueException.
345      */

346     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
347         throws TorqueException
348     {
349         return populateObjects(doSelectVillageRecords(criteria, con));
350     }
351
352     /**
353      * Grabs the raw Village records to be formed into objects.
354      * This method handles connections internally. The Record objects
355      * returned by this method should be considered readonly. Do not
356      * alter the data and call save(), your results may vary, but are
357      * certainly likely to result in hard to track MT bugs.
358      *
359      * @throws TorqueException Any exceptions caught during processing will be
360      * rethrown wrapped into a TorqueException.
361      */

362     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
363         throws TorqueException
364     {
365         return BaseServiceItemPeer
366             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
367     }
368
369     /**
370      * Grabs the raw Village records to be formed into objects.
371      * This method should be used for transactions
372      *
373      * @param criteria object used to create the SELECT statement.
374      * @param con the connection to use
375      * @throws TorqueException Any exceptions caught during processing will be
376      * rethrown wrapped into a TorqueException.
377      */

378     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
379         throws TorqueException
380     {
381         if (criteria.getSelectColumns().size() == 0)
382         {
383             addSelectColumns(criteria);
384         }
385
386                                                         
387         setDbName(criteria);
388
389         // BasePeer returns a List of Value (Village) arrays. The array
390
// order follows the order columns were placed in the Select clause.
391
if (con == null)
392         {
393             return BasePeer.doSelect(criteria);
394         }
395         else
396         {
397             return BasePeer.doSelect(criteria, con);
398         }
399     }
400
401     /**
402      * The returned List will contain objects of the default type or
403      * objects that inherit from the default.
404      *
405      * @throws TorqueException Any exceptions caught during processing will be
406      * rethrown wrapped into a TorqueException.
407      */

408     public static List JavaDoc populateObjects(List JavaDoc records)
409         throws TorqueException
410     {
411         List JavaDoc results = new ArrayList JavaDoc(records.size());
412
413         // populate the object(s)
414
for (int i = 0; i < records.size(); i++)
415         {
416             Record row = (Record) records.get(i);
417               results.add(ServiceItemPeer.row2Object(row, 1,
418                 ServiceItemPeer.getOMClass()));
419           }
420         return results;
421     }
422  
423
424     /**
425      * The class that the Peer will make instances of.
426      * If the BO is abstract then you must implement this method
427      * in the BO.
428      *
429      * @throws TorqueException Any exceptions caught during processing will be
430      * rethrown wrapped into a TorqueException.
431      */

432     public static Class JavaDoc getOMClass()
433         throws TorqueException
434     {
435         return CLASS_DEFAULT;
436     }
437
438     /**
439      * Method to do updates.
440      *
441      * @param criteria object containing data that is used to create the UPDATE
442      * statement.
443      * @throws TorqueException Any exceptions caught during processing will be
444      * rethrown wrapped into a TorqueException.
445      */

446     public static void doUpdate(Criteria criteria) throws TorqueException
447     {
448          BaseServiceItemPeer
449             .doUpdate(criteria, (Connection JavaDoc) null);
450     }
451
452     /**
453      * Method to do updates. This method is to be used during a transaction,
454      * otherwise use the doUpdate(Criteria) method. It will take care of
455      * the connection details internally.
456      *
457      * @param criteria object containing data that is used to create the UPDATE
458      * statement.
459      * @param con the connection to use
460      * @throws TorqueException Any exceptions caught during processing will be
461      * rethrown wrapped into a TorqueException.
462      */

463     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
464         throws TorqueException
465     {
466         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
467                    selectCriteria.put(SERVICE_ITEM_ID, criteria.remove(SERVICE_ITEM_ID));
468                                                                                       
469         setDbName(criteria);
470
471         if (con == null)
472         {
473             BasePeer.doUpdate(selectCriteria, criteria);
474         }
475         else
476         {
477             BasePeer.doUpdate(selectCriteria, criteria, con);
478         }
479     }
480
481     /**
482      * Method to do deletes.
483      *
484      * @param criteria object containing data that is used DELETE from database.
485      * @throws TorqueException Any exceptions caught during processing will be
486      * rethrown wrapped into a TorqueException.
487      */

488      public static void doDelete(Criteria criteria) throws TorqueException
489      {
490          ServiceItemPeer
491             .doDelete(criteria, (Connection JavaDoc) null);
492      }
493
494     /**
495      * Method to do deletes. This method is to be used during a transaction,
496      * otherwise use the doDelete(Criteria) method. It will take care of
497      * the connection details internally.
498      *
499      * @param criteria object containing data that is used DELETE from database.
500      * @param con the connection to use
501      * @throws TorqueException Any exceptions caught during processing will be
502      * rethrown wrapped into a TorqueException.
503      */

504      public static void doDelete(Criteria criteria, Connection JavaDoc con)
505         throws TorqueException
506      {
507                                                         
508         setDbName(criteria);
509
510         if (con == null)
511         {
512             BasePeer.doDelete(criteria);
513         }
514         else
515         {
516             BasePeer.doDelete(criteria, con);
517         }
518      }
519
520     /**
521      * Method to do selects
522      *
523      * @throws TorqueException Any exceptions caught during processing will be
524      * rethrown wrapped into a TorqueException.
525      */

526     public static List JavaDoc doSelect(ServiceItem obj) throws TorqueException
527     {
528         return doSelect(buildSelectCriteria(obj));
529     }
530
531     /**
532      * Method to do inserts
533      *
534      * @throws TorqueException Any exceptions caught during processing will be
535      * rethrown wrapped into a TorqueException.
536      */

537     public static void doInsert(ServiceItem obj) throws TorqueException
538     {
539           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
540           obj.setNew(false);
541         obj.setModified(false);
542     }
543
544     /**
545      * @param obj the data object to update in the database.
546      * @throws TorqueException Any exceptions caught during processing will be
547      * rethrown wrapped into a TorqueException.
548      */

549     public static void doUpdate(ServiceItem obj) throws TorqueException
550     {
551         doUpdate(buildCriteria(obj));
552         obj.setModified(false);
553     }
554
555     /**
556      * @param obj the data object to delete in the database.
557      * @throws TorqueException Any exceptions caught during processing will be
558      * rethrown wrapped into a TorqueException.
559      */

560     public static void doDelete(ServiceItem obj) throws TorqueException
561     {
562         doDelete(buildSelectCriteria(obj));
563     }
564
565     /**
566      * Method to do inserts. This method is to be used during a transaction,
567      * otherwise use the doInsert(ServiceItem) method. It will take
568      * care of the connection details internally.
569      *
570      * @param obj the data object to insert into the database.
571      * @param con the connection to use
572      * @throws TorqueException Any exceptions caught during processing will be
573      * rethrown wrapped into a TorqueException.
574      */

575     public static void doInsert(ServiceItem obj, Connection JavaDoc con)
576         throws TorqueException
577     {
578           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
579           obj.setNew(false);
580         obj.setModified(false);
581     }
582
583     /**
584      * Method to do update. This method is to be used during a transaction,
585      * otherwise use the doUpdate(ServiceItem) method. It will take
586      * care of the connection details internally.
587      *
588      * @param obj the data object to update in the database.
589      * @param con the connection to use
590      * @throws TorqueException Any exceptions caught during processing will be
591      * rethrown wrapped into a TorqueException.
592      */

593     public static void doUpdate(ServiceItem obj, Connection JavaDoc con)
594         throws TorqueException
595     {
596         doUpdate(buildCriteria(obj), con);
597         obj.setModified(false);
598     }
599
600     /**
601      * Method to delete. This method is to be used during a transaction,
602      * otherwise use the doDelete(ServiceItem) method. It will take
603      * care of the connection details internally.
604      *
605      * @param obj the data object to delete in the database.
606      * @param con the connection to use
607      * @throws TorqueException Any exceptions caught during processing will be
608      * rethrown wrapped into a TorqueException.
609      */

610     public static void doDelete(ServiceItem obj, Connection JavaDoc con)
611         throws TorqueException
612     {
613         doDelete(buildSelectCriteria(obj), con);
614     }
615
616     /**
617      * Method to do deletes.
618      *
619      * @param pk ObjectKey that is used DELETE from database.
620      * @throws TorqueException Any exceptions caught during processing will be
621      * rethrown wrapped into a TorqueException.
622      */

623     public static void doDelete(ObjectKey pk) throws TorqueException
624     {
625         BaseServiceItemPeer
626            .doDelete(pk, (Connection JavaDoc) null);
627     }
628
629     /**
630      * Method to delete. This method is to be used during a transaction,
631      * otherwise use the doDelete(ObjectKey) method. It will take
632      * care of the connection details internally.
633      *
634      * @param pk the primary key for the object to delete in the database.
635      * @param con the connection to use
636      * @throws TorqueException Any exceptions caught during processing will be
637      * rethrown wrapped into a TorqueException.
638      */

639     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
640         throws TorqueException
641     {
642         doDelete(buildCriteria(pk), con);
643     }
644
645     /** Build a Criteria object from an ObjectKey */
646     public static Criteria buildCriteria( ObjectKey pk )
647     {
648         Criteria criteria = new Criteria();
649               criteria.add(SERVICE_ITEM_ID, pk);
650           return criteria;
651      }
652
653     /** Build a Criteria object from the data object for this peer */
654     public static Criteria buildCriteria( ServiceItem obj )
655     {
656         Criteria criteria = new Criteria(DATABASE_NAME);
657               if (!obj.isNew())
658             criteria.add(SERVICE_ITEM_ID, obj.getServiceItemId());
659               criteria.add(SORDER_ID, obj.getSorderId());
660               criteria.add(CUSTOMER_ID, obj.getCustomerId());
661               criteria.add(RECIPIENT_ID, obj.getRecipientId());
662               criteria.add(PROJECT_ID, obj.getProjectId());
663               criteria.add(SERVICE_ID, obj.getServiceId());
664               criteria.add(PRODUCT_ID, obj.getProductId());
665               criteria.add(DESCRIPTION, obj.getDescription());
666               criteria.add(QUANTITY, obj.getQuantity());
667           return criteria;
668     }
669
670     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
671     public static Criteria buildSelectCriteria( ServiceItem obj )
672     {
673         Criteria criteria = new Criteria(DATABASE_NAME);
674               if (!obj.isNew())
675                     criteria.add(SERVICE_ITEM_ID, obj.getServiceItemId());
676                           criteria.add(SORDER_ID, obj.getSorderId());
677                           criteria.add(CUSTOMER_ID, obj.getCustomerId());
678                           criteria.add(RECIPIENT_ID, obj.getRecipientId());
679                           criteria.add(PROJECT_ID, obj.getProjectId());
680                           criteria.add(SERVICE_ID, obj.getServiceId());
681                           criteria.add(PRODUCT_ID, obj.getProductId());
682                           criteria.add(DESCRIPTION, obj.getDescription());
683                           criteria.add(QUANTITY, obj.getQuantity());
684               return criteria;
685     }
686  
687     
688         /**
689      * Retrieve a single object by pk
690      *
691      * @param pk the primary key
692      * @throws TorqueException Any exceptions caught during processing will be
693      * rethrown wrapped into a TorqueException.
694      * @throws NoRowsException Primary key was not found in database.
695      * @throws TooManyRowsException Primary key was not found in database.
696      */

697     public static ServiceItem retrieveByPK(int pk)
698         throws TorqueException, NoRowsException, TooManyRowsException
699     {
700         return retrieveByPK(SimpleKey.keyFor(pk));
701     }
702
703     /**
704      * Retrieve a single object by pk
705      *
706      * @param pk the primary key
707      * @param con the connection to use
708      * @throws TorqueException Any exceptions caught during processing will be
709      * rethrown wrapped into a TorqueException.
710      * @throws NoRowsException Primary key was not found in database.
711      * @throws TooManyRowsException Primary key was not found in database.
712      */

713     public static ServiceItem retrieveByPK(int pk, Connection JavaDoc con)
714         throws TorqueException, NoRowsException, TooManyRowsException
715     {
716         return retrieveByPK(SimpleKey.keyFor(pk), con);
717     }
718   
719     /**
720      * Retrieve a single object by pk
721      *
722      * @param pk the primary key
723      * @throws TorqueException Any exceptions caught during processing will be
724      * rethrown wrapped into a TorqueException.
725      * @throws NoRowsException Primary key was not found in database.
726      * @throws TooManyRowsException Primary key was not found in database.
727      */

728     public static ServiceItem retrieveByPK(ObjectKey pk)
729         throws TorqueException, NoRowsException, TooManyRowsException
730     {
731         Connection JavaDoc db = null;
732         ServiceItem retVal = null;
733         try
734         {
735             db = Torque.getConnection(DATABASE_NAME);
736             retVal = retrieveByPK(pk, db);
737         }
738         finally
739         {
740             Torque.closeConnection(db);
741         }
742         return(retVal);
743     }
744
745     /**
746      * Retrieve a single object by pk
747      *
748      * @param pk the primary key
749      * @param con the connection to use
750      * @throws TorqueException Any exceptions caught during processing will be
751      * rethrown wrapped into a TorqueException.
752      * @throws NoRowsException Primary key was not found in database.
753      * @throws TooManyRowsException Primary key was not found in database.
754      */

755     public static ServiceItem retrieveByPK(ObjectKey pk, Connection JavaDoc con)
756         throws TorqueException, NoRowsException, TooManyRowsException
757     {
758         Criteria criteria = buildCriteria(pk);
759         List JavaDoc v = doSelect(criteria, con);
760         if (v.size() == 0)
761         {
762             throw new NoRowsException("Failed to select a row.");
763         }
764         else if (v.size() > 1)
765         {
766             throw new TooManyRowsException("Failed to select only one row.");
767         }
768         else
769         {
770             return (ServiceItem)v.get(0);
771         }
772     }
773
774     /**
775      * Retrieve a multiple objects by pk
776      *
777      * @param pks List of primary keys
778      * @throws TorqueException Any exceptions caught during processing will be
779      * rethrown wrapped into a TorqueException.
780      */

781     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
782         throws TorqueException
783     {
784         Connection JavaDoc db = null;
785         List JavaDoc retVal = null;
786         try
787         {
788            db = Torque.getConnection(DATABASE_NAME);
789            retVal = retrieveByPKs(pks, db);
790         }
791         finally
792         {
793             Torque.closeConnection(db);
794         }
795         return(retVal);
796     }
797
798     /**
799      * Retrieve a multiple objects by pk
800      *
801      * @param pks List of primary keys
802      * @param dbcon the connection to use
803      * @throws TorqueException Any exceptions caught during processing will be
804      * rethrown wrapped into a TorqueException.
805      */

806     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
807         throws TorqueException
808     {
809         List JavaDoc objs = null;
810         if (pks == null || pks.size() == 0)
811         {
812             objs = new LinkedList JavaDoc();
813         }
814         else
815         {
816             Criteria criteria = new Criteria();
817               criteria.addIn( SERVICE_ITEM_ID, pks );
818           objs = doSelect(criteria, dbcon);
819         }
820         return objs;
821     }
822
823  
824
825
826
827                     
828                                               
829                 
830                 
831
832     /**
833      * selects a collection of ServiceItem objects pre-filled with their
834      * Service objects.
835      *
836      * This method is protected by default in order to keep the public
837      * api reasonable. You can provide public methods for those you
838      * actually need in ServiceItemPeer.
839      *
840      * @throws TorqueException Any exceptions caught during processing will be
841      * rethrown wrapped into a TorqueException.
842      */

843     protected static List JavaDoc doSelectJoinService(Criteria criteria)
844         throws TorqueException
845     {
846         setDbName(criteria);
847
848         ServiceItemPeer.addSelectColumns(criteria);
849         int offset = numColumns + 1;
850         ServicePeer.addSelectColumns(criteria);
851
852
853                         criteria.addJoin(ServiceItemPeer.SERVICE_ID,
854             ServicePeer.SERVICE_ID);
855         
856
857                                                                                                                                                                           
858         List JavaDoc rows = BasePeer.doSelect(criteria);
859         List JavaDoc results = new ArrayList JavaDoc();
860
861         for (int i = 0; i < rows.size(); i++)
862         {
863             Record row = (Record) rows.get(i);
864
865                             Class JavaDoc omClass = ServiceItemPeer.getOMClass();
866                     ServiceItem obj1 = (ServiceItem) ServiceItemPeer
867                 .row2Object(row, 1, omClass);
868                      omClass = ServicePeer.getOMClass();
869                     Service obj2 = (Service)ServicePeer
870                 .row2Object(row, offset, omClass);
871
872             boolean newObject = true;
873             for (int j = 0; j < results.size(); j++)
874             {
875                 ServiceItem temp_obj1 = (ServiceItem)results.get(j);
876                 Service temp_obj2 = (Service)temp_obj1.getService();
877                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
878                 {
879                     newObject = false;
880                               temp_obj2.addServiceItem(obj1);
881                               break;
882                 }
883             }
884                       if (newObject)
885             {
886                 obj2.initServiceItems();
887                 obj2.addServiceItem(obj1);
888             }
889                       results.add(obj1);
890         }
891         return results;
892     }
893                                                             
894                 
895                 
896
897     /**
898      * selects a collection of ServiceItem objects pre-filled with their
899      * Sorder objects.
900      *
901      * This method is protected by default in order to keep the public
902      * api reasonable. You can provide public methods for those you
903      * actually need in ServiceItemPeer.
904      *
905      * @throws TorqueException Any exceptions caught during processing will be
906      * rethrown wrapped into a TorqueException.
907      */

908     protected static List JavaDoc doSelectJoinSorder(Criteria criteria)
909         throws TorqueException
910     {
911         setDbName(criteria);
912
913         ServiceItemPeer.addSelectColumns(criteria);
914         int offset = numColumns + 1;
915         SorderPeer.addSelectColumns(criteria);
916
917
918                         criteria.addJoin(ServiceItemPeer.SORDER_ID,
919             SorderPeer.SORDER_ID);
920         
921
922                                                                                                                                                                           
923         List JavaDoc rows = BasePeer.doSelect(criteria);
924         List JavaDoc results = new ArrayList JavaDoc();
925
926         for (int i = 0; i < rows.size(); i++)
927         {
928             Record row = (Record) rows.get(i);
929
930                             Class JavaDoc omClass = ServiceItemPeer.getOMClass();
931                     ServiceItem obj1 = (ServiceItem) ServiceItemPeer
932                 .row2Object(row, 1, omClass);
933                      omClass = SorderPeer.getOMClass();
934                     Sorder obj2 = (Sorder)SorderPeer
935                 .row2Object(row, offset, omClass);
936
937             boolean newObject = true;
938             for (int j = 0; j < results.size(); j++)
939             {
940                 ServiceItem temp_obj1 = (ServiceItem)results.get(j);
941                 Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
942                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
943                 {
944                     newObject = false;
945                               temp_obj2.addServiceItem(obj1);
946                               break;
947                 }
948             }
949                       if (newObject)
950             {
951                 obj2.initServiceItems();
952                 obj2.addServiceItem(obj1);
953             }
954                       results.add(obj1);
955         }
956         return results;
957     }
958                                                             
959                 
960                 
961
962     /**
963      * selects a collection of ServiceItem objects pre-filled with their
964      * Product objects.
965      *
966      * This method is protected by default in order to keep the public
967      * api reasonable. You can provide public methods for those you
968      * actually need in ServiceItemPeer.
969      *
970      * @throws TorqueException Any exceptions caught during processing will be
971      * rethrown wrapped into a TorqueException.
972      */

973     protected static List JavaDoc doSelectJoinProduct(Criteria criteria)
974         throws TorqueException
975     {
976         setDbName(criteria);
977
978         ServiceItemPeer.addSelectColumns(criteria);
979         int offset = numColumns + 1;
980         ProductPeer.addSelectColumns(criteria);
981
982
983                         criteria.addJoin(ServiceItemPeer.PRODUCT_ID,
984             ProductPeer.PRODUCT_ID);
985         
986
987                                                                                                                                                                           
988         List JavaDoc rows = BasePeer.doSelect(criteria);
989         List JavaDoc results = new ArrayList JavaDoc();
990
991         for (int i = 0; i < rows.size(); i++)
992         {
993             Record row = (Record) rows.get(i);
994
995                             Class JavaDoc omClass = ServiceItemPeer.getOMClass();
996                     ServiceItem obj1 = (ServiceItem) ServiceItemPeer
997                 .row2Object(row, 1, omClass);
998                      omClass = ProductPeer.getOMClass();
999                     Product obj2 = (Product)ProductPeer
1000                .row2Object(row, offset, omClass);
1001
1002            boolean newObject = true;
1003            for (int j = 0; j < results.size(); j++)
1004            {
1005                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1006                Product temp_obj2 = (Product)temp_obj1.getProduct();
1007                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1008                {
1009                    newObject = false;
1010                              temp_obj2.addServiceItem(obj1);
1011                              break;
1012                }
1013            }
1014                      if (newObject)
1015            {
1016                obj2.initServiceItems();
1017                obj2.addServiceItem(obj1);
1018            }
1019                      results.add(obj1);
1020        }
1021        return results;
1022    }
1023                                                                      
1024                
1025                
1026
1027    /**
1028     * selects a collection of ServiceItem objects pre-filled with their
1029     * Customer objects.
1030     *
1031     * This method is protected by default in order to keep the public
1032     * api reasonable. You can provide public methods for those you
1033     * actually need in ServiceItemPeer.
1034     *
1035     * @throws TorqueException Any exceptions caught during processing will be
1036     * rethrown wrapped into a TorqueException.
1037     */

1038    protected static List JavaDoc doSelectJoinCustomerRelatedByCustomerId(Criteria criteria)
1039        throws TorqueException
1040    {
1041        setDbName(criteria);
1042
1043        ServiceItemPeer.addSelectColumns(criteria);
1044        int offset = numColumns + 1;
1045        CustomerPeer.addSelectColumns(criteria);
1046
1047
1048                        criteria.addJoin(ServiceItemPeer.CUSTOMER_ID,
1049            CustomerPeer.CUSTOMER_ID);
1050        
1051
1052                                                                                                                                                                          
1053        List JavaDoc rows = BasePeer.doSelect(criteria);
1054        List JavaDoc results = new ArrayList JavaDoc();
1055
1056        for (int i = 0; i < rows.size(); i++)
1057        {
1058            Record row = (Record) rows.get(i);
1059
1060                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1061                    ServiceItem obj1 = (ServiceItem) ServiceItemPeer
1062                .row2Object(row, 1, omClass);
1063                     omClass = CustomerPeer.getOMClass();
1064                    Customer obj2 = (Customer)CustomerPeer
1065                .row2Object(row, offset, omClass);
1066
1067            boolean newObject = true;
1068            for (int j = 0; j < results.size(); j++)
1069            {
1070                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1071                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1072                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1073                {
1074                    newObject = false;
1075                              temp_obj2.addServiceItemRelatedByCustomerId(obj1);
1076                              break;
1077                }
1078            }
1079                      if (newObject)
1080            {
1081                obj2.initServiceItemsRelatedByCustomerId();
1082                obj2.addServiceItemRelatedByCustomerId(obj1);
1083            }
1084                      results.add(obj1);
1085        }
1086        return results;
1087    }
1088                                                                      
1089                
1090                
1091
1092    /**
1093     * selects a collection of ServiceItem objects pre-filled with their
1094     * Customer objects.
1095     *
1096     * This method is protected by default in order to keep the public
1097     * api reasonable. You can provide public methods for those you
1098     * actually need in ServiceItemPeer.
1099     *
1100     * @throws TorqueException Any exceptions caught during processing will be
1101     * rethrown wrapped into a TorqueException.
1102     */

1103    protected static List JavaDoc doSelectJoinCustomerRelatedByRecipientId(Criteria criteria)
1104        throws TorqueException
1105    {
1106        setDbName(criteria);
1107
1108        ServiceItemPeer.addSelectColumns(criteria);
1109        int offset = numColumns + 1;
1110        CustomerPeer.addSelectColumns(criteria);
1111
1112
1113                        criteria.addJoin(ServiceItemPeer.RECIPIENT_ID,
1114            CustomerPeer.CUSTOMER_ID);
1115        
1116
1117                                                                                                                                                                          
1118        List JavaDoc rows = BasePeer.doSelect(criteria);
1119        List JavaDoc results = new ArrayList JavaDoc();
1120
1121        for (int i = 0; i < rows.size(); i++)
1122        {
1123            Record row = (Record) rows.get(i);
1124
1125                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1126                    ServiceItem obj1 = (ServiceItem) ServiceItemPeer
1127                .row2Object(row, 1, omClass);
1128                     omClass = CustomerPeer.getOMClass();
1129                    Customer obj2 = (Customer)CustomerPeer
1130                .row2Object(row, offset, omClass);
1131
1132            boolean newObject = true;
1133            for (int j = 0; j < results.size(); j++)
1134            {
1135                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1136                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1137                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1138                {
1139                    newObject = false;
1140                              temp_obj2.addServiceItemRelatedByRecipientId(obj1);
1141                              break;
1142                }
1143            }
1144                      if (newObject)
1145            {
1146                obj2.initServiceItemsRelatedByRecipientId();
1147                obj2.addServiceItemRelatedByRecipientId(obj1);
1148            }
1149                      results.add(obj1);
1150        }
1151        return results;
1152    }
1153                                                            
1154                
1155                
1156
1157    /**
1158     * selects a collection of ServiceItem objects pre-filled with their
1159     * Project objects.
1160     *
1161     * This method is protected by default in order to keep the public
1162     * api reasonable. You can provide public methods for those you
1163     * actually need in ServiceItemPeer.
1164     *
1165     * @throws TorqueException Any exceptions caught during processing will be
1166     * rethrown wrapped into a TorqueException.
1167     */

1168    protected static List JavaDoc doSelectJoinProject(Criteria criteria)
1169        throws TorqueException
1170    {
1171        setDbName(criteria);
1172
1173        ServiceItemPeer.addSelectColumns(criteria);
1174        int offset = numColumns + 1;
1175        ProjectPeer.addSelectColumns(criteria);
1176
1177
1178                        criteria.addJoin(ServiceItemPeer.PROJECT_ID,
1179            ProjectPeer.PROJECT_ID);
1180        
1181
1182                                                                                                                                                                          
1183        List JavaDoc rows = BasePeer.doSelect(criteria);
1184        List JavaDoc results = new ArrayList JavaDoc();
1185
1186        for (int i = 0; i < rows.size(); i++)
1187        {
1188            Record row = (Record) rows.get(i);
1189
1190                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1191                    ServiceItem obj1 = (ServiceItem) ServiceItemPeer
1192                .row2Object(row, 1, omClass);
1193                     omClass = ProjectPeer.getOMClass();
1194                    Project obj2 = (Project)ProjectPeer
1195                .row2Object(row, offset, omClass);
1196
1197            boolean newObject = true;
1198            for (int j = 0; j < results.size(); j++)
1199            {
1200                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1201                Project temp_obj2 = (Project)temp_obj1.getProject();
1202                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1203                {
1204                    newObject = false;
1205                              temp_obj2.addServiceItem(obj1);
1206                              break;
1207                }
1208            }
1209                      if (newObject)
1210            {
1211                obj2.initServiceItems();
1212                obj2.addServiceItem(obj1);
1213            }
1214                      results.add(obj1);
1215        }
1216        return results;
1217    }
1218                    
1219  
1220                                                                  
1221          
1222        
1223                                  
1224                
1225
1226    /**
1227     * selects a collection of ServiceItem objects pre-filled with
1228     * all related objects.
1229     *
1230     * This method is protected by default in order to keep the public
1231     * api reasonable. You can provide public methods for those you
1232     * actually need in ServiceItemPeer.
1233     *
1234     * @throws TorqueException Any exceptions caught during processing will be
1235     * rethrown wrapped into a TorqueException.
1236     */

1237    protected static List JavaDoc doSelectJoinAllExceptService(Criteria criteria)
1238        throws TorqueException
1239    {
1240        setDbName(criteria);
1241
1242        addSelectColumns(criteria);
1243        int offset2 = numColumns + 1;
1244                                    
1245                                                  
1246                    SorderPeer.addSelectColumns(criteria);
1247        int offset3 = offset2 + SorderPeer.numColumns;
1248                                                                
1249                    ProductPeer.addSelectColumns(criteria);
1250        int offset4 = offset3 + ProductPeer.numColumns;
1251                                                                
1252                    CustomerPeer.addSelectColumns(criteria);
1253        int offset5 = offset4 + CustomerPeer.numColumns;
1254                                                                
1255                    CustomerPeer.addSelectColumns(criteria);
1256        int offset6 = offset5 + CustomerPeer.numColumns;
1257                                                                
1258                    ProjectPeer.addSelectColumns(criteria);
1259        int offset7 = offset6 + ProjectPeer.numColumns;
1260                                                                                                                                                                                                                      
1261        List JavaDoc rows = BasePeer.doSelect(criteria);
1262        List JavaDoc results = new ArrayList JavaDoc();
1263
1264        for (int i = 0; i < rows.size(); i++)
1265        {
1266            Record row = (Record)rows.get(i);
1267
1268                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1269                    ServiceItem obj1 = (ServiceItem)ServiceItemPeer
1270                .row2Object(row, 1, omClass);
1271                                                
1272                                                                  
1273                                                        
1274                            
1275              
1276                           omClass = SorderPeer.getOMClass();
1277                          Sorder obj2 = (Sorder)SorderPeer
1278                .row2Object( row, offset2, omClass);
1279
1280               boolean newObject = true;
1281            for (int j = 0; j < results.size(); j++)
1282            {
1283                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1284                Sorder temp_obj2 = (Sorder)temp_obj1.getSorder();
1285                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1286                {
1287                    newObject = false;
1288                                    temp_obj2.addServiceItem(obj1);
1289                                    break;
1290                }
1291            }
1292                            if (newObject)
1293            {
1294                obj2.initServiceItems();
1295                obj2.addServiceItem(obj1);
1296            }
1297                                                                                    
1298                                                        
1299                            
1300              
1301                           omClass = ProductPeer.getOMClass();
1302                          Product obj3 = (Product)ProductPeer
1303                .row2Object( row, offset3, omClass);
1304
1305               newObject = true;
1306            for (int j = 0; j < results.size(); j++)
1307            {
1308                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1309                Product temp_obj3 = (Product)temp_obj1.getProduct();
1310                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1311                {
1312                    newObject = false;
1313                                    temp_obj3.addServiceItem(obj1);
1314                                    break;
1315                }
1316            }
1317                            if (newObject)
1318            {
1319                obj3.initServiceItems();
1320                obj3.addServiceItem(obj1);
1321            }
1322                                                                                    
1323                                                                        
1324                            
1325              
1326                           omClass = CustomerPeer.getOMClass();
1327                          Customer obj4 = (Customer)CustomerPeer
1328                .row2Object( row, offset4, omClass);
1329
1330               newObject = true;
1331            for (int j = 0; j < results.size(); j++)
1332            {
1333                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1334                Customer temp_obj4 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1335                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1336                {
1337                    newObject = false;
1338                                    temp_obj4.addServiceItemRelatedByCustomerId(obj1);
1339                                    break;
1340                }
1341            }
1342                            if (newObject)
1343            {
1344                obj4.initServiceItemsRelatedByCustomerId();
1345                obj4.addServiceItemRelatedByCustomerId(obj1);
1346            }
1347                                                                                    
1348                                                                        
1349                            
1350              
1351                           omClass = CustomerPeer.getOMClass();
1352                          Customer obj5 = (Customer)CustomerPeer
1353                .row2Object( row, offset5, omClass);
1354
1355               newObject = true;
1356            for (int j = 0; j < results.size(); j++)
1357            {
1358                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1359                Customer temp_obj5 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1360                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1361                {
1362                    newObject = false;
1363                                    temp_obj5.addServiceItemRelatedByRecipientId(obj1);
1364                                    break;
1365                }
1366            }
1367                            if (newObject)
1368            {
1369                obj5.initServiceItemsRelatedByRecipientId();
1370                obj5.addServiceItemRelatedByRecipientId(obj1);
1371            }
1372                                                                                    
1373                                                        
1374                            
1375              
1376                           omClass = ProjectPeer.getOMClass();
1377                          Project obj6 = (Project)ProjectPeer
1378                .row2Object( row, offset6, omClass);
1379
1380               newObject = true;
1381            for (int j = 0; j < results.size(); j++)
1382            {
1383                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1384                Project temp_obj6 = (Project)temp_obj1.getProject();
1385                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1386                {
1387                    newObject = false;
1388                                    temp_obj6.addServiceItem(obj1);
1389                                    break;
1390                }
1391            }
1392                            if (newObject)
1393            {
1394                obj6.initServiceItems();
1395                obj6.addServiceItem(obj1);
1396            }
1397                                                                results.add(obj1);
1398        }
1399        return results;
1400    }
1401        
1402        
1403                                  
1404                
1405
1406    /**
1407     * selects a collection of ServiceItem objects pre-filled with
1408     * all related objects.
1409     *
1410     * This method is protected by default in order to keep the public
1411     * api reasonable. You can provide public methods for those you
1412     * actually need in ServiceItemPeer.
1413     *
1414     * @throws TorqueException Any exceptions caught during processing will be
1415     * rethrown wrapped into a TorqueException.
1416     */

1417    protected static List JavaDoc doSelectJoinAllExceptSorder(Criteria criteria)
1418        throws TorqueException
1419    {
1420        setDbName(criteria);
1421
1422        addSelectColumns(criteria);
1423        int offset2 = numColumns + 1;
1424                                    
1425                    ServicePeer.addSelectColumns(criteria);
1426        int offset3 = offset2 + ServicePeer.numColumns;
1427                                                                
1428                                                  
1429                    ProductPeer.addSelectColumns(criteria);
1430        int offset4 = offset3 + ProductPeer.numColumns;
1431                                                                
1432                    CustomerPeer.addSelectColumns(criteria);
1433        int offset5 = offset4 + CustomerPeer.numColumns;
1434                                                                
1435                    CustomerPeer.addSelectColumns(criteria);
1436        int offset6 = offset5 + CustomerPeer.numColumns;
1437                                                                
1438                    ProjectPeer.addSelectColumns(criteria);
1439        int offset7 = offset6 + ProjectPeer.numColumns;
1440                                                                                                                                                                                                                      
1441        List JavaDoc rows = BasePeer.doSelect(criteria);
1442        List JavaDoc results = new ArrayList JavaDoc();
1443
1444        for (int i = 0; i < rows.size(); i++)
1445        {
1446            Record row = (Record)rows.get(i);
1447
1448                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1449                    ServiceItem obj1 = (ServiceItem)ServiceItemPeer
1450                .row2Object(row, 1, omClass);
1451                                                
1452                                                        
1453                            
1454              
1455                           omClass = ServicePeer.getOMClass();
1456                          Service obj2 = (Service)ServicePeer
1457                .row2Object( row, offset2, omClass);
1458
1459               boolean newObject = true;
1460            for (int j = 0; j < results.size(); j++)
1461            {
1462                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1463                Service temp_obj2 = (Service)temp_obj1.getService();
1464                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1465                {
1466                    newObject = false;
1467                                    temp_obj2.addServiceItem(obj1);
1468                                    break;
1469                }
1470            }
1471                            if (newObject)
1472            {
1473                obj2.initServiceItems();
1474                obj2.addServiceItem(obj1);
1475            }
1476                                                                                    
1477                                                                  
1478                                                        
1479                            
1480              
1481                           omClass = ProductPeer.getOMClass();
1482                          Product obj3 = (Product)ProductPeer
1483                .row2Object( row, offset3, omClass);
1484
1485               newObject = true;
1486            for (int j = 0; j < results.size(); j++)
1487            {
1488                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1489                Product temp_obj3 = (Product)temp_obj1.getProduct();
1490                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1491                {
1492                    newObject = false;
1493                                    temp_obj3.addServiceItem(obj1);
1494                                    break;
1495                }
1496            }
1497                            if (newObject)
1498            {
1499                obj3.initServiceItems();
1500                obj3.addServiceItem(obj1);
1501            }
1502                                                                                    
1503                                                                        
1504                            
1505              
1506                           omClass = CustomerPeer.getOMClass();
1507                          Customer obj4 = (Customer)CustomerPeer
1508                .row2Object( row, offset4, omClass);
1509
1510               newObject = true;
1511            for (int j = 0; j < results.size(); j++)
1512            {
1513                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1514                Customer temp_obj4 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1515                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1516                {
1517                    newObject = false;
1518                                    temp_obj4.addServiceItemRelatedByCustomerId(obj1);
1519                                    break;
1520                }
1521            }
1522                            if (newObject)
1523            {
1524                obj4.initServiceItemsRelatedByCustomerId();
1525                obj4.addServiceItemRelatedByCustomerId(obj1);
1526            }
1527                                                                                    
1528                                                                        
1529                            
1530              
1531                           omClass = CustomerPeer.getOMClass();
1532                          Customer obj5 = (Customer)CustomerPeer
1533                .row2Object( row, offset5, omClass);
1534
1535               newObject = true;
1536            for (int j = 0; j < results.size(); j++)
1537            {
1538                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1539                Customer temp_obj5 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1540                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1541                {
1542                    newObject = false;
1543                                    temp_obj5.addServiceItemRelatedByRecipientId(obj1);
1544                                    break;
1545                }
1546            }
1547                            if (newObject)
1548            {
1549                obj5.initServiceItemsRelatedByRecipientId();
1550                obj5.addServiceItemRelatedByRecipientId(obj1);
1551            }
1552                                                                                    
1553                                                        
1554                            
1555              
1556                           omClass = ProjectPeer.getOMClass();
1557                          Project obj6 = (Project)ProjectPeer
1558                .row2Object( row, offset6, omClass);
1559
1560               newObject = true;
1561            for (int j = 0; j < results.size(); j++)
1562            {
1563                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1564                Project temp_obj6 = (Project)temp_obj1.getProject();
1565                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1566                {
1567                    newObject = false;
1568                                    temp_obj6.addServiceItem(obj1);
1569                                    break;
1570                }
1571            }
1572                            if (newObject)
1573            {
1574                obj6.initServiceItems();
1575                obj6.addServiceItem(obj1);
1576            }
1577                                                                results.add(obj1);
1578        }
1579        return results;
1580    }
1581        
1582        
1583                                  
1584                
1585
1586    /**
1587     * selects a collection of ServiceItem objects pre-filled with
1588     * all related objects.
1589     *
1590     * This method is protected by default in order to keep the public
1591     * api reasonable. You can provide public methods for those you
1592     * actually need in ServiceItemPeer.
1593     *
1594     * @throws TorqueException Any exceptions caught during processing will be
1595     * rethrown wrapped into a TorqueException.
1596     */

1597    protected static List JavaDoc doSelectJoinAllExceptProduct(Criteria criteria)
1598        throws TorqueException
1599    {
1600        setDbName(criteria);
1601
1602        addSelectColumns(criteria);
1603        int offset2 = numColumns + 1;
1604                                    
1605                    ServicePeer.addSelectColumns(criteria);
1606        int offset3 = offset2 + ServicePeer.numColumns;
1607                                                                
1608                    SorderPeer.addSelectColumns(criteria);
1609        int offset4 = offset3 + SorderPeer.numColumns;
1610                                                                
1611                                                  
1612                    CustomerPeer.addSelectColumns(criteria);
1613        int offset5 = offset4 + CustomerPeer.numColumns;
1614                                                                
1615                    CustomerPeer.addSelectColumns(criteria);
1616        int offset6 = offset5 + CustomerPeer.numColumns;
1617                                                                
1618                    ProjectPeer.addSelectColumns(criteria);
1619        int offset7 = offset6 + ProjectPeer.numColumns;
1620                                                                                                                                                                                                                      
1621        List JavaDoc rows = BasePeer.doSelect(criteria);
1622        List JavaDoc results = new ArrayList JavaDoc();
1623
1624        for (int i = 0; i < rows.size(); i++)
1625        {
1626            Record row = (Record)rows.get(i);
1627
1628                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1629                    ServiceItem obj1 = (ServiceItem)ServiceItemPeer
1630                .row2Object(row, 1, omClass);
1631                                                
1632                                                        
1633                            
1634              
1635                           omClass = ServicePeer.getOMClass();
1636                          Service obj2 = (Service)ServicePeer
1637                .row2Object( row, offset2, omClass);
1638
1639               boolean newObject = true;
1640            for (int j = 0; j < results.size(); j++)
1641            {
1642                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1643                Service temp_obj2 = (Service)temp_obj1.getService();
1644                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1645                {
1646                    newObject = false;
1647                                    temp_obj2.addServiceItem(obj1);
1648                                    break;
1649                }
1650            }
1651                            if (newObject)
1652            {
1653                obj2.initServiceItems();
1654                obj2.addServiceItem(obj1);
1655            }
1656                                                                                    
1657                                                        
1658                            
1659              
1660                           omClass = SorderPeer.getOMClass();
1661                          Sorder obj3 = (Sorder)SorderPeer
1662                .row2Object( row, offset3, omClass);
1663
1664               newObject = true;
1665            for (int j = 0; j < results.size(); j++)
1666            {
1667                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1668                Sorder temp_obj3 = (Sorder)temp_obj1.getSorder();
1669                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1670                {
1671                    newObject = false;
1672                                    temp_obj3.addServiceItem(obj1);
1673                                    break;
1674                }
1675            }
1676                            if (newObject)
1677            {
1678                obj3.initServiceItems();
1679                obj3.addServiceItem(obj1);
1680            }
1681                                                                                    
1682                                                                  
1683                                                                        
1684                            
1685              
1686                           omClass = CustomerPeer.getOMClass();
1687                          Customer obj4 = (Customer)CustomerPeer
1688                .row2Object( row, offset4, omClass);
1689
1690               newObject = true;
1691            for (int j = 0; j < results.size(); j++)
1692            {
1693                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1694                Customer temp_obj4 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1695                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1696                {
1697                    newObject = false;
1698                                    temp_obj4.addServiceItemRelatedByCustomerId(obj1);
1699                                    break;
1700                }
1701            }
1702                            if (newObject)
1703            {
1704                obj4.initServiceItemsRelatedByCustomerId();
1705                obj4.addServiceItemRelatedByCustomerId(obj1);
1706            }
1707                                                                                    
1708                                                                        
1709                            
1710              
1711                           omClass = CustomerPeer.getOMClass();
1712                          Customer obj5 = (Customer)CustomerPeer
1713                .row2Object( row, offset5, omClass);
1714
1715               newObject = true;
1716            for (int j = 0; j < results.size(); j++)
1717            {
1718                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1719                Customer temp_obj5 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1720                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1721                {
1722                    newObject = false;
1723                                    temp_obj5.addServiceItemRelatedByRecipientId(obj1);
1724                                    break;
1725                }
1726            }
1727                            if (newObject)
1728            {
1729                obj5.initServiceItemsRelatedByRecipientId();
1730                obj5.addServiceItemRelatedByRecipientId(obj1);
1731            }
1732                                                                                    
1733                                                        
1734                            
1735              
1736                           omClass = ProjectPeer.getOMClass();
1737                          Project obj6 = (Project)ProjectPeer
1738                .row2Object( row, offset6, omClass);
1739
1740               newObject = true;
1741            for (int j = 0; j < results.size(); j++)
1742            {
1743                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1744                Project temp_obj6 = (Project)temp_obj1.getProject();
1745                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
1746                {
1747                    newObject = false;
1748                                    temp_obj6.addServiceItem(obj1);
1749                                    break;
1750                }
1751            }
1752                            if (newObject)
1753            {
1754                obj6.initServiceItems();
1755                obj6.addServiceItem(obj1);
1756            }
1757                                                                results.add(obj1);
1758        }
1759        return results;
1760    }
1761        
1762        
1763                                            
1764                
1765
1766    /**
1767     * selects a collection of ServiceItem objects pre-filled with
1768     * all related objects.
1769     *
1770     * This method is protected by default in order to keep the public
1771     * api reasonable. You can provide public methods for those you
1772     * actually need in ServiceItemPeer.
1773     *
1774     * @throws TorqueException Any exceptions caught during processing will be
1775     * rethrown wrapped into a TorqueException.
1776     */

1777    protected static List JavaDoc doSelectJoinAllExceptCustomerRelatedByCustomerId(Criteria criteria)
1778        throws TorqueException
1779    {
1780        setDbName(criteria);
1781
1782        addSelectColumns(criteria);
1783        int offset2 = numColumns + 1;
1784                                    
1785                    ServicePeer.addSelectColumns(criteria);
1786        int offset3 = offset2 + ServicePeer.numColumns;
1787                                                                
1788                    SorderPeer.addSelectColumns(criteria);
1789        int offset4 = offset3 + SorderPeer.numColumns;
1790                                                                
1791                    ProductPeer.addSelectColumns(criteria);
1792        int offset5 = offset4 + ProductPeer.numColumns;
1793                                                                
1794                                                  
1795                                                  
1796                    ProjectPeer.addSelectColumns(criteria);
1797        int offset6 = offset5 + ProjectPeer.numColumns;
1798                                                                                                                                                                                                                      
1799        List JavaDoc rows = BasePeer.doSelect(criteria);
1800        List JavaDoc results = new ArrayList JavaDoc();
1801
1802        for (int i = 0; i < rows.size(); i++)
1803        {
1804            Record row = (Record)rows.get(i);
1805
1806                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1807                    ServiceItem obj1 = (ServiceItem)ServiceItemPeer
1808                .row2Object(row, 1, omClass);
1809                                                
1810                                                        
1811                            
1812              
1813                           omClass = ServicePeer.getOMClass();
1814                          Service obj2 = (Service)ServicePeer
1815                .row2Object( row, offset2, omClass);
1816
1817               boolean newObject = true;
1818            for (int j = 0; j < results.size(); j++)
1819            {
1820                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1821                Service temp_obj2 = (Service)temp_obj1.getService();
1822                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1823                {
1824                    newObject = false;
1825                                    temp_obj2.addServiceItem(obj1);
1826                                    break;
1827                }
1828            }
1829                            if (newObject)
1830            {
1831                obj2.initServiceItems();
1832                obj2.addServiceItem(obj1);
1833            }
1834                                                                                    
1835                                                        
1836                            
1837              
1838                           omClass = SorderPeer.getOMClass();
1839                          Sorder obj3 = (Sorder)SorderPeer
1840                .row2Object( row, offset3, omClass);
1841
1842               newObject = true;
1843            for (int j = 0; j < results.size(); j++)
1844            {
1845                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1846                Sorder temp_obj3 = (Sorder)temp_obj1.getSorder();
1847                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1848                {
1849                    newObject = false;
1850                                    temp_obj3.addServiceItem(obj1);
1851                                    break;
1852                }
1853            }
1854                            if (newObject)
1855            {
1856                obj3.initServiceItems();
1857                obj3.addServiceItem(obj1);
1858            }
1859                                                                                    
1860                                                        
1861                            
1862              
1863                           omClass = ProductPeer.getOMClass();
1864                          Product obj4 = (Product)ProductPeer
1865                .row2Object( row, offset4, omClass);
1866
1867               newObject = true;
1868            for (int j = 0; j < results.size(); j++)
1869            {
1870                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1871                Product temp_obj4 = (Product)temp_obj1.getProduct();
1872                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1873                {
1874                    newObject = false;
1875                                    temp_obj4.addServiceItem(obj1);
1876                                    break;
1877                }
1878            }
1879                            if (newObject)
1880            {
1881                obj4.initServiceItems();
1882                obj4.addServiceItem(obj1);
1883            }
1884                                                                                    
1885                                                                  
1886                                                                  
1887                                                        
1888                            
1889              
1890                           omClass = ProjectPeer.getOMClass();
1891                          Project obj5 = (Project)ProjectPeer
1892                .row2Object( row, offset5, omClass);
1893
1894               newObject = true;
1895            for (int j = 0; j < results.size(); j++)
1896            {
1897                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1898                Project temp_obj5 = (Project)temp_obj1.getProject();
1899                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1900                {
1901                    newObject = false;
1902                                    temp_obj5.addServiceItem(obj1);
1903                                    break;
1904                }
1905            }
1906                            if (newObject)
1907            {
1908                obj5.initServiceItems();
1909                obj5.addServiceItem(obj1);
1910            }
1911                                                                results.add(obj1);
1912        }
1913        return results;
1914    }
1915        
1916        
1917                                            
1918                
1919
1920    /**
1921     * selects a collection of ServiceItem objects pre-filled with
1922     * all related objects.
1923     *
1924     * This method is protected by default in order to keep the public
1925     * api reasonable. You can provide public methods for those you
1926     * actually need in ServiceItemPeer.
1927     *
1928     * @throws TorqueException Any exceptions caught during processing will be
1929     * rethrown wrapped into a TorqueException.
1930     */

1931    protected static List JavaDoc doSelectJoinAllExceptCustomerRelatedByRecipientId(Criteria criteria)
1932        throws TorqueException
1933    {
1934        setDbName(criteria);
1935
1936        addSelectColumns(criteria);
1937        int offset2 = numColumns + 1;
1938                                    
1939                    ServicePeer.addSelectColumns(criteria);
1940        int offset3 = offset2 + ServicePeer.numColumns;
1941                                                                
1942                    SorderPeer.addSelectColumns(criteria);
1943        int offset4 = offset3 + SorderPeer.numColumns;
1944                                                                
1945                    ProductPeer.addSelectColumns(criteria);
1946        int offset5 = offset4 + ProductPeer.numColumns;
1947                                                                
1948                                                  
1949                                                  
1950                    ProjectPeer.addSelectColumns(criteria);
1951        int offset6 = offset5 + ProjectPeer.numColumns;
1952                                                                                                                                                                                                                      
1953        List JavaDoc rows = BasePeer.doSelect(criteria);
1954        List JavaDoc results = new ArrayList JavaDoc();
1955
1956        for (int i = 0; i < rows.size(); i++)
1957        {
1958            Record row = (Record)rows.get(i);
1959
1960                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
1961                    ServiceItem obj1 = (ServiceItem)ServiceItemPeer
1962                .row2Object(row, 1, omClass);
1963                                                
1964                                                        
1965                            
1966              
1967                           omClass = ServicePeer.getOMClass();
1968                          Service obj2 = (Service)ServicePeer
1969                .row2Object( row, offset2, omClass);
1970
1971               boolean newObject = true;
1972            for (int j = 0; j < results.size(); j++)
1973            {
1974                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
1975                Service temp_obj2 = (Service)temp_obj1.getService();
1976                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1977                {
1978                    newObject = false;
1979                                    temp_obj2.addServiceItem(obj1);
1980                                    break;
1981                }
1982            }
1983                            if (newObject)
1984            {
1985                obj2.initServiceItems();
1986                obj2.addServiceItem(obj1);
1987            }
1988                                                                                    
1989                                                        
1990                            
1991              
1992                           omClass = SorderPeer.getOMClass();
1993                          Sorder obj3 = (Sorder)SorderPeer
1994                .row2Object( row, offset3, omClass);
1995
1996               newObject = true;
1997            for (int j = 0; j < results.size(); j++)
1998            {
1999                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2000                Sorder temp_obj3 = (Sorder)temp_obj1.getSorder();
2001                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2002                {
2003                    newObject = false;
2004                                    temp_obj3.addServiceItem(obj1);
2005                                    break;
2006                }
2007            }
2008                            if (newObject)
2009            {
2010                obj3.initServiceItems();
2011                obj3.addServiceItem(obj1);
2012            }
2013                                                                                    
2014                                                        
2015                            
2016              
2017                           omClass = ProductPeer.getOMClass();
2018                          Product obj4 = (Product)ProductPeer
2019                .row2Object( row, offset4, omClass);
2020
2021               newObject = true;
2022            for (int j = 0; j < results.size(); j++)
2023            {
2024                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2025                Product temp_obj4 = (Product)temp_obj1.getProduct();
2026                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2027                {
2028                    newObject = false;
2029                                    temp_obj4.addServiceItem(obj1);
2030                                    break;
2031                }
2032            }
2033                            if (newObject)
2034            {
2035                obj4.initServiceItems();
2036                obj4.addServiceItem(obj1);
2037            }
2038                                                                                    
2039                                                                  
2040                                                                  
2041                                                        
2042                            
2043              
2044                           omClass = ProjectPeer.getOMClass();
2045                          Project obj5 = (Project)ProjectPeer
2046                .row2Object( row, offset5, omClass);
2047
2048               newObject = true;
2049            for (int j = 0; j < results.size(); j++)
2050            {
2051                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2052                Project temp_obj5 = (Project)temp_obj1.getProject();
2053                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2054                {
2055                    newObject = false;
2056                                    temp_obj5.addServiceItem(obj1);
2057                                    break;
2058                }
2059            }
2060                            if (newObject)
2061            {
2062                obj5.initServiceItems();
2063                obj5.addServiceItem(obj1);
2064            }
2065                                                                results.add(obj1);
2066        }
2067        return results;
2068    }
2069        
2070        
2071                                  
2072                
2073
2074    /**
2075     * selects a collection of ServiceItem objects pre-filled with
2076     * all related objects.
2077     *
2078     * This method is protected by default in order to keep the public
2079     * api reasonable. You can provide public methods for those you
2080     * actually need in ServiceItemPeer.
2081     *
2082     * @throws TorqueException Any exceptions caught during processing will be
2083     * rethrown wrapped into a TorqueException.
2084     */

2085    protected static List JavaDoc doSelectJoinAllExceptProject(Criteria criteria)
2086        throws TorqueException
2087    {
2088        setDbName(criteria);
2089
2090        addSelectColumns(criteria);
2091        int offset2 = numColumns + 1;
2092                                    
2093                    ServicePeer.addSelectColumns(criteria);
2094        int offset3 = offset2 + ServicePeer.numColumns;
2095                                                                
2096                    SorderPeer.addSelectColumns(criteria);
2097        int offset4 = offset3 + SorderPeer.numColumns;
2098                                                                
2099                    ProductPeer.addSelectColumns(criteria);
2100        int offset5 = offset4 + ProductPeer.numColumns;
2101                                                                
2102                    CustomerPeer.addSelectColumns(criteria);
2103        int offset6 = offset5 + CustomerPeer.numColumns;
2104                                                                
2105                    CustomerPeer.addSelectColumns(criteria);
2106        int offset7 = offset6 + CustomerPeer.numColumns;
2107                                                                
2108                                                                                                                                                                                                        
2109        List JavaDoc rows = BasePeer.doSelect(criteria);
2110        List JavaDoc results = new ArrayList JavaDoc();
2111
2112        for (int i = 0; i < rows.size(); i++)
2113        {
2114            Record row = (Record)rows.get(i);
2115
2116                            Class JavaDoc omClass = ServiceItemPeer.getOMClass();
2117                    ServiceItem obj1 = (ServiceItem)ServiceItemPeer
2118                .row2Object(row, 1, omClass);
2119                                                
2120                                                        
2121                            
2122              
2123                           omClass = ServicePeer.getOMClass();
2124                          Service obj2 = (Service)ServicePeer
2125                .row2Object( row, offset2, omClass);
2126
2127               boolean newObject = true;
2128            for (int j = 0; j < results.size(); j++)
2129            {
2130                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2131                Service temp_obj2 = (Service)temp_obj1.getService();
2132                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
2133                {
2134                    newObject = false;
2135                                    temp_obj2.addServiceItem(obj1);
2136                                    break;
2137                }
2138            }
2139                            if (newObject)
2140            {
2141                obj2.initServiceItems();
2142                obj2.addServiceItem(obj1);
2143            }
2144                                                                                    
2145                                                        
2146                            
2147              
2148                           omClass = SorderPeer.getOMClass();
2149                          Sorder obj3 = (Sorder)SorderPeer
2150                .row2Object( row, offset3, omClass);
2151
2152               newObject = true;
2153            for (int j = 0; j < results.size(); j++)
2154            {
2155                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2156                Sorder temp_obj3 = (Sorder)temp_obj1.getSorder();
2157                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
2158                {
2159                    newObject = false;
2160                                    temp_obj3.addServiceItem(obj1);
2161                                    break;
2162                }
2163            }
2164                            if (newObject)
2165            {
2166                obj3.initServiceItems();
2167                obj3.addServiceItem(obj1);
2168            }
2169                                                                                    
2170                                                        
2171                            
2172              
2173                           omClass = ProductPeer.getOMClass();
2174                          Product obj4 = (Product)ProductPeer
2175                .row2Object( row, offset4, omClass);
2176
2177               newObject = true;
2178            for (int j = 0; j < results.size(); j++)
2179            {
2180                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2181                Product temp_obj4 = (Product)temp_obj1.getProduct();
2182                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
2183                {
2184                    newObject = false;
2185                                    temp_obj4.addServiceItem(obj1);
2186                                    break;
2187                }
2188            }
2189                            if (newObject)
2190            {
2191                obj4.initServiceItems();
2192                obj4.addServiceItem(obj1);
2193            }
2194                                                                                    
2195                                                                        
2196                            
2197              
2198                           omClass = CustomerPeer.getOMClass();
2199                          Customer obj5 = (Customer)CustomerPeer
2200                .row2Object( row, offset5, omClass);
2201
2202               newObject = true;
2203            for (int j = 0; j < results.size(); j++)
2204            {
2205                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2206                Customer temp_obj5 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
2207                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
2208                {
2209                    newObject = false;
2210                                    temp_obj5.addServiceItemRelatedByCustomerId(obj1);
2211                                    break;
2212                }
2213            }
2214                            if (newObject)
2215            {
2216                obj5.initServiceItemsRelatedByCustomerId();
2217                obj5.addServiceItemRelatedByCustomerId(obj1);
2218            }
2219                                                                                    
2220                                                                        
2221                            
2222              
2223                           omClass = CustomerPeer.getOMClass();
2224                          Customer obj6 = (Customer)CustomerPeer
2225                .row2Object( row, offset6, omClass);
2226
2227               newObject = true;
2228            for (int j = 0; j < results.size(); j++)
2229            {
2230                ServiceItem temp_obj1 = (ServiceItem)results.get(j);
2231                Customer temp_obj6 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
2232                if (temp_obj6.getPrimaryKey().equals(obj6.getPrimaryKey()))
2233                {
2234                    newObject = false;
2235                                    temp_obj6.addServiceItemRelatedByRecipientId(obj1);
2236                                    break;
2237                }
2238            }
2239                            if (newObject)
2240            {
2241                obj6.initServiceItemsRelatedByRecipientId();
2242                obj6.addServiceItemRelatedByRecipientId(obj1);
2243            }
2244                                                                                    
2245                                              results.add(obj1);
2246        }
2247        return results;
2248    }
2249                    
2250  
2251      /**
2252     * Returns the TableMap related to this peer. This method is not
2253     * needed for general use but a specific application could have a need.
2254     *
2255     * @throws TorqueException Any exceptions caught during processing will be
2256     * rethrown wrapped into a TorqueException.
2257     */

2258    protected static TableMap getTableMap()
2259        throws TorqueException
2260    {
2261        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
2262    }
2263   
2264    private static void setDbName(Criteria crit)
2265    {
2266        // Set the correct dbName if it has not been overridden
2267
// crit.getDbName will return the same object if not set to
2268
// another value so == check is okay and faster
2269
if (crit.getDbName() == Torque.getDefaultDB())
2270        {
2271            crit.setDbName(DATABASE_NAME);
2272        }
2273    }
2274}
2275
Popular Tags