KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > tigris > scarab > om > BaseConditionPeer


1 package org.tigris.scarab.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.tigris.scarab.om.map.*;
32
33
34   
35   
36   
37   
38   
39 /**
40  */

41 public abstract class BaseConditionPeer
42     extends BasePeer
43 {
44
45     /** the default database name for this class */
46     public static final String JavaDoc DATABASE_NAME = "scarab";
47
48      /** the table name for this class */
49     public static final String JavaDoc TABLE_NAME = "SCARAB_CONDITION";
50
51     /**
52      * @return the map builder for this peer
53      * @throws TorqueException Any exceptions caught during processing will be
54      * rethrown wrapped into a TorqueException.
55      */

56     public static MapBuilder getMapBuilder()
57         throws TorqueException
58     {
59         return getMapBuilder(ConditionMapBuilder.CLASS_NAME);
60     }
61
62       /** the column name for the CONDITION_ID field */
63     public static final String JavaDoc CONDITION_ID;
64       /** the column name for the TRANSITION_ID field */
65     public static final String JavaDoc TRANSITION_ID;
66       /** the column name for the MODULE_ID field */
67     public static final String JavaDoc MODULE_ID;
68       /** the column name for the ISSUE_TYPE_ID field */
69     public static final String JavaDoc ISSUE_TYPE_ID;
70       /** the column name for the ATTRIBUTE_ID field */
71     public static final String JavaDoc ATTRIBUTE_ID;
72       /** the column name for the OPTION_ID field */
73     public static final String JavaDoc OPTION_ID;
74   
75     static
76     {
77           CONDITION_ID = "SCARAB_CONDITION.CONDITION_ID";
78           TRANSITION_ID = "SCARAB_CONDITION.TRANSITION_ID";
79           MODULE_ID = "SCARAB_CONDITION.MODULE_ID";
80           ISSUE_TYPE_ID = "SCARAB_CONDITION.ISSUE_TYPE_ID";
81           ATTRIBUTE_ID = "SCARAB_CONDITION.ATTRIBUTE_ID";
82           OPTION_ID = "SCARAB_CONDITION.OPTION_ID";
83           if (Torque.isInit())
84         {
85             try
86             {
87                 getMapBuilder(ConditionMapBuilder.CLASS_NAME);
88             }
89             catch (Exception JavaDoc e)
90             {
91                 log.error("Could not initialize Peer", e);
92             }
93         }
94         else
95         {
96             Torque.registerMapBuilder(ConditionMapBuilder.CLASS_NAME);
97         }
98     }
99  
100     /** number of columns for this peer */
101     public static final int numColumns = 6;
102
103     /** A class that can be returned by this peer. */
104     protected static final String JavaDoc CLASSNAME_DEFAULT =
105         "org.tigris.scarab.om.Condition";
106
107     /** A class that can be returned by this peer. */
108     protected static final Class JavaDoc CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
109
110     /**
111      * Class object initialization method.
112      *
113      * @param className name of the class to initialize
114      * @return the initialized class
115      */

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

150     public static List JavaDoc resultSet2Objects(java.sql.ResultSet JavaDoc results)
151             throws TorqueException
152     {
153         try
154         {
155             QueryDataSet qds = null;
156             List JavaDoc rows = null;
157             try
158             {
159                 qds = new QueryDataSet(results);
160                 rows = getSelectResults(qds);
161             }
162             finally
163             {
164                 if (qds != null)
165                 {
166                     qds.close();
167                 }
168             }
169
170             return populateObjects(rows);
171         }
172         catch (SQLException JavaDoc e)
173         {
174             throw new TorqueException(e);
175         }
176         catch (DataSetException e)
177         {
178             throw new TorqueException(e);
179         }
180     }
181
182
183   
184     /**
185      * Method to do inserts.
186      *
187      * @param criteria object used to create the INSERT statement.
188      * @throws TorqueException Any exceptions caught during processing will be
189      * rethrown wrapped into a TorqueException.
190      */

191     public static ObjectKey doInsert(Criteria criteria)
192         throws TorqueException
193     {
194         return BaseConditionPeer
195             .doInsert(criteria, (Connection JavaDoc) null);
196     }
197
198     /**
199      * Method to do inserts. This method is to be used during a transaction,
200      * otherwise use the doInsert(Criteria) method. It will take care of
201      * the connection details internally.
202      *
203      * @param criteria object used to create the INSERT statement.
204      * @param con the connection to use
205      * @throws TorqueException Any exceptions caught during processing will be
206      * rethrown wrapped into a TorqueException.
207      */

208     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
209         throws TorqueException
210     {
211                                       
212         setDbName(criteria);
213
214         if (con == null)
215         {
216             return BasePeer.doInsert(criteria);
217         }
218         else
219         {
220             return BasePeer.doInsert(criteria, con);
221         }
222     }
223
224     /**
225      * Add all the columns needed to create a new object.
226      *
227      * @param criteria object containing the columns to add.
228      * @throws TorqueException Any exceptions caught during processing will be
229      * rethrown wrapped into a TorqueException.
230      */

231     public static void addSelectColumns(Criteria criteria)
232             throws TorqueException
233     {
234           criteria.addSelectColumn(CONDITION_ID);
235           criteria.addSelectColumn(TRANSITION_ID);
236           criteria.addSelectColumn(MODULE_ID);
237           criteria.addSelectColumn(ISSUE_TYPE_ID);
238           criteria.addSelectColumn(ATTRIBUTE_ID);
239           criteria.addSelectColumn(OPTION_ID);
240       }
241
242     /**
243      * Create a new object of type cls from a resultset row starting
244      * from a specified offset. This is done so that you can select
245      * other rows than just those needed for this object. You may
246      * for example want to create two objects from the same row.
247      *
248      * @throws TorqueException Any exceptions caught during processing will be
249      * rethrown wrapped into a TorqueException.
250      */

251     public static Condition row2Object(Record row,
252                                              int offset,
253                                              Class JavaDoc cls)
254         throws TorqueException
255     {
256         try
257         {
258             Condition obj = (Condition) cls.newInstance();
259             ConditionPeer.populateObject(row, offset, obj);
260                   obj.setModified(false);
261               obj.setNew(false);
262
263             return obj;
264         }
265         catch (InstantiationException JavaDoc e)
266         {
267             throw new TorqueException(e);
268         }
269         catch (IllegalAccessException JavaDoc e)
270         {
271             throw new TorqueException(e);
272         }
273     }
274
275     /**
276      * Populates an object from a resultset row starting
277      * from a specified offset. This is done so that you can select
278      * other rows than just those needed for this object. You may
279      * for example want to create two objects from the same row.
280      *
281      * @throws TorqueException Any exceptions caught during processing will be
282      * rethrown wrapped into a TorqueException.
283      */

284     public static void populateObject(Record row,
285                                       int offset,
286                                       Condition obj)
287         throws TorqueException
288     {
289         try
290         {
291                 obj.setConditionId(row.getValue(offset + 0).asLongObj());
292                   obj.setTransitionId(row.getValue(offset + 1).asIntegerObj());
293                   obj.setModuleId(row.getValue(offset + 2).asIntegerObj());
294                   obj.setIssueTypeId(row.getValue(offset + 3).asIntegerObj());
295                   obj.setAttributeId(row.getValue(offset + 4).asIntegerObj());
296                   obj.setOptionId(row.getValue(offset + 5).asIntegerObj());
297               }
298         catch (DataSetException e)
299         {
300             throw new TorqueException(e);
301         }
302     }
303
304     /**
305      * Method to do selects.
306      *
307      * @param criteria object used to create the SELECT statement.
308      * @return List of selected Objects
309      * @throws TorqueException Any exceptions caught during processing will be
310      * rethrown wrapped into a TorqueException.
311      */

312     public static List JavaDoc doSelect(Criteria criteria) throws TorqueException
313     {
314         return populateObjects(doSelectVillageRecords(criteria));
315     }
316
317     /**
318      * Method to do selects within a transaction.
319      *
320      * @param criteria object used to create the SELECT statement.
321      * @param con the connection to use
322      * @return List of selected Objects
323      * @throws TorqueException Any exceptions caught during processing will be
324      * rethrown wrapped into a TorqueException.
325      */

326     public static List JavaDoc doSelect(Criteria criteria, Connection JavaDoc con)
327         throws TorqueException
328     {
329         return populateObjects(doSelectVillageRecords(criteria, con));
330     }
331
332     /**
333      * Grabs the raw Village records to be formed into objects.
334      * This method handles connections internally. The Record objects
335      * returned by this method should be considered readonly. Do not
336      * alter the data and call save(), your results may vary, but are
337      * certainly likely to result in hard to track MT bugs.
338      *
339      * @throws TorqueException Any exceptions caught during processing will be
340      * rethrown wrapped into a TorqueException.
341      */

342     public static List JavaDoc doSelectVillageRecords(Criteria criteria)
343         throws TorqueException
344     {
345         return BaseConditionPeer
346             .doSelectVillageRecords(criteria, (Connection JavaDoc) null);
347     }
348
349     /**
350      * Grabs the raw Village records to be formed into objects.
351      * This method should be used for transactions
352      *
353      * @param criteria object used to create the SELECT statement.
354      * @param con the connection to use
355      * @throws TorqueException Any exceptions caught during processing will be
356      * rethrown wrapped into a TorqueException.
357      */

358     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
359         throws TorqueException
360     {
361         if (criteria.getSelectColumns().size() == 0)
362         {
363             addSelectColumns(criteria);
364         }
365
366                                       
367         setDbName(criteria);
368
369         // BasePeer returns a List of Value (Village) arrays. The array
370
// order follows the order columns were placed in the Select clause.
371
if (con == null)
372         {
373             return BasePeer.doSelect(criteria);
374         }
375         else
376         {
377             return BasePeer.doSelect(criteria, con);
378         }
379     }
380
381     /**
382      * The returned List will contain objects of the default type or
383      * objects that inherit from the default.
384      *
385      * @throws TorqueException Any exceptions caught during processing will be
386      * rethrown wrapped into a TorqueException.
387      */

388     public static List JavaDoc populateObjects(List JavaDoc records)
389         throws TorqueException
390     {
391         List JavaDoc results = new ArrayList JavaDoc(records.size());
392
393         // populate the object(s)
394
for (int i = 0; i < records.size(); i++)
395         {
396             Record row = (Record) records.get(i);
397               results.add(ConditionPeer.row2Object(row, 1,
398                 ConditionPeer.getOMClass()));
399           }
400         return results;
401     }
402  
403
404     /**
405      * The class that the Peer will make instances of.
406      * If the BO is abstract then you must implement this method
407      * in the BO.
408      *
409      * @throws TorqueException Any exceptions caught during processing will be
410      * rethrown wrapped into a TorqueException.
411      */

412     public static Class JavaDoc getOMClass()
413         throws TorqueException
414     {
415         return CLASS_DEFAULT;
416     }
417
418     /**
419      * Method to do updates.
420      *
421      * @param criteria object containing data that is used to create the UPDATE
422      * statement.
423      * @throws TorqueException Any exceptions caught during processing will be
424      * rethrown wrapped into a TorqueException.
425      */

426     public static void doUpdate(Criteria criteria) throws TorqueException
427     {
428          BaseConditionPeer
429             .doUpdate(criteria, (Connection JavaDoc) null);
430     }
431
432     /**
433      * Method to do updates. This method is to be used during a transaction,
434      * otherwise use the doUpdate(Criteria) method. It will take care of
435      * the connection details internally.
436      *
437      * @param criteria object containing data that is used to create the UPDATE
438      * statement.
439      * @param con the connection to use
440      * @throws TorqueException Any exceptions caught during processing will be
441      * rethrown wrapped into a TorqueException.
442      */

443     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
444         throws TorqueException
445     {
446         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
447                    selectCriteria.put(CONDITION_ID, criteria.remove(CONDITION_ID));
448                                                         
449         setDbName(criteria);
450
451         if (con == null)
452         {
453             BasePeer.doUpdate(selectCriteria, criteria);
454         }
455         else
456         {
457             BasePeer.doUpdate(selectCriteria, criteria, con);
458         }
459     }
460
461     /**
462      * Method to do deletes.
463      *
464      * @param criteria object containing data that is used DELETE from database.
465      * @throws TorqueException Any exceptions caught during processing will be
466      * rethrown wrapped into a TorqueException.
467      */

468      public static void doDelete(Criteria criteria) throws TorqueException
469      {
470          ConditionPeer
471             .doDelete(criteria, (Connection JavaDoc) null);
472      }
473
474     /**
475      * Method to do deletes. This method is to be used during a transaction,
476      * otherwise use the doDelete(Criteria) method. It will take care of
477      * the connection details internally.
478      *
479      * @param criteria object containing data that is used DELETE from database.
480      * @param con the connection to use
481      * @throws TorqueException Any exceptions caught during processing will be
482      * rethrown wrapped into a TorqueException.
483      */

484      public static void doDelete(Criteria criteria, Connection JavaDoc con)
485         throws TorqueException
486      {
487                                       
488         setDbName(criteria);
489
490         if (con == null)
491         {
492             BasePeer.doDelete(criteria);
493         }
494         else
495         {
496             BasePeer.doDelete(criteria, con);
497         }
498      }
499
500     /**
501      * Method to do selects
502      *
503      * @throws TorqueException Any exceptions caught during processing will be
504      * rethrown wrapped into a TorqueException.
505      */

506     public static List JavaDoc doSelect(Condition obj) throws TorqueException
507     {
508         return doSelect(buildSelectCriteria(obj));
509     }
510
511     /**
512      * Method to do inserts
513      *
514      * @throws TorqueException Any exceptions caught during processing will be
515      * rethrown wrapped into a TorqueException.
516      */

517     public static void doInsert(Condition obj) throws TorqueException
518     {
519           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
520           obj.setNew(false);
521         obj.setModified(false);
522     }
523
524     /**
525      * @param obj the data object to update in the database.
526      * @throws TorqueException Any exceptions caught during processing will be
527      * rethrown wrapped into a TorqueException.
528      */

529     public static void doUpdate(Condition obj) throws TorqueException
530     {
531         doUpdate(buildCriteria(obj));
532         obj.setModified(false);
533     }
534
535     /**
536      * @param obj the data object to delete in the database.
537      * @throws TorqueException Any exceptions caught during processing will be
538      * rethrown wrapped into a TorqueException.
539      */

540     public static void doDelete(Condition obj) throws TorqueException
541     {
542         doDelete(buildSelectCriteria(obj));
543     }
544
545     /**
546      * Method to do inserts. This method is to be used during a transaction,
547      * otherwise use the doInsert(Condition) method. It will take
548      * care of the connection details internally.
549      *
550      * @param obj the data object to insert into the database.
551      * @param con the connection to use
552      * @throws TorqueException Any exceptions caught during processing will be
553      * rethrown wrapped into a TorqueException.
554      */

555     public static void doInsert(Condition obj, Connection JavaDoc con)
556         throws TorqueException
557     {
558           obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
559           obj.setNew(false);
560         obj.setModified(false);
561     }
562
563     /**
564      * Method to do update. This method is to be used during a transaction,
565      * otherwise use the doUpdate(Condition) method. It will take
566      * care of the connection details internally.
567      *
568      * @param obj the data object to update in the database.
569      * @param con the connection to use
570      * @throws TorqueException Any exceptions caught during processing will be
571      * rethrown wrapped into a TorqueException.
572      */

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

590     public static void doDelete(Condition obj, Connection JavaDoc con)
591         throws TorqueException
592     {
593         doDelete(buildSelectCriteria(obj), con);
594     }
595
596     /**
597      * Method to do deletes.
598      *
599      * @param pk ObjectKey that is used DELETE from database.
600      * @throws TorqueException Any exceptions caught during processing will be
601      * rethrown wrapped into a TorqueException.
602      */

603     public static void doDelete(ObjectKey pk) throws TorqueException
604     {
605         BaseConditionPeer
606            .doDelete(pk, (Connection JavaDoc) null);
607     }
608
609     /**
610      * Method to delete. This method is to be used during a transaction,
611      * otherwise use the doDelete(ObjectKey) method. It will take
612      * care of the connection details internally.
613      *
614      * @param pk the primary key for the object to delete in 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 doDelete(ObjectKey pk, Connection JavaDoc con)
620         throws TorqueException
621     {
622         doDelete(buildCriteria(pk), con);
623     }
624
625     /** Build a Criteria object from an ObjectKey */
626     public static Criteria buildCriteria( ObjectKey pk )
627     {
628         Criteria criteria = new Criteria();
629               criteria.add(CONDITION_ID, pk);
630           return criteria;
631      }
632
633     /** Build a Criteria object from the data object for this peer */
634     public static Criteria buildCriteria( Condition obj )
635     {
636         Criteria criteria = new Criteria(DATABASE_NAME);
637               if (!obj.isNew())
638             criteria.add(CONDITION_ID, obj.getConditionId());
639               criteria.add(TRANSITION_ID, obj.getTransitionId());
640               criteria.add(MODULE_ID, obj.getModuleId());
641               criteria.add(ISSUE_TYPE_ID, obj.getIssueTypeId());
642               criteria.add(ATTRIBUTE_ID, obj.getAttributeId());
643               criteria.add(OPTION_ID, obj.getOptionId());
644           return criteria;
645     }
646
647     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
648     public static Criteria buildSelectCriteria( Condition obj )
649     {
650         Criteria criteria = new Criteria(DATABASE_NAME);
651               if (!obj.isNew())
652                     criteria.add(CONDITION_ID, obj.getConditionId());
653                           criteria.add(TRANSITION_ID, obj.getTransitionId());
654                           criteria.add(MODULE_ID, obj.getModuleId());
655                           criteria.add(ISSUE_TYPE_ID, obj.getIssueTypeId());
656                           criteria.add(ATTRIBUTE_ID, obj.getAttributeId());
657                           criteria.add(OPTION_ID, obj.getOptionId());
658               return criteria;
659     }
660  
661     
662         /**
663      * Retrieve a single object by pk
664      *
665      * @param pk the primary key
666      * @throws TorqueException Any exceptions caught during processing will be
667      * rethrown wrapped into a TorqueException.
668      * @throws NoRowsException Primary key was not found in database.
669      * @throws TooManyRowsException Primary key was not found in database.
670      */

671     public static Condition retrieveByPK(Long JavaDoc pk)
672         throws TorqueException, NoRowsException, TooManyRowsException
673     {
674         return retrieveByPK(SimpleKey.keyFor(pk));
675     }
676
677     /**
678      * Retrieve a single object by pk
679      *
680      * @param pk the primary key
681      * @param con the connection to use
682      * @throws TorqueException Any exceptions caught during processing will be
683      * rethrown wrapped into a TorqueException.
684      * @throws NoRowsException Primary key was not found in database.
685      * @throws TooManyRowsException Primary key was not found in database.
686      */

687     public static Condition retrieveByPK(Long JavaDoc pk, Connection JavaDoc con)
688         throws TorqueException, NoRowsException, TooManyRowsException
689     {
690         return retrieveByPK(SimpleKey.keyFor(pk), con);
691     }
692   
693     /**
694      * Retrieve a single object by pk
695      *
696      * @param pk the primary key
697      * @throws TorqueException Any exceptions caught during processing will be
698      * rethrown wrapped into a TorqueException.
699      * @throws NoRowsException Primary key was not found in database.
700      * @throws TooManyRowsException Primary key was not found in database.
701      */

702     public static Condition retrieveByPK(ObjectKey pk)
703         throws TorqueException, NoRowsException, TooManyRowsException
704     {
705         Connection JavaDoc db = null;
706         Condition retVal = null;
707         try
708         {
709             db = Torque.getConnection(DATABASE_NAME);
710             retVal = retrieveByPK(pk, db);
711         }
712         finally
713         {
714             Torque.closeConnection(db);
715         }
716         return(retVal);
717     }
718
719     /**
720      * Retrieve a single object by pk
721      *
722      * @param pk the primary key
723      * @param con the connection to use
724      * @throws TorqueException Any exceptions caught during processing will be
725      * rethrown wrapped into a TorqueException.
726      * @throws NoRowsException Primary key was not found in database.
727      * @throws TooManyRowsException Primary key was not found in database.
728      */

729     public static Condition retrieveByPK(ObjectKey pk, Connection JavaDoc con)
730         throws TorqueException, NoRowsException, TooManyRowsException
731     {
732         Criteria criteria = buildCriteria(pk);
733         List JavaDoc v = doSelect(criteria, con);
734         if (v.size() == 0)
735         {
736             throw new NoRowsException("Failed to select a row.");
737         }
738         else if (v.size() > 1)
739         {
740             throw new TooManyRowsException("Failed to select only one row.");
741         }
742         else
743         {
744             return (Condition)v.get(0);
745         }
746     }
747
748     /**
749      * Retrieve a multiple objects by pk
750      *
751      * @param pks List of primary keys
752      * @throws TorqueException Any exceptions caught during processing will be
753      * rethrown wrapped into a TorqueException.
754      */

755     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
756         throws TorqueException
757     {
758         Connection JavaDoc db = null;
759         List JavaDoc retVal = null;
760         try
761         {
762            db = Torque.getConnection(DATABASE_NAME);
763            retVal = retrieveByPKs(pks, db);
764         }
765         finally
766         {
767             Torque.closeConnection(db);
768         }
769         return(retVal);
770     }
771
772     /**
773      * Retrieve a multiple objects by pk
774      *
775      * @param pks List of primary keys
776      * @param dbcon the connection to use
777      * @throws TorqueException Any exceptions caught during processing will be
778      * rethrown wrapped into a TorqueException.
779      */

780     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
781         throws TorqueException
782     {
783         List JavaDoc objs = null;
784         if (pks == null || pks.size() == 0)
785         {
786             objs = new LinkedList JavaDoc();
787         }
788         else
789         {
790             Criteria criteria = new Criteria();
791               criteria.addIn( CONDITION_ID, pks );
792           objs = doSelect(criteria, dbcon);
793         }
794         return objs;
795     }
796
797  
798
799
800
801                   
802                                                                                   
803                 
804                 
805
806     /**
807      * selects a collection of Condition objects pre-filled with their
808      * RModuleAttribute objects.
809      *
810      * This method is protected by default in order to keep the public
811      * api reasonable. You can provide public methods for those you
812      * actually need in ConditionPeer.
813      *
814      * @throws TorqueException Any exceptions caught during processing will be
815      * rethrown wrapped into a TorqueException.
816      */

817     protected static List JavaDoc doSelectJoinRModuleAttribute(Criteria criteria)
818         throws TorqueException
819     {
820         setDbName(criteria);
821
822         ConditionPeer.addSelectColumns(criteria);
823         int offset = numColumns + 1;
824         RModuleAttributePeer.addSelectColumns(criteria);
825
826
827                         criteria.addJoin(ConditionPeer.MODULE_ID,
828             RModuleAttributePeer.MODULE_ID);
829                 criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
830             RModuleAttributePeer.ATTRIBUTE_ID);
831                 criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
832             RModuleAttributePeer.ISSUE_TYPE_ID);
833         
834
835                                                                                                                     
836         List JavaDoc rows = BasePeer.doSelect(criteria);
837         List JavaDoc results = new ArrayList JavaDoc();
838
839         for (int i = 0; i < rows.size(); i++)
840         {
841             Record row = (Record) rows.get(i);
842
843                             Class JavaDoc omClass = ConditionPeer.getOMClass();
844                     Condition obj1 = (Condition) ConditionPeer
845                 .row2Object(row, 1, omClass);
846                      omClass = RModuleAttributePeer.getOMClass();
847                     RModuleAttribute obj2 = (RModuleAttribute)RModuleAttributePeer
848                 .row2Object(row, offset, omClass);
849
850             boolean newObject = true;
851             for (int j = 0; j < results.size(); j++)
852             {
853                 Condition temp_obj1 = (Condition)results.get(j);
854                 RModuleAttribute temp_obj2 = (RModuleAttribute)temp_obj1.getRModuleAttribute();
855                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
856                 {
857                     newObject = false;
858                               temp_obj2.addCondition(obj1);
859                               break;
860                 }
861             }
862                       if (newObject)
863             {
864                 obj2.initConditions();
865                 obj2.addCondition(obj1);
866             }
867                       results.add(obj1);
868         }
869         return results;
870     }
871                                                             
872                 
873                 
874
875     /**
876      * selects a collection of Condition objects pre-filled with their
877      * Transition objects.
878      *
879      * This method is protected by default in order to keep the public
880      * api reasonable. You can provide public methods for those you
881      * actually need in ConditionPeer.
882      *
883      * @throws TorqueException Any exceptions caught during processing will be
884      * rethrown wrapped into a TorqueException.
885      */

