KickJava   Java API By Example, From Geeks To Geeks.

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


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  * This class was autogenerated by Torque on:
41  *
42  * [Wed May 04 09:10:56 CEST 2005]
43  *
44  */

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

60     public static MapBuilder getMapBuilder()
61         throws TorqueException
62     {
63         return getMapBuilder(SorderMapBuilder.CLASS_NAME);
64     }
65
66       /** the column name for the SORDER_ID field */
67     public static final String JavaDoc SORDER_ID;
68       /** the column name for the SORDER_CODE field */
69     public static final String JavaDoc SORDER_CODE;
70       /** the column name for the STATUS field */
71     public static final String JavaDoc STATUS;
72       /** the column name for the PRIORITY field */
73     public static final String JavaDoc PRIORITY;
74       /** the column name for the ISSUED_DATE field */
75     public static final String JavaDoc ISSUED_DATE;
76       /** the column name for the CLOSED_DATE field */
77     public static final String JavaDoc CLOSED_DATE;
78       /** the column name for the CUSTOMER_ID field */
79     public static final String JavaDoc CUSTOMER_ID;
80       /** the column name for the RECIPIENT_ID field */
81     public static final String JavaDoc RECIPIENT_ID;
82       /** the column name for the PROJECT_ID field */
83     public static final String JavaDoc PROJECT_ID;
84       /** the column name for the CARRIER_ID field */
85     public static final String JavaDoc CARRIER_ID;
86       /** the column name for the PAY_TERM field */
87     public static final String JavaDoc PAY_TERM;
88       /** the column name for the PAY_METHOD field */
89     public static final String JavaDoc PAY_METHOD;
90       /** the column name for the CURRENCY_ID field */
91     public static final String JavaDoc CURRENCY_ID;
92       /** the column name for the CURRENCY_AMOUNT field */
93     public static final String JavaDoc CURRENCY_AMOUNT;
94       /** the column name for the SUBJECT field */
95     public static final String JavaDoc SUBJECT;
96       /** the column name for the NOTES field */
97     public static final String JavaDoc NOTES;
98       /** the column name for the CREATED field */
99     public static final String JavaDoc CREATED;
100       /** the column name for the MODIFIED field */
101     public static final String JavaDoc MODIFIED;
102       /** the column name for the CREATED_BY field */
103     public static final String JavaDoc CREATED_BY;
104       /** the column name for the MODIFIED_BY field */
105     public static final String JavaDoc MODIFIED_BY;
106   
107     static
108     {
109           SORDER_ID = "SORDER.SORDER_ID";
110           SORDER_CODE = "SORDER.SORDER_CODE";
111           STATUS = "SORDER.STATUS";
112           PRIORITY = "SORDER.PRIORITY";
113           ISSUED_DATE = "SORDER.ISSUED_DATE";
114           CLOSED_DATE = "SORDER.CLOSED_DATE";
115           CUSTOMER_ID = "SORDER.CUSTOMER_ID";
116           RECIPIENT_ID = "SORDER.RECIPIENT_ID";
117           PROJECT_ID = "SORDER.PROJECT_ID";
118           CARRIER_ID = "SORDER.CARRIER_ID";
119           PAY_TERM = "SORDER.PAY_TERM";
120           PAY_METHOD = "SORDER.PAY_METHOD";
121           CURRENCY_ID = "SORDER.CURRENCY_ID";
122           CURRENCY_AMOUNT = "SORDER.CURRENCY_AMOUNT";
123           SUBJECT = "SORDER.SUBJECT";
124           NOTES = "SORDER.NOTES";
125           CREATED = "SORDER.CREATED";
126           MODIFIED = "SORDER.MODIFIED";
127           CREATED_BY = "SORDER.CREATED_BY";
128           MODIFIED_BY = "SORDER.MODIFIED_BY";
129           if (Torque.isInit())
130         {
131             try
132             {
133                 getMapBuilder(SorderMapBuilder.CLASS_NAME);
134             }
135             catch (Exception JavaDoc e)
136             {
137                 log.error("Could not initialize Peer", e);
138             }
139         }
140         else
141         {
142             Torque.registerMapBuilder(SorderMapBuilder.CLASS_NAME);
143         }
144     }
145  
146     /** number of columns for this peer */
147     public static final int numColumns = 20;
148
149     /** A class that can be returned by this peer. */
150     protected static final String JavaDoc CLASSNAME_DEFAULT =
151         "org.campware.cream.om.Sorder";
152
153     /** A class that can be returned by this peer. */
154     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
155
156     /**
157      * Class object initialization method.
158      *
159      * @param className name of the class to initialize
160      * @return the initialized class
161      */

162     private static Class JavaDoc initClass(String JavaDoc className)
163     {
164         Class JavaDoc c = null;
165         try
166         {
167             c = Class.forName(className);
168         }
169         catch (Throwable JavaDoc t)
170         {
171             log.error("A FATAL ERROR has occurred which should not "
172                 + "have happened under any circumstance. Please notify "
173                 + "the Torque developers <torque-dev@db.apache.org> "
174                 + "and give as many details as possible (including the error "
175                 + "stack trace).", t);
176
177             // Error objects should always be propogated.
178
if (t instanceof Error JavaDoc)
179             {
180                 throw (Error JavaDoc) t.fillInStackTrace();
181             }
182         }
183         return c;
184     }
185
186     /**
187      * Get the list of objects for a ResultSet. Please not that your
188      * resultset MUST return columns in the right order. You can use
189      * getFieldNames() in BaseObject to get the correct sequence.
190      *
191      * @param results the ResultSet
192      * @return the list of objects
193      * @throws TorqueException Any exceptions caught during processing will be
194      * rethrown wrapped into a TorqueException.
195      */

196     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
197             throws TorqueException
198     {
199         try
200         {
201             QueryDataSet qds = null;
202             List JavaDoc rows = null;
203             try
204             {
205                 qds = new QueryDataSet(results);
206                 rows = getSelectResults(qds);
207             }
208             finally
209             {
210                 if (qds != null)
211                 {
212                     qds.close();
213                 }
214             }
215
216             return populateObjects(rows);
217         }
218         catch (SQLException JavaDoc e)
219         {
220             throw new TorqueException(e);
221         }
222         catch (DataSetException e)
223         {
224             throw new TorqueException(e);
225         }
226     }
227
228
229   
230     /**
231      * Method to do inserts.
232      *
233      * @param criteria object used to create the INSERT statement.
234      * @throws TorqueException Any exceptions caught during processing will be
235      * rethrown wrapped into a TorqueException.
236      */

237     public static ObjectKey doInsert(Criteria criteria)
238         throws TorqueException
239     {
240         return BaseSorderPeer
241             .doInsert(criteria, (Connection JavaDoc) null);
242     }
243
244     /**
245      * Method to do inserts. This method is to be used during a transaction,
246      * otherwise use the doInsert(Criteria) method. It will take care of
247      * the connection details internally.
248      *
249      * @param criteria object used to create the INSERT statement.
250      * @param con the connection to use
251      * @throws TorqueException Any exceptions caught during processing will be
252      * rethrown wrapped into a TorqueException.
253      */

254     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
255         throws TorqueException
256     {
257                                                                                                                           
258         setDbName(criteria);
259
260         if (con == null)
261         {
262             return BasePeer.doInsert(criteria);
263         }
264         else
265         {
266             return BasePeer.doInsert(criteria, con);
267         }
268     }
269
270     /**
271      * Add all the columns needed to create a new object.
272      *
273      * @param criteria object containing the columns to add.
274      * @throws TorqueException Any exceptions caught during processing will be
275      * rethrown wrapped into a TorqueException.
276      */

