Source Code Cross Referenced for BaseConditionPeer.java in  » Issue-Tracking » scarab-0.21 » org » tigris » scarab » om » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Issue Tracking » scarab 0.21 » org.tigris.scarab.om 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package org.tigris.scarab.om;
0002:
0003:        import java.math.BigDecimal;
0004:        import java.sql.Connection;
0005:        import java.sql.SQLException;
0006:        import java.util.ArrayList;
0007:        import java.util.Date;
0008:        import java.util.Iterator;
0009:        import java.util.LinkedList;
0010:        import java.util.List;
0011:
0012:        import org.apache.torque.NoRowsException;
0013:        import org.apache.torque.TooManyRowsException;
0014:        import org.apache.torque.Torque;
0015:        import org.apache.torque.TorqueException;
0016:        import org.apache.torque.map.MapBuilder;
0017:        import org.apache.torque.map.TableMap;
0018:        import org.apache.torque.om.DateKey;
0019:        import org.apache.torque.om.NumberKey;
0020:        import org.apache.torque.om.StringKey;
0021:        import org.apache.torque.om.ObjectKey;
0022:        import org.apache.torque.om.SimpleKey;
0023:        import org.apache.torque.util.BasePeer;
0024:        import org.apache.torque.util.Criteria;
0025:
0026:        import com.workingdogs.village.DataSetException;
0027:        import com.workingdogs.village.QueryDataSet;
0028:        import com.workingdogs.village.Record;
0029:
0030:        // Local classes
0031:        import org.tigris.scarab.om.map.*;
0032:
0033:        /**
0034:         */
0035:        public abstract class BaseConditionPeer extends BasePeer {
0036:
0037:            /** the default database name for this class */
0038:            public static final String DATABASE_NAME = "scarab";
0039:
0040:            /** the table name for this class */
0041:            public static final String TABLE_NAME = "SCARAB_CONDITION";
0042:
0043:            /**
0044:             * @return the map builder for this peer
0045:             * @throws TorqueException Any exceptions caught during processing will be
0046:             *         rethrown wrapped into a TorqueException.
0047:             */
0048:            public static MapBuilder getMapBuilder() throws TorqueException {
0049:                return getMapBuilder(ConditionMapBuilder.CLASS_NAME);
0050:            }
0051:
0052:            /** the column name for the CONDITION_ID field */
0053:            public static final String CONDITION_ID;
0054:            /** the column name for the TRANSITION_ID field */
0055:            public static final String TRANSITION_ID;
0056:            /** the column name for the MODULE_ID field */
0057:            public static final String MODULE_ID;
0058:            /** the column name for the ISSUE_TYPE_ID field */
0059:            public static final String ISSUE_TYPE_ID;
0060:            /** the column name for the ATTRIBUTE_ID field */
0061:            public static final String ATTRIBUTE_ID;
0062:            /** the column name for the OPTION_ID field */
0063:            public static final String OPTION_ID;
0064:
0065:            static {
0066:                CONDITION_ID = "SCARAB_CONDITION.CONDITION_ID";
0067:                TRANSITION_ID = "SCARAB_CONDITION.TRANSITION_ID";
0068:                MODULE_ID = "SCARAB_CONDITION.MODULE_ID";
0069:                ISSUE_TYPE_ID = "SCARAB_CONDITION.ISSUE_TYPE_ID";
0070:                ATTRIBUTE_ID = "SCARAB_CONDITION.ATTRIBUTE_ID";
0071:                OPTION_ID = "SCARAB_CONDITION.OPTION_ID";
0072:                if (Torque.isInit()) {
0073:                    try {
0074:                        getMapBuilder(ConditionMapBuilder.CLASS_NAME);
0075:                    } catch (Exception e) {
0076:                        log.error("Could not initialize Peer", e);
0077:                        throw new RuntimeException(e);
0078:                    }
0079:                } else {
0080:                    Torque.registerMapBuilder(ConditionMapBuilder.CLASS_NAME);
0081:                }
0082:            }
0083:
0084:            /** number of columns for this peer */
0085:            public static final int numColumns = 6;
0086:
0087:            /** A class that can be returned by this peer. */
0088:            protected static final String CLASSNAME_DEFAULT = "org.tigris.scarab.om.Condition";
0089:
0090:            /** A class that can be returned by this peer. */
0091:            protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
0092:
0093:            /**
0094:             * Class object initialization method.
0095:             *
0096:             * @param className name of the class to initialize
0097:             * @return the initialized class
0098:             */
0099:            private static Class initClass(String className) {
0100:                Class c = null;
0101:                try {
0102:                    c = Class.forName(className);
0103:                } catch (Throwable t) {
0104:                    log
0105:                            .error(
0106:                                    "A FATAL ERROR has occurred which should not "
0107:                                            + "have happened under any circumstance.  Please notify "
0108:                                            + "the Torque developers <torque-dev@db.apache.org> "
0109:                                            + "and give as many details as possible (including the error "
0110:                                            + "stack trace).", t);
0111:
0112:                    // Error objects should always be propogated.
0113:                    if (t instanceof  Error) {
0114:                        throw (Error) t.fillInStackTrace();
0115:                    }
0116:                }
0117:                return c;
0118:            }
0119:
0120:            /**
0121:             * Get the list of objects for a ResultSet.  Please not that your
0122:             * resultset MUST return columns in the right order.  You can use
0123:             * getFieldNames() in BaseObject to get the correct sequence.
0124:             *
0125:             * @param results the ResultSet
0126:             * @return the list of objects
0127:             * @throws TorqueException Any exceptions caught during processing will be
0128:             *         rethrown wrapped into a TorqueException.
0129:             */
0130:            public static List resultSet2Objects(java.sql.ResultSet results)
0131:                    throws TorqueException {
0132:                try {
0133:                    QueryDataSet qds = null;
0134:                    List rows = null;
0135:                    try {
0136:                        qds = new QueryDataSet(results);
0137:                        rows = getSelectResults(qds);
0138:                    } finally {
0139:                        if (qds != null) {
0140:                            qds.close();
0141:                        }
0142:                    }
0143:
0144:                    return populateObjects(rows);
0145:                } catch (SQLException e) {
0146:                    throw new TorqueException(e);
0147:                } catch (DataSetException e) {
0148:                    throw new TorqueException(e);
0149:                }
0150:            }
0151:
0152:            /**
0153:             * Method to do inserts.
0154:             *
0155:             * @param criteria object used to create the INSERT statement.
0156:             * @throws TorqueException Any exceptions caught during processing will be
0157:             *         rethrown wrapped into a TorqueException.
0158:             */
0159:            public static ObjectKey doInsert(Criteria criteria)
0160:                    throws TorqueException {
0161:                return BaseConditionPeer.doInsert(criteria, (Connection) null);
0162:            }
0163:
0164:            /**
0165:             * Method to do inserts.  This method is to be used during a transaction,
0166:             * otherwise use the doInsert(Criteria) method.  It will take care of
0167:             * the connection details internally.
0168:             *
0169:             * @param criteria object used to create the INSERT statement.
0170:             * @param con the connection to use
0171:             * @throws TorqueException Any exceptions caught during processing will be
0172:             *         rethrown wrapped into a TorqueException.
0173:             */
0174:            public static ObjectKey doInsert(Criteria criteria, Connection con)
0175:                    throws TorqueException {
0176:                correctBooleans(criteria);
0177:
0178:                setDbName(criteria);
0179:
0180:                if (con == null) {
0181:                    return BasePeer.doInsert(criteria);
0182:                } else {
0183:                    return BasePeer.doInsert(criteria, con);
0184:                }
0185:            }
0186:
0187:            /**
0188:             * Add all the columns needed to create a new object.
0189:             *
0190:             * @param criteria object containing the columns to add.
0191:             * @throws TorqueException Any exceptions caught during processing will be
0192:             *         rethrown wrapped into a TorqueException.
0193:             */
0194:            public static void addSelectColumns(Criteria criteria)
0195:                    throws TorqueException {
0196:                criteria.addSelectColumn(CONDITION_ID);
0197:                criteria.addSelectColumn(TRANSITION_ID);
0198:                criteria.addSelectColumn(MODULE_ID);
0199:                criteria.addSelectColumn(ISSUE_TYPE_ID);
0200:                criteria.addSelectColumn(ATTRIBUTE_ID);
0201:                criteria.addSelectColumn(OPTION_ID);
0202:            }
0203:
0204:            /**
0205:             * changes the boolean values in the criteria to the appropriate type,
0206:             * whenever a booleanchar or booleanint column is involved.
0207:             * This enables the user to create criteria using Boolean values
0208:             * for booleanchar or booleanint columns
0209:             * @param criteria the criteria in which the boolean values should be corrected
0210:             */
0211:            public static void correctBooleans(Criteria criteria) {
0212:            }
0213:
0214:            /**
0215:             * Create a new object of type cls from a resultset row starting
0216:             * from a specified offset.  This is done so that you can select
0217:             * other rows than just those needed for this object.  You may
0218:             * for example want to create two objects from the same row.
0219:             *
0220:             * @throws TorqueException Any exceptions caught during processing will be
0221:             *         rethrown wrapped into a TorqueException.
0222:             */
0223:            public static Condition row2Object(Record row, int offset, Class cls)
0224:                    throws TorqueException {
0225:                try {
0226:                    Condition obj = (Condition) cls.newInstance();
0227:                    ConditionPeer.populateObject(row, offset, obj);
0228:                    obj.setModified(false);
0229:                    obj.setNew(false);
0230:
0231:                    return obj;
0232:                } catch (InstantiationException e) {
0233:                    throw new TorqueException(e);
0234:                } catch (IllegalAccessException e) {
0235:                    throw new TorqueException(e);
0236:                }
0237:            }
0238:
0239:            /**
0240:             * Populates an object from a resultset row starting
0241:             * from a specified offset.  This is done so that you can select
0242:             * other rows than just those needed for this object.  You may
0243:             * for example want to create two objects from the same row.
0244:             *
0245:             * @throws TorqueException Any exceptions caught during processing will be
0246:             *         rethrown wrapped into a TorqueException.
0247:             */
0248:            public static void populateObject(Record row, int offset,
0249:                    Condition obj) throws TorqueException {
0250:                try {
0251:                    obj.setConditionId(row.getValue(offset + 0).asLongObj());
0252:                    obj
0253:                            .setTransitionId(row.getValue(offset + 1)
0254:                                    .asIntegerObj());
0255:                    obj.setModuleId(row.getValue(offset + 2).asIntegerObj());
0256:                    obj.setIssueTypeId(row.getValue(offset + 3).asIntegerObj());
0257:                    obj.setAttributeId(row.getValue(offset + 4).asIntegerObj());
0258:                    obj.setOptionId(row.getValue(offset + 5).asIntegerObj());
0259:                } catch (DataSetException e) {
0260:                    throw new TorqueException(e);
0261:                }
0262:            }
0263:
0264:            /**
0265:             * Method to do selects.
0266:             *
0267:             * @param criteria object used to create the SELECT statement.
0268:             * @return List of selected Objects
0269:             * @throws TorqueException Any exceptions caught during processing will be
0270:             *         rethrown wrapped into a TorqueException.
0271:             */
0272:            public static List doSelect(Criteria criteria)
0273:                    throws TorqueException {
0274:                return populateObjects(doSelectVillageRecords(criteria));
0275:            }
0276:
0277:            /**
0278:             * Method to do selects within a transaction.
0279:             *
0280:             * @param criteria object used to create the SELECT statement.
0281:             * @param con the connection to use
0282:             * @return List of selected Objects
0283:             * @throws TorqueException Any exceptions caught during processing will be
0284:             *         rethrown wrapped into a TorqueException.
0285:             */
0286:            public static List doSelect(Criteria criteria, Connection con)
0287:                    throws TorqueException {
0288:                return populateObjects(doSelectVillageRecords(criteria, con));
0289:            }
0290:
0291:            /**
0292:             * Grabs the raw Village records to be formed into objects.
0293:             * This method handles connections internally.  The Record objects
0294:             * returned by this method should be considered readonly.  Do not
0295:             * alter the data and call save(), your results may vary, but are
0296:             * certainly likely to result in hard to track MT bugs.
0297:             *
0298:             * @throws TorqueException Any exceptions caught during processing will be
0299:             *         rethrown wrapped into a TorqueException.
0300:             */
0301:            public static List doSelectVillageRecords(Criteria criteria)
0302:                    throws TorqueException {
0303:                return BaseConditionPeer.doSelectVillageRecords(criteria,
0304:                        (Connection) null);
0305:            }
0306:
0307:            /**
0308:             * Grabs the raw Village records to be formed into objects.
0309:             * This method should be used for transactions
0310:             *
0311:             * @param criteria object used to create the SELECT statement.
0312:             * @param con the connection to use
0313:             * @throws TorqueException Any exceptions caught during processing will be
0314:             *         rethrown wrapped into a TorqueException.
0315:             */
0316:            public static List doSelectVillageRecords(Criteria criteria,
0317:                    Connection con) throws TorqueException {
0318:                if (criteria.getSelectColumns().size() == 0) {
0319:                    addSelectColumns(criteria);
0320:                }
0321:                correctBooleans(criteria);
0322:
0323:                setDbName(criteria);
0324:
0325:                // BasePeer returns a List of Value (Village) arrays.  The array
0326:                // order follows the order columns were placed in the Select clause.
0327:                if (con == null) {
0328:                    return BasePeer.doSelect(criteria);
0329:                } else {
0330:                    return BasePeer.doSelect(criteria, con);
0331:                }
0332:            }
0333:
0334:            /**
0335:             * The returned List will contain objects of the default type or
0336:             * objects that inherit from the default.
0337:             *
0338:             * @throws TorqueException Any exceptions caught during processing will be
0339:             *         rethrown wrapped into a TorqueException.
0340:             */
0341:            public static List populateObjects(List records)
0342:                    throws TorqueException {
0343:                List results = new ArrayList(records.size());
0344:
0345:                // populate the object(s)
0346:                for (int i = 0; i < records.size(); i++) {
0347:                    Record row = (Record) records.get(i);
0348:                    results.add(ConditionPeer.row2Object(row, 1, ConditionPeer
0349:                            .getOMClass()));
0350:                }
0351:                return results;
0352:            }
0353:
0354:            /**
0355:             * The class that the Peer will make instances of.
0356:             * If the BO is abstract then you must implement this method
0357:             * in the BO.
0358:             *
0359:             * @throws TorqueException Any exceptions caught during processing will be
0360:             *         rethrown wrapped into a TorqueException.
0361:             */
0362:            public static Class getOMClass() throws TorqueException {
0363:                return CLASS_DEFAULT;
0364:            }
0365:
0366:            /**
0367:             * Method to do updates.
0368:             *
0369:             * @param criteria object containing data that is used to create the UPDATE
0370:             *        statement.
0371:             * @throws TorqueException Any exceptions caught during processing will be
0372:             *         rethrown wrapped into a TorqueException.
0373:             */
0374:            public static void doUpdate(Criteria criteria)
0375:                    throws TorqueException {
0376:                BaseConditionPeer.doUpdate(criteria, (Connection) null);
0377:            }
0378:
0379:            /**
0380:             * Method to do updates.  This method is to be used during a transaction,
0381:             * otherwise use the doUpdate(Criteria) method.  It will take care of
0382:             * the connection details internally.
0383:             *
0384:             * @param criteria object containing data that is used to create the UPDATE
0385:             *        statement.
0386:             * @param con the connection to use
0387:             * @throws TorqueException Any exceptions caught during processing will be
0388:             *         rethrown wrapped into a TorqueException.
0389:             */
0390:            public static void doUpdate(Criteria criteria, Connection con)
0391:                    throws TorqueException {
0392:                Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
0393:                correctBooleans(criteria);
0394:
0395:                selectCriteria.put(CONDITION_ID, criteria.remove(CONDITION_ID));
0396:
0397:                setDbName(criteria);
0398:
0399:                if (con == null) {
0400:                    BasePeer.doUpdate(selectCriteria, criteria);
0401:                } else {
0402:                    BasePeer.doUpdate(selectCriteria, criteria, con);
0403:                }
0404:            }
0405:
0406:            /**
0407:             * Method to do deletes.
0408:             *
0409:             * @param criteria object containing data that is used DELETE from database.
0410:             * @throws TorqueException Any exceptions caught during processing will be
0411:             *         rethrown wrapped into a TorqueException.
0412:             */
0413:            public static void doDelete(Criteria criteria)
0414:                    throws TorqueException {
0415:                ConditionPeer.doDelete(criteria, (Connection) null);
0416:            }
0417:
0418:            /**
0419:             * Method to do deletes.  This method is to be used during a transaction,
0420:             * otherwise use the doDelete(Criteria) method.  It will take care of
0421:             * the connection details internally.
0422:             *
0423:             * @param criteria object containing data that is used DELETE from database.
0424:             * @param con the connection to use
0425:             * @throws TorqueException Any exceptions caught during processing will be
0426:             *         rethrown wrapped into a TorqueException.
0427:             */
0428:            public static void doDelete(Criteria criteria, Connection con)
0429:                    throws TorqueException {
0430:                correctBooleans(criteria);
0431:
0432:                setDbName(criteria);
0433:
0434:                if (con == null) {
0435:                    BasePeer.doDelete(criteria);
0436:                } else {
0437:                    BasePeer.doDelete(criteria, con);
0438:                }
0439:            }
0440:
0441:            /**
0442:             * Method to do selects
0443:             *
0444:             * @throws TorqueException Any exceptions caught during processing will be
0445:             *         rethrown wrapped into a TorqueException.
0446:             */
0447:            public static List doSelect(Condition obj) throws TorqueException {
0448:                return doSelect(buildSelectCriteria(obj));
0449:            }
0450:
0451:            /**
0452:             * Method to do inserts
0453:             *
0454:             * @throws TorqueException Any exceptions caught during processing will be
0455:             *         rethrown wrapped into a TorqueException.
0456:             */
0457:            public static void doInsert(Condition obj) throws TorqueException {
0458:                obj.setPrimaryKey(doInsert(buildCriteria(obj)));
0459:                obj.setNew(false);
0460:                obj.setModified(false);
0461:            }
0462:
0463:            /**
0464:             * @param obj the data object to update in the database.
0465:             * @throws TorqueException Any exceptions caught during processing will be
0466:             *         rethrown wrapped into a TorqueException.
0467:             */
0468:            public static void doUpdate(Condition obj) throws TorqueException {
0469:                doUpdate(buildCriteria(obj));
0470:                obj.setModified(false);
0471:            }
0472:
0473:            /**
0474:             * @param obj the data object to delete in the database.
0475:             * @throws TorqueException Any exceptions caught during processing will be
0476:             *         rethrown wrapped into a TorqueException.
0477:             */
0478:            public static void doDelete(Condition obj) throws TorqueException {
0479:                doDelete(buildSelectCriteria(obj));
0480:            }
0481:
0482:            /**
0483:             * Method to do inserts.  This method is to be used during a transaction,
0484:             * otherwise use the doInsert(Condition) method.  It will take
0485:             * care of the connection details internally.
0486:             *
0487:             * @param obj the data object to insert into the database.
0488:             * @param con the connection to use
0489:             * @throws TorqueException Any exceptions caught during processing will be
0490:             *         rethrown wrapped into a TorqueException.
0491:             */
0492:            public static void doInsert(Condition obj, Connection con)
0493:                    throws TorqueException {
0494:                obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
0495:                obj.setNew(false);
0496:                obj.setModified(false);
0497:            }
0498:
0499:            /**
0500:             * Method to do update.  This method is to be used during a transaction,
0501:             * otherwise use the doUpdate(Condition) method.  It will take
0502:             * care of the connection details internally.
0503:             *
0504:             * @param obj the data object to update in the database.
0505:             * @param con the connection to use
0506:             * @throws TorqueException Any exceptions caught during processing will be
0507:             *         rethrown wrapped into a TorqueException.
0508:             */
0509:            public static void doUpdate(Condition obj, Connection con)
0510:                    throws TorqueException {
0511:                doUpdate(buildCriteria(obj), con);
0512:                obj.setModified(false);
0513:            }
0514:
0515:            /**
0516:             * Method to delete.  This method is to be used during a transaction,
0517:             * otherwise use the doDelete(Condition) method.  It will take
0518:             * care of the connection details internally.
0519:             *
0520:             * @param obj the data object to delete in the database.
0521:             * @param con the connection to use
0522:             * @throws TorqueException Any exceptions caught during processing will be
0523:             *         rethrown wrapped into a TorqueException.
0524:             */
0525:            public static void doDelete(Condition obj, Connection con)
0526:                    throws TorqueException {
0527:                doDelete(buildSelectCriteria(obj), con);
0528:            }
0529:
0530:            /**
0531:             * Method to do deletes.
0532:             *
0533:             * @param pk ObjectKey that is used DELETE from database.
0534:             * @throws TorqueException Any exceptions caught during processing will be
0535:             *         rethrown wrapped into a TorqueException.
0536:             */
0537:            public static void doDelete(ObjectKey pk) throws TorqueException {
0538:                BaseConditionPeer.doDelete(pk, (Connection) null);
0539:            }
0540:
0541:            /**
0542:             * Method to delete.  This method is to be used during a transaction,
0543:             * otherwise use the doDelete(ObjectKey) method.  It will take
0544:             * care of the connection details internally.
0545:             *
0546:             * @param pk the primary key for the object to delete in the database.
0547:             * @param con the connection to use
0548:             * @throws TorqueException Any exceptions caught during processing will be
0549:             *         rethrown wrapped into a TorqueException.
0550:             */
0551:            public static void doDelete(ObjectKey pk, Connection con)
0552:                    throws TorqueException {
0553:                doDelete(buildCriteria(pk), con);
0554:            }
0555:
0556:            /** Build a Criteria object from an ObjectKey */
0557:            public static Criteria buildCriteria(ObjectKey pk) {
0558:                Criteria criteria = new Criteria();
0559:                criteria.add(CONDITION_ID, pk);
0560:                return criteria;
0561:            }
0562:
0563:            /** Build a Criteria object from the data object for this peer */
0564:            public static Criteria buildCriteria(Condition obj) {
0565:                Criteria criteria = new Criteria(DATABASE_NAME);
0566:                if (!obj.isNew())
0567:                    criteria.add(CONDITION_ID, obj.getConditionId());
0568:                criteria.add(TRANSITION_ID, obj.getTransitionId());
0569:                criteria.add(MODULE_ID, obj.getModuleId());
0570:                criteria.add(ISSUE_TYPE_ID, obj.getIssueTypeId());
0571:                criteria.add(ATTRIBUTE_ID, obj.getAttributeId());
0572:                criteria.add(OPTION_ID, obj.getOptionId());
0573:                return criteria;
0574:            }
0575:
0576:            /** Build a Criteria object from the data object for this peer, skipping all binary columns */
0577:            public static Criteria buildSelectCriteria(Condition obj) {
0578:                Criteria criteria = new Criteria(DATABASE_NAME);
0579:                if (!obj.isNew()) {
0580:                    criteria.add(CONDITION_ID, obj.getConditionId());
0581:                }
0582:                criteria.add(TRANSITION_ID, obj.getTransitionId());
0583:                criteria.add(MODULE_ID, obj.getModuleId());
0584:                criteria.add(ISSUE_TYPE_ID, obj.getIssueTypeId());
0585:                criteria.add(ATTRIBUTE_ID, obj.getAttributeId());
0586:                criteria.add(OPTION_ID, obj.getOptionId());
0587:                return criteria;
0588:            }
0589:
0590:            /**
0591:             * Retrieve a single object by pk
0592:             *
0593:             * @param pk the primary key
0594:             * @throws TorqueException Any exceptions caught during processing will be
0595:             *         rethrown wrapped into a TorqueException.
0596:             * @throws NoRowsException Primary key was not found in database.
0597:             * @throws TooManyRowsException Primary key was not found in database.
0598:             */
0599:            public static Condition retrieveByPK(Long pk)
0600:                    throws TorqueException, NoRowsException,
0601:                    TooManyRowsException {
0602:                return retrieveByPK(SimpleKey.keyFor(pk));
0603:            }
0604:
0605:            /**
0606:             * Retrieve a single object by pk
0607:             *
0608:             * @param pk the primary key
0609:             * @param con the connection to use
0610:             * @throws TorqueException Any exceptions caught during processing will be
0611:             *         rethrown wrapped into a TorqueException.
0612:             * @throws NoRowsException Primary key was not found in database.
0613:             * @throws TooManyRowsException Primary key was not found in database.
0614:             */
0615:            public static Condition retrieveByPK(Long pk, Connection con)
0616:                    throws TorqueException, NoRowsException,
0617:                    TooManyRowsException {
0618:                return retrieveByPK(SimpleKey.keyFor(pk), con);
0619:            }
0620:
0621:            /**
0622:             * Retrieve a single object by pk
0623:             *
0624:             * @param pk the primary key
0625:             * @throws TorqueException Any exceptions caught during processing will be
0626:             *         rethrown wrapped into a TorqueException.
0627:             * @throws NoRowsException Primary key was not found in database.
0628:             * @throws TooManyRowsException Primary key was not found in database.
0629:             */
0630:            public static Condition retrieveByPK(ObjectKey pk)
0631:                    throws TorqueException, NoRowsException,
0632:                    TooManyRowsException {
0633:                Connection db = null;
0634:                Condition retVal = null;
0635:                try {
0636:                    db = Torque.getConnection(DATABASE_NAME);
0637:                    retVal = retrieveByPK(pk, db);
0638:                } finally {
0639:                    Torque.closeConnection(db);
0640:                }
0641:                return retVal;
0642:            }
0643:
0644:            /**
0645:             * Retrieve a single object by pk
0646:             *
0647:             * @param pk the primary key
0648:             * @param con the connection to use
0649:             * @throws TorqueException Any exceptions caught during processing will be
0650:             *         rethrown wrapped into a TorqueException.
0651:             * @throws NoRowsException Primary key was not found in database.
0652:             * @throws TooManyRowsException Primary key was not found in database.
0653:             */
0654:            public static Condition retrieveByPK(ObjectKey pk, Connection con)
0655:                    throws TorqueException, NoRowsException,
0656:                    TooManyRowsException {
0657:                Criteria criteria = buildCriteria(pk);
0658:                List v = doSelect(criteria, con);
0659:                if (v.size() == 0) {
0660:                    throw new NoRowsException("Failed to select a row.");
0661:                } else if (v.size() > 1) {
0662:                    throw new TooManyRowsException(
0663:                            "Failed to select only one row.");
0664:                } else {
0665:                    return (Condition) v.get(0);
0666:                }
0667:            }
0668:
0669:            /**
0670:             * Retrieve a multiple objects by pk
0671:             *
0672:             * @param pks List of primary keys
0673:             * @throws TorqueException Any exceptions caught during processing will be
0674:             *         rethrown wrapped into a TorqueException.
0675:             */
0676:            public static List retrieveByPKs(List pks) throws TorqueException {
0677:                Connection db = null;
0678:                List retVal = null;
0679:                try {
0680:                    db = Torque.getConnection(DATABASE_NAME);
0681:                    retVal = retrieveByPKs(pks, db);
0682:                } finally {
0683:                    Torque.closeConnection(db);
0684:                }
0685:                return retVal;
0686:            }
0687:
0688:            /**
0689:             * Retrieve a multiple objects by pk
0690:             *
0691:             * @param pks List of primary keys
0692:             * @param dbcon the connection to use
0693:             * @throws TorqueException Any exceptions caught during processing will be
0694:             *         rethrown wrapped into a TorqueException.
0695:             */
0696:            public static List retrieveByPKs(List pks, Connection dbcon)
0697:                    throws TorqueException {
0698:                List objs = null;
0699:                if (pks == null || pks.size() == 0) {
0700:                    objs = new LinkedList();
0701:                } else {
0702:                    Criteria criteria = new Criteria();
0703:                    criteria.addIn(CONDITION_ID, pks);
0704:                    objs = doSelect(criteria, dbcon);
0705:                }
0706:                return objs;
0707:            }
0708:
0709:            /**
0710:             * selects a collection of Condition objects pre-filled with their
0711:             * RModuleAttribute objects.
0712:             *
0713:             * This method is protected by default in order to keep the public
0714:             * api reasonable.  You can provide public methods for those you
0715:             * actually need in ConditionPeer.
0716:             *
0717:             * @throws TorqueException Any exceptions caught during processing will be
0718:             *         rethrown wrapped into a TorqueException.
0719:             */
0720:            protected static List doSelectJoinRModuleAttribute(Criteria criteria)
0721:                    throws TorqueException {
0722:                return doSelectJoinRModuleAttribute(criteria, null);
0723:            }
0724:
0725:            /**
0726:             * selects a collection of Condition objects pre-filled with their
0727:             * RModuleAttribute objects.
0728:             *
0729:             * This method is protected by default in order to keep the public
0730:             * api reasonable.  You can provide public methods for those you
0731:             * actually need in ConditionPeer.
0732:             *
0733:             * @throws TorqueException Any exceptions caught during processing will be
0734:             *         rethrown wrapped into a TorqueException.
0735:             */
0736:            protected static List doSelectJoinRModuleAttribute(
0737:                    Criteria criteria, Connection conn) throws TorqueException {
0738:                setDbName(criteria);
0739:
0740:                ConditionPeer.addSelectColumns(criteria);
0741:                int offset = numColumns + 1;
0742:                RModuleAttributePeer.addSelectColumns(criteria);
0743:
0744:                criteria.addJoin(ConditionPeer.MODULE_ID,
0745:                        RModuleAttributePeer.MODULE_ID);
0746:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
0747:                        RModuleAttributePeer.ATTRIBUTE_ID);
0748:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
0749:                        RModuleAttributePeer.ISSUE_TYPE_ID);
0750:
0751:                correctBooleans(criteria);
0752:
0753:                List rows;
0754:                if (conn == null) {
0755:                    rows = BasePeer.doSelect(criteria);
0756:                } else {
0757:                    rows = BasePeer.doSelect(criteria, conn);
0758:                }
0759:
0760:                List results = new ArrayList();
0761:
0762:                for (int i = 0; i < rows.size(); i++) {
0763:                    Record row = (Record) rows.get(i);
0764:
0765:                    Class omClass = ConditionPeer.getOMClass();
0766:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
0767:                            1, omClass);
0768:                    omClass = RModuleAttributePeer.getOMClass();
0769:                    RModuleAttribute obj2 = (RModuleAttribute) RModuleAttributePeer
0770:                            .row2Object(row, offset, omClass);
0771:
0772:                    boolean newObject = true;
0773:                    for (int j = 0; j < results.size(); j++) {
0774:                        Condition temp_obj1 = (Condition) results.get(j);
0775:                        RModuleAttribute temp_obj2 = (RModuleAttribute) temp_obj1
0776:                                .getRModuleAttribute();
0777:                        if (temp_obj2.getPrimaryKey().equals(
0778:                                obj2.getPrimaryKey())) {
0779:                            newObject = false;
0780:                            temp_obj2.addCondition(obj1);
0781:                            break;
0782:                        }
0783:                    }
0784:                    if (newObject) {
0785:                        obj2.initConditions();
0786:                        obj2.addCondition(obj1);
0787:                    }
0788:                    results.add(obj1);
0789:                }
0790:                return results;
0791:            }
0792:
0793:            /**
0794:             * selects a collection of Condition objects pre-filled with their
0795:             * Transition objects.
0796:             *
0797:             * This method is protected by default in order to keep the public
0798:             * api reasonable.  You can provide public methods for those you
0799:             * actually need in ConditionPeer.
0800:             *
0801:             * @throws TorqueException Any exceptions caught during processing will be
0802:             *         rethrown wrapped into a TorqueException.
0803:             */
0804:            protected static List doSelectJoinTransition(Criteria criteria)
0805:                    throws TorqueException {
0806:                return doSelectJoinTransition(criteria, null);
0807:            }
0808:
0809:            /**
0810:             * selects a collection of Condition objects pre-filled with their
0811:             * Transition objects.
0812:             *
0813:             * This method is protected by default in order to keep the public
0814:             * api reasonable.  You can provide public methods for those you
0815:             * actually need in ConditionPeer.
0816:             *
0817:             * @throws TorqueException Any exceptions caught during processing will be
0818:             *         rethrown wrapped into a TorqueException.
0819:             */
0820:            protected static List doSelectJoinTransition(Criteria criteria,
0821:                    Connection conn) throws TorqueException {
0822:                setDbName(criteria);
0823:
0824:                ConditionPeer.addSelectColumns(criteria);
0825:                int offset = numColumns + 1;
0826:                TransitionPeer.addSelectColumns(criteria);
0827:
0828:                criteria.addJoin(ConditionPeer.TRANSITION_ID,
0829:                        TransitionPeer.TRANSITION_ID);
0830:
0831:                correctBooleans(criteria);
0832:
0833:                List rows;
0834:                if (conn == null) {
0835:                    rows = BasePeer.doSelect(criteria);
0836:                } else {
0837:                    rows = BasePeer.doSelect(criteria, conn);
0838:                }
0839:
0840:                List results = new ArrayList();
0841:
0842:                for (int i = 0; i < rows.size(); i++) {
0843:                    Record row = (Record) rows.get(i);
0844:
0845:                    Class omClass = ConditionPeer.getOMClass();
0846:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
0847:                            1, omClass);
0848:                    omClass = TransitionPeer.getOMClass();
0849:                    Transition obj2 = (Transition) TransitionPeer.row2Object(
0850:                            row, offset, omClass);
0851:
0852:                    boolean newObject = true;
0853:                    for (int j = 0; j < results.size(); j++) {
0854:                        Condition temp_obj1 = (Condition) results.get(j);
0855:                        Transition temp_obj2 = (Transition) temp_obj1
0856:                                .getTransition();
0857:                        if (temp_obj2.getPrimaryKey().equals(
0858:                                obj2.getPrimaryKey())) {
0859:                            newObject = false;
0860:                            temp_obj2.addCondition(obj1);
0861:                            break;
0862:                        }
0863:                    }
0864:                    if (newObject) {
0865:                        obj2.initConditions();
0866:                        obj2.addCondition(obj1);
0867:                    }
0868:                    results.add(obj1);
0869:                }
0870:                return results;
0871:            }
0872:
0873:            /**
0874:             * selects a collection of Condition objects pre-filled with their
0875:             * Attribute objects.
0876:             *
0877:             * This method is protected by default in order to keep the public
0878:             * api reasonable.  You can provide public methods for those you
0879:             * actually need in ConditionPeer.
0880:             *
0881:             * @throws TorqueException Any exceptions caught during processing will be
0882:             *         rethrown wrapped into a TorqueException.
0883:             */
0884:            protected static List doSelectJoinAttribute(Criteria criteria)
0885:                    throws TorqueException {
0886:                return doSelectJoinAttribute(criteria, null);
0887:            }
0888:
0889:            /**
0890:             * selects a collection of Condition objects pre-filled with their
0891:             * Attribute objects.
0892:             *
0893:             * This method is protected by default in order to keep the public
0894:             * api reasonable.  You can provide public methods for those you
0895:             * actually need in ConditionPeer.
0896:             *
0897:             * @throws TorqueException Any exceptions caught during processing will be
0898:             *         rethrown wrapped into a TorqueException.
0899:             */
0900:            protected static List doSelectJoinAttribute(Criteria criteria,
0901:                    Connection conn) throws TorqueException {
0902:                setDbName(criteria);
0903:
0904:                ConditionPeer.addSelectColumns(criteria);
0905:                int offset = numColumns + 1;
0906:                AttributePeer.addSelectColumns(criteria);
0907:
0908:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
0909:                        AttributePeer.ATTRIBUTE_ID);
0910:
0911:                correctBooleans(criteria);
0912:
0913:                List rows;
0914:                if (conn == null) {
0915:                    rows = BasePeer.doSelect(criteria);
0916:                } else {
0917:                    rows = BasePeer.doSelect(criteria, conn);
0918:                }
0919:
0920:                List results = new ArrayList();
0921:
0922:                for (int i = 0; i < rows.size(); i++) {
0923:                    Record row = (Record) rows.get(i);
0924:
0925:                    Class omClass = ConditionPeer.getOMClass();
0926:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
0927:                            1, omClass);
0928:                    omClass = AttributePeer.getOMClass();
0929:                    Attribute obj2 = (Attribute) AttributePeer.row2Object(row,
0930:                            offset, omClass);
0931:
0932:                    boolean newObject = true;
0933:                    for (int j = 0; j < results.size(); j++) {
0934:                        Condition temp_obj1 = (Condition) results.get(j);
0935:                        Attribute temp_obj2 = (Attribute) temp_obj1
0936:                                .getAttribute();
0937:                        if (temp_obj2.getPrimaryKey().equals(
0938:                                obj2.getPrimaryKey())) {
0939:                            newObject = false;
0940:                            temp_obj2.addCondition(obj1);
0941:                            break;
0942:                        }
0943:                    }
0944:                    if (newObject) {
0945:                        obj2.initConditions();
0946:                        obj2.addCondition(obj1);
0947:                    }
0948:                    results.add(obj1);
0949:                }
0950:                return results;
0951:            }
0952:
0953:            /**
0954:             * selects a collection of Condition objects pre-filled with their
0955:             * AttributeOption objects.
0956:             *
0957:             * This method is protected by default in order to keep the public
0958:             * api reasonable.  You can provide public methods for those you
0959:             * actually need in ConditionPeer.
0960:             *
0961:             * @throws TorqueException Any exceptions caught during processing will be
0962:             *         rethrown wrapped into a TorqueException.
0963:             */
0964:            protected static List doSelectJoinAttributeOption(Criteria criteria)
0965:                    throws TorqueException {
0966:                return doSelectJoinAttributeOption(criteria, null);
0967:            }
0968:
0969:            /**
0970:             * selects a collection of Condition objects pre-filled with their
0971:             * AttributeOption objects.
0972:             *
0973:             * This method is protected by default in order to keep the public
0974:             * api reasonable.  You can provide public methods for those you
0975:             * actually need in ConditionPeer.
0976:             *
0977:             * @throws TorqueException Any exceptions caught during processing will be
0978:             *         rethrown wrapped into a TorqueException.
0979:             */
0980:            protected static List doSelectJoinAttributeOption(
0981:                    Criteria criteria, Connection conn) throws TorqueException {
0982:                setDbName(criteria);
0983:
0984:                ConditionPeer.addSelectColumns(criteria);
0985:                int offset = numColumns + 1;
0986:                AttributeOptionPeer.addSelectColumns(criteria);
0987:
0988:                criteria.addJoin(ConditionPeer.OPTION_ID,
0989:                        AttributeOptionPeer.OPTION_ID);
0990:
0991:                correctBooleans(criteria);
0992:
0993:                List rows;
0994:                if (conn == null) {
0995:                    rows = BasePeer.doSelect(criteria);
0996:                } else {
0997:                    rows = BasePeer.doSelect(criteria, conn);
0998:                }
0999:
1000:                List results = new ArrayList();
1001:
1002:                for (int i = 0; i < rows.size(); i++) {
1003:                    Record row = (Record) rows.get(i);
1004:
1005:                    Class omClass = ConditionPeer.getOMClass();
1006:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1007:                            1, omClass);
1008:                    omClass = AttributeOptionPeer.getOMClass();
1009:                    AttributeOption obj2 = (AttributeOption) AttributeOptionPeer
1010:                            .row2Object(row, offset, omClass);
1011:
1012:                    boolean newObject = true;
1013:                    for (int j = 0; j < results.size(); j++) {
1014:                        Condition temp_obj1 = (Condition) results.get(j);
1015:                        AttributeOption temp_obj2 = (AttributeOption) temp_obj1
1016:                                .getAttributeOption();
1017:                        if (temp_obj2.getPrimaryKey().equals(
1018:                                obj2.getPrimaryKey())) {
1019:                            newObject = false;
1020:                            temp_obj2.addCondition(obj1);
1021:                            break;
1022:                        }
1023:                    }
1024:                    if (newObject) {
1025:                        obj2.initConditions();
1026:                        obj2.addCondition(obj1);
1027:                    }
1028:                    results.add(obj1);
1029:                }
1030:                return results;
1031:            }
1032:
1033:            /**
1034:             * selects a collection of Condition objects pre-filled with their
1035:             * RModuleIssueType objects.
1036:             *
1037:             * This method is protected by default in order to keep the public
1038:             * api reasonable.  You can provide public methods for those you
1039:             * actually need in ConditionPeer.
1040:             *
1041:             * @throws TorqueException Any exceptions caught during processing will be
1042:             *         rethrown wrapped into a TorqueException.
1043:             */
1044:            protected static List doSelectJoinRModuleIssueType(Criteria criteria)
1045:                    throws TorqueException {
1046:                return doSelectJoinRModuleIssueType(criteria, null);
1047:            }
1048:
1049:            /**
1050:             * selects a collection of Condition objects pre-filled with their
1051:             * RModuleIssueType objects.
1052:             *
1053:             * This method is protected by default in order to keep the public
1054:             * api reasonable.  You can provide public methods for those you
1055:             * actually need in ConditionPeer.
1056:             *
1057:             * @throws TorqueException Any exceptions caught during processing will be
1058:             *         rethrown wrapped into a TorqueException.
1059:             */
1060:            protected static List doSelectJoinRModuleIssueType(
1061:                    Criteria criteria, Connection conn) throws TorqueException {
1062:                setDbName(criteria);
1063:
1064:                ConditionPeer.addSelectColumns(criteria);
1065:                int offset = numColumns + 1;
1066:                RModuleIssueTypePeer.addSelectColumns(criteria);
1067:
1068:                criteria.addJoin(ConditionPeer.MODULE_ID,
1069:                        RModuleIssueTypePeer.MODULE_ID);
1070:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1071:                        RModuleIssueTypePeer.ISSUE_TYPE_ID);
1072:
1073:                correctBooleans(criteria);
1074:
1075:                List rows;
1076:                if (conn == null) {
1077:                    rows = BasePeer.doSelect(criteria);
1078:                } else {
1079:                    rows = BasePeer.doSelect(criteria, conn);
1080:                }
1081:
1082:                List results = new ArrayList();
1083:
1084:                for (int i = 0; i < rows.size(); i++) {
1085:                    Record row = (Record) rows.get(i);
1086:
1087:                    Class omClass = ConditionPeer.getOMClass();
1088:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1089:                            1, omClass);
1090:                    omClass = RModuleIssueTypePeer.getOMClass();
1091:                    RModuleIssueType obj2 = (RModuleIssueType) RModuleIssueTypePeer
1092:                            .row2Object(row, offset, omClass);
1093:
1094:                    boolean newObject = true;
1095:                    for (int j = 0; j < results.size(); j++) {
1096:                        Condition temp_obj1 = (Condition) results.get(j);
1097:                        RModuleIssueType temp_obj2 = (RModuleIssueType) temp_obj1
1098:                                .getRModuleIssueType();
1099:                        if (temp_obj2.getPrimaryKey().equals(
1100:                                obj2.getPrimaryKey())) {
1101:                            newObject = false;
1102:                            temp_obj2.addCondition(obj1);
1103:                            break;
1104:                        }
1105:                    }
1106:                    if (newObject) {
1107:                        obj2.initConditions();
1108:                        obj2.addCondition(obj1);
1109:                    }
1110:                    results.add(obj1);
1111:                }
1112:                return results;
1113:            }
1114:
1115:            /**
1116:             * selects a collection of Condition objects pre-filled with
1117:             * all related objects.
1118:             *
1119:             * This method is protected by default in order to keep the public
1120:             * api reasonable.  You can provide public methods for those you
1121:             * actually need in ConditionPeer.
1122:             *
1123:             * @throws TorqueException Any exceptions caught during processing will be
1124:             *         rethrown wrapped into a TorqueException.
1125:             */
1126:            protected static List doSelectJoinAllExceptRModuleAttribute(
1127:                    Criteria criteria) throws TorqueException {
1128:                return doSelectJoinAllExceptRModuleAttribute(criteria, null);
1129:            }
1130:
1131:            /**
1132:             * selects a collection of Condition objects pre-filled with
1133:             * all related objects.
1134:             *
1135:             * This method is protected by default in order to keep the public
1136:             * api reasonable.  You can provide public methods for those you
1137:             * actually need in ConditionPeer.
1138:             *
1139:             * @throws TorqueException Any exceptions caught during processing will be
1140:             *         rethrown wrapped into a TorqueException.
1141:             */
1142:            protected static List doSelectJoinAllExceptRModuleAttribute(
1143:                    Criteria criteria, Connection conn) throws TorqueException {
1144:                setDbName(criteria);
1145:
1146:                addSelectColumns(criteria);
1147:                int offset2 = numColumns + 1;
1148:
1149:                TransitionPeer.addSelectColumns(criteria);
1150:                criteria.addJoin(ConditionPeer.TRANSITION_ID,
1151:                        TransitionPeer.TRANSITION_ID);
1152:                int offset3 = offset2 + TransitionPeer.numColumns;
1153:
1154:                AttributePeer.addSelectColumns(criteria);
1155:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1156:                        AttributePeer.ATTRIBUTE_ID);
1157:                int offset4 = offset3 + AttributePeer.numColumns;
1158:
1159:                AttributeOptionPeer.addSelectColumns(criteria);
1160:                criteria.addJoin(ConditionPeer.OPTION_ID,
1161:                        AttributeOptionPeer.OPTION_ID);
1162:                int offset5 = offset4 + AttributeOptionPeer.numColumns;
1163:
1164:                RModuleIssueTypePeer.addSelectColumns(criteria);
1165:                criteria.addJoin(ConditionPeer.MODULE_ID,
1166:                        RModuleIssueTypePeer.MODULE_ID);
1167:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1168:                        RModuleIssueTypePeer.ISSUE_TYPE_ID);
1169:
1170:                correctBooleans(criteria);
1171:
1172:                List rows;
1173:                if (conn == null) {
1174:                    rows = BasePeer.doSelect(criteria);
1175:                } else {
1176:                    rows = BasePeer.doSelect(criteria, conn);
1177:                }
1178:
1179:                List results = new ArrayList();
1180:
1181:                for (int i = 0; i < rows.size(); i++) {
1182:                    Record row = (Record) rows.get(i);
1183:
1184:                    Class omClass = ConditionPeer.getOMClass();
1185:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1186:                            1, omClass);
1187:
1188:                    omClass = TransitionPeer.getOMClass();
1189:                    Transition obj2 = (Transition) TransitionPeer.row2Object(
1190:                            row, offset2, omClass);
1191:
1192:                    boolean newObject = true;
1193:                    for (int j = 0; j < results.size(); j++) {
1194:                        Condition temp_obj1 = (Condition) results.get(j);
1195:                        Transition temp_obj2 = (Transition) temp_obj1
1196:                                .getTransition();
1197:                        if (temp_obj2.getPrimaryKey().equals(
1198:                                obj2.getPrimaryKey())) {
1199:                            newObject = false;
1200:                            temp_obj2.addCondition(obj1);
1201:                            break;
1202:                        }
1203:                    }
1204:                    if (newObject) {
1205:                        obj2.initConditions();
1206:                        obj2.addCondition(obj1);
1207:                    }
1208:
1209:                    omClass = AttributePeer.getOMClass();
1210:                    Attribute obj3 = (Attribute) AttributePeer.row2Object(row,
1211:                            offset3, omClass);
1212:
1213:                    newObject = true;
1214:                    for (int j = 0; j < results.size(); j++) {
1215:                        Condition temp_obj1 = (Condition) results.get(j);
1216:                        Attribute temp_obj3 = (Attribute) temp_obj1
1217:                                .getAttribute();
1218:                        if (temp_obj3.getPrimaryKey().equals(
1219:                                obj3.getPrimaryKey())) {
1220:                            newObject = false;
1221:                            temp_obj3.addCondition(obj1);
1222:                            break;
1223:                        }
1224:                    }
1225:                    if (newObject) {
1226:                        obj3.initConditions();
1227:                        obj3.addCondition(obj1);
1228:                    }
1229:
1230:                    omClass = AttributeOptionPeer.getOMClass();
1231:                    AttributeOption obj4 = (AttributeOption) AttributeOptionPeer
1232:                            .row2Object(row, offset4, omClass);
1233:
1234:                    newObject = true;
1235:                    for (int j = 0; j < results.size(); j++) {
1236:                        Condition temp_obj1 = (Condition) results.get(j);
1237:                        AttributeOption temp_obj4 = (AttributeOption) temp_obj1
1238:                                .getAttributeOption();
1239:                        if (temp_obj4.getPrimaryKey().equals(
1240:                                obj4.getPrimaryKey())) {
1241:                            newObject = false;
1242:                            temp_obj4.addCondition(obj1);
1243:                            break;
1244:                        }
1245:                    }
1246:                    if (newObject) {
1247:                        obj4.initConditions();
1248:                        obj4.addCondition(obj1);
1249:                    }
1250:
1251:                    omClass = RModuleIssueTypePeer.getOMClass();
1252:                    RModuleIssueType obj5 = (RModuleIssueType) RModuleIssueTypePeer
1253:                            .row2Object(row, offset5, omClass);
1254:
1255:                    newObject = true;
1256:                    for (int j = 0; j < results.size(); j++) {
1257:                        Condition temp_obj1 = (Condition) results.get(j);
1258:                        RModuleIssueType temp_obj5 = (RModuleIssueType) temp_obj1
1259:                                .getRModuleIssueType();
1260:                        if (temp_obj5.getPrimaryKey().equals(
1261:                                obj5.getPrimaryKey())) {
1262:                            newObject = false;
1263:                            temp_obj5.addCondition(obj1);
1264:                            break;
1265:                        }
1266:                    }
1267:                    if (newObject) {
1268:                        obj5.initConditions();
1269:                        obj5.addCondition(obj1);
1270:                    }
1271:                    results.add(obj1);
1272:                }
1273:                return results;
1274:            }
1275:
1276:            /**
1277:             * selects a collection of Condition objects pre-filled with
1278:             * all related objects.
1279:             *
1280:             * This method is protected by default in order to keep the public
1281:             * api reasonable.  You can provide public methods for those you
1282:             * actually need in ConditionPeer.
1283:             *
1284:             * @throws TorqueException Any exceptions caught during processing will be
1285:             *         rethrown wrapped into a TorqueException.
1286:             */
1287:            protected static List doSelectJoinAllExceptTransition(
1288:                    Criteria criteria) throws TorqueException {
1289:                return doSelectJoinAllExceptTransition(criteria, null);
1290:            }
1291:
1292:            /**
1293:             * selects a collection of Condition objects pre-filled with
1294:             * all related objects.
1295:             *
1296:             * This method is protected by default in order to keep the public
1297:             * api reasonable.  You can provide public methods for those you
1298:             * actually need in ConditionPeer.
1299:             *
1300:             * @throws TorqueException Any exceptions caught during processing will be
1301:             *         rethrown wrapped into a TorqueException.
1302:             */
1303:            protected static List doSelectJoinAllExceptTransition(
1304:                    Criteria criteria, Connection conn) throws TorqueException {
1305:                setDbName(criteria);
1306:
1307:                addSelectColumns(criteria);
1308:                int offset2 = numColumns + 1;
1309:
1310:                RModuleAttributePeer.addSelectColumns(criteria);
1311:                criteria.addJoin(ConditionPeer.MODULE_ID,
1312:                        RModuleAttributePeer.MODULE_ID);
1313:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1314:                        RModuleAttributePeer.ATTRIBUTE_ID);
1315:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1316:                        RModuleAttributePeer.ISSUE_TYPE_ID);
1317:                int offset3 = offset2 + RModuleAttributePeer.numColumns;
1318:
1319:                AttributePeer.addSelectColumns(criteria);
1320:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1321:                        AttributePeer.ATTRIBUTE_ID);
1322:                int offset4 = offset3 + AttributePeer.numColumns;
1323:
1324:                AttributeOptionPeer.addSelectColumns(criteria);
1325:                criteria.addJoin(ConditionPeer.OPTION_ID,
1326:                        AttributeOptionPeer.OPTION_ID);
1327:                int offset5 = offset4 + AttributeOptionPeer.numColumns;
1328:
1329:                RModuleIssueTypePeer.addSelectColumns(criteria);
1330:                criteria.addJoin(ConditionPeer.MODULE_ID,
1331:                        RModuleIssueTypePeer.MODULE_ID);
1332:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1333:                        RModuleIssueTypePeer.ISSUE_TYPE_ID);
1334:
1335:                correctBooleans(criteria);
1336:
1337:                List rows;
1338:                if (conn == null) {
1339:                    rows = BasePeer.doSelect(criteria);
1340:                } else {
1341:                    rows = BasePeer.doSelect(criteria, conn);
1342:                }
1343:
1344:                List results = new ArrayList();
1345:
1346:                for (int i = 0; i < rows.size(); i++) {
1347:                    Record row = (Record) rows.get(i);
1348:
1349:                    Class omClass = ConditionPeer.getOMClass();
1350:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1351:                            1, omClass);
1352:
1353:                    omClass = RModuleAttributePeer.getOMClass();
1354:                    RModuleAttribute obj2 = (RModuleAttribute) RModuleAttributePeer
1355:                            .row2Object(row, offset2, omClass);
1356:
1357:                    boolean newObject = true;
1358:                    for (int j = 0; j < results.size(); j++) {
1359:                        Condition temp_obj1 = (Condition) results.get(j);
1360:                        RModuleAttribute temp_obj2 = (RModuleAttribute) temp_obj1
1361:                                .getRModuleAttribute();
1362:                        if (temp_obj2.getPrimaryKey().equals(
1363:                                obj2.getPrimaryKey())) {
1364:                            newObject = false;
1365:                            temp_obj2.addCondition(obj1);
1366:                            break;
1367:                        }
1368:                    }
1369:                    if (newObject) {
1370:                        obj2.initConditions();
1371:                        obj2.addCondition(obj1);
1372:                    }
1373:
1374:                    omClass = AttributePeer.getOMClass();
1375:                    Attribute obj3 = (Attribute) AttributePeer.row2Object(row,
1376:                            offset3, omClass);
1377:
1378:                    newObject = true;
1379:                    for (int j = 0; j < results.size(); j++) {
1380:                        Condition temp_obj1 = (Condition) results.get(j);
1381:                        Attribute temp_obj3 = (Attribute) temp_obj1
1382:                                .getAttribute();
1383:                        if (temp_obj3.getPrimaryKey().equals(
1384:                                obj3.getPrimaryKey())) {
1385:                            newObject = false;
1386:                            temp_obj3.addCondition(obj1);
1387:                            break;
1388:                        }
1389:                    }
1390:                    if (newObject) {
1391:                        obj3.initConditions();
1392:                        obj3.addCondition(obj1);
1393:                    }
1394:
1395:                    omClass = AttributeOptionPeer.getOMClass();
1396:                    AttributeOption obj4 = (AttributeOption) AttributeOptionPeer
1397:                            .row2Object(row, offset4, omClass);
1398:
1399:                    newObject = true;
1400:                    for (int j = 0; j < results.size(); j++) {
1401:                        Condition temp_obj1 = (Condition) results.get(j);
1402:                        AttributeOption temp_obj4 = (AttributeOption) temp_obj1
1403:                                .getAttributeOption();
1404:                        if (temp_obj4.getPrimaryKey().equals(
1405:                                obj4.getPrimaryKey())) {
1406:                            newObject = false;
1407:                            temp_obj4.addCondition(obj1);
1408:                            break;
1409:                        }
1410:                    }
1411:                    if (newObject) {
1412:                        obj4.initConditions();
1413:                        obj4.addCondition(obj1);
1414:                    }
1415:
1416:                    omClass = RModuleIssueTypePeer.getOMClass();
1417:                    RModuleIssueType obj5 = (RModuleIssueType) RModuleIssueTypePeer
1418:                            .row2Object(row, offset5, omClass);
1419:
1420:                    newObject = true;
1421:                    for (int j = 0; j < results.size(); j++) {
1422:                        Condition temp_obj1 = (Condition) results.get(j);
1423:                        RModuleIssueType temp_obj5 = (RModuleIssueType) temp_obj1
1424:                                .getRModuleIssueType();
1425:                        if (temp_obj5.getPrimaryKey().equals(
1426:                                obj5.getPrimaryKey())) {
1427:                            newObject = false;
1428:                            temp_obj5.addCondition(obj1);
1429:                            break;
1430:                        }
1431:                    }
1432:                    if (newObject) {
1433:                        obj5.initConditions();
1434:                        obj5.addCondition(obj1);
1435:                    }
1436:                    results.add(obj1);
1437:                }
1438:                return results;
1439:            }
1440:
1441:            /**
1442:             * selects a collection of Condition objects pre-filled with
1443:             * all related objects.
1444:             *
1445:             * This method is protected by default in order to keep the public
1446:             * api reasonable.  You can provide public methods for those you
1447:             * actually need in ConditionPeer.
1448:             *
1449:             * @throws TorqueException Any exceptions caught during processing will be
1450:             *         rethrown wrapped into a TorqueException.
1451:             */
1452:            protected static List doSelectJoinAllExceptAttribute(
1453:                    Criteria criteria) throws TorqueException {
1454:                return doSelectJoinAllExceptAttribute(criteria, null);
1455:            }
1456:
1457:            /**
1458:             * selects a collection of Condition objects pre-filled with
1459:             * all related objects.
1460:             *
1461:             * This method is protected by default in order to keep the public
1462:             * api reasonable.  You can provide public methods for those you
1463:             * actually need in ConditionPeer.
1464:             *
1465:             * @throws TorqueException Any exceptions caught during processing will be
1466:             *         rethrown wrapped into a TorqueException.
1467:             */
1468:            protected static List doSelectJoinAllExceptAttribute(
1469:                    Criteria criteria, Connection conn) throws TorqueException {
1470:                setDbName(criteria);
1471:
1472:                addSelectColumns(criteria);
1473:                int offset2 = numColumns + 1;
1474:
1475:                RModuleAttributePeer.addSelectColumns(criteria);
1476:                criteria.addJoin(ConditionPeer.MODULE_ID,
1477:                        RModuleAttributePeer.MODULE_ID);
1478:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1479:                        RModuleAttributePeer.ATTRIBUTE_ID);
1480:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1481:                        RModuleAttributePeer.ISSUE_TYPE_ID);
1482:                int offset3 = offset2 + RModuleAttributePeer.numColumns;
1483:
1484:                TransitionPeer.addSelectColumns(criteria);
1485:                criteria.addJoin(ConditionPeer.TRANSITION_ID,
1486:                        TransitionPeer.TRANSITION_ID);
1487:                int offset4 = offset3 + TransitionPeer.numColumns;
1488:
1489:                AttributeOptionPeer.addSelectColumns(criteria);
1490:                criteria.addJoin(ConditionPeer.OPTION_ID,
1491:                        AttributeOptionPeer.OPTION_ID);
1492:                int offset5 = offset4 + AttributeOptionPeer.numColumns;
1493:
1494:                RModuleIssueTypePeer.addSelectColumns(criteria);
1495:                criteria.addJoin(ConditionPeer.MODULE_ID,
1496:                        RModuleIssueTypePeer.MODULE_ID);
1497:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1498:                        RModuleIssueTypePeer.ISSUE_TYPE_ID);
1499:
1500:                correctBooleans(criteria);
1501:
1502:                List rows;
1503:                if (conn == null) {
1504:                    rows = BasePeer.doSelect(criteria);
1505:                } else {
1506:                    rows = BasePeer.doSelect(criteria, conn);
1507:                }
1508:
1509:                List results = new ArrayList();
1510:
1511:                for (int i = 0; i < rows.size(); i++) {
1512:                    Record row = (Record) rows.get(i);
1513:
1514:                    Class omClass = ConditionPeer.getOMClass();
1515:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1516:                            1, omClass);
1517:
1518:                    omClass = RModuleAttributePeer.getOMClass();
1519:                    RModuleAttribute obj2 = (RModuleAttribute) RModuleAttributePeer
1520:                            .row2Object(row, offset2, omClass);
1521:
1522:                    boolean newObject = true;
1523:                    for (int j = 0; j < results.size(); j++) {
1524:                        Condition temp_obj1 = (Condition) results.get(j);
1525:                        RModuleAttribute temp_obj2 = (RModuleAttribute) temp_obj1
1526:                                .getRModuleAttribute();
1527:                        if (temp_obj2.getPrimaryKey().equals(
1528:                                obj2.getPrimaryKey())) {
1529:                            newObject = false;
1530:                            temp_obj2.addCondition(obj1);
1531:                            break;
1532:                        }
1533:                    }
1534:                    if (newObject) {
1535:                        obj2.initConditions();
1536:                        obj2.addCondition(obj1);
1537:                    }
1538:
1539:                    omClass = TransitionPeer.getOMClass();
1540:                    Transition obj3 = (Transition) TransitionPeer.row2Object(
1541:                            row, offset3, omClass);
1542:
1543:                    newObject = true;
1544:                    for (int j = 0; j < results.size(); j++) {
1545:                        Condition temp_obj1 = (Condition) results.get(j);
1546:                        Transition temp_obj3 = (Transition) temp_obj1
1547:                                .getTransition();
1548:                        if (temp_obj3.getPrimaryKey().equals(
1549:                                obj3.getPrimaryKey())) {
1550:                            newObject = false;
1551:                            temp_obj3.addCondition(obj1);
1552:                            break;
1553:                        }
1554:                    }
1555:                    if (newObject) {
1556:                        obj3.initConditions();
1557:                        obj3.addCondition(obj1);
1558:                    }
1559:
1560:                    omClass = AttributeOptionPeer.getOMClass();
1561:                    AttributeOption obj4 = (AttributeOption) AttributeOptionPeer
1562:                            .row2Object(row, offset4, omClass);
1563:
1564:                    newObject = true;
1565:                    for (int j = 0; j < results.size(); j++) {
1566:                        Condition temp_obj1 = (Condition) results.get(j);
1567:                        AttributeOption temp_obj4 = (AttributeOption) temp_obj1
1568:                                .getAttributeOption();
1569:                        if (temp_obj4.getPrimaryKey().equals(
1570:                                obj4.getPrimaryKey())) {
1571:                            newObject = false;
1572:                            temp_obj4.addCondition(obj1);
1573:                            break;
1574:                        }
1575:                    }
1576:                    if (newObject) {
1577:                        obj4.initConditions();
1578:                        obj4.addCondition(obj1);
1579:                    }
1580:
1581:                    omClass = RModuleIssueTypePeer.getOMClass();
1582:                    RModuleIssueType obj5 = (RModuleIssueType) RModuleIssueTypePeer
1583:                            .row2Object(row, offset5, omClass);
1584:
1585:                    newObject = true;
1586:                    for (int j = 0; j < results.size(); j++) {
1587:                        Condition temp_obj1 = (Condition) results.get(j);
1588:                        RModuleIssueType temp_obj5 = (RModuleIssueType) temp_obj1
1589:                                .getRModuleIssueType();
1590:                        if (temp_obj5.getPrimaryKey().equals(
1591:                                obj5.getPrimaryKey())) {
1592:                            newObject = false;
1593:                            temp_obj5.addCondition(obj1);
1594:                            break;
1595:                        }
1596:                    }
1597:                    if (newObject) {
1598:                        obj5.initConditions();
1599:                        obj5.addCondition(obj1);
1600:                    }
1601:                    results.add(obj1);
1602:                }
1603:                return results;
1604:            }
1605:
1606:            /**
1607:             * selects a collection of Condition objects pre-filled with
1608:             * all related objects.
1609:             *
1610:             * This method is protected by default in order to keep the public
1611:             * api reasonable.  You can provide public methods for those you
1612:             * actually need in ConditionPeer.
1613:             *
1614:             * @throws TorqueException Any exceptions caught during processing will be
1615:             *         rethrown wrapped into a TorqueException.
1616:             */
1617:            protected static List doSelectJoinAllExceptAttributeOption(
1618:                    Criteria criteria) throws TorqueException {
1619:                return doSelectJoinAllExceptAttributeOption(criteria, null);
1620:            }
1621:
1622:            /**
1623:             * selects a collection of Condition objects pre-filled with
1624:             * all related objects.
1625:             *
1626:             * This method is protected by default in order to keep the public
1627:             * api reasonable.  You can provide public methods for those you
1628:             * actually need in ConditionPeer.
1629:             *
1630:             * @throws TorqueException Any exceptions caught during processing will be
1631:             *         rethrown wrapped into a TorqueException.
1632:             */
1633:            protected static List doSelectJoinAllExceptAttributeOption(
1634:                    Criteria criteria, Connection conn) throws TorqueException {
1635:                setDbName(criteria);
1636:
1637:                addSelectColumns(criteria);
1638:                int offset2 = numColumns + 1;
1639:
1640:                RModuleAttributePeer.addSelectColumns(criteria);
1641:                criteria.addJoin(ConditionPeer.MODULE_ID,
1642:                        RModuleAttributePeer.MODULE_ID);
1643:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1644:                        RModuleAttributePeer.ATTRIBUTE_ID);
1645:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1646:                        RModuleAttributePeer.ISSUE_TYPE_ID);
1647:                int offset3 = offset2 + RModuleAttributePeer.numColumns;
1648:
1649:                TransitionPeer.addSelectColumns(criteria);
1650:                criteria.addJoin(ConditionPeer.TRANSITION_ID,
1651:                        TransitionPeer.TRANSITION_ID);
1652:                int offset4 = offset3 + TransitionPeer.numColumns;
1653:
1654:                AttributePeer.addSelectColumns(criteria);
1655:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1656:                        AttributePeer.ATTRIBUTE_ID);
1657:                int offset5 = offset4 + AttributePeer.numColumns;
1658:
1659:                RModuleIssueTypePeer.addSelectColumns(criteria);
1660:                criteria.addJoin(ConditionPeer.MODULE_ID,
1661:                        RModuleIssueTypePeer.MODULE_ID);
1662:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1663:                        RModuleIssueTypePeer.ISSUE_TYPE_ID);
1664:
1665:                correctBooleans(criteria);
1666:
1667:                List rows;
1668:                if (conn == null) {
1669:                    rows = BasePeer.doSelect(criteria);
1670:                } else {
1671:                    rows = BasePeer.doSelect(criteria, conn);
1672:                }
1673:
1674:                List results = new ArrayList();
1675:
1676:                for (int i = 0; i < rows.size(); i++) {
1677:                    Record row = (Record) rows.get(i);
1678:
1679:                    Class omClass = ConditionPeer.getOMClass();
1680:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1681:                            1, omClass);
1682:
1683:                    omClass = RModuleAttributePeer.getOMClass();
1684:                    RModuleAttribute obj2 = (RModuleAttribute) RModuleAttributePeer
1685:                            .row2Object(row, offset2, omClass);
1686:
1687:                    boolean newObject = true;
1688:                    for (int j = 0; j < results.size(); j++) {
1689:                        Condition temp_obj1 = (Condition) results.get(j);
1690:                        RModuleAttribute temp_obj2 = (RModuleAttribute) temp_obj1
1691:                                .getRModuleAttribute();
1692:                        if (temp_obj2.getPrimaryKey().equals(
1693:                                obj2.getPrimaryKey())) {
1694:                            newObject = false;
1695:                            temp_obj2.addCondition(obj1);
1696:                            break;
1697:                        }
1698:                    }
1699:                    if (newObject) {
1700:                        obj2.initConditions();
1701:                        obj2.addCondition(obj1);
1702:                    }
1703:
1704:                    omClass = TransitionPeer.getOMClass();
1705:                    Transition obj3 = (Transition) TransitionPeer.row2Object(
1706:                            row, offset3, omClass);
1707:
1708:                    newObject = true;
1709:                    for (int j = 0; j < results.size(); j++) {
1710:                        Condition temp_obj1 = (Condition) results.get(j);
1711:                        Transition temp_obj3 = (Transition) temp_obj1
1712:                                .getTransition();
1713:                        if (temp_obj3.getPrimaryKey().equals(
1714:                                obj3.getPrimaryKey())) {
1715:                            newObject = false;
1716:                            temp_obj3.addCondition(obj1);
1717:                            break;
1718:                        }
1719:                    }
1720:                    if (newObject) {
1721:                        obj3.initConditions();
1722:                        obj3.addCondition(obj1);
1723:                    }
1724:
1725:                    omClass = AttributePeer.getOMClass();
1726:                    Attribute obj4 = (Attribute) AttributePeer.row2Object(row,
1727:                            offset4, omClass);
1728:
1729:                    newObject = true;
1730:                    for (int j = 0; j < results.size(); j++) {
1731:                        Condition temp_obj1 = (Condition) results.get(j);
1732:                        Attribute temp_obj4 = (Attribute) temp_obj1
1733:                                .getAttribute();
1734:                        if (temp_obj4.getPrimaryKey().equals(
1735:                                obj4.getPrimaryKey())) {
1736:                            newObject = false;
1737:                            temp_obj4.addCondition(obj1);
1738:                            break;
1739:                        }
1740:                    }
1741:                    if (newObject) {
1742:                        obj4.initConditions();
1743:                        obj4.addCondition(obj1);
1744:                    }
1745:
1746:                    omClass = RModuleIssueTypePeer.getOMClass();
1747:                    RModuleIssueType obj5 = (RModuleIssueType) RModuleIssueTypePeer
1748:                            .row2Object(row, offset5, omClass);
1749:
1750:                    newObject = true;
1751:                    for (int j = 0; j < results.size(); j++) {
1752:                        Condition temp_obj1 = (Condition) results.get(j);
1753:                        RModuleIssueType temp_obj5 = (RModuleIssueType) temp_obj1
1754:                                .getRModuleIssueType();
1755:                        if (temp_obj5.getPrimaryKey().equals(
1756:                                obj5.getPrimaryKey())) {
1757:                            newObject = false;
1758:                            temp_obj5.addCondition(obj1);
1759:                            break;
1760:                        }
1761:                    }
1762:                    if (newObject) {
1763:                        obj5.initConditions();
1764:                        obj5.addCondition(obj1);
1765:                    }
1766:                    results.add(obj1);
1767:                }
1768:                return results;
1769:            }
1770:
1771:            /**
1772:             * selects a collection of Condition objects pre-filled with
1773:             * all related objects.
1774:             *
1775:             * This method is protected by default in order to keep the public
1776:             * api reasonable.  You can provide public methods for those you
1777:             * actually need in ConditionPeer.
1778:             *
1779:             * @throws TorqueException Any exceptions caught during processing will be
1780:             *         rethrown wrapped into a TorqueException.
1781:             */
1782:            protected static List doSelectJoinAllExceptRModuleIssueType(
1783:                    Criteria criteria) throws TorqueException {
1784:                return doSelectJoinAllExceptRModuleIssueType(criteria, null);
1785:            }
1786:
1787:            /**
1788:             * selects a collection of Condition objects pre-filled with
1789:             * all related objects.
1790:             *
1791:             * This method is protected by default in order to keep the public
1792:             * api reasonable.  You can provide public methods for those you
1793:             * actually need in ConditionPeer.
1794:             *
1795:             * @throws TorqueException Any exceptions caught during processing will be
1796:             *         rethrown wrapped into a TorqueException.
1797:             */
1798:            protected static List doSelectJoinAllExceptRModuleIssueType(
1799:                    Criteria criteria, Connection conn) throws TorqueException {
1800:                setDbName(criteria);
1801:
1802:                addSelectColumns(criteria);
1803:                int offset2 = numColumns + 1;
1804:
1805:                RModuleAttributePeer.addSelectColumns(criteria);
1806:                criteria.addJoin(ConditionPeer.MODULE_ID,
1807:                        RModuleAttributePeer.MODULE_ID);
1808:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1809:                        RModuleAttributePeer.ATTRIBUTE_ID);
1810:                criteria.addJoin(ConditionPeer.ISSUE_TYPE_ID,
1811:                        RModuleAttributePeer.ISSUE_TYPE_ID);
1812:                int offset3 = offset2 + RModuleAttributePeer.numColumns;
1813:
1814:                TransitionPeer.addSelectColumns(criteria);
1815:                criteria.addJoin(ConditionPeer.TRANSITION_ID,
1816:                        TransitionPeer.TRANSITION_ID);
1817:                int offset4 = offset3 + TransitionPeer.numColumns;
1818:
1819:                AttributePeer.addSelectColumns(criteria);
1820:                criteria.addJoin(ConditionPeer.ATTRIBUTE_ID,
1821:                        AttributePeer.ATTRIBUTE_ID);
1822:                int offset5 = offset4 + AttributePeer.numColumns;
1823:
1824:                AttributeOptionPeer.addSelectColumns(criteria);
1825:                criteria.addJoin(ConditionPeer.OPTION_ID,
1826:                        AttributeOptionPeer.OPTION_ID);
1827:
1828:                correctBooleans(criteria);
1829:
1830:                List rows;
1831:                if (conn == null) {
1832:                    rows = BasePeer.doSelect(criteria);
1833:                } else {
1834:                    rows = BasePeer.doSelect(criteria, conn);
1835:                }
1836:
1837:                List results = new ArrayList();
1838:
1839:                for (int i = 0; i < rows.size(); i++) {
1840:                    Record row = (Record) rows.get(i);
1841:
1842:                    Class omClass = ConditionPeer.getOMClass();
1843:                    Condition obj1 = (Condition) ConditionPeer.row2Object(row,
1844:                            1, omClass);
1845:
1846:                    omClass = RModuleAttributePeer.getOMClass();
1847:                    RModuleAttribute obj2 = (RModuleAttribute) RModuleAttributePeer
1848:                            .row2Object(row, offset2, omClass);
1849:
1850:                    boolean newObject = true;
1851:                    for (int j = 0; j < results.size(); j++) {
1852:                        Condition temp_obj1 = (Condition) results.get(j);
1853:                        RModuleAttribute temp_obj2 = (RModuleAttribute) temp_obj1
1854:                                .getRModuleAttribute();
1855:                        if (temp_obj2.getPrimaryKey().equals(
1856:                                obj2.getPrimaryKey())) {
1857:                            newObject = false;
1858:                            temp_obj2.addCondition(obj1);
1859:                            break;
1860:                        }
1861:                    }
1862:                    if (newObject) {
1863:                        obj2.initConditions();
1864:                        obj2.addCondition(obj1);
1865:                    }
1866:
1867:                    omClass = TransitionPeer.getOMClass();
1868:                    Transition obj3 = (Transition) TransitionPeer.row2Object(
1869:                            row, offset3, omClass);
1870:
1871:                    newObject = true;
1872:                    for (int j = 0; j < results.size(); j++) {
1873:                        Condition temp_obj1 = (Condition) results.get(j);
1874:                        Transition temp_obj3 = (Transition) temp_obj1
1875:                                .getTransition();
1876:                        if (temp_obj3.getPrimaryKey().equals(
1877:                                obj3.getPrimaryKey())) {
1878:                            newObject = false;
1879:                            temp_obj3.addCondition(obj1);
1880:                            break;
1881:                        }
1882:                    }
1883:                    if (newObject) {
1884:                        obj3.initConditions();
1885:                        obj3.addCondition(obj1);
1886:                    }
1887:
1888:                    omClass = AttributePeer.getOMClass();
1889:                    Attribute obj4 = (Attribute) AttributePeer.row2Object(row,
1890:                            offset4, omClass);
1891:
1892:                    newObject = true;
1893:                    for (int j = 0; j < results.size(); j++) {
1894:                        Condition temp_obj1 = (Condition) results.get(j);
1895:                        Attribute temp_obj4 = (Attribute) temp_obj1
1896:                                .getAttribute();
1897:                        if (temp_obj4.getPrimaryKey().equals(
1898:                                obj4.getPrimaryKey())) {
1899:                            newObject = false;
1900:                            temp_obj4.addCondition(obj1);
1901:                            break;
1902:                        }
1903:                    }
1904:                    if (newObject) {
1905:                        obj4.initConditions();
1906:                        obj4.addCondition(obj1);
1907:                    }
1908:
1909:                    omClass = AttributeOptionPeer.getOMClass();
1910:                    AttributeOption obj5 = (AttributeOption) AttributeOptionPeer
1911:                            .row2Object(row, offset5, omClass);
1912:
1913:                    newObject = true;
1914:                    for (int j = 0; j < results.size(); j++) {
1915:                        Condition temp_obj1 = (Condition) results.get(j);
1916:                        AttributeOption temp_obj5 = (AttributeOption) temp_obj1
1917:                                .getAttributeOption();
1918:                        if (temp_obj5.getPrimaryKey().equals(
1919:                                obj5.getPrimaryKey())) {
1920:                            newObject = false;
1921:                            temp_obj5.addCondition(obj1);
1922:                            break;
1923:                        }
1924:                    }
1925:                    if (newObject) {
1926:                        obj5.initConditions();
1927:                        obj5.addCondition(obj1);
1928:                    }
1929:
1930:                    results.add(obj1);
1931:                }
1932:                return results;
1933:            }
1934:
1935:            /**
1936:             * Returns the TableMap related to this peer.  This method is not
1937:             * needed for general use but a specific application could have a need.
1938:             *
1939:             * @throws TorqueException Any exceptions caught during processing will be
1940:             *         rethrown wrapped into a TorqueException.
1941:             */
1942:            protected static TableMap getTableMap() throws TorqueException {
1943:                return Torque.getDatabaseMap(DATABASE_NAME)
1944:                        .getTable(TABLE_NAME);
1945:            }
1946:
1947:            private static void setDbName(Criteria crit) {
1948:                // Set the correct dbName if it has not been overridden
1949:                // crit.getDbName will return the same object if not set to
1950:                // another value so == check is okay and faster
1951:                if (crit.getDbName() == Torque.getDefaultDB()) {
1952:                    crit.setDbName(DATABASE_NAME);
1953:                }
1954:            }
1955:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.