886     protected static List JavaDoc doSelectJoinTransition(Criteria criteria)
887         throws TorqueException
888     {
889         setDbName(criteria);
890
891         ConditionPeer.addSelectColumns(criteria);
892         int offset = numColumns + 1;
893         TransitionPeer.addSelectColumns(criteria);
894
895
896                         criteria.addJoin(ConditionPeer.TRANSITION_ID,
897             TransitionPeer.TRANSITION_ID);
898         
899
900                                                                                                                     
901         List JavaDoc rows = BasePeer.doSelect(criteria);
902         List JavaDoc results = new ArrayList JavaDoc();
903
904         for (int i = 0; i < rows.size(); i++)
905         {
906             Record row = (Record) rows.get(i);
907
908                             Class JavaDoc omClass = ConditionPeer.getOMClass();
909                     Condition obj1 = (Condition) ConditionPeer
910                 .row2Object(row, 1, omClass);
911                      omClass = TransitionPeer.getOMClass();
912                     Transition obj2 = (Transition)TransitionPeer
913                 .row2Object(row, offset, omClass);
914
915             boolean newObject = true;
916             for (int j = 0; j < results.size(); j++)
917             {
918                 Condition temp_obj1 = (Condition)results.get(j);
919                 Transition temp_obj2 = (Transition)temp_obj1.getTransition();
920                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
921                 {
922                     newObject = false;
923                               temp_obj2.addCondition(obj1);
924                               break;
925                 }
926             }
927                       if (newObject)
928             {
929                 obj2.initConditions();
930                 obj2.addCondition(obj1);
931             }
932                       results.add(obj1);
933         }
934         return results;
935     }
936                                                             
937                 
938                 
939
940     /**
941      * selects a collection of Condition objects pre-filled with their
942      * Attribute objects.
943      *
944      * This method is protected by default in order to keep the public
945      * api reasonable. You can provide public methods for those you
946      * actually need in ConditionPeer.
947      *
948      * @throws TorqueException Any exceptions caught during processing will be
949      * rethrown wrapped into a TorqueException.
950      */