277     public static void addSelectColumns(Criteria criteria)
278             throws TorqueException
279     {
280           criteria.addSelectColumn(SORDER_ID);
281           criteria.addSelectColumn(SORDER_CODE);
282           criteria.addSelectColumn(STATUS);
283           criteria.addSelectColumn(PRIORITY);
284           criteria.addSelectColumn(ISSUED_DATE);
285           criteria.addSelectColumn(CLOSED_DATE);
286           criteria.addSelectColumn(CUSTOMER_ID);
287           criteria.addSelectColumn(RECIPIENT_ID);
288           criteria.addSelectColumn(PROJECT_ID);
289           criteria.addSelectColumn(CARRIER_ID);
290           criteria.addSelectColumn(PAY_TERM);
291           criteria.addSelectColumn(PAY_METHOD);
292           criteria.addSelectColumn(CURRENCY_ID);
293           criteria.addSelectColumn(CURRENCY_AMOUNT);
294           criteria.addSelectColumn(SUBJECT);
295           criteria.addSelectColumn(NOTES);
296           criteria.addSelectColumn(CREATED);
297           criteria.addSelectColumn(MODIFIED);
298           criteria.addSelectColumn(CREATED_BY);
299           criteria.addSelectColumn(MODIFIED_BY);
300       }
301
302     /**
303      * Create a new object of type cls from a resultset row starting
304      * from a specified offset. This is done so that you can select
305      * other rows than just those needed for this object. You may
306      * for example want to create two objects from the same row.
307      *
308      * @throws TorqueException Any exceptions caught during processing will be
309      * rethrown wrapped into a TorqueException.
310      */

311     public static Sorder row2Object(Record row,
312                                              int offset,
313                                              Class JavaDoc cls)
314         throws TorqueException
315     {
316         try
317         {
318             Sorder obj = (Sorder) cls.newInstance();
319             SorderPeer.populateObject(row, offset, obj);
320                   obj.setModified(false);
321               obj.setNew(false);
322
323             return obj;
324         }
325         catch (InstantiationException JavaDoc e)
326         {
327             throw new TorqueException(e);
328         }
329         catch (IllegalAccessException JavaDoc e)
330         {
331             throw new TorqueException(e);
332         }
333     }
334
335     /**
336      * Populates an object from a resultset row starting
337      * from a specified offset. This is done so that you can select
338      * other rows than just those needed for this object. You may
339      * for example want to create two objects from the same row.
340      *
341      * @throws TorqueException Any exceptions caught during processing will be
342      * rethrown wrapped into a TorqueException.
343      */

344     public static void populateObject(Record row,
345                                       int offset,
346                                       Sorder obj)
347         throws TorqueException
348     {
349         try
350         {
351                 obj.setSorderId(row.getValue(offset + 0).asInt());
352                   obj.setSorderCode(row.getValue(offset + 1).asString());
353                   obj.setStatus(row.getValue(offset + 2).asInt());
354                   obj.setPriority(row.getValue(offset + 3).asInt());
355                   obj.setIssuedDate(row.getValue(offset + 4).asUtilDate());
356                   obj.setClosedDate(row.getValue(offset + 5).asUtilDate());
357                   obj.setCustomerId(row.getValue(offset + 6).asInt());
358                   obj.setRecipientId(row.getValue(offset + 7).asInt());
359                   obj.setProjectId(row.getValue(offset + 8).asInt());
360                   obj.setCarrierId(row.getValue(offset + 9).asInt());
361                   obj.setPayTerm(row.getValue(offset + 10).asInt());
362                   obj.setPayMethod(row.getValue(offset + 11).asInt());
363                   obj.setCurrencyId(row.getValue(offset + 12).asInt());
364                   obj.setCurrencyAmount(row.getValue(offset + 13).asBigDecimal());
365                   obj.setSubject(row.getValue(offset + 14).asString());
366                   obj.setNotes(row.getValue(offset + 15).asString());
367                   obj.setCreated(row.getValue(offset + 16).asUtilDate());
368                   obj.setModified(row.getValue(offset + 17).asUtilDate());
369                   obj.setCreatedBy(row.getValue(offset + 18).asString());
370                   obj.setModifiedBy(row.getValue(offset + 19).asString());
371               }
372         catch (DataSetException e)
373         {
374             throw new TorqueException(e);
375         }
376     }
377
378     /**
379      * Method to do selects.
380      *
381      * @param criteria object used to create the SELECT statement.
382      * @return List of selected Objects
383      * @throws TorqueException Any exceptions caught during processing will be
384      * rethrown wrapped into a TorqueException.
385      */

386     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
387     {
388         return populateObjects(doSelectVillageRecords(criteria));
389     }
390
391     /**
392      * Method to do selects within a transaction.
393      *
394      * @param criteria object used to create the SELECT statement.
395      * @param con the connection to use
396      * @return List of selected Objects
397      * @throws TorqueException Any exceptions caught during processing will be
398      * rethrown wrapped into a TorqueException.
399      */

400     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
401         throws TorqueException
402     {
403         return populateObjects(doSelectVillageRecords(criteria, con));
404     }
405
406     /**
407      * Grabs the raw Village records to be formed into objects.
408      * This method handles connections internally. The Record objects
409      * returned by this method should be considered readonly. Do not
410      * alter the data and call save(), your results may vary, but are
411      * certainly likely to result in hard to track MT bugs.
412      *
413      * @throws TorqueException Any exceptions caught during processing will be
414      * rethrown wrapped into a TorqueException.
415      */

416     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
417         throws TorqueException
418     {
419         return BaseSorderPeer
420             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
421     }
422
423     /**
424      * Grabs the raw Village records to be formed into objects.
425      * This method should be used for transactions
426      *
427      * @param criteria object used to create the SELECT statement.
428      * @param con the connection to use
429      * @throws TorqueException Any exceptions caught during processing will be
430      * rethrown wrapped into a TorqueException.
431      */

432     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
433         throws TorqueException
434     {
435         if (criteria.getSelectColumns().size() == 0)
436         {
437             addSelectColumns(criteria);
438         }
439
440                                                                                                                           
441         setDbName(criteria);
442
443         // BasePeer returns a List of Value (Village) arrays. The array
444
// order follows the order columns were placed in the Select clause.
445
if (con == null)
446         {
447             return BasePeer.doSelect(criteria);
448         }
449         else
450         {
451             return BasePeer.doSelect(criteria, con);
452         }
453     }
454
455     /**
456      * The returned List will contain objects of the default type or
457      * objects that inherit from the default.
458      *
459      * @throws TorqueException Any exceptions caught during processing will be
460      * rethrown wrapped into a TorqueException.
461      */

462     public static List JavaDoc populateObjects(List JavaDoc records)
463         throws TorqueException
464     {
465         List JavaDoc results = new ArrayList JavaDoc(records.size());
466
467         // populate the object(s)
468
for (int i = 0; i < records.size(); i++)
469         {
470             Record row = (Record) records.get(i);
471               results.add(SorderPeer.row2Object(row, 1,
472                 SorderPeer.getOMClass()));
473           }
474         return results;
475     }
476  
477
478     /**
479      * The class that the Peer will make instances of.
480      * If the BO is abstract then you must implement this method
481      * in the BO.
482      *
483      * @throws TorqueException Any exceptions caught during processing will be
484      * rethrown wrapped into a TorqueException.
485      */

