KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

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

215     public static ObjectKey doInsert(Criteria criteria, Connection JavaDoc con)
216         throws TorqueException
217     {
218                                                         // check for conversion from boolean to int
219
if (criteria.containsKey(DELETED))
220         {
221             Object JavaDoc possibleBoolean = criteria.get(DELETED);
222             if (possibleBoolean instanceof Boolean JavaDoc)
223             {
224                 criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
225             }
226          }
227       
228         setDbName(criteria);
229
230         if (con == null)
231         {
232             return BasePeer.doInsert(criteria);
233         }
234         else
235         {
236             return BasePeer.doInsert(criteria, con);
237         }
238     }
239
240     /**
241      * Add all the columns needed to create a new object.
242      *
243      * @param criteria object containing the columns to add.
244      * @throws TorqueException Any exceptions caught during processing will be
245      * rethrown wrapped into a TorqueException.
246      */

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

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

302     public static void populateObject(Record row,
303                                       int offset,
304                                       AttributeValue obj)
305         throws TorqueException
306     {
307         try
308         {
309                 obj.setValueId(row.getValue(offset + 0).asLongObj());
310                   obj.setIssueId(row.getValue(offset + 1).asLongObj());
311                   obj.setAttributeId(row.getValue(offset + 2).asIntegerObj());
312                   obj.setNumericValue(row.getValue(offset + 3).asIntegerObj());
313                   obj.setOptionId(row.getValue(offset + 4).asIntegerObj());
314                   obj.setUserId(row.getValue(offset + 5).asIntegerObj());
315                   obj.setValue(row.getValue(offset + 6).asString());
316                   obj.setDeleted(row.getValue(offset + 7).asBoolean());
317               }
318         catch (DataSetException e)
319         {
320             throw new TorqueException(e);
321         }
322     }
323
324     /**
325      * Method to do selects.
326      *
327      * @param criteria object used to create the SELECT statement.
328      * @return List of selected Objects
329      * @throws TorqueException Any exceptions caught during processing will be
330      * rethrown wrapped into a TorqueException.
331      */

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

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

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

378     public static List JavaDoc doSelectVillageRecords(Criteria criteria, Connection JavaDoc con)
379         throws TorqueException
380     {
381         if (criteria.getSelectColumns().size() == 0)
382         {
383             addSelectColumns(criteria);
384         }
385
386                                                         // check for conversion from boolean to int
387
if (criteria.containsKey(DELETED))
388         {
389             Object JavaDoc possibleBoolean = criteria.get(DELETED);
390             if (possibleBoolean instanceof Boolean JavaDoc)
391             {
392                 criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
393             }
394          }
395       
396         setDbName(criteria);
397
398         // BasePeer returns a List of Value (Village) arrays. The array
399
// order follows the order columns were placed in the Select clause.
400
if (con == null)
401         {
402             return BasePeer.doSelect(criteria);
403         }
404         else
405         {
406             return BasePeer.doSelect(criteria, con);
407         }
408     }
409
410     /**
411      * The returned List will contain objects of the default type or
412      * objects that inherit from the default.
413      *
414      * @throws TorqueException Any exceptions caught during processing will be
415      * rethrown wrapped into a TorqueException.
416      */

417     public static List JavaDoc populateObjects(List JavaDoc records)
418         throws TorqueException
419     {
420         List JavaDoc results = new ArrayList JavaDoc(records.size());
421
422         // populate the object(s)
423
for (int i = 0; i < records.size(); i++)
424         {
425             Record row = (Record) records.get(i);
426               results.add(AttributeValuePeer.row2Object(row, 1,
427                 AttributeValuePeer.getOMClass(row, 1)));
428           }
429         return results;
430     }
431  
432     /**
433      * The returned Class will contain objects of the default type or
434      * objects that inherit from the default.
435      *
436      * @throws TorqueException Any exceptions caught during processing will be
437      * rethrown wrapped into a TorqueException.
438      */

439     public static Class JavaDoc getOMClass(Record record, int offset)
440         throws TorqueException
441     {
442         Class JavaDoc c = null;
443         try
444         {
445               c = Class.forName(
446                 record.getValue(offset - 1 + 3).asString());
447           }
448         catch (Exception JavaDoc e)
449         {
450             throw new TorqueException(e);
451         }
452         return c;
453     }
454
455     /**
456      * The class that the Peer will make instances of.
457      * If the BO is abstract then you must implement this method
458      * in the BO.
459      *
460      * @throws TorqueException Any exceptions caught during processing will be
461      * rethrown wrapped into a TorqueException.
462      */

463     public static Class JavaDoc getOMClass()
464         throws TorqueException
465     {
466         return CLASS_DEFAULT;
467     }
468
469     /**
470      * Method to do updates.
471      *
472      * @param criteria object containing data that is used to create the UPDATE
473      * statement.
474      * @throws TorqueException Any exceptions caught during processing will be
475      * rethrown wrapped into a TorqueException.
476      */