951     protected static List JavaDoc doSelectJoinAttribute(Criteria criteria)
952         throws TorqueException
953     {
954         setDbName(criteria);
955
956         ConditionPeer.addSelectColumns(criteria);
957         int offset = numColumns + 1;
958         AttributePeer.addSelectColumns(criteria);
959
960
961                         criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
962             AttributePeer.ATTRIBUTE_ID);
963         
964
965                                                                                                                     
966         List JavaDoc rows = BasePeer.doSelect(criteria);
967         List JavaDoc results = new ArrayList JavaDoc();
968
969         for (int i = 0; i < rows.size(); i++)
970         {
971             Record row = (Record) rows.get(i);
972
973                             Class JavaDoc omClass = ConditionPeer.getOMClass();
974                     Condition obj1 = (Condition) ConditionPeer
975                 .row2Object(row, 1, omClass);
976                      omClass = AttributePeer.getOMClass();
977                     Attribute obj2 = (Attribute)AttributePeer
978                 .row2Object(row, offset, omClass);
979
980             boolean newObject = true;
981             for (int j = 0; j < results.size(); j++)
982             {
983                 Condition temp_obj1 = (Condition)results.get(j);
984                 Attribute temp_obj2 = (Attribute)temp_obj1.getAttribute();
985                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
986                 {
987                     newObject = false;
988                               temp_obj2.addCondition(obj1);
989                               break;
990                 }
991             }
992                       if (newObject)
993             {
994                 obj2.initConditions();
995                 obj2.addCondition(obj1);
996             }
997                       results.add(obj1);
998         }
999         return results;
1000    }
1001                                                            
1002                
1003                
1004
1005    /**
1006     * selects a collection of Condition objects pre-filled with their
1007     * AttributeOption objects.
1008     *
1009     * This method is protected by default in order to keep the public
1010     * api reasonable. You can provide public methods for those you
1011     * actually need in ConditionPeer.
1012     *
1013     * @throws TorqueException Any exceptions caught during processing will be
1014     * rethrown wrapped into a TorqueException.
1015     */