486     public static Class JavaDoc getOMClass()
487         throws TorqueException
488     {
489         return CLASS_DEFAULT;
490     }
491
492     /**
493      * Method to do updates.
494      *
495      * @param criteria object containing data that is used to create the UPDATE
496      * statement.
497      * @throws TorqueException Any exceptions caught during processing will be
498      * rethrown wrapped into a TorqueException.
499      */

500     public static void doUpdate(Criteria criteria) throws TorqueException
501     {
502          BaseSorderPeer
503             .doUpdate(criteria, (Connection JavaDoc) null);
504     }
505
506     /**
507      * Method to do updates. This method is to be used during a transaction,
508      * otherwise use the doUpdate(Criteria) method. It will take care of
509      * the connection details internally.
510      *
511      * @param criteria object containing data that is used to create the UPDATE
512      * statement.
513      * @param con the connection to use
514      * @throws TorqueException Any exceptions caught during processing will be
515      * rethrown wrapped into a TorqueException.
516      */

517     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
518         throws TorqueException
519     {
520         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
521                    selectCriteria.put(SORDER_ID, criteria.remove(SORDER_ID));
522                                                                                                                                                                                                     
523         setDbName(criteria);
524
525         if (con == null)
526         {
527             BasePeer.doUpdate(selectCriteria, criteria);
528         }
529         else
530         {
531             BasePeer.doUpdate(selectCriteria, criteria, con);
532         }
533     }
534
535     /**
536      * Method to do deletes.
537      *
538      * @param criteria object containing data that is used DELETE from database.
539      * @throws TorqueException Any exceptions caught during processing will be
540      * rethrown wrapped into a TorqueException.
541      */

542      public static void doDelete(Criteria criteria) throws TorqueException
543      {
544          SorderPeer
545             .doDelete(criteria, (Connection JavaDoc) null);
546      }
547
548     /**
549      * Method to do deletes. This method is to be used during a transaction,
550      * otherwise use the doDelete(Criteria) method. It will take care of
551      * the connection details internally.
552      *
553      * @param criteria object containing data that is used DELETE from database.
554      * @param con the connection to use
555      * @throws TorqueException Any exceptions caught during processing will be
556      * rethrown wrapped into a TorqueException.
557      */

558      public static void doDelete(Criteria criteria, Connection JavaDoc con)
559         throws TorqueException
560      {
561                                                                                                                           
562         setDbName(criteria);
563
564         if (con == null)
565         {
566             BasePeer.doDelete(criteria);
567         }
568         else
569         {
570             BasePeer.doDelete(criteria, con);
571         }
572      }
573
574     /**
575      * Method to do selects
576      *
577      * @throws TorqueException Any exceptions caught during processing will be
578      * rethrown wrapped into a TorqueException.
579      */

580     public static List JavaDoc doSelect(Sorder obj) throws TorqueException
581     {
582         return doSelect(buildSelectCriteria(obj));
583     }
584
585     /**
586      * Method to do inserts
587      *
588      * @throws TorqueException Any exceptions caught during processing will be
589      * rethrown wrapped into a TorqueException.
590      */

591     public static void doInsert(Sorder obj) throws TorqueException
592     {
593           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
594           obj.setNew(false);
595         obj.setModified(false);
596     }
597
598     /**
599      * @param obj the data object to update in the database.
600      * @throws TorqueException Any exceptions caught during processing will be
601      * rethrown wrapped into a TorqueException.
602      */

603     public static void doUpdate(Sorder obj) throws TorqueException
604     {
605         doUpdate(buildCriteria(obj));
606         obj.setModified(false);
607     }
608
609     /**
610      * @param obj the data object to delete in the database.
611      * @throws TorqueException Any exceptions caught during processing will be
612      * rethrown wrapped into a TorqueException.
613      */

614     public static void doDelete(Sorder obj) throws TorqueException
615     {
616         doDelete(buildSelectCriteria(obj));
617     }
618
619     /**
620      * Method to do inserts. This method is to be used during a transaction,
621      * otherwise use the doInsert(Sorder) method. It will take
622      * care of the connection details internally.
623      *
624      * @param obj the data object to insert into the database.
625      * @param con the connection to use
626      * @throws TorqueException Any exceptions caught during processing will be
627      * rethrown wrapped into a TorqueException.
628      */

629     public static void doInsert(Sorder obj, Connection JavaDoc con)
630         throws TorqueException
631     {
632           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
633           obj.setNew(false);
634         obj.setModified(false);
635     }
636
637     /**
638      * Method to do update. This method is to be used during a transaction,
639      * otherwise use the doUpdate(Sorder) method. It will take
640      * care of the connection details internally.
641      *
642      * @param obj the data object to update in the database.
643      * @param con the connection to use
644      * @throws TorqueException Any exceptions caught during processing will be
645      * rethrown wrapped into a TorqueException.
646      */

647     public static void doUpdate(Sorder obj, Connection JavaDoc con)
648         throws TorqueException
649     {
650         doUpdate(buildCriteria(obj), con);
651         obj.setModified(false);
652     }
653
654     /**
655      * Method to delete. This method is to be used during a transaction,
656      * otherwise use the doDelete(Sorder) method. It will take
657      * care of the connection details internally.
658      *
659      * @param obj the data object to delete in the database.
660      * @param con the connection to use
661      * @throws TorqueException Any exceptions caught during processing will be
662      * rethrown wrapped into a TorqueException.
663      */

664     public static void doDelete(Sorder obj, Connection JavaDoc con)
665         throws TorqueException
666     {
667         doDelete(buildSelectCriteria(obj), con);
668     }
669
670     /**
671      * Method to do deletes.
672      *
673      * @param pk ObjectKey that is used DELETE from database.
674      * @throws TorqueException Any exceptions caught during processing will be
675      * rethrown wrapped into a TorqueException.
676      */

677     public static void doDelete(ObjectKey pk) throws TorqueException
678     {
679         BaseSorderPeer
680            .doDelete(pk, (Connection JavaDoc) null);
681     }
682
683     /**
684      * Method to delete. This method is to be used during a transaction,
685      * otherwise use the doDelete(ObjectKey) method. It will take
686      * care of the connection details internally.
687      *
688      * @param pk the primary key for the object to delete in the database.
689      * @param con the connection to use
690      * @throws TorqueException Any exceptions caught during processing will be
691      * rethrown wrapped into a TorqueException.
692      */