477     public static void doUpdate(Criteria criteria) throws TorqueException
478     {
479          BaseAttributeValuePeer
480             .doUpdate(criteria, (Connection JavaDoc) null);
481     }
482
483     /**
484      * Method to do updates. This method is to be used during a transaction,
485      * otherwise use the doUpdate(Criteria) method. It will take care of
486      * the connection details internally.
487      *
488      * @param criteria object containing data that is used to create the UPDATE
489      * statement.
490      * @param con the connection to use
491      * @throws TorqueException Any exceptions caught during processing will be
492      * rethrown wrapped into a TorqueException.
493      */

494     public static void doUpdate(Criteria criteria, Connection JavaDoc con)
495         throws TorqueException
496     {
497         Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
498                    selectCriteria.put(VALUE_ID, criteria.remove(VALUE_ID));
499                                                                               // check for conversion from boolean to int
500
if (criteria.containsKey(DELETED))
501         {
502             Object JavaDoc possibleBoolean = criteria.get(DELETED);
503             if (possibleBoolean instanceof Boolean JavaDoc)
504             {
505                 criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
506             }
507          }
508           
509         setDbName(criteria);
510
511         if (con == null)
512         {
513             BasePeer.doUpdate(selectCriteria, criteria);
514         }
515         else
516         {
517             BasePeer.doUpdate(selectCriteria, criteria, con);
518         }
519     }
520
521     /**
522      * Method to do deletes.
523      *
524      * @param criteria object containing data that is used DELETE from database.
525      * @throws TorqueException Any exceptions caught during processing will be
526      * rethrown wrapped into a TorqueException.
527      */

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

544      public static void doDelete(Criteria criteria, Connection JavaDoc con)
545         throws TorqueException
546      {
547                                                         // check for conversion from boolean to int
548
if (criteria.containsKey(DELETED))
549         {
550             Object JavaDoc possibleBoolean = criteria.get(DELETED);
551             if (possibleBoolean instanceof Boolean JavaDoc)
552             {
553                 criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
554             }
555          }
556       
557         setDbName(criteria);
558
559         if (con == null)
560         {
561             BasePeer.doDelete(criteria);
562         }
563         else
564         {
565             BasePeer.doDelete(criteria, con);
566         }
567      }
568
569     /**
570      * Method to do selects
571      *
572      * @throws TorqueException Any exceptions caught during processing will be
573      * rethrown wrapped into a TorqueException.
574      */

575     public static List JavaDoc doSelect(AttributeValue obj) throws TorqueException
576     {
577         return doSelect(buildSelectCriteria(obj));
578     }
579
580     /**
581      * Method to do inserts
582      *
583      * @throws TorqueException Any exceptions caught during processing will be
584      * rethrown wrapped into a TorqueException.
585      */

586     public static void doInsert(AttributeValue obj) throws TorqueException
587     {
588           obj.setPrimaryKey(doInsert(buildCriteria(obj)));
589           obj.setNew(false);
590         obj.setModified(false);
591     }
592
593     /**
594      * @param obj the data object to update in the database.
595      * @throws TorqueException Any exceptions caught during processing will be
596      * rethrown wrapped into a TorqueException.
597      */

598     public static void doUpdate(AttributeValue obj) throws TorqueException
599     {
600         doUpdate(buildCriteria(obj));
601         obj.setModified(false);
602     }
603
604     /**
605      * @param obj the data object to delete in the database.
606      * @throws TorqueException Any exceptions caught during processing will be
607      * rethrown wrapped into a TorqueException.
608      */

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

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

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

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

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

