KickJava   Java API By Example, From Geeks To Geeks.

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


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 BaseShipmentPeer
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 = "SHIPMENT";
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(ShipmentMapBuilder.CLASS_NAME);
64     }
65
66       /** the column name for the SHIPMENT_ID field */
67     public static final String JavaDoc SHIPMENT_ID;
68       /** the column name for the SHIPMENT_CODE field */
69     public static final String JavaDoc SHIPMENT_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 SORDER_ID field */
85     public static final String JavaDoc SORDER_ID;
86       /** the column name for the INVOICE_CODE field */
87     public static final String JavaDoc INVOICE_CODE;
88       /** the column name for the CARRIER_ID field */
89     public static final String JavaDoc CARRIER_ID;
90       /** the column name for the SUBJECT field */
91     public static final String JavaDoc SUBJECT;
92       /** the column name for the NOTES field */
93     public static final String JavaDoc NOTES;
94       /** the column name for the CREATED field */
95     public static final String JavaDoc CREATED;
96       /** the column name for the MODIFIED field */
97     public static final String JavaDoc MODIFIED;
98       /** the column name for the CREATED_BY field */
99     public static final String JavaDoc CREATED_BY;
100       /** the column name for the MODIFIED_BY field */
101     public static final String JavaDoc MODIFIED_BY;
102   
103     static
104     {
105           SHIPMENT_ID = "SHIPMENT.SHIPMENT_ID";
106           SHIPMENT_CODE = "SHIPMENT.SHIPMENT_CODE";
107           STATUS = "SHIPMENT.STATUS";
108           PRIORITY = "SHIPMENT.PRIORITY";
109           ISSUED_DATE = "SHIPMENT.ISSUED_DATE";
110           CLOSED_DATE = "SHIPMENT.CLOSED_DATE";
111           CUSTOMER_ID = "SHIPMENT.CUSTOMER_ID";
112           RECIPIENT_ID = "SHIPMENT.RECIPIENT_ID";
113           PROJECT_ID = "SHIPMENT.PROJECT_ID";
114           SORDER_ID = "SHIPMENT.SORDER_ID";
115           INVOICE_CODE = "SHIPMENT.INVOICE_CODE";
116           CARRIER_ID = "SHIPMENT.CARRIER_ID";
117           SUBJECT = "SHIPMENT.SUBJECT";
118           NOTES = "SHIPMENT.NOTES";
119           CREATED = "SHIPMENT.CREATED";
120           MODIFIED = "SHIPMENT.MODIFIED";
121           CREATED_BY = "SHIPMENT.CREATED_BY";
122           MODIFIED_BY = "SHIPMENT.MODIFIED_BY";
123           if (Torque.isInit())
124         {
125             try
126             {
127                 getMapBuilder(ShipmentMapBuilder.CLASS_NAME);
128             }
129             catch (Exception JavaDoc e)
130             {
131                 log.error("Could not initialize Peer", e);
132             }
133         }
134         else
135         {
136             Torque.registerMapBuilder(ShipmentMapBuilder.CLASS_NAME);
137         }
138     }
139  
140     /** number of columns for this peer */
141     public static final int numColumns = 18;
142
143     /** A class that can be returned by this peer. */
144     protected static final String JavaDoc CLASSNAME_DEFAULT =
145         "org.campware.cream.om.Shipment";
146
147     /** A class that can be returned by this peer. */
148     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
149
150     /**
151      * Class object initialization method.
152      *
153      * @param className name of the class to initialize
154      * @return the initialized class
155      */

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

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

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

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

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

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

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

376     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
377     {
378         return populateObjects(doSelectVillageRecords(criteria));
379     }
380
381     /**
382      * Method to do selects within a transaction.
383      *
384      * @param criteria object used to create the SELECT statement.
385      * @param con the connection to use
386      * @return List of selected Objects
387      * @throws TorqueException Any exceptions caught during processing will be
388      * rethrown wrapped into a TorqueException.
389      */

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

406     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
407         throws TorqueException
408     {
409         return BaseShipmentPeer
410             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
411     }
412
413     /**
414      * Grabs the raw Village records to be formed into objects.
415      * This method should be used for transactions
416      *
417      * @param criteria object used to create the SELECT statement.
418      * @param con the connection to use
419      * @throws TorqueException Any exceptions caught during processing will be
420      * rethrown wrapped into a TorqueException.
421      */

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

452     public static List JavaDoc populateObjects(List JavaDoc records)
453         throws TorqueException
454     {
455         List JavaDoc results = new ArrayList JavaDoc(records.size());
456
457         // populate the object(s)
458
for (int i = 0; i < records.size(); i++)
459         {
460             Record row = (Record) records.get(i);
461               results.add(ShipmentPeer.row2Object(row, 1,
462                 ShipmentPeer.getOMClass()));
463           }
464         return results;
465     }
466  
467
468     /**
469      * The class that the Peer will make instances of.
470      * If the BO is abstract then you must implement this method
471      * in the BO.
472      *
473      * @throws TorqueException Any exceptions caught during processing will be
474      * rethrown wrapped into a TorqueException.
475      */