693     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
694         throws TorqueException
695     {
696         doDelete(buildCriteria(pk), con);
697     }
698
699     /** Build a Criteria object from an ObjectKey */
700     public static Criteria buildCriteria( ObjectKey pk )
701     {
702         Criteria criteria = new Criteria();
703               criteria.add(SORDER_ID, pk);
704           return criteria;
705      }
706
707     /** Build a Criteria object from the data object for this peer */
708     public static Criteria buildCriteria( Sorder obj )
709     {
710         Criteria criteria = new Criteria(DATABASE_NAME);
711               if (!obj.isNew())
712             criteria.add(SORDER_ID, obj.getSorderId());
713               criteria.add(SORDER_CODE, obj.getSorderCode());
714               criteria.add(STATUS, obj.getStatus());
715               criteria.add(PRIORITY, obj.getPriority());
716               criteria.add(ISSUED_DATE, obj.getIssuedDate());
717               criteria.add(CLOSED_DATE, obj.getClosedDate());
718               criteria.add(CUSTOMER_ID, obj.getCustomerId());
719               criteria.add(RECIPIENT_ID, obj.getRecipientId());
720               criteria.add(PROJECT_ID, obj.getProjectId());
721               criteria.add(CARRIER_ID, obj.getCarrierId());
722               criteria.add(PAY_TERM, obj.getPayTerm());
723               criteria.add(PAY_METHOD, obj.getPayMethod());
724               criteria.add(CURRENCY_ID, obj.getCurrencyId());
725               criteria.add(CURRENCY_AMOUNT, obj.getCurrencyAmount());
726               criteria.add(SUBJECT, obj.getSubject());
727               criteria.add(NOTES, obj.getNotes());
728               criteria.add(CREATED, obj.getCreated());
729               criteria.add(MODIFIED, obj.getModified());
730               criteria.add(CREATED_BY, obj.getCreatedBy());
731               criteria.add(MODIFIED_BY, obj.getModifiedBy());
732           return criteria;
733     }
734
735     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
736     public static Criteria buildSelectCriteria( Sorder obj )
737     {
738         Criteria criteria = new Criteria(DATABASE_NAME);
739               if (!obj.isNew())
740                     criteria.add(SORDER_ID, obj.getSorderId());
741                           criteria.add(SORDER_CODE, obj.getSorderCode());
742                           criteria.add(STATUS, obj.getStatus());
743                           criteria.add(PRIORITY, obj.getPriority());
744                           criteria.add(ISSUED_DATE, obj.getIssuedDate());
745                           criteria.add(CLOSED_DATE, obj.getClosedDate());
746                           criteria.add(CUSTOMER_ID, obj.getCustomerId());
747                           criteria.add(RECIPIENT_ID, obj.getRecipientId());
748                           criteria.add(PROJECT_ID, obj.getProjectId());
749                           criteria.add(CARRIER_ID, obj.getCarrierId());
750                           criteria.add(PAY_TERM, obj.getPayTerm());
751                           criteria.add(PAY_METHOD, obj.getPayMethod());
752                           criteria.add(CURRENCY_ID, obj.getCurrencyId());
753                           criteria.add(CURRENCY_AMOUNT, obj.getCurrencyAmount());
754                           criteria.add(SUBJECT, obj.getSubject());
755                           criteria.add(NOTES, obj.getNotes());
756                           criteria.add(CREATED, obj.getCreated());
757                           criteria.add(MODIFIED, obj.getModified());
758                           criteria.add(CREATED_BY, obj.getCreatedBy());
759                           criteria.add(MODIFIED_BY, obj.getModifiedBy());
760               return criteria;
761     }
762  
763     
764         /**
765      * Retrieve a single object by pk
766      *
767      * @param pk the primary key
768      * @throws TorqueException Any exceptions caught during processing will be
769      * rethrown wrapped into a TorqueException.
770      * @throws NoRowsException Primary key was not found in database.
771      * @throws TooManyRowsException Primary key was not found in database.
772      */

773     public static Sorder retrieveByPK(int pk)
774         throws TorqueException, NoRowsException, TooManyRowsException
775     {
776         return retrieveByPK(SimpleKey.keyFor(pk));
777     }
778
779     /**
780      * Retrieve a single object by pk
781      *
782      * @param pk the primary key
783      * @param con the connection to use
784      * @throws TorqueException Any exceptions caught during processing will be
785      * rethrown wrapped into a TorqueException.
786      * @throws NoRowsException Primary key was not found in database.
787      * @throws TooManyRowsException Primary key was not found in database.
788      */

789     public static Sorder retrieveByPK(int pk, Connection JavaDoc con)
790         throws TorqueException, NoRowsException, TooManyRowsException
791     {
792         return retrieveByPK(SimpleKey.keyFor(pk), con);
793     }
794   
795     /**
796      * Retrieve a single object by pk
797      *
798      * @param pk the primary key
799      * @throws TorqueException Any exceptions caught during processing will be
800      * rethrown wrapped into a TorqueException.
801      * @throws NoRowsException Primary key was not found in database.
802      * @throws TooManyRowsException Primary key was not found in database.
803      */

804     public static Sorder retrieveByPK(ObjectKey pk)
805         throws TorqueException, NoRowsException, TooManyRowsException
806     {
807         Connection JavaDoc db = null;
808         Sorder retVal = null;
809         try
810         {
811             db = Torque.getConnection(DATABASE_NAME);
812             retVal = retrieveByPK(pk, db);
813         }
814         finally
815         {
816             Torque.closeConnection(db);
817         }
818         return(retVal);
819     }
820
821     /**
822      * Retrieve a single object by pk
823      *
824      * @param pk the primary key
825      * @param con the connection to use
826      * @throws TorqueException Any exceptions caught during processing will be
827      * rethrown wrapped into a TorqueException.
828      * @throws NoRowsException Primary key was not found in database.
829      * @throws TooManyRowsException Primary key was not found in database.
830      */

831     public static Sorder retrieveByPK(ObjectKey pk, Connection JavaDoc con)
832         throws TorqueException, NoRowsException, TooManyRowsException
833     {
834         Criteria criteria = buildCriteria(pk);
835         List JavaDoc v = doSelect(criteria, con);
836         if (v.size() == 0)
837         {
838             throw new NoRowsException("Failed to select a row.");
839         }
840         else if (v.size() > 1)
841         {
842             throw new TooManyRowsException("Failed to select only one row.");
843         }
844         else
845         {
846             return (Sorder)v.get(0);
847         }
848     }
849
850     /**
851      * Retrieve a multiple objects by pk
852      *
853      * @param pks List of primary keys
854      * @throws TorqueException Any exceptions caught during processing will be
855      * rethrown wrapped into a TorqueException.
856      */

857     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
858         throws TorqueException
859     {
860         Connection JavaDoc db = null;
861         List JavaDoc retVal = null;
862         try
863         {
864            db = Torque.getConnection(DATABASE_NAME);
865            retVal = retrieveByPKs(pks, db);
866         }
867         finally
868         {
869             Torque.closeConnection(db);
870         }
871         return(retVal);
872     }
873
874     /**
875      * Retrieve a multiple objects by pk
876      *
877      * @param pks List of primary keys
878      * @param dbcon the connection to use
879      * @throws TorqueException Any exceptions caught during processing will be
880      * rethrown wrapped into a TorqueException.
881      */

882     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
883         throws TorqueException
884     {
885         List JavaDoc objs = null;
886         if (pks == null || pks.size() == 0)
887         {
888             objs = new LinkedList JavaDoc();
889         }
890         else
891         {
892             Criteria criteria = new Criteria();
893               criteria.addIn( SORDER_ID, pks );
894           objs = doSelect(criteria, dbcon);
895         }
896         return objs;
897     }
898
899  
900
901
902
903                   
904                                                         
905                 
906                 
907
908     /**
909      * selects a collection of Sorder objects pre-filled with their
910      * Customer objects.
911      *
912      * This method is protected by default in order to keep the public
913      * api reasonable. You can provide public methods for those you
914      * actually need in SorderPeer.
915      *
916      * @throws TorqueException Any exceptions caught during processing will be
917      * rethrown wrapped into a TorqueException.
918      */

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