688     public static void doDelete(ObjectKey pk, Connection JavaDoc con)
689         throws TorqueException
690     {
691         doDelete(buildCriteria(pk), con);
692     }
693
694     /** Build a Criteria object from an ObjectKey */
695     public static Criteria buildCriteria( ObjectKey pk )
696     {
697         Criteria criteria = new Criteria();
698               criteria.add(VALUE_ID, pk);
699           return criteria;
700      }
701
702     /** Build a Criteria object from the data object for this peer */
703     public static Criteria buildCriteria( AttributeValue obj )
704     {
705         Criteria criteria = new Criteria(DATABASE_NAME);
706               if (!obj.isNew())
707             criteria.add(VALUE_ID, obj.getValueId());
708               criteria.add(ISSUE_ID, obj.getIssueId());
709               criteria.add(ATTRIBUTE_ID, obj.getAttributeId());
710               criteria.add(NUMERIC_VALUE, obj.getNumericValue());
711               criteria.add(OPTION_ID, obj.getOptionId());
712               criteria.add(USER_ID, obj.getUserId());
713               criteria.add(VALUE, obj.getValue());
714               criteria.add(DELETED, obj.getDeleted());
715           return criteria;
716     }
717
718     /** Build a Criteria object from the data object for this peer, skipping all binary columns */
719     public static Criteria buildSelectCriteria( AttributeValue obj )
720     {
721         Criteria criteria = new Criteria(DATABASE_NAME);
722               if (!obj.isNew())
723                     criteria.add(VALUE_ID, obj.getValueId());
724                           criteria.add(ISSUE_ID, obj.getIssueId());
725                           criteria.add(ATTRIBUTE_ID, obj.getAttributeId());
726                           criteria.add(NUMERIC_VALUE, obj.getNumericValue());
727                           criteria.add(OPTION_ID, obj.getOptionId());
728                           criteria.add(USER_ID, obj.getUserId());
729                           criteria.add(VALUE, obj.getValue());
730                           criteria.add(DELETED, obj.getDeleted());
731               return criteria;
732     }
733  
734     
735         /**
736      * Retrieve a single object by pk
737      *
738      * @param pk the primary key
739      * @throws TorqueException Any exceptions caught during processing will be
740      * rethrown wrapped into a TorqueException.
741      * @throws NoRowsException Primary key was not found in database.
742      * @throws TooManyRowsException Primary key was not found in database.
743      */

744     public static AttributeValue retrieveByPK(Long JavaDoc pk)
745         throws TorqueException, NoRowsException, TooManyRowsException
746     {
747         return retrieveByPK(SimpleKey.keyFor(pk));
748     }
749
750     /**
751      * Retrieve a single object by pk
752      *
753      * @param pk the primary key
754      * @param con the connection to use
755      * @throws TorqueException Any exceptions caught during processing will be
756      * rethrown wrapped into a TorqueException.
757      * @throws NoRowsException Primary key was not found in database.
758      * @throws TooManyRowsException Primary key was not found in database.
759      */

760     public static AttributeValue retrieveByPK(Long JavaDoc pk, Connection JavaDoc con)
761         throws TorqueException, NoRowsException, TooManyRowsException
762     {
763         return retrieveByPK(SimpleKey.keyFor(pk), con);
764     }
765   
766     /**
767      * Retrieve a single object by pk
768      *
769      * @param pk the primary key
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 AttributeValue retrieveByPK(ObjectKey pk)
776         throws TorqueException, NoRowsException, TooManyRowsException
777     {
778         Connection JavaDoc db = null;
779         AttributeValue retVal = null;
780         try
781         {
782             db = Torque.getConnection(DATABASE_NAME);
783             retVal = retrieveByPK(pk, db);
784         }
785         finally
786         {
787             Torque.closeConnection(db);
788         }
789         return(retVal);
790     }
791
792     /**
793      * Retrieve a single object by pk
794      *
795      * @param pk the primary key
796      * @param con the connection to use
797      * @throws TorqueException Any exceptions caught during processing will be
798      * rethrown wrapped into a TorqueException.
799      * @throws NoRowsException Primary key was not found in database.
800      * @throws TooManyRowsException Primary key was not found in database.
801      */

802     public static AttributeValue retrieveByPK(ObjectKey pk, Connection JavaDoc con)
803         throws TorqueException, NoRowsException, TooManyRowsException
804     {
805         Criteria criteria = buildCriteria(pk);
806         List JavaDoc v = doSelect(criteria, con);
807         if (v.size() == 0)
808         {
809             throw new NoRowsException("Failed to select a row.");
810         }
811         else if (v.size() > 1)
812         {
813             throw new TooManyRowsException("Failed to select only one row.");
814         }
815         else
816         {
817             return (AttributeValue)v.get(0);
818         }
819     }
820
821     /**
822      * Retrieve a multiple objects by pk
823      *
824      * @param pks List of primary keys
825      * @throws TorqueException Any exceptions caught during processing will be
826      * rethrown wrapped into a TorqueException.
827      */

828     public static List JavaDoc retrieveByPKs(List JavaDoc pks)
829         throws TorqueException
830     {
831         Connection JavaDoc db = null;
832         List JavaDoc retVal = null;
833         try
834         {
835            db = Torque.getConnection(DATABASE_NAME);
836            retVal = retrieveByPKs(pks, db);
837         }
838         finally
839         {
840             Torque.closeConnection(db);
841         }
842         return(retVal);
843     }
844
845     /**
846      * Retrieve a multiple objects by pk
847      *
848      * @param pks List of primary keys
849      * @param dbcon the connection to use
850      * @throws TorqueException Any exceptions caught during processing will be
851      * rethrown wrapped into a TorqueException.
852      */