1016    protected static List JavaDoc doSelectJoinAttributeOption(Criteria criteria)
1017        throws TorqueException
1018    {
1019        setDbName(criteria);
1020
1021        ConditionPeer.addSelectColumns(criteria);
1022        int offset = numColumns + 1;
1023        AttributeOptionPeer.addSelectColumns(criteria);
1024
1025
1026                        criteria.addJoin(ConditionPeer.OPTION_ID,
1027            AttributeOptionPeer.OPTION_ID);
1028        
1029
1030                                                                                                                    
1031        List JavaDoc rows = BasePeer.doSelect(criteria);
1032        List JavaDoc results = new ArrayList JavaDoc();
1033
1034        for (int i = 0; i < rows.size(); i++)
1035        {
1036            Record row = (Record) rows.get(i);
1037
1038                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1039                    Condition obj1 = (Condition) ConditionPeer
1040                .row2Object(row, 1, omClass);
1041                     omClass = AttributeOptionPeer.getOMClass();
1042                    AttributeOption obj2 = (AttributeOption)AttributeOptionPeer
1043                .row2Object(row, offset, omClass);
1044
1045            boolean newObject = true;
1046            for (int j = 0; j < results.size(); j++)
1047            {
1048                Condition temp_obj1 = (Condition)results.get(j);
1049                AttributeOption temp_obj2 = (AttributeOption)temp_obj1.getAttributeOption();
1050                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1051                {
1052                    newObject = false;
1053                              temp_obj2.addCondition(obj1);
1054                              break;
1055                }
1056            }
1057                      if (newObject)
1058            {
1059                obj2.initConditions();
1060                obj2.addCondition(obj1);
1061            }
1062                      results.add(obj1);
1063        }
1064        return results;
1065    }
1066                                                                              
1067                
1068                
1069
1070    /**
1071     * selects a collection of Condition objects pre-filled with their
1072     * RModuleIssueType objects.
1073     *
1074     * This method is protected by default in order to keep the public
1075     * api reasonable. You can provide public methods for those you
1076     * actually need in ConditionPeer.
1077     *
1078     * @throws TorqueException Any exceptions caught during processing will be
1079     * rethrown wrapped into a TorqueException.
1080     */