984     protected static List JavaDoc doSelectJoinCustomerRelatedByRecipientId(Criteria criteria)
985         throws TorqueException
986     {
987         setDbName(criteria);
988
989         SorderPeer.addSelectColumns(criteria);
990         int offset = numColumns + 1;
991         CustomerPeer.addSelectColumns(criteria);
992
993
994                         criteria.addJoin(SorderPeer.RECIPIENT_ID,
995             CustomerPeer.CUSTOMER_ID);
996         
997
998                                                                                                                                                                                                                                                                                                                                                                                 
999         List JavaDoc rows = BasePeer.doSelect(criteria);
1000        List JavaDoc results = new ArrayList JavaDoc();
1001
1002        for (int i = 0; i < rows.size(); i++)
1003        {
1004            Record row = (Record) rows.get(i);
1005
1006                            Class JavaDoc omClass = SorderPeer.getOMClass();
1007                    Sorder obj1 = (Sorder) SorderPeer
1008                .row2Object(row, 1, omClass);
1009                     omClass = CustomerPeer.getOMClass();
1010                    Customer obj2 = (Customer)CustomerPeer
1011                .row2Object(row, offset, omClass);
1012
1013            boolean newObject = true;
1014            for (int j = 0; j < results.size(); j++)
1015            {
1016                Sorder temp_obj1 = (Sorder)results.get(j);
1017                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1018                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1019                {
1020                    newObject = false;
1021                              temp_obj2.addSorderRelatedByRecipientId(obj1);
1022                              break;
1023                }
1024            }
1025                      if (newObject)
1026            {
1027                obj2.initSordersRelatedByRecipientId();
1028                obj2.addSorderRelatedByRecipientId(obj1);
1029            }
1030                      results.add(obj1);
1031        }
1032        return results;
1033    }
1034                                                            
1035                
1036                
1037
1038    /**
1039     * selects a collection of Sorder objects pre-filled with their
1040     * Project objects.
1041     *
1042     * This method is protected by default in order to keep the public
1043     * api reasonable. You can provide public methods for those you
1044     * actually need in SorderPeer.
1045     *
1046     * @throws TorqueException Any exceptions caught during processing will be
1047     * rethrown wrapped into a TorqueException.
1048     */

1049    protected static List JavaDoc doSelectJoinProject(Criteria criteria)
1050        throws TorqueException
1051    {
1052        setDbName(criteria);
1053
1054        SorderPeer.addSelectColumns(criteria);
1055        int offset = numColumns + 1;
1056        ProjectPeer.addSelectColumns(criteria);
1057
1058
1059                        criteria.addJoin(SorderPeer.PROJECT_ID,
1060            ProjectPeer.PROJECT_ID);
1061        
1062
1063                                                                                                                                                                                                                                                                                                                                                                                
1064        List JavaDoc rows = BasePeer.doSelect(criteria);
1065        List JavaDoc results = new ArrayList JavaDoc();
1066
1067        for (int i = 0; i < rows.size(); i++)
1068        {
1069            Record row = (Record) rows.get(i);
1070
1071                            Class JavaDoc omClass = SorderPeer.getOMClass();
1072                    Sorder obj1 = (Sorder) SorderPeer
1073                .row2Object(row, 1, omClass);
1074                     omClass = ProjectPeer.getOMClass();
1075                    Project obj2 = (Project)ProjectPeer
1076                .row2Object(row, offset, omClass);
1077
1078            boolean newObject = true;
1079            for (int j = 0; j < results.size(); j++)
1080            {
1081                Sorder temp_obj1 = (Sorder)results.get(j);
1082                Project temp_obj2 = (Project)temp_obj1.getProject();
1083                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1084                {
1085                    newObject = false;
1086                              temp_obj2.addSorder(obj1);
1087                              break;
1088                }
1089            }
1090                      if (newObject)
1091            {
1092                obj2.initSorders();
1093                obj2.addSorder(obj1);
1094            }
1095                      results.add(obj1);
1096        }
1097        return results;
1098    }
1099                                                            
1100                
1101                
1102
1103    /**
1104     * selects a collection of Sorder objects pre-filled with their
1105     * Carrier objects.
1106     *
1107     * This method is protected by default in order to keep the public
1108     * api reasonable. You can provide public methods for those you
1109     * actually need in SorderPeer.
1110     *
1111     * @throws TorqueException Any exceptions caught during processing will be
1112     * rethrown wrapped into a TorqueException.
1113     */

1114    protected static List JavaDoc doSelectJoinCarrier(Criteria criteria)
1115        throws TorqueException
1116    {
1117        setDbName(criteria);
1118
1119        SorderPeer.addSelectColumns(criteria);
1120        int offset = numColumns + 1;
1121        CarrierPeer.addSelectColumns(criteria);
1122
1123
1124                        criteria.addJoin(SorderPeer.CARRIER_ID,
1125            CarrierPeer.CARRIER_ID);
1126        
1127
1128                                                                                                                                                                                                                                                                                                                                                                                
1129        List JavaDoc rows = BasePeer.doSelect(criteria);
1130        List JavaDoc results = new ArrayList JavaDoc();
1131
1132        for (int i = 0; i < rows.size(); i++)
1133        {
1134            Record row = (Record) rows.get(i);
1135
1136                            Class JavaDoc omClass = SorderPeer.getOMClass();
1137                    Sorder obj1 = (Sorder) SorderPeer
1138                .row2Object(row, 1, omClass);
1139                     omClass = CarrierPeer.getOMClass();
1140                    Carrier obj2 = (Carrier)CarrierPeer
1141                .row2Object(row, offset, omClass);
1142
1143            boolean newObject = true;
1144            for (int j = 0; j < results.size(); j++)
1145            {
1146                Sorder temp_obj1 = (Sorder)results.get(j);
1147                Carrier temp_obj2 = (Carrier)temp_obj1.getCarrier();
1148                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1149                {
1150                    newObject = false;
1151                              temp_obj2.addSorder(obj1);
1152                              break;
1153                }
1154            }
1155                      if (newObject)
1156            {
1157                obj2.initSorders();
1158                obj2.addSorder(obj1);
1159            }
1160                      results.add(obj1);
1161        }
1162        return results;
1163    }
1164                                                            
1165                
1166                
1167
1168    /**
1169     * selects a collection of Sorder objects pre-filled with their
1170     * Currency objects.
1171     *
1172     * This method is protected by default in order to keep the public
1173     * api reasonable. You can provide public methods for those you
1174     * actually need in SorderPeer.
1175     *
1176     * @throws TorqueException Any exceptions caught during processing will be
1177     * rethrown wrapped into a TorqueException.
1178     */

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