853     public static List JavaDoc retrieveByPKs( List JavaDoc pks, Connection JavaDoc dbcon )
854         throws TorqueException
855     {
856         List JavaDoc objs = null;
857         if (pks == null || pks.size() == 0)
858         {
859             objs = new LinkedList JavaDoc();
860         }
861         else
862         {
863             Criteria criteria = new Criteria();
864               criteria.addIn( VALUE_ID, pks );
865           objs = doSelect(criteria, dbcon);
866         }
867         return objs;
868     }
869
870  
871
872
873
874                 
875                                               
876                 
877                 
878
879     /**
880      * selects a collection of AttributeValue objects pre-filled with their
881      * Issue objects.
882      *
883      * This method is protected by default in order to keep the public
884      * api reasonable. You can provide public methods for those you
885      * actually need in AttributeValuePeer.
886      *
887      * @throws TorqueException Any exceptions caught during processing will be
888      * rethrown wrapped into a TorqueException.
889      */

890     protected static List JavaDoc doSelectJoinIssue(Criteria criteria)
891         throws TorqueException
892     {
893         setDbName(criteria);
894
895         AttributeValuePeer.addSelectColumns(criteria);
896         int offset = numColumns + 1;
897         IssuePeer.addSelectColumns(criteria);
898
899
900                         criteria.addJoin(AttributeValuePeer.ISSUE_ID,
901             IssuePeer.ISSUE_ID);
902         
903
904                                                                                                                                                         // check for conversion from boolean to int
905
if (criteria.containsKey(DELETED))
906         {
907             Object JavaDoc possibleBoolean = criteria.get(DELETED);
908             if (possibleBoolean instanceof Boolean JavaDoc)
909             {
910                 criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
911             }
912          }
913                   
914         List JavaDoc rows = BasePeer.doSelect(criteria);
915         List JavaDoc results = new ArrayList JavaDoc();
916
917         for (int i = 0; i < rows.size(); i++)
918         {
919             Record row = (Record) rows.get(i);
920
921                             Class JavaDoc omClass = AttributeValuePeer.getOMClass(row, 1);
922                     AttributeValue obj1 = (AttributeValue) AttributeValuePeer
923                 .row2Object(row, 1, omClass);
924                      omClass = IssuePeer.getOMClass();
925                     Issue obj2 = (Issue)IssuePeer
926                 .row2Object(row, offset, omClass);
927
928             boolean newObject = true;
929             for (int j = 0; j < results.size(); j++)
930             {
931                 AttributeValue temp_obj1 = (AttributeValue)results.get(j);
932                 Issue temp_obj2 = (Issue)temp_obj1.getIssue();
933                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
934                 {
935                     newObject = false;
936                               temp_obj2.addAttributeValue(obj1);
937                               break;
938                 }
939             }
940                       if (newObject)
941             {
942                 obj2.initAttributeValues();
943                 obj2.addAttributeValue(obj1);
944             }
945                       results.add(obj1);
946         }
947         return results;
948     }
949                                                             
950                 
951                 
952
953     /**
954      * selects a collection of AttributeValue objects pre-filled with their
955      * Attribute objects.
956      *
957      * This method is protected by default in order to keep the public
958      * api reasonable. You can provide public methods for those you
959      * actually need in AttributeValuePeer.
960      *
961      * @throws TorqueException Any exceptions caught during processing will be
962      * rethrown wrapped into a TorqueException.
963      */

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

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

1112    protected static List JavaDoc doSelectJoinScarabUserImpl(Criteria criteria)
1113        throws TorqueException
1114    {
1115        setDbName(criteria);
1116
1117        AttributeValuePeer.addSelectColumns(criteria);
1118        int offset = numColumns + 1;
1119        ScarabUserImplPeer.addSelectColumns(criteria);
1120
1121
1122                        criteria.addJoin(AttributeValuePeer.USER_ID,
1123            ScarabUserImplPeer.USER_ID);
1124        
1125
1126                                                                                                                                                        // check for conversion from boolean to int
1127
if (criteria.containsKey(DELETED))
1128        {
1129            Object JavaDoc possibleBoolean = criteria.get(DELETED);
1130            if (possibleBoolean instanceof Boolean JavaDoc)
1131            {
1132                criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
1133            }
1134         }
1135                  
1136        List JavaDoc rows = BasePeer.doSelect(criteria);
1137        List JavaDoc results = new ArrayList JavaDoc();
1138
1139        for (int i = 0; i < rows.size(); i++)
1140        {
1141            Record row = (Record) rows.get(i);
1142
1143                            Class JavaDoc omClass = AttributeValuePeer.getOMClass(row, 1);
1144                    AttributeValue obj1 = (AttributeValue) AttributeValuePeer
1145                .row2Object(row, 1, omClass);
1146                     omClass = ScarabUserImplPeer.getOMClass();
1147                    ScarabUserImpl obj2 = (ScarabUserImpl)ScarabUserImplPeer
1148                .row2Object(row, offset, omClass);
1149
1150            boolean newObject = true;
1151            for (int j = 0; j < results.size(); j++)
1152            {
1153                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1154                ScarabUserImpl temp_obj2 = (ScarabUserImpl)temp_obj1.getScarabUser();
1155                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1156                {
1157                    newObject = false;
1158                              temp_obj2.addAttributeValue(obj1);
1159                              break;
1160                }
1161            }
1162                      if (newObject)
1163            {
1164                obj2.initAttributeValues();
1165                obj2.addAttributeValue(obj1);
1166            }
1167                      results.add(obj1);
1168        }
1169        return results;
1170    }
1171                    
1172  
1173                                              
1174          
1175        
1176                                  
1177                
1178
1179    /**
1180     * selects a collection of AttributeValue objects pre-filled with
1181     * all related objects.
1182     *
1183     * This method is protected by default in order to keep the public
1184     * api reasonable. You can provide public methods for those you
1185     * actually need in AttributeValuePeer.
1186     *
1187     * @throws TorqueException Any exceptions caught during processing will be
1188     * rethrown wrapped into a TorqueException.
1189     */