1081    protected static List JavaDoc doSelectJoinRModuleIssueType(Criteria criteria)
1082        throws TorqueException
1083    {
1084        setDbName(criteria);
1085
1086        ConditionPeer.addSelectColumns(criteria);
1087        int offset = numColumns + 1;
1088        RModuleIssueTypePeer.addSelectColumns(criteria);
1089
1090
1091                        criteria.addJoin(ConditionPeer.MODULE_ID,
1092            RModuleIssueTypePeer.MODULE_ID);
1093                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1094            RModuleIssueTypePeer.ISSUE_TYPE_ID);
1095        
1096
1097                                                                                                                    
1098        List JavaDoc rows = BasePeer.doSelect(criteria);
1099        List JavaDoc results = new ArrayList JavaDoc();
1100
1101        for (int i = 0; i < rows.size(); i++)
1102        {
1103            Record row = (Record) rows.get(i);
1104
1105                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1106                    Condition obj1 = (Condition) ConditionPeer
1107                .row2Object(row, 1, omClass);
1108                     omClass = RModuleIssueTypePeer.getOMClass();
1109                    RModuleIssueType obj2 = (RModuleIssueType)RModuleIssueTypePeer
1110                .row2Object(row, offset, omClass);
1111
1112            boolean newObject = true;
1113            for (int j = 0; j < results.size(); j++)
1114            {
1115                Condition temp_obj1 = (Condition)results.get(j);
1116                RModuleIssueType temp_obj2 = (RModuleIssueType)temp_obj1.getRModuleIssueType();
1117                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1118                {
1119                    newObject = false;
1120                              temp_obj2.addCondition(obj1);
1121                              break;
1122                }
1123            }
1124                      if (newObject)
1125            {
1126                obj2.initConditions();
1127                obj2.addCondition(obj1);
1128            }
1129                      results.add(obj1);
1130        }
1131        return results;
1132    }
1133                    
1134  
1135                                                        
1136          
1137        
1138                                                                      
1139                
1140
1141    /**
1142     * selects a collection of Condition objects pre-filled with
1143     * all related objects.
1144     *
1145     * This method is protected by default in order to keep the public
1146     * api reasonable. You can provide public methods for those you
1147     * actually need in ConditionPeer.
1148     *
1149     * @throws TorqueException Any exceptions caught during processing will be
1150     * rethrown wrapped into a TorqueException.
1151     */

1152    protected static List JavaDoc doSelectJoinAllExceptRModuleAttribute(Criteria criteria)
1153        throws TorqueException
1154    {
1155        setDbName(criteria);
1156
1157        addSelectColumns(criteria);
1158        int offset2 = numColumns + 1;
1159                                    
1160                                                  
1161                    TransitionPeer.addSelectColumns(criteria);
1162        int offset3 = offset2 + TransitionPeer.numColumns;
1163                                                                
1164                    AttributePeer.addSelectColumns(criteria);
1165        int offset4 = offset3 + AttributePeer.numColumns;
1166                                                                
1167                    AttributeOptionPeer.addSelectColumns(criteria);
1168        int offset5 = offset4 + AttributeOptionPeer.numColumns;
1169                                                                
1170                    RModuleIssueTypePeer.addSelectColumns(criteria);
1171        int offset6 = offset5 + RModuleIssueTypePeer.numColumns;
1172                                                                                                                                                                
1173        List JavaDoc rows = BasePeer.doSelect(criteria);
1174        List JavaDoc results = new ArrayList JavaDoc();
1175
1176        for (int i = 0; i < rows.size(); i++)
1177        {
1178            Record row = (Record)rows.get(i);
1179
1180                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1181                    Condition obj1 = (Condition)ConditionPeer
1182                .row2Object(row, 1, omClass);
1183                                                
1184                                                                  
1185                                                        
1186                            
1187              
1188                           omClass = TransitionPeer.getOMClass();
1189                          Transition obj2 = (Transition)TransitionPeer
1190                .row2Object( row, offset2, omClass);
1191
1192               boolean newObject = true;
1193            for (int j = 0; j < results.size(); j++)
1194            {
1195                Condition temp_obj1 = (Condition)results.get(j);
1196                Transition temp_obj2 = (Transition)temp_obj1.getTransition();
1197                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1198                {
1199                    newObject = false;
1200                                    temp_obj2.addCondition(obj1);
1201                                    break;
1202                }
1203            }
1204                            if (newObject)
1205            {
1206                obj2.initConditions();
1207                obj2.addCondition(obj1);
1208            }
1209                                                                                    
1210                                                        
1211                            
1212              
1213                           omClass = AttributePeer.getOMClass();
1214                          Attribute obj3 = (Attribute)AttributePeer
1215                .row2Object( row, offset3, omClass);
1216
1217               newObject = true;
1218            for (int j = 0; j < results.size(); j++)
1219            {
1220                Condition temp_obj1 = (Condition)results.get(j);
1221                Attribute temp_obj3 = (Attribute)temp_obj1.getAttribute();
1222                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1223                {
1224                    newObject = false;
1225                                    temp_obj3.addCondition(obj1);
1226                                    break;
1227                }
1228            }
1229                            if (newObject)
1230            {
1231                obj3.initConditions();
1232                obj3.addCondition(obj1);
1233            }
1234                                                                                    
1235                                                        
1236                            
1237              
1238                           omClass = AttributeOptionPeer.getOMClass();
1239                          AttributeOption obj4 = (AttributeOption)AttributeOptionPeer
1240                .row2Object( row, offset4, omClass);
1241
1242               newObject = true;
1243            for (int j = 0; j < results.size(); j++)
1244            {
1245                Condition temp_obj1 = (Condition)results.get(j);
1246                AttributeOption temp_obj4 = (AttributeOption)temp_obj1.getAttributeOption();
1247                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1248                {
1249                    newObject = false;
1250                                    temp_obj4.addCondition(obj1);
1251                                    break;
1252                }
1253            }
1254                            if (newObject)
1255            {
1256                obj4.initConditions();
1257                obj4.addCondition(obj1);
1258            }
1259                                                                                    
1260                                                                                      
1261                            
1262              
1263                           omClass = RModuleIssueTypePeer.getOMClass();
1264                          RModuleIssueType obj5 = (RModuleIssueType)RModuleIssueTypePeer
1265                .row2Object( row, offset5, omClass);
1266
1267               newObject = true;
1268            for (int j = 0; j < results.size(); j++)
1269            {
1270                Condition temp_obj1 = (Condition)results.get(j);
1271                RModuleIssueType temp_obj5 = (RModuleIssueType)temp_obj1.getRModuleIssueType();
1272                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1273                {
1274                    newObject = false;
1275                                    temp_obj5.addCondition(obj1);
1276                                    break;
1277                }
1278            }
1279                            if (newObject)
1280            {
1281                obj5.initConditions();
1282                obj5.addCondition(obj1);
1283            }
1284                                                                results.add(obj1);
1285        }
1286        return results;
1287    }
1288        
1289        
1290                                  
1291                
1292
1293    /**
1294     * selects a collection of Condition objects pre-filled with
1295     * all related objects.
1296     *
1297     * This method is protected by default in order to keep the public
1298     * api reasonable. You can provide public methods for those you
1299     * actually need in ConditionPeer.
1300     *
1301     * @throws TorqueException Any exceptions caught during processing will be
1302     * rethrown wrapped into a TorqueException.
1303     */