1248    protected static List JavaDoc doSelectJoinAllExceptCustomerRelatedByCustomerId(Criteria criteria)
1249        throws TorqueException
1250    {
1251        setDbName(criteria);
1252
1253        addSelectColumns(criteria);
1254        int offset2 = numColumns + 1;
1255                                    
1256                                                  
1257                                                  
1258                    ProjectPeer.addSelectColumns(criteria);
1259        int offset3 = offset2 + ProjectPeer.numColumns;
1260                                                                
1261                    CarrierPeer.addSelectColumns(criteria);
1262        int offset4 = offset3 + CarrierPeer.numColumns;
1263                                                                
1264                    CurrencyPeer.addSelectColumns(criteria);
1265        int offset5 = offset4 + CurrencyPeer.numColumns;
1266                                                                                                                                                                                                                                                                                                                                                                                                                            
1267        List JavaDoc rows = BasePeer.doSelect(criteria);
1268        List JavaDoc results = new ArrayList JavaDoc();
1269
1270        for (int i = 0; i < rows.size(); i++)
1271        {
1272            Record row = (Record)rows.get(i);
1273
1274                            Class JavaDoc omClass = SorderPeer.getOMClass();
1275                    Sorder obj1 = (Sorder)SorderPeer
1276                .row2Object(row, 1, omClass);
1277                                                
1278                                                                  
1279                                                                  
1280                                                        
1281                            
1282              
1283                           omClass = ProjectPeer.getOMClass();
1284                          Project obj2 = (Project)ProjectPeer
1285                .row2Object( row, offset2, omClass);
1286
1287               boolean newObject = true;
1288            for (int j = 0; j < results.size(); j++)
1289            {
1290                Sorder temp_obj1 = (Sorder)results.get(j);
1291                Project temp_obj2 = (Project)temp_obj1.getProject();
1292                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1293                {
1294                    newObject = false;
1295                                    temp_obj2.addSorder(obj1);
1296                                    break;
1297                }
1298            }
1299                            if (newObject)
1300            {
1301                obj2.initSorders();
1302                obj2.addSorder(obj1);
1303            }
1304                                                                                    
1305                                                        
1306                            
1307              
1308                           omClass = CarrierPeer.getOMClass();
1309                          Carrier obj3 = (Carrier)CarrierPeer
1310                .row2Object( row, offset3, omClass);
1311
1312               newObject = true;
1313            for (int j = 0; j < results.size(); j++)
1314            {
1315                Sorder temp_obj1 = (Sorder)results.get(j);
1316                Carrier temp_obj3 = (Carrier)temp_obj1.getCarrier();
1317                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1318                {
1319                    newObject = false;
1320                                    temp_obj3.addSorder(obj1);
1321                                    break;
1322                }
1323            }
1324                            if (newObject)
1325            {
1326                obj3.initSorders();
1327                obj3.addSorder(obj1);
1328            }
1329                                                                                    
1330                                                        
1331                            
1332              
1333                           omClass = CurrencyPeer.getOMClass();
1334                          Currency obj4 = (Currency)CurrencyPeer
1335                .row2Object( row, offset4, omClass);
1336
1337               newObject = true;
1338            for (int j = 0; j < results.size(); j++)
1339            {
1340                Sorder temp_obj1 = (Sorder)results.get(j);
1341                Currency temp_obj4 = (Currency)temp_obj1.getCurrency();
1342                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1343                {
1344                    newObject = false;
1345                                    temp_obj4.addSorder(obj1);
1346                                    break;
1347                }
1348            }
1349                            if (newObject)
1350            {
1351                obj4.initSorders();
1352                obj4.addSorder(obj1);
1353            }
1354                                                                results.add(obj1);
1355        }
1356        return results;
1357    }
1358        
1359        
1360                                            
1361                
1362
1363    /**
1364     * selects a collection of Sorder objects pre-filled with
1365     * all related objects.
1366     *
1367     * This method is protected by default in order to keep the public
1368     * api reasonable. You can provide public methods for those you
1369     * actually need in SorderPeer.
1370     *
1371     * @throws TorqueException Any exceptions caught during processing will be
1372     * rethrown wrapped into a TorqueException.
1373     */

1374    protected static List JavaDoc doSelectJoinAllExceptCustomerRelatedByRecipientId(Criteria criteria)
1375        throws TorqueException
1376    {
1377        setDbName(criteria);
1378
1379        addSelectColumns(criteria);
1380        int offset2 = numColumns + 1;
1381                                    
1382                                                  
1383                                                  
1384                    ProjectPeer.addSelectColumns(criteria);
1385        int offset3 = offset2 + ProjectPeer.numColumns;
1386                                                                
1387                    CarrierPeer.addSelectColumns(criteria);
1388        int offset4 = offset3 + CarrierPeer.numColumns;
1389                                                                
1390                    CurrencyPeer.addSelectColumns(criteria);
1391        int offset5 = offset4 + CurrencyPeer.numColumns;
1392                                                                                                                                                                                                                                                                                                                                                                                                                            
1393        List JavaDoc rows = BasePeer.doSelect(criteria);
1394        List JavaDoc results = new ArrayList JavaDoc();
1395
1396        for (int i = 0; i < rows.size(); i++)
1397        {
1398            Record row = (Record)rows.get(i);
1399
1400                            Class JavaDoc omClass = SorderPeer.getOMClass();
1401                    Sorder obj1 = (Sorder)SorderPeer
1402                .row2Object(row, 1, omClass);
1403                                                
1404                                                                  
1405                                                                  
1406                                                        
1407                            
1408              
1409                           omClass = ProjectPeer.getOMClass();
1410                          Project obj2 = (Project)ProjectPeer
1411                .row2Object( row, offset2, omClass);
1412
1413               boolean newObject = true;
1414            for (int j = 0; j < results.size(); j++)
1415            {
1416                Sorder temp_obj1 = (Sorder)results.get(j);
1417                Project temp_obj2 = (Project)temp_obj1.getProject();
1418                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1419                {
1420                    newObject = false;
1421                                    temp_obj2.addSorder(obj1);
1422                                    break;
1423                }
1424            }
1425                            if (newObject)
1426            {
1427                obj2.initSorders();
1428                obj2.addSorder(obj1);
1429            }
1430                                                                                    
1431                                                        
1432                            
1433              
1434                           omClass = CarrierPeer.getOMClass();
1435                          Carrier obj3 = (Carrier)CarrierPeer
1436                .row2Object( row, offset3, omClass);
1437
1438               newObject = true;
1439            for (int j = 0; j < results.size(); j++)
1440            {
1441                Sorder temp_obj1 = (Sorder)results.get(j);
1442                Carrier temp_obj3 = (Carrier)temp_obj1.getCarrier();
1443                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1444                {
1445                    newObject = false;
1446                                    temp_obj3.addSorder(obj1);
1447                                    break;
1448                }
1449            }
1450                            if (newObject)
1451            {
1452                obj3.initSorders();
1453                obj3.addSorder(obj1);
1454            }
1455                                                                                    
1456                                                        
1457                            
1458              
1459                           omClass = CurrencyPeer.getOMClass();
1460                          Currency obj4 = (Currency)CurrencyPeer
1461                .row2Object( row, offset4, omClass);
1462
1463               newObject = true;
1464            for (int j = 0; j < results.size(); j++)
1465            {
1466                Sorder temp_obj1 = (Sorder)results.get(j);
1467                Currency temp_obj4 = (Currency)temp_obj1.getCurrency();
1468                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1469                {
1470                    newObject = false;
1471                                    temp_obj4.addSorder(obj1);
1472                                    break;
1473                }
1474            }
1475                            if (newObject)
1476            {
1477                obj4.initSorders();
1478                obj4.addSorder(obj1);
1479            }
1480                                                                results.add(obj1);
1481        }
1482        return results;
1483    }
1484        
1485        
1486                                  
1487                
1488
1489    /**
1490     * selects a collection of Sorder objects pre-filled with
1491     * all related objects.
1492     *
1493     * This method is protected by default in order to keep the public
1494     * api reasonable. You can provide public methods for those you
1495     * actually need in SorderPeer.
1496     *
1497     * @throws TorqueException Any exceptions caught during processing will be
1498     * rethrown wrapped into a TorqueException.
1499     */