1190    protected static List JavaDoc doSelectJoinAllExceptIssue(Criteria criteria)
1191        throws TorqueException
1192    {
1193        setDbName(criteria);
1194
1195        addSelectColumns(criteria);
1196        int offset2 = numColumns + 1;
1197                                    
1198                                                  
1199                    AttributePeer.addSelectColumns(criteria);
1200        int offset3 = offset2 + AttributePeer.numColumns;
1201                                                                
1202                    AttributeOptionPeer.addSelectColumns(criteria);
1203        int offset4 = offset3 + AttributeOptionPeer.numColumns;
1204                                                                
1205                    ScarabUserImplPeer.addSelectColumns(criteria);
1206        int offset5 = offset4 + ScarabUserImplPeer.numColumns;
1207                                                                                                                                                                                                    // check for conversion from boolean to int
1208
if (criteria.containsKey(DELETED))
1209        {
1210            Object JavaDoc possibleBoolean = criteria.get(DELETED);
1211            if (possibleBoolean instanceof Boolean JavaDoc)
1212            {
1213                criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
1214            }
1215         }
1216                  
1217        List JavaDoc rows = BasePeer.doSelect(criteria);
1218        List JavaDoc results = new ArrayList JavaDoc();
1219
1220        for (int i = 0; i < rows.size(); i++)
1221        {
1222            Record row = (Record)rows.get(i);
1223
1224                            Class JavaDoc omClass = AttributeValuePeer.getOMClass(row, 1);
1225                    AttributeValue obj1 = (AttributeValue)AttributeValuePeer
1226                .row2Object(row, 1, omClass);
1227                                                
1228                                                                  
1229                                                        
1230                            
1231              
1232                           omClass = AttributePeer.getOMClass();
1233                          Attribute obj2 = (Attribute)AttributePeer
1234                .row2Object( row, offset2, omClass);
1235
1236               boolean newObject = true;
1237            for (int j = 0; j < results.size(); j++)
1238            {
1239                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1240                Attribute temp_obj2 = (Attribute)temp_obj1.getAttribute();
1241                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1242                {
1243                    newObject = false;
1244                                    temp_obj2.addAttributeValue(obj1);
1245                                    break;
1246                }
1247            }
1248                            if (newObject)
1249            {
1250                obj2.initAttributeValues();
1251                obj2.addAttributeValue(obj1);
1252            }
1253                                                                                    
1254                                                        
1255                            
1256              
1257                           omClass = AttributeOptionPeer.getOMClass();
1258                          AttributeOption obj3 = (AttributeOption)AttributeOptionPeer
1259                .row2Object( row, offset3, omClass);
1260
1261               newObject = true;
1262            for (int j = 0; j < results.size(); j++)
1263            {
1264                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1265                AttributeOption temp_obj3 = (AttributeOption)temp_obj1.getAttributeOption();
1266                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1267                {
1268                    newObject = false;
1269                                    temp_obj3.addAttributeValue(obj1);
1270                                    break;
1271                }
1272            }
1273                            if (newObject)
1274            {
1275                obj3.initAttributeValues();
1276                obj3.addAttributeValue(obj1);
1277            }
1278                                                                                                
1279                                                        
1280                            
1281              
1282                           omClass = ScarabUserImplPeer.getOMClass();
1283                          ScarabUserImpl obj4 = (ScarabUserImpl)ScarabUserImplPeer
1284                .row2Object( row, offset4, omClass);
1285
1286               newObject = true;
1287            for (int j = 0; j < results.size(); j++)
1288            {
1289                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1290                ScarabUserImpl temp_obj4 = (ScarabUserImpl)temp_obj1.getScarabUser();
1291                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1292                {
1293                    newObject = false;
1294                                    temp_obj4.addAttributeValue(obj1);
1295                                    break;
1296                }
1297            }
1298                            if (newObject)
1299            {
1300                obj4.initAttributeValues();
1301                obj4.addAttributeValue(obj1);
1302            }
1303                                                                results.add(obj1);
1304        }
1305        return results;
1306    }
1307        
1308        
1309                                  
1310                
1311
1312    /**
1313     * selects a collection of AttributeValue objects pre-filled with
1314     * all related objects.
1315     *
1316     * This method is protected by default in order to keep the public
1317     * api reasonable. You can provide public methods for those you
1318     * actually need in AttributeValuePeer.
1319     *
1320     * @throws TorqueException Any exceptions caught during processing will be
1321     * rethrown wrapped into a TorqueException.
1322     */