1304    protected static List JavaDoc doSelectJoinAllExceptTransition(Criteria criteria)
1305        throws TorqueException
1306    {
1307        setDbName(criteria);
1308
1309        addSelectColumns(criteria);
1310        int offset2 = numColumns + 1;
1311                                    
1312                    RModuleAttributePeer.addSelectColumns(criteria);
1313        int offset3 = offset2 + RModuleAttributePeer.numColumns;
1314                                                                
1315                                                  
1316                    AttributePeer.addSelectColumns(criteria);
1317        int offset4 = offset3 + AttributePeer.numColumns;
1318                                                                
1319                    AttributeOptionPeer.addSelectColumns(criteria);
1320        int offset5 = offset4 + AttributeOptionPeer.numColumns;
1321                                                                
1322                    RModuleIssueTypePeer.addSelectColumns(criteria);
1323        int offset6 = offset5 + RModuleIssueTypePeer.numColumns;
1324                                                                                                                                                                
1325        List JavaDoc rows = BasePeer.doSelect(criteria);
1326        List JavaDoc results = new ArrayList JavaDoc();
1327
1328        for (int i = 0; i < rows.size(); i++)
1329        {
1330            Record row = (Record)rows.get(i);
1331
1332                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1333                    Condition obj1 = (Condition)ConditionPeer
1334                .row2Object(row, 1, omClass);
1335                                                
1336                                                                                                                    
1337                            
1338              
1339                           omClass = RModuleAttributePeer.getOMClass();
1340                          RModuleAttribute obj2 = (RModuleAttribute)RModuleAttributePeer
1341                .row2Object( row, offset2, omClass);
1342
1343               boolean newObject = true;
1344            for (int j = 0; j < results.size(); j++)
1345            {
1346                Condition temp_obj1 = (Condition)results.get(j);
1347                RModuleAttribute temp_obj2 = (RModuleAttribute)temp_obj1.getRModuleAttribute();
1348                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1349                {
1350                    newObject = false;
1351                                    temp_obj2.addCondition(obj1);
1352                                    break;
1353                }
1354            }
1355                            if (newObject)
1356            {
1357                obj2.initConditions();
1358                obj2.addCondition(obj1);
1359            }
1360                                                                                    
1361                                                                  
1362                                                        
1363                            
1364              
1365                           omClass = AttributePeer.getOMClass();
1366                          Attribute obj3 = (Attribute)AttributePeer
1367                .row2Object( row, offset3, omClass);
1368
1369               newObject = true;
1370            for (int j = 0; j < results.size(); j++)
1371            {
1372                Condition temp_obj1 = (Condition)results.get(j);
1373                Attribute temp_obj3 = (Attribute)temp_obj1.getAttribute();
1374                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1375                {
1376                    newObject = false;
1377                                    temp_obj3.addCondition(obj1);
1378                                    break;
1379                }
1380            }
1381                            if (newObject)
1382            {
1383                obj3.initConditions();
1384                obj3.addCondition(obj1);
1385            }
1386                                                                                    
1387                                                        
1388                            
1389              
1390                           omClass = AttributeOptionPeer.getOMClass();
1391                          AttributeOption obj4 = (AttributeOption)AttributeOptionPeer
1392                .row2Object( row, offset4, omClass);
1393
1394               newObject = true;
1395            for (int j = 0; j < results.size(); j++)
1396            {
1397                Condition temp_obj1 = (Condition)results.get(j);
1398                AttributeOption temp_obj4 = (AttributeOption)temp_obj1.getAttributeOption();
1399                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1400                {
1401                    newObject = false;
1402                                    temp_obj4.addCondition(obj1);
1403                                    break;
1404                }
1405            }
1406                            if (newObject)
1407            {
1408                obj4.initConditions();
1409                obj4.addCondition(obj1);
1410            }
1411                                                                                    
1412                                                                                      
1413                            
1414              
1415                           omClass = RModuleIssueTypePeer.getOMClass();
1416                          RModuleIssueType obj5 = (RModuleIssueType)RModuleIssueTypePeer
1417                .row2Object( row, offset5, omClass);
1418
1419               newObject = true;
1420            for (int j = 0; j < results.size(); j++)
1421            {
1422                Condition temp_obj1 = (Condition)results.get(j);
1423                RModuleIssueType temp_obj5 = (RModuleIssueType)temp_obj1.getRModuleIssueType();
1424                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1425                {
1426                    newObject = false;
1427                                    temp_obj5.addCondition(obj1);
1428                                    break;
1429                }
1430            }
1431                            if (newObject)
1432            {
1433                obj5.initConditions();
1434                obj5.addCondition(obj1);
1435            }
1436                                                                results.add(obj1);
1437        }
1438        return results;
1439    }
1440        
1441        
1442                                  
1443                
1444
1445    /**
1446     * selects a collection of Condition objects pre-filled with
1447     * all related objects.
1448     *
1449     * This method is protected by default in order to keep the public
1450     * api reasonable. You can provide public methods for those you
1451     * actually need in ConditionPeer.
1452     *
1453     * @throws TorqueException Any exceptions caught during processing will be
1454     * rethrown wrapped into a TorqueException.
1455     */