476     public static Class JavaDoc getOMClass()
477         throws TorqueException
478     {
479         return CLASS_DEFAULT;
480     }
481
482     /**
483      * Method to do updates.
484      *
485      * @param criteria object containing data that is used to create the UPDATE
486      * statement.
487      * @throws TorqueException Any exceptions caught during processing will be
488      * rethrown wrapped into a TorqueException.
489      */

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

507     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
508         throws TorqueException
509     {
510         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
511                    selectCriteria.put(SHIPMENT_ID, criteria.remove(SHIPMENT_ID));
512                                                                                                                                                                                 
513         setDbName(criteria);
514
515         if (con == null)
516         {
517             BasePeer.doUpdate(selectCriteria, criteria);
518         }
519         else
520         {
521             BasePeer.doUpdate(selectCriteria, criteria, con);
522         }
523     }
524
525     /**
526      * Method to do deletes.
527      *
528      * @param criteria object containing data that is used DELETE from database.
529      * @throws TorqueException Any exceptions caught during processing will be
530      * rethrown wrapped into a TorqueException.
531      */

532      public static void doDelete(Criteria criteria) throws TorqueException
533      {
534          ShipmentPeer
535             .doDelete(criteria, (Connection JavaDoc) null);
536      }
537
538     /**
539      * Method to do deletes. This method is to be used during a transaction,
540      * otherwise use the doDelete(Criteria) method. It will take care of
541      * the connection details internally.
542      *
543      * @param criteria object containing data that is used DELETE from database.
544      * @param con the connection to use
545      * @throws TorqueException Any exceptions caught during processing will be
546      * rethrown wrapped into a TorqueException.
547      */

548      public static void doDelete(Criteria criteria, Connection JavaDoc con)
549         throws TorqueException
550      {
551                                                                                                               
552         setDbName(criteria);
553
554         if (con == null)
555         {
556             BasePeer.doDelete(criteria);
557         }
558         else
559         {
560             BasePeer.doDelete(criteria, con);
561         }
562      }
563
564     /**
565      * Method to do selects
566      *
567      * @throws TorqueException Any exceptions caught during processing will be
568      * rethrown wrapped into a TorqueException.
569      */

570     public static List JavaDoc doSelect(Shipment obj) throws TorqueException
571     {
572         return doSelect(buildSelectCriteria(obj));
573     }
574
575     /**
576      * Method to do inserts
577      *
578      * @throws TorqueException Any exceptions caught during processing will be
579      * rethrown wrapped into a TorqueException.
580      */

581     public static void doInsert(Shipment obj) throws TorqueException
582     {
583           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
584           obj.setNew(false);
585         obj.setModified(false);
586     }
587
588     /**
589      * @param obj the data object to update in the database.
590      * @throws TorqueException Any exceptions caught during processing will be
591      * rethrown wrapped into a TorqueException.
592      */

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

604     public static void doDelete(Shipment obj) throws TorqueException
605     {
606         doDelete(buildSelectCriteria(obj));
607     }
608
609     /**
610      * Method to do inserts. This method is to be used during a transaction,
611      * otherwise use the doInsert(Shipment) method. It will take
612      * care of the connection details internally.
613      *
614      * @param obj the data object to insert into the database.
615      * @param con the connection to use
616      * @throws TorqueException Any exceptions caught during processing will be
617      * rethrown wrapped into a TorqueException.
618      */

619     public static void doInsert(Shipment obj, Connection JavaDoc con)
620         throws TorqueException
621     {
622           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
623           obj.setNew(false);
624         obj.setModified(false);
625     }
626
627     /**
628      * Method to do update. This method is to be used during a transaction,
629      * otherwise use the doUpdate(Shipment) method. It will take
630      * care of the connection details internally.
631      *
632      * @param obj the data object to update in the database.
633      * @param con the connection to use
634      * @throws TorqueException Any exceptions caught during processing will be
635      * rethrown wrapped into a TorqueException.
636      */

637     public static void doUpdate(Shipment obj, Connection JavaDoc con)
638         throws TorqueException
639     {
640         doUpdate(buildCriteria(obj), con);
641         obj.setModified(false);
642     }
643
644     /**
645      * Method to delete. This method is to be used during a transaction,
646      * otherwise use the doDelete(Shipment) method. It will take
647      * care of the connection details internally.
648      *
649      * @param obj the data object to delete in the database.
650      * @param con the connection to use
651      * @throws TorqueException Any exceptions caught during processing will be
652      * rethrown wrapped into a TorqueException.
653      */

654     public static void doDelete(Shipment obj, Connection JavaDoc con)
655         throws TorqueException
656     {
657         doDelete(buildSelectCriteria(obj), con);
658     }
659
660     /**
661      * Method to do deletes.
662      *
663      * @param pk ObjectKey that is used DELETE from database.
664      * @throws TorqueException Any exceptions caught during processing will be
665      * rethrown wrapped into a TorqueException.
666      */