1323    protected static List JavaDoc doSelectJoinAllExceptAttribute(Criteria criteria)
1324        throws TorqueException
1325    {
1326        setDbName(criteria);
1327
1328        addSelectColumns(criteria);
1329        int offset2 = numColumns + 1;
1330                                    
1331                    IssuePeer.addSelectColumns(criteria);
1332        int offset3 = offset2 + IssuePeer.numColumns;
1333                                                                
1334                                                  
1335                    AttributeOptionPeer.addSelectColumns(criteria);
1336        int offset4 = offset3 + AttributeOptionPeer.numColumns;
1337                                                                
1338                    ScarabUserImplPeer.addSelectColumns(criteria);
1339        int offset5 = offset4 + ScarabUserImplPeer.numColumns;
1340                                                                                                                                                                                                    // check for conversion from boolean to int
1341
if (criteria.containsKey(DELETED))
1342        {
1343            Object JavaDoc possibleBoolean = criteria.get(DELETED);
1344            if (possibleBoolean instanceof Boolean JavaDoc)
1345            {
1346                criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
1347            }
1348         }
1349                  
1350        List JavaDoc rows = BasePeer.doSelect(criteria);
1351        List JavaDoc results = new ArrayList JavaDoc();
1352
1353        for (int i = 0; i < rows.size(); i++)
1354        {
1355            Record row = (Record)rows.get(i);
1356
1357                            Class JavaDoc omClass = AttributeValuePeer.getOMClass(row, 1);
1358                    AttributeValue obj1 = (AttributeValue)AttributeValuePeer
1359                .row2Object(row, 1, omClass);
1360                                                
1361                                                        
1362                            
1363              
1364                           omClass = IssuePeer.getOMClass();
1365                          Issue obj2 = (Issue)IssuePeer
1366                .row2Object( row, offset2, omClass);
1367
1368               boolean newObject = true;
1369            for (int j = 0; j < results.size(); j++)
1370            {
1371                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1372                Issue temp_obj2 = (Issue)temp_obj1.getIssue();
1373                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1374                {
1375                    newObject = false;
1376                                    temp_obj2.addAttributeValue(obj1);
1377                                    break;
1378                }
1379            }
1380                            if (newObject)
1381            {
1382                obj2.initAttributeValues();
1383                obj2.addAttributeValue(obj1);
1384            }
1385                                                                                    
1386                                                                  
1387                                                        
1388                            
1389              
1390                           omClass = AttributeOptionPeer.getOMClass();
1391                          AttributeOption obj3 = (AttributeOption)AttributeOptionPeer
1392                .row2Object( row, offset3, omClass);
1393
1394               newObject = true;
1395            for (int j = 0; j < results.size(); j++)
1396            {
1397                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1398                AttributeOption temp_obj3 = (AttributeOption)temp_obj1.getAttributeOption();
1399                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1400                {
1401                    newObject = false;
1402                                    temp_obj3.addAttributeValue(obj1);
1403                                    break;
1404                }
1405            }
1406                            if (newObject)
1407            {
1408                obj3.initAttributeValues();
1409                obj3.addAttributeValue(obj1);
1410            }
1411                                                                                                
1412                                                        
1413                            
1414              
1415                           omClass = ScarabUserImplPeer.getOMClass();
1416                          ScarabUserImpl obj4 = (ScarabUserImpl)ScarabUserImplPeer
1417                .row2Object( row, offset4, omClass);
1418
1419               newObject = true;
1420            for (int j = 0; j < results.size(); j++)
1421            {
1422                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1423                ScarabUserImpl temp_obj4 = (ScarabUserImpl)temp_obj1.getScarabUser();
1424                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1425                {
1426                    newObject = false;
1427                                    temp_obj4.addAttributeValue(obj1);
1428                                    break;
1429                }
1430            }
1431                            if (newObject)
1432            {
1433                obj4.initAttributeValues();
1434                obj4.addAttributeValue(obj1);
1435            }
1436                                                                results.add(obj1);
1437        }
1438        return results;
1439    }
1440        
1441        
1442                                  
1443                
1444
1445    /**
1446     * selects a collection of AttributeValue 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 AttributeValuePeer.
1452     *
1453     * @throws TorqueException Any exceptions caught during processing will be
1454     * rethrown wrapped into a TorqueException.
1455     */