1456    protected static List JavaDoc doSelectJoinAllExceptAttribute(Criteria criteria)
1457        throws TorqueException
1458    {
1459        setDbName(criteria);
1460
1461        addSelectColumns(criteria);
1462        int offset2 = numColumns + 1;
1463                                    
1464                    RModuleAttributePeer.addSelectColumns(criteria);
1465        int offset3 = offset2 + RModuleAttributePeer.numColumns;
1466                                                                
1467                    TransitionPeer.addSelectColumns(criteria);
1468        int offset4 = offset3 + TransitionPeer.numColumns;
1469                                                                
1470                                                  
1471                    AttributeOptionPeer.addSelectColumns(criteria);
1472        int offset5 = offset4 + AttributeOptionPeer.numColumns;
1473                                                                
1474                    RModuleIssueTypePeer.addSelectColumns(criteria);
1475        int offset6 = offset5 + RModuleIssueTypePeer.numColumns;
1476                                                                                                                                                                
1477        List JavaDoc rows = BasePeer.doSelect(criteria);
1478        List JavaDoc results = new ArrayList JavaDoc();
1479
1480        for (int i = 0; i < rows.size(); i++)
1481        {
1482            Record row = (Record)rows.get(i);
1483
1484                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1485                    Condition obj1 = (Condition)ConditionPeer
1486                .row2Object(row, 1, omClass);
1487                                                
1488                                                                                                                    
1489                            
1490              
1491                           omClass = RModuleAttributePeer.getOMClass();
1492                          RModuleAttribute obj2 = (RModuleAttribute)RModuleAttributePeer
1493                .row2Object( row, offset2, omClass);
1494
1495               boolean newObject = true;
1496            for (int j = 0; j < results.size(); j++)
1497            {
1498                Condition temp_obj1 = (Condition)results.get(j);
1499                RModuleAttribute temp_obj2 = (RModuleAttribute)temp_obj1.getRModuleAttribute();
1500                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1501                {
1502                    newObject = false;
1503                                    temp_obj2.addCondition(obj1);
1504                                    break;
1505                }
1506            }
1507                            if (newObject)
1508            {
1509                obj2.initConditions();
1510                obj2.addCondition(obj1);
1511            }
1512                                                                                    
1513                                                        
1514                            
1515              
1516                           omClass = TransitionPeer.getOMClass();
1517                          Transition obj3 = (Transition)TransitionPeer
1518                .row2Object( row, offset3, omClass);
1519
1520               newObject = true;
1521            for (int j = 0; j < results.size(); j++)
1522            {
1523                Condition temp_obj1 = (Condition)results.get(j);
1524                Transition temp_obj3 = (Transition)temp_obj1.getTransition();
1525                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1526                {
1527                    newObject = false;
1528                                    temp_obj3.addCondition(obj1);
1529                                    break;
1530                }
1531            }
1532                            if (newObject)
1533            {
1534                obj3.initConditions();
1535                obj3.addCondition(obj1);
1536            }
1537                                                                                    
1538                                                                  
1539                                                        
1540                            
1541              
1542                           omClass = AttributeOptionPeer.getOMClass();
1543                          AttributeOption obj4 = (AttributeOption)AttributeOptionPeer
1544                .row2Object( row, offset4, omClass);
1545
1546               newObject = true;
1547            for (int j = 0; j < results.size(); j++)
1548            {
1549                Condition temp_obj1 = (Condition)results.get(j);
1550                AttributeOption temp_obj4 = (AttributeOption)temp_obj1.getAttributeOption();
1551                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1552                {
1553                    newObject = false;
1554                                    temp_obj4.addCondition(obj1);
1555                                    break;
1556                }
1557            }
1558                            if (newObject)
1559            {
1560                obj4.initConditions();
1561                obj4.addCondition(obj1);
1562            }
1563                                                                                    
1564                                                                                      
1565                            
1566              
1567                           omClass = RModuleIssueTypePeer.getOMClass();
1568                          RModuleIssueType obj5 = (RModuleIssueType)RModuleIssueTypePeer
1569                .row2Object( row, offset5, omClass);
1570
1571               newObject = true;
1572            for (int j = 0; j < results.size(); j++)
1573            {
1574                Condition temp_obj1 = (Condition)results.get(j);
1575                RModuleIssueType temp_obj5 = (RModuleIssueType)temp_obj1.getRModuleIssueType();
1576                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1577                {
1578                    newObject = false;
1579                                    temp_obj5.addCondition(obj1);
1580                                    break;
1581                }
1582            }
1583                            if (newObject)
1584            {
1585                obj5.initConditions();
1586                obj5.addCondition(obj1);
1587            }
1588                                                                results.add(obj1);
1589        }
1590        return results;
1591    }
1592        
1593        
1594                                  
1595                
1596
1597    /**
1598     * selects a collection of Condition objects pre-filled with
1599     * all related objects.
1600     *
1601     * This method is protected by default in order to keep the public
1602     * api reasonable. You can provide public methods for those you
1603     * actually need in ConditionPeer.
1604     *
1605     * @throws TorqueException Any exceptions caught during processing will be
1606     * rethrown wrapped into a TorqueException.
1607     */

1608    protected static List JavaDoc doSelectJoinAllExceptAttributeOption(Criteria criteria)
1609        throws TorqueException
1610    {
1611        setDbName(criteria);
1612
1613        addSelectColumns(criteria);
1614        int offset2 = numColumns + 1;
1615                                    
1616                    RModuleAttributePeer.addSelectColumns(criteria);
1617        int offset3 = offset2 + RModuleAttributePeer.numColumns;
1618                                                                
1619                    TransitionPeer.addSelectColumns(criteria);
1620        int offset4 = offset3 + TransitionPeer.numColumns;
1621                                                                
1622                    AttributePeer.addSelectColumns(criteria);
1623        int offset5 = offset4 + AttributePeer.numColumns;
1624                                                                
1625                                                  
1626                    RModuleIssueTypePeer.addSelectColumns(criteria);
1627        int offset6 = offset5 + RModuleIssueTypePeer.numColumns;
1628                                                                                                                                                                
1629        List JavaDoc rows = BasePeer.doSelect(criteria);
1630        List JavaDoc results = new ArrayList JavaDoc();
1631
1632        for (int i = 0; i < rows.size(); i++)
1633        {
1634            Record row = (Record)rows.get(i);
1635
1636                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1637                    Condition obj1 = (Condition)ConditionPeer
1638                .row2Object(row, 1, omClass);
1639                                                
1640                                                                                                                    
1641                            
1642              
1643                           omClass = RModuleAttributePeer.getOMClass();
1644                          RModuleAttribute obj2 = (RModuleAttribute)RModuleAttributePeer
1645                .row2Object( row, offset2, omClass);
1646
1647               boolean newObject = true;
1648            for (int j = 0; j < results.size(); j++)
1649            {
1650                Condition temp_obj1 = (Condition)results.get(j);
1651                RModuleAttribute temp_obj2 = (RModuleAttribute)temp_obj1.getRModuleAttribute();
1652                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1653                {
1654                    newObject = false;
1655                                    temp_obj2.addCondition(obj1);
1656                                    break;
1657                }
1658            }
1659                            if (newObject)
1660            {
1661                obj2.initConditions();
1662                obj2.addCondition(obj1);
1663            }
1664                                                                                    
1665                                                        
1666                            
1667              
1668                           omClass = TransitionPeer.getOMClass();
1669                          Transition obj3 = (Transition)TransitionPeer
1670                .row2Object( row, offset3, omClass);
1671
1672               newObject = true;
1673            for (int j = 0; j < results.size(); j++)
1674            {
1675                Condition temp_obj1 = (Condition)results.get(j);
1676                Transition temp_obj3 = (Transition)temp_obj1.getTransition();
1677                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1678                {
1679                    newObject = false;
1680                                    temp_obj3.addCondition(obj1);
1681                                    break;
1682                }
1683            }
1684                            if (newObject)
1685            {
1686                obj3.initConditions();
1687                obj3.addCondition(obj1);
1688            }
1689                                                                                    
1690                                                        
1691                            
1692              
1693                           omClass = AttributePeer.getOMClass();
1694                          Attribute obj4 = (Attribute)AttributePeer
1695                .row2Object( row, offset4, omClass);
1696
1697               newObject = true;
1698            for (int j = 0; j < results.size(); j++)
1699            {
1700                Condition temp_obj1 = (Condition)results.get(j);
1701                Attribute temp_obj4 = (Attribute)temp_obj1.getAttribute();
1702                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1703                {
1704                    newObject = false;
1705                                    temp_obj4.addCondition(obj1);
1706                                    break;
1707                }
1708            }
1709                            if (newObject)
1710            {
1711                obj4.initConditions();
1712                obj4.addCondition(obj1);
1713            }
1714                                                                                    
1715                                                                  
1716                                                                                      
1717                            
1718              
1719                           omClass = RModuleIssueTypePeer.getOMClass();
1720                          RModuleIssueType obj5 = (RModuleIssueType)RModuleIssueTypePeer
1721                .row2Object( row, offset5, omClass);
1722
1723               newObject = true;
1724            for (int j = 0; j < results.size(); j++)
1725            {
1726                Condition temp_obj1 = (Condition)results.get(j);
1727                RModuleIssueType temp_obj5 = (RModuleIssueType)temp_obj1.getRModuleIssueType();
1728                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1729                {
1730                    newObject = false;
1731                                    temp_obj5.addCondition(obj1);
1732                                    break;
1733                }
1734            }
1735                            if (newObject)
1736            {
1737                obj5.initConditions();
1738                obj5.addCondition(obj1);
1739            }
1740                                                                results.add(obj1);
1741        }
1742        return results;
1743    }
1744        
1745        
1746                                                    
1747                
1748
1749    /**
1750     * selects a collection of Condition objects pre-filled with
1751     * all related objects.
1752     *
1753     * This method is protected by default in order to keep the public
1754     * api reasonable. You can provide public methods for those you
1755     * actually need in ConditionPeer.
1756     *
1757     * @throws TorqueException Any exceptions caught during processing will be
1758     * rethrown wrapped into a TorqueException.
1759     */