1500    protected static List JavaDoc doSelectJoinAllExceptProject(Criteria criteria)
1501        throws TorqueException
1502    {
1503        setDbName(criteria);
1504
1505        addSelectColumns(criteria);
1506        int offset2 = numColumns + 1;
1507                                    
1508                    CustomerPeer.addSelectColumns(criteria);
1509        int offset3 = offset2 + CustomerPeer.numColumns;
1510                                                                
1511                    CustomerPeer.addSelectColumns(criteria);
1512        int offset4 = offset3 + CustomerPeer.numColumns;
1513                                                                
1514                                                  
1515                    CarrierPeer.addSelectColumns(criteria);
1516        int offset5 = offset4 + CarrierPeer.numColumns;
1517                                                                
1518                    CurrencyPeer.addSelectColumns(criteria);
1519        int offset6 = offset5 + CurrencyPeer.numColumns;
1520                                                                                                                                                                                                                                                                                                                                                                                                                            
1521        List JavaDoc rows = BasePeer.doSelect(criteria);
1522        List JavaDoc results = new ArrayList JavaDoc();
1523
1524        for (int i = 0; i < rows.size(); i++)
1525        {
1526            Record row = (Record)rows.get(i);
1527
1528                            Class JavaDoc omClass = SorderPeer.getOMClass();
1529                    Sorder obj1 = (Sorder)SorderPeer
1530                .row2Object(row, 1, omClass);
1531                                                
1532                                                                        
1533                            
1534              
1535                           omClass = CustomerPeer.getOMClass();
1536                          Customer obj2 = (Customer)CustomerPeer
1537                .row2Object( row, offset2, omClass);
1538
1539               boolean newObject = true;
1540            for (int j = 0; j < results.size(); j++)
1541            {
1542                Sorder temp_obj1 = (Sorder)results.get(j);
1543                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1544                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1545                {
1546                    newObject = false;
1547                                    temp_obj2.addSorderRelatedByCustomerId(obj1);
1548                                    break;
1549                }
1550            }
1551                            if (newObject)
1552            {
1553                obj2.initSordersRelatedByCustomerId();
1554                obj2.addSorderRelatedByCustomerId(obj1);
1555            }
1556                                                                                    
1557                                                                        
1558                            
1559              
1560                           omClass = CustomerPeer.getOMClass();
1561                          Customer obj3 = (Customer)CustomerPeer
1562                .row2Object( row, offset3, omClass);
1563
1564               newObject = true;
1565            for (int j = 0; j < results.size(); j++)
1566            {
1567                Sorder temp_obj1 = (Sorder)results.get(j);
1568                Customer temp_obj3 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1569                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1570                {
1571                    newObject = false;
1572                                    temp_obj3.addSorderRelatedByRecipientId(obj1);
1573                                    break;
1574                }
1575            }
1576                            if (newObject)
1577            {
1578                obj3.initSordersRelatedByRecipientId();
1579                obj3.addSorderRelatedByRecipientId(obj1);
1580            }
1581                                                                                    
1582                                                                  
1583                                                        
1584                            
1585              
1586                           omClass = CarrierPeer.getOMClass();
1587                          Carrier obj4 = (Carrier)CarrierPeer
1588                .row2Object( row, offset4, omClass);
1589
1590               newObject = true;
1591            for (int j = 0; j < results.size(); j++)
1592            {
1593                Sorder temp_obj1 = (Sorder)results.get(j);
1594                Carrier temp_obj4 = (Carrier)temp_obj1.getCarrier();
1595                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1596                {
1597                    newObject = false;
1598                                    temp_obj4.addSorder(obj1);
1599                                    break;
1600                }
1601            }
1602                            if (newObject)
1603            {
1604                obj4.initSorders();
1605                obj4.addSorder(obj1);
1606            }
1607                                                                                    
1608                                                        
1609                            
1610              
1611                           omClass = CurrencyPeer.getOMClass();
1612                          Currency obj5 = (Currency)CurrencyPeer
1613                .row2Object( row, offset5, omClass);
1614
1615               newObject = true;
1616            for (int j = 0; j < results.size(); j++)
1617            {
1618                Sorder temp_obj1 = (Sorder)results.get(j);
1619                Currency temp_obj5 = (Currency)temp_obj1.getCurrency();
1620                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1621                {
1622                    newObject = false;
1623                                    temp_obj5.addSorder(obj1);
1624                                    break;
1625                }
1626            }
1627                            if (newObject)
1628            {
1629                obj5.initSorders();
1630                obj5.addSorder(obj1);
1631            }
1632                                                                results.add(obj1);
1633        }
1634        return results;
1635    }
1636        
1637        
1638                                  
1639                
1640
1641    /**
1642     * selects a collection of Sorder objects pre-filled with
1643     * all related objects.
1644     *
1645     * This method is protected by default in order to keep the public
1646     * api reasonable. You can provide public methods for those you
1647     * actually need in SorderPeer.
1648     *
1649     * @throws TorqueException Any exceptions caught during processing will be
1650     * rethrown wrapped into a TorqueException.
1651     */

1652    protected static List JavaDoc doSelectJoinAllExceptCarrier(Criteria criteria)
1653        throws TorqueException
1654    {
1655        setDbName(criteria);
1656
1657        addSelectColumns(criteria);
1658        int offset2 = numColumns + 1;
1659                                    
1660                    CustomerPeer.addSelectColumns(criteria);
1661        int offset3 = offset2 + CustomerPeer.numColumns;
1662                                                                
1663                    CustomerPeer.addSelectColumns(criteria);
1664        int offset4 = offset3 + CustomerPeer.numColumns;
1665                                                                
1666                    ProjectPeer.addSelectColumns(criteria);
1667        int offset5 = offset4 + ProjectPeer.numColumns;
1668                                                                
1669                                                  
1670                    CurrencyPeer.addSelectColumns(criteria);
1671        int offset6 = offset5 + CurrencyPeer.numColumns;
1672                                                                                                                                                                                                                                                                                                                                                                                                                            
1673        List JavaDoc rows = BasePeer.doSelect(criteria);
1674        List JavaDoc results = new ArrayList JavaDoc();
1675
1676        for (int i = 0; i < rows.size(); i++)
1677        {
1678            Record row = (Record)rows.get(i);
1679
1680                            Class JavaDoc omClass = SorderPeer.getOMClass();
1681                    Sorder obj1 = (Sorder)SorderPeer
1682                .row2Object(row, 1, omClass);
1683                                                
1684                                                                        
1685                            
1686              
1687                           omClass = CustomerPeer.getOMClass();
1688                          Customer obj2 = (Customer)CustomerPeer
1689                .row2Object( row, offset2, omClass);
1690
1691               boolean newObject = true;
1692            for (int j = 0; j < results.size(); j++)
1693            {
1694                Sorder temp_obj1 = (Sorder)results.get(j);
1695                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1696                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1697                {
1698                    newObject = false;
1699                                    temp_obj2.addSorderRelatedByCustomerId(obj1);
1700                                    break;
1701                }
1702            }
1703                            if (newObject)
1704            {
1705                obj2.initSordersRelatedByCustomerId();
1706                obj2.addSorderRelatedByCustomerId(obj1);
1707            }
1708                                                                                    
1709                                                                        
1710                            
1711              
1712                           omClass = CustomerPeer.getOMClass();
1713                          Customer obj3 = (Customer)CustomerPeer
1714                .row2Object( row, offset3, omClass);
1715
1716               newObject = true;
1717            for (int j = 0; j < results.size(); j++)
1718            {
1719                Sorder temp_obj1 = (Sorder)results.get(j);
1720                Customer temp_obj3 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1721                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1722                {
1723                    newObject = false;
1724                                    temp_obj3.addSorderRelatedByRecipientId(obj1);
1725                                    break;
1726                }
1727            }
1728                            if (newObject)
1729            {
1730                obj3.initSordersRelatedByRecipientId();
1731                obj3.addSorderRelatedByRecipientId(obj1);
1732            }
1733                                                                                    
1734                                                        
1735                            
1736              
1737                           omClass = ProjectPeer.getOMClass();
1738                          Project obj4 = (Project)ProjectPeer
1739                .row2Object( row, offset4, omClass);
1740
1741               newObject = true;
1742            for (int j = 0; j < results.size(); j++)
1743            {
1744                Sorder temp_obj1 = (Sorder)results.get(j);
1745                Project temp_obj4 = (Project)temp_obj1.getProject();
1746                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1747                {
1748                    newObject = false;
1749                                    temp_obj4.addSorder(obj1);
1750                                    break;
1751                }
1752            }
1753                            if (newObject)
1754            {
1755                obj4.initSorders();
1756                obj4.addSorder(obj1);
1757            }
1758                                                                                    
1759                                                                  
1760                                                        
1761                            
1762              
1763                           omClass = CurrencyPeer.getOMClass();
1764                          Currency obj5 = (Currency)CurrencyPeer
1765                .row2Object( row, offset5, omClass);
1766
1767               newObject = true;
1768            for (int j = 0; j < results.size(); j++)
1769            {
1770                Sorder temp_obj1 = (Sorder)results.get(j);
1771                Currency temp_obj5 = (Currency)temp_obj1.getCurrency();
1772                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1773                {
1774                    newObject = false;
1775                                    temp_obj5.addSorder(obj1);
1776                                    break;
1777                }
1778            }
1779                            if (newObject)
1780            {
1781                obj5.initSorders();
1782                obj5.addSorder(obj1);
1783            }
1784                                                                results.add(obj1);
1785        }
1786        return results;
1787    }
1788        
1789        
1790                                  
1791                
1792
1793    /**
1794     * selects a collection of Sorder objects pre-filled with
1795     * all related objects.
1796     *
1797     * This method is protected by default in order to keep the public
1798     * api reasonable. You can provide public methods for those you
1799     * actually need in SorderPeer.
1800     *
1801     * @throws TorqueException Any exceptions caught during processing will be
1802     * rethrown wrapped into a TorqueException.
1803     */