1456    protected static List JavaDoc doSelectJoinAllExceptAttributeOption(Criteria criteria)
1457        throws TorqueException
1458    {
1459        setDbName(criteria);
1460
1461        addSelectColumns(criteria);
1462        int offset2 = numColumns + 1;
1463                                    
1464                    IssuePeer.addSelectColumns(criteria);
1465        int offset3 = offset2 + IssuePeer.numColumns;
1466                                                                
1467                    AttributePeer.addSelectColumns(criteria);
1468        int offset4 = offset3 + AttributePeer.numColumns;
1469                                                                
1470                                                  
1471                    ScarabUserImplPeer.addSelectColumns(criteria);
1472        int offset5 = offset4 + ScarabUserImplPeer.numColumns;
1473                                                                                                                                                                                                    // check for conversion from boolean to int
1474
if (criteria.containsKey(DELETED))
1475        {
1476            Object JavaDoc possibleBoolean = criteria.get(DELETED);
1477            if (possibleBoolean instanceof Boolean JavaDoc)
1478            {
1479                criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
1480            }
1481         }
1482                  
1483        List JavaDoc rows = BasePeer.doSelect(criteria);
1484        List JavaDoc results = new ArrayList JavaDoc();
1485
1486        for (int i = 0; i < rows.size(); i++)
1487        {
1488            Record row = (Record)rows.get(i);
1489
1490                            Class JavaDoc omClass = AttributeValuePeer.getOMClass(row, 1);
1491                    AttributeValue obj1 = (AttributeValue)AttributeValuePeer
1492                .row2Object(row, 1, omClass);
1493                                                
1494                                                        
1495                            
1496              
1497                           omClass = IssuePeer.getOMClass();
1498                          Issue obj2 = (Issue)IssuePeer
1499                .row2Object( row, offset2, omClass);
1500
1501               boolean newObject = true;
1502            for (int j = 0; j < results.size(); j++)
1503            {
1504                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1505                Issue temp_obj2 = (Issue)temp_obj1.getIssue();
1506                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1507                {
1508                    newObject = false;
1509                                    temp_obj2.addAttributeValue(obj1);
1510                                    break;
1511                }
1512            }
1513                            if (newObject)
1514            {
1515                obj2.initAttributeValues();
1516                obj2.addAttributeValue(obj1);
1517            }
1518                                                                                    
1519                                                        
1520                            
1521              
1522                           omClass = AttributePeer.getOMClass();
1523                          Attribute obj3 = (Attribute)AttributePeer
1524                .row2Object( row, offset3, omClass);
1525
1526               newObject = true;
1527            for (int j = 0; j < results.size(); j++)
1528            {
1529                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1530                Attribute temp_obj3 = (Attribute)temp_obj1.getAttribute();
1531                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1532                {
1533                    newObject = false;
1534                                    temp_obj3.addAttributeValue(obj1);
1535                                    break;
1536                }
1537            }
1538                            if (newObject)
1539            {
1540                obj3.initAttributeValues();
1541                obj3.addAttributeValue(obj1);
1542            }
1543                                                                                    
1544                                                                              
1545                                                        
1546                            
1547              
1548                           omClass = ScarabUserImplPeer.getOMClass();
1549                          ScarabUserImpl obj4 = (ScarabUserImpl)ScarabUserImplPeer
1550                .row2Object( row, offset4, omClass);
1551
1552               newObject = true;
1553            for (int j = 0; j < results.size(); j++)
1554            {
1555                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1556                ScarabUserImpl temp_obj4 = (ScarabUserImpl)temp_obj1.getScarabUser();
1557                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1558                {
1559                    newObject = false;
1560                                    temp_obj4.addAttributeValue(obj1);
1561                                    break;
1562                }
1563            }
1564                            if (newObject)
1565            {
1566                obj4.initAttributeValues();
1567                obj4.addAttributeValue(obj1);
1568            }
1569                                                                results.add(obj1);
1570        }
1571        return results;
1572    }
1573        
1574        
1575                                  
1576                
1577
1578    /**
1579     * selects a collection of AttributeValue objects pre-filled with
1580     * all related objects.
1581     *
1582     * This method is protected by default in order to keep the public
1583     * api reasonable. You can provide public methods for those you
1584     * actually need in AttributeValuePeer.
1585     *
1586     * @throws TorqueException Any exceptions caught during processing will be
1587     * rethrown wrapped into a TorqueException.
1588     */