1760    protected static List JavaDoc doSelectJoinAllExceptRModuleIssueType(Criteria criteria)
1761        throws TorqueException
1762    {
1763        setDbName(criteria);
1764
1765        addSelectColumns(criteria);
1766        int offset2 = numColumns + 1;
1767                                    
1768                    RModuleAttributePeer.addSelectColumns(criteria);
1769        int offset3 = offset2 + RModuleAttributePeer.numColumns;
1770                                                                
1771                    TransitionPeer.addSelectColumns(criteria);
1772        int offset4 = offset3 + TransitionPeer.numColumns;
1773                                                                
1774                    AttributePeer.addSelectColumns(criteria);
1775        int offset5 = offset4 + AttributePeer.numColumns;
1776                                                                
1777                    AttributeOptionPeer.addSelectColumns(criteria);
1778        int offset6 = offset5 + AttributeOptionPeer.numColumns;
1779                                                                
1780                                                                                                                                                  
1781        List JavaDoc rows = BasePeer.doSelect(criteria);
1782        List JavaDoc results = new ArrayList JavaDoc();
1783
1784        for (int i = 0; i < rows.size(); i++)
1785        {
1786            Record row = (Record)rows.get(i);
1787
1788                            Class JavaDoc omClass = ConditionPeer.getOMClass();
1789                    Condition obj1 = (Condition)ConditionPeer
1790                .row2Object(row, 1, omClass);
1791                                                
1792                                                                                                                    
1793                            
1794              
1795                           omClass = RModuleAttributePeer.getOMClass();
1796                          RModuleAttribute obj2 = (RModuleAttribute)RModuleAttributePeer
1797                .row2Object( row, offset2, omClass);
1798
1799               boolean newObject = true;
1800            for (int j = 0; j < results.size(); j++)
1801            {
1802                Condition temp_obj1 = (Condition)results.get(j);
1803                RModuleAttribute temp_obj2 = (RModuleAttribute)temp_obj1.getRModuleAttribute();
1804                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1805                {
1806                    newObject = false;
1807                                    temp_obj2.addCondition(obj1);
1808                                    break;
1809                }
1810            }
1811                            if (newObject)
1812            {
1813                obj2.initConditions();
1814                obj2.addCondition(obj1);
1815            }
1816                                                                                    
1817                                                        
1818                            
1819              
1820                           omClass = TransitionPeer.getOMClass();
1821                          Transition obj3 = (Transition)TransitionPeer
1822                .row2Object( row, offset3, omClass);
1823
1824               newObject = true;
1825            for (int j = 0; j < results.size(); j++)
1826            {
1827                Condition temp_obj1 = (Condition)results.get(j);
1828                Transition temp_obj3 = (Transition)temp_obj1.getTransition();
1829                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1830                {
1831                    newObject = false;
1832                                    temp_obj3.addCondition(obj1);
1833                                    break;
1834                }
1835            }
1836                            if (newObject)
1837            {
1838                obj3.initConditions();
1839                obj3.addCondition(obj1);
1840            }
1841                                                                                    
1842                                                        
1843                            
1844              
1845                           omClass = AttributePeer.getOMClass();
1846                          Attribute obj4 = (Attribute)AttributePeer
1847                .row2Object( row, offset4, omClass);
1848
1849               newObject = true;
1850            for (int j = 0; j < results.size(); j++)
1851            {
1852                Condition temp_obj1 = (Condition)results.get(j);
1853                Attribute temp_obj4 = (Attribute)temp_obj1.getAttribute();
1854                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1855                {
1856                    newObject = false;
1857                                    temp_obj4.addCondition(obj1);
1858                                    break;
1859                }
1860            }
1861                            if (newObject)
1862            {
1863                obj4.initConditions();
1864                obj4.addCondition(obj1);
1865            }
1866                                                                                    
1867                                                        
1868                            
1869              
1870                           omClass = AttributeOptionPeer.getOMClass();
1871                          AttributeOption obj5 = (AttributeOption)AttributeOptionPeer
1872                .row2Object( row, offset5, omClass);
1873
1874               newObject = true;
1875            for (int j = 0; j < results.size(); j++)
1876            {
1877                Condition temp_obj1 = (Condition)results.get(j);
1878                AttributeOption temp_obj5 = (AttributeOption)temp_obj1.getAttributeOption();
1879                if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1880                {
1881                    newObject = false;
1882                                    temp_obj5.addCondition(obj1);
1883                                    break;
1884                }
1885            }
1886                            if (newObject)
1887            {
1888                obj5.initConditions();
1889                obj5.addCondition(obj1);
1890            }
1891                                                                                    
1892                                              results.add(obj1);
1893        }
1894        return results;
1895    }
1896                    
1897  
1898      /**
1899     * Returns the TableMap related to this peer. This method is not
1900     * needed for general use but a specific application could have a need.
1901     *
1902     * @throws TorqueException Any exceptions caught during processing will be
1903     * rethrown wrapped into a TorqueException.
1904     */

1905    protected static TableMap getTableMap()
1906        throws TorqueException
1907    {
1908        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1909    }
1910   
1911    private static void setDbName(Criteria crit)
1912    {
1913        // Set the correct dbName if it has not been overridden
1914
// crit.getDbName will return the same object if not set to
1915
// another value so == check is okay and faster
1916
if (crit.getDbName() == Torque.getDefaultDB())
1917        {
1918            crit.setDbName(DATABASE_NAME);
1919        }
1920    }
1921}
1922
Popular Tags