667     public static void doDelete(ObjectKey pk) throws TorqueException
668     {
669         BaseShipmentPeer
670            .doDelete(pk, (Connection JavaDoc) null);
671     }
672
673     /**
674      * Method to delete. This method is to be used during a transaction,
675      * otherwise use the doDelete(ObjectKey) method. It will take
676      * care of the connection details internally.
677      *
678      * @param pk the primary key for the object to delete in the database.
679      * @param con the connection to use
680      * @throws TorqueException Any exceptions caught during processing will be
681      * rethrown wrapped into a TorqueException.
682      */

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

759     public static Shipment retrieveByPK(int pk)
760         throws TorqueException, NoRowsException, TooManyRowsException
761     {
762         return retrieveByPK(SimpleKey.keyFor(pk));
763     }
764
765     /**
766      * Retrieve a single object by pk
767      *
768      * @param pk the primary key
769      * @param con the connection to use
770      * @throws TorqueException Any exceptions caught during processing will be
771      * rethrown wrapped into a TorqueException.
772      * @throws NoRowsException Primary key was not found in database.
773      * @throws TooManyRowsException Primary key was not found in database.
774      */

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

790     public static Shipment retrieveByPK(ObjectKey pk)
791         throws TorqueException, NoRowsException, TooManyRowsException
792     {
793         Connection JavaDoc db = null;
794         Shipment retVal = null;
795         try
796         {
797             db = Torque.getConnection(DATABASE_NAME);
798             retVal = retrieveByPK(pk, db);
799         }
800         finally
801         {
802             Torque.closeConnection(db);
803         }
804         return(retVal);
805     }
806
807     /**
808      * Retrieve a single object by pk
809      *
810      * @param pk the primary key
811      * @param con the connection to use
812      * @throws TorqueException Any exceptions caught during processing will be
813      * rethrown wrapped into a TorqueException.
814      * @throws NoRowsException Primary key was not found in database.
815      * @throws TooManyRowsException Primary key was not found in database.
816      */

817     public static Shipment retrieveByPK(ObjectKey pk, Connection JavaDoc con)
818         throws TorqueException, NoRowsException, TooManyRowsException
819     {
820         Criteria criteria = buildCriteria(pk);
821         List JavaDoc v = doSelect(criteria, con);
822         if (v.size() == 0)
823         {
824             throw new NoRowsException("Failed to select a row.");
825         }
826         else if (v.size() > 1)
827         {
828             throw new TooManyRowsException("Failed to select only one row.");
829         }
830         else
831         {
832             return (Shipment)v.get(0);
833         }
834     }
835
836     /**
837      * Retrieve a multiple objects by pk
838      *
839      * @param pks List of primary keys
840      * @throws TorqueException Any exceptions caught during processing will be
841      * rethrown wrapped into a TorqueException.
842      */

843     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
844         throws TorqueException
845     {
846         Connection JavaDoc db = null;
847         List JavaDoc retVal = null;
848         try
849         {
850            db = Torque.getConnection(DATABASE_NAME);
851            retVal = retrieveByPKs(pks, db);
852         }
853         finally
854         {
855             Torque.closeConnection(db);
856         }
857         return(retVal);
858     }
859
860     /**
861      * Retrieve a multiple objects by pk
862      *
863      * @param pks List of primary keys
864      * @param dbcon the connection to use
865      * @throws TorqueException Any exceptions caught during processing will be
866      * rethrown wrapped into a TorqueException.
867      */

868     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
869         throws TorqueException
870     {
871         List JavaDoc objs = null;
872         if (pks == null || pks.size() == 0)
873         {
874             objs = new LinkedList JavaDoc();
875         }
876         else
877         {
878             Criteria criteria = new Criteria();
879               criteria.addIn( SHIPMENT_ID, pks );
880           objs = doSelect(criteria, dbcon);
881         }
882         return objs;
883     }
884
885  
886
887
888
889                   
890                                                         
891                 
892                 
893
894     /**
895      * selects a collection of Shipment objects pre-filled with their
896      * Customer objects.
897      *
898      * This method is protected by default in order to keep the public
899      * api reasonable. You can provide public methods for those you
900      * actually need in ShipmentPeer.
901      *
902      * @throws TorqueException Any exceptions caught during processing will be
903      * rethrown wrapped into a TorqueException.
904      */

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

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

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

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

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

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

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

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

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

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

1935    protected static TableMap getTableMap()
1936        throws TorqueException
1937    {
1938        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1939    }
1940   
1941    private static void setDbName(Criteria crit)
1942    {
1943        // Set the correct dbName if it has not been overridden
1944
// crit.getDbName will return the same object if not set to
1945
// another value so == check is okay and faster
1946
if (crit.getDbName() == Torque.getDefaultDB())
1947        {
1948            crit.setDbName(DATABASE_NAME);
1949        }
1950    }
1951}
1952
Popular Tags