1589    protected static List JavaDoc doSelectJoinAllExceptScarabUserImpl(Criteria criteria)
1590        throws TorqueException
1591    {
1592        setDbName(criteria);
1593
1594        addSelectColumns(criteria);
1595        int offset2 = numColumns + 1;
1596                                    
1597                    IssuePeer.addSelectColumns(criteria);
1598        int offset3 = offset2 + IssuePeer.numColumns;
1599                                                                
1600                    AttributePeer.addSelectColumns(criteria);
1601        int offset4 = offset3 + AttributePeer.numColumns;
1602                                                                
1603                    AttributeOptionPeer.addSelectColumns(criteria);
1604        int offset5 = offset4 + AttributeOptionPeer.numColumns;
1605                                                                
1606                                                                                                                                                                                      // check for conversion from boolean to int
1607
if (criteria.containsKey(DELETED))
1608        {
1609            Object JavaDoc possibleBoolean = criteria.get(DELETED);
1610            if (possibleBoolean instanceof Boolean JavaDoc)
1611            {
1612                criteria.add(DELETED, ((Boolean JavaDoc) possibleBoolean).booleanValue() ? 1 : 0);
1613            }
1614         }
1615                  
1616        List JavaDoc rows = BasePeer.doSelect(criteria);
1617        List JavaDoc results = new ArrayList JavaDoc();
1618
1619        for (int i = 0; i < rows.size(); i++)
1620        {
1621            Record row = (Record)rows.get(i);
1622
1623                            Class JavaDoc omClass = AttributeValuePeer.getOMClass(row, 1);
1624                    AttributeValue obj1 = (AttributeValue)AttributeValuePeer
1625                .row2Object(row, 1, omClass);
1626                                                
1627                                                        
1628                            
1629              
1630                           omClass = IssuePeer.getOMClass();
1631                          Issue obj2 = (Issue)IssuePeer
1632                .row2Object( row, offset2, omClass);
1633
1634               boolean newObject = true;
1635            for (int j = 0; j < results.size(); j++)
1636            {
1637                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1638                Issue temp_obj2 = (Issue)temp_obj1.getIssue();
1639                if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1640                {
1641                    newObject = false;
1642                                    temp_obj2.addAttributeValue(obj1);
1643                                    break;
1644                }
1645            }
1646                            if (newObject)
1647            {
1648                obj2.initAttributeValues();
1649                obj2.addAttributeValue(obj1);
1650            }
1651                                                                                    
1652                                                        
1653                            
1654              
1655                           omClass = AttributePeer.getOMClass();
1656                          Attribute obj3 = (Attribute)AttributePeer
1657                .row2Object( row, offset3, omClass);
1658
1659               newObject = true;
1660            for (int j = 0; j < results.size(); j++)
1661            {
1662                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1663                Attribute temp_obj3 = (Attribute)temp_obj1.getAttribute();
1664                if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1665                {
1666                    newObject = false;
1667                                    temp_obj3.addAttributeValue(obj1);
1668                                    break;
1669                }
1670            }
1671                            if (newObject)
1672            {
1673                obj3.initAttributeValues();
1674                obj3.addAttributeValue(obj1);
1675            }
1676                                                                                    
1677                                                        
1678                            
1679              
1680                           omClass = AttributeOptionPeer.getOMClass();
1681                          AttributeOption obj4 = (AttributeOption)AttributeOptionPeer
1682                .row2Object( row, offset4, omClass);
1683
1684               newObject = true;
1685            for (int j = 0; j < results.size(); j++)
1686            {
1687                AttributeValue temp_obj1 = (AttributeValue)results.get(j);
1688                AttributeOption temp_obj4 = (AttributeOption)temp_obj1.getAttributeOption();
1689                if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1690                {
1691                    newObject = false;
1692                                    temp_obj4.addAttributeValue(obj1);
1693                                    break;
1694                }
1695            }
1696                            if (newObject)
1697            {
1698                obj4.initAttributeValues();
1699                obj4.addAttributeValue(obj1);
1700            }
1701                                                                                                
1702                                              results.add(obj1);
1703        }
1704        return results;
1705    }
1706                    
1707  
1708      /**
1709     * Returns the TableMap related to this peer. This method is not
1710     * needed for general use but a specific application could have a need.
1711     *
1712     * @throws TorqueException Any exceptions caught during processing will be
1713     * rethrown wrapped into a TorqueException.
1714     */

1715    protected static TableMap getTableMap()
1716        throws TorqueException
1717    {
1718        return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1719    }
1720   
1721    private static void setDbName(Criteria crit)
1722    {
1723        // Set the correct dbName if it has not been overridden
1724
// crit.getDbName will return the same object if not set to
1725
// another value so == check is okay and faster
1726
if (crit.getDbName() == Torque.getDefaultDB())
1727        {
1728            crit.setDbName(DATABASE_NAME);
1729        }
1730    }
1731}
1732
Popular Tags