1804    protected static List JavaDoc doSelectJoinAllExceptCurrency(Criteria criteria)
1805        throws TorqueException
1806    {
1807        setDbName(criteria);
1808
1809        addSelectColumns(criteria);
1810        int offset2 = numColumns + 1;
1811                                    
1812                    CustomerPeer.addSelectColumns(criteria);
1813        int offset3 = offset2 + CustomerPeer.numColumns;
1814                                                                
1815                    CustomerPeer.addSelectColumns(criteria);
1816        int offset4 = offset3 + CustomerPeer.numColumns;
1817                                                                
1818                    ProjectPeer.addSelectColumns(criteria);
1819        int offset5 = offset4 + ProjectPeer.numColumns;
1820                                                                
1821                    CarrierPeer.addSelectColumns(criteria);
1822        int offset6 = offset5 + CarrierPeer.numColumns;
1823                                                                
1824                                                                                                                                                                                                                                                                                                                                                                                                              
1825        List JavaDoc rows = BasePeer.doSelect(criteria);
1826        List JavaDoc results = new ArrayList JavaDoc();
1827
1828        for (int i = 0; i < rows.size(); i++)
1829        {
1830            Record row = (Record)rows.get(i);
1831
1832                            Class JavaDoc omClass = SorderPeer.getOMClass();
1833                    Sorder obj1 = (Sorder)SorderPeer
1834                .row2Object(row, 1, omClass);
1835                                                
1836                                                                        
1837                            
1838              
1839                           omClass = CustomerPeer.getOMClass();
1840                          Customer obj2 = (Customer)CustomerPeer
1841                .row2Object( row, offset2, omClass);
1842
1843               boolean newObject = true;
1844            for (int j = 0; j < results.size(); j++)
1845            {
1846                Sorder temp_obj1 = (Sorder)results.get(j);
1847                Customer temp_obj2 = (Customer)temp_obj1.getCustomerRelatedByCustomerId();
1848                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1849                {
1850                    newObject = false;
1851                                    temp_obj2.addSorderRelatedByCustomerId(obj1);
1852                                    break;
1853                }
1854            }
1855                            if (newObject)
1856            {
1857                obj2.initSordersRelatedByCustomerId();
1858                obj2.addSorderRelatedByCustomerId(obj1);
1859            }
1860                                                                                    
1861                                                                        
1862                            
1863              
1864                           omClass = CustomerPeer.getOMClass();
1865                          Customer obj3 = (Customer)CustomerPeer
1866                .row2Object( row, offset3, omClass);
1867
1868               newObject = true;
1869            for (int j = 0; j < results.size(); j++)
1870            {
1871                Sorder temp_obj1 = (Sorder)results.get(j);
1872                Customer temp_obj3 = (Customer)temp_obj1.getCustomerRelatedByRecipientId();
1873                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1874                {
1875                    newObject = false;
1876                                    temp_obj3.addSorderRelatedByRecipientId(obj1);
1877                                    break;
1878                }
1879            }
1880                            if (newObject)
1881            {
1882                obj3.initSordersRelatedByRecipientId();
1883                obj3.addSorderRelatedByRecipientId(obj1);
1884            }
1885                                                                                    
1886                                                        
1887                            
1888              
1889                           omClass = ProjectPeer.getOMClass();
1890                          Project obj4 = (Project)ProjectPeer
1891                .row2Object( row, offset4, omClass);
1892
1893               newObject = true;
1894            for (int j = 0; j < results.size(); j++)
1895            {
1896                Sorder temp_obj1 = (Sorder)results.get(j);
1897                Project temp_obj4 = (Project)temp_obj1.getProject();
1898                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1899                {
1900                    newObject = false;
1901                                    temp_obj4.addSorder(obj1);
1902                                    break;
1903                }
1904            }
1905                            if (newObject)
1906            {
1907                obj4.initSorders();
1908                obj4.addSorder(obj1);
1909            }
1910                                                                                    
1911                                                        
1912                            
1913              
1914                           omClass = CarrierPeer.getOMClass();
1915                          Carrier obj5 = (Carrier)CarrierPeer
1916                .row2Object( row, offset5, omClass);
1917
1918               newObject = true;
1919            for (int j = 0; j < results.size(); j++)
1920            {
1921                Sorder temp_obj1 = (Sorder)results.get(j);
1922                Carrier temp_obj5 = (Carrier)temp_obj1.getCarrier();
1923                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1924                {
1925                    newObject = false;
1926                                    temp_obj5.addSorder(obj1);
1927                                    break;
1928                }
1929            }
1930                            if (newObject)
1931            {
1932                obj5.initSorders();
1933                obj5.addSorder(obj1);
1934            }
1935                                                                                    
1936                                              results.add(obj1);
1937        }
1938        return results;
1939    }
1940                    
1941  
1942      /**
1943     * Returns the TableMap related to this peer. This method is not
1944     * needed for general use but a specific application could have a need.
1945     *
1946     * @throws TorqueException Any exceptions caught during processing will be
1947     * rethrown wrapped into a TorqueException.
1948     */

1949    protected static TableMap getTableMap()
1950        throws TorqueException
1951    {
1952        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1953    }
1954   
1955    private static void setDbName(Criteria crit)
1956    {
1957        // Set the correct dbName if it has not been overridden
1958
// crit.getDbName will return the same object if not set to
1959
// another value so == check is okay and faster
1960
if (crit.getDbName() == Torque.getDefaultDB())
1961        {
1962            crit.setDbName(DATABASE_NAME);
1963        }
1964    }
1965}
1966
Popular Tags