Source Code Cross Referenced for BaseIssuePeer.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 BaseIssuePeer 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_ISSUE";
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(IssueMapBuilder.CLASS_NAME);
0050:            }
0051:
0052:            /** the column name for the ISSUE_ID field */
0053:            public static final String ISSUE_ID;
0054:            /** the column name for the ID_PREFIX field */
0055:            public static final String ID_PREFIX;
0056:            /** the column name for the ID_COUNT field */
0057:            public static final String ID_COUNT;
0058:            /** the column name for the ID_DOMAIN field */
0059:            public static final String ID_DOMAIN;
0060:            /** the column name for the TYPE_ID field */
0061:            public static final String TYPE_ID;
0062:            /** the column name for the MODULE_ID field */
0063:            public static final String MODULE_ID;
0064:            /** the column name for the CREATED_TRANS_ID field */
0065:            public static final String CREATED_TRANS_ID;
0066:            /** the column name for the LAST_TRANS_ID field */
0067:            public static final String LAST_TRANS_ID;
0068:            /** the column name for the DELETED field */
0069:            public static final String DELETED;
0070:            /** the column name for the MOVED field */
0071:            public static final String MOVED;
0072:
0073:            static {
0074:                ISSUE_ID = "SCARAB_ISSUE.ISSUE_ID";
0075:                ID_PREFIX = "SCARAB_ISSUE.ID_PREFIX";
0076:                ID_COUNT = "SCARAB_ISSUE.ID_COUNT";
0077:                ID_DOMAIN = "SCARAB_ISSUE.ID_DOMAIN";
0078:                TYPE_ID = "SCARAB_ISSUE.TYPE_ID";
0079:                MODULE_ID = "SCARAB_ISSUE.MODULE_ID";
0080:                CREATED_TRANS_ID = "SCARAB_ISSUE.CREATED_TRANS_ID";
0081:                LAST_TRANS_ID = "SCARAB_ISSUE.LAST_TRANS_ID";
0082:                DELETED = "SCARAB_ISSUE.DELETED";
0083:                MOVED = "SCARAB_ISSUE.MOVED";
0084:                if (Torque.isInit()) {
0085:                    try {
0086:                        getMapBuilder(IssueMapBuilder.CLASS_NAME);
0087:                    } catch (Exception e) {
0088:                        log.error("Could not initialize Peer", e);
0089:                        throw new RuntimeException(e);
0090:                    }
0091:                } else {
0092:                    Torque.registerMapBuilder(IssueMapBuilder.CLASS_NAME);
0093:                }
0094:            }
0095:
0096:            /** number of columns for this peer */
0097:            public static final int numColumns = 10;
0098:
0099:            /** A class that can be returned by this peer. */
0100:            protected static final String CLASSNAME_DEFAULT = "org.tigris.scarab.om.Issue";
0101:
0102:            /** A class that can be returned by this peer. */
0103:            protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
0104:
0105:            /**
0106:             * Class object initialization method.
0107:             *
0108:             * @param className name of the class to initialize
0109:             * @return the initialized class
0110:             */
0111:            private static Class initClass(String className) {
0112:                Class c = null;
0113:                try {
0114:                    c = Class.forName(className);
0115:                } catch (Throwable t) {
0116:                    log
0117:                            .error(
0118:                                    "A FATAL ERROR has occurred which should not "
0119:                                            + "have happened under any circumstance.  Please notify "
0120:                                            + "the Torque developers <torque-dev@db.apache.org> "
0121:                                            + "and give as many details as possible (including the error "
0122:                                            + "stack trace).", t);
0123:
0124:                    // Error objects should always be propogated.
0125:                    if (t instanceof  Error) {
0126:                        throw (Error) t.fillInStackTrace();
0127:                    }
0128:                }
0129:                return c;
0130:            }
0131:
0132:            /**
0133:             * Get the list of objects for a ResultSet.  Please not that your
0134:             * resultset MUST return columns in the right order.  You can use
0135:             * getFieldNames() in BaseObject to get the correct sequence.
0136:             *
0137:             * @param results the ResultSet
0138:             * @return the list of objects
0139:             * @throws TorqueException Any exceptions caught during processing will be
0140:             *         rethrown wrapped into a TorqueException.
0141:             */
0142:            public static List resultSet2Objects(java.sql.ResultSet results)
0143:                    throws TorqueException {
0144:                try {
0145:                    QueryDataSet qds = null;
0146:                    List rows = null;
0147:                    try {
0148:                        qds = new QueryDataSet(results);
0149:                        rows = getSelectResults(qds);
0150:                    } finally {
0151:                        if (qds != null) {
0152:                            qds.close();
0153:                        }
0154:                    }
0155:
0156:                    return populateObjects(rows);
0157:                } catch (SQLException e) {
0158:                    throw new TorqueException(e);
0159:                } catch (DataSetException e) {
0160:                    throw new TorqueException(e);
0161:                }
0162:            }
0163:
0164:            /**
0165:             * Method to do inserts.
0166:             *
0167:             * @param criteria object used to create the INSERT statement.
0168:             * @throws TorqueException Any exceptions caught during processing will be
0169:             *         rethrown wrapped into a TorqueException.
0170:             */
0171:            public static ObjectKey doInsert(Criteria criteria)
0172:                    throws TorqueException {
0173:                return BaseIssuePeer.doInsert(criteria, (Connection) null);
0174:            }
0175:
0176:            /**
0177:             * Method to do inserts.  This method is to be used during a transaction,
0178:             * otherwise use the doInsert(Criteria) method.  It will take care of
0179:             * the connection details internally.
0180:             *
0181:             * @param criteria object used to create the INSERT statement.
0182:             * @param con the connection to use
0183:             * @throws TorqueException Any exceptions caught during processing will be
0184:             *         rethrown wrapped into a TorqueException.
0185:             */
0186:            public static ObjectKey doInsert(Criteria criteria, Connection con)
0187:                    throws TorqueException {
0188:                correctBooleans(criteria);
0189:
0190:                setDbName(criteria);
0191:
0192:                if (con == null) {
0193:                    return BasePeer.doInsert(criteria);
0194:                } else {
0195:                    return BasePeer.doInsert(criteria, con);
0196:                }
0197:            }
0198:
0199:            /**
0200:             * Add all the columns needed to create a new object.
0201:             *
0202:             * @param criteria object containing the columns to add.
0203:             * @throws TorqueException Any exceptions caught during processing will be
0204:             *         rethrown wrapped into a TorqueException.
0205:             */
0206:            public static void addSelectColumns(Criteria criteria)
0207:                    throws TorqueException {
0208:                criteria.addSelectColumn(ISSUE_ID);
0209:                criteria.addSelectColumn(ID_PREFIX);
0210:                criteria.addSelectColumn(ID_COUNT);
0211:                criteria.addSelectColumn(ID_DOMAIN);
0212:                criteria.addSelectColumn(TYPE_ID);
0213:                criteria.addSelectColumn(MODULE_ID);
0214:                criteria.addSelectColumn(CREATED_TRANS_ID);
0215:                criteria.addSelectColumn(LAST_TRANS_ID);
0216:                criteria.addSelectColumn(DELETED);
0217:                criteria.addSelectColumn(MOVED);
0218:            }
0219:
0220:            /**
0221:             * changes the boolean values in the criteria to the appropriate type,
0222:             * whenever a booleanchar or booleanint column is involved.
0223:             * This enables the user to create criteria using Boolean values
0224:             * for booleanchar or booleanint columns
0225:             * @param criteria the criteria in which the boolean values should be corrected
0226:             */
0227:            public static void correctBooleans(Criteria criteria) {
0228:                // check for conversion from boolean to int
0229:                if (criteria.containsKey(DELETED)) {
0230:                    Object possibleBoolean = criteria.get(DELETED);
0231:                    if (possibleBoolean instanceof  Boolean) {
0232:                        criteria.add(DELETED, ((Boolean) possibleBoolean)
0233:                                .booleanValue() ? 1 : 0);
0234:                    }
0235:                }
0236:                // check for conversion from boolean to int
0237:                if (criteria.containsKey(MOVED)) {
0238:                    Object possibleBoolean = criteria.get(MOVED);
0239:                    if (possibleBoolean instanceof  Boolean) {
0240:                        criteria.add(MOVED, ((Boolean) possibleBoolean)
0241:                                .booleanValue() ? 1 : 0);
0242:                    }
0243:                }
0244:            }
0245:
0246:            /**
0247:             * Create a new object of type cls from a resultset row starting
0248:             * from a specified offset.  This is done so that you can select
0249:             * other rows than just those needed for this object.  You may
0250:             * for example want to create two objects from the same row.
0251:             *
0252:             * @throws TorqueException Any exceptions caught during processing will be
0253:             *         rethrown wrapped into a TorqueException.
0254:             */
0255:            public static Issue row2Object(Record row, int offset, Class cls)
0256:                    throws TorqueException {
0257:                try {
0258:                    Issue obj = (Issue) cls.newInstance();
0259:                    IssuePeer.populateObject(row, offset, obj);
0260:                    obj.setModified(false);
0261:                    obj.setNew(false);
0262:
0263:                    return obj;
0264:                } catch (InstantiationException e) {
0265:                    throw new TorqueException(e);
0266:                } catch (IllegalAccessException e) {
0267:                    throw new TorqueException(e);
0268:                }
0269:            }
0270:
0271:            /**
0272:             * Populates an object from a resultset row starting
0273:             * from a specified offset.  This is done so that you can select
0274:             * other rows than just those needed for this object.  You may
0275:             * for example want to create two objects from the same row.
0276:             *
0277:             * @throws TorqueException Any exceptions caught during processing will be
0278:             *         rethrown wrapped into a TorqueException.
0279:             */
0280:            public static void populateObject(Record row, int offset, Issue obj)
0281:                    throws TorqueException {
0282:                try {
0283:                    obj.setIssueId(row.getValue(offset + 0).asLongObj());
0284:                    obj.setIdPrefix(row.getValue(offset + 1).asString());
0285:                    obj.setIdCount(row.getValue(offset + 2).asInt());
0286:                    obj.setIdDomain(row.getValue(offset + 3).asString());
0287:                    obj.setTypeId(row.getValue(offset + 4).asIntegerObj());
0288:                    obj.setModuleId(row.getValue(offset + 5).asIntegerObj());
0289:                    obj.setCreatedTransId(row.getValue(offset + 6).asLongObj());
0290:                    obj.setLastTransId(row.getValue(offset + 7).asLongObj());
0291:                    obj.setDeleted(row.getValue(offset + 8).asBoolean());
0292:                    obj.setMoved(row.getValue(offset + 9).asBoolean());
0293:                } catch (DataSetException e) {
0294:                    throw new TorqueException(e);
0295:                }
0296:            }
0297:
0298:            /**
0299:             * Method to do selects.
0300:             *
0301:             * @param criteria object used to create the SELECT statement.
0302:             * @return List of selected Objects
0303:             * @throws TorqueException Any exceptions caught during processing will be
0304:             *         rethrown wrapped into a TorqueException.
0305:             */
0306:            public static List doSelect(Criteria criteria)
0307:                    throws TorqueException {
0308:                return populateObjects(doSelectVillageRecords(criteria));
0309:            }
0310:
0311:            /**
0312:             * Method to do selects within a transaction.
0313:             *
0314:             * @param criteria object used to create the SELECT statement.
0315:             * @param con the connection to use
0316:             * @return List of selected Objects
0317:             * @throws TorqueException Any exceptions caught during processing will be
0318:             *         rethrown wrapped into a TorqueException.
0319:             */
0320:            public static List doSelect(Criteria criteria, Connection con)
0321:                    throws TorqueException {
0322:                return populateObjects(doSelectVillageRecords(criteria, con));
0323:            }
0324:
0325:            /**
0326:             * Grabs the raw Village records to be formed into objects.
0327:             * This method handles connections internally.  The Record objects
0328:             * returned by this method should be considered readonly.  Do not
0329:             * alter the data and call save(), your results may vary, but are
0330:             * certainly likely to result in hard to track MT bugs.
0331:             *
0332:             * @throws TorqueException Any exceptions caught during processing will be
0333:             *         rethrown wrapped into a TorqueException.
0334:             */
0335:            public static List doSelectVillageRecords(Criteria criteria)
0336:                    throws TorqueException {
0337:                return BaseIssuePeer.doSelectVillageRecords(criteria,
0338:                        (Connection) null);
0339:            }
0340:
0341:            /**
0342:             * Grabs the raw Village records to be formed into objects.
0343:             * This method should be used for transactions
0344:             *
0345:             * @param criteria object used to create the SELECT statement.
0346:             * @param con the connection to use
0347:             * @throws TorqueException Any exceptions caught during processing will be
0348:             *         rethrown wrapped into a TorqueException.
0349:             */
0350:            public static List doSelectVillageRecords(Criteria criteria,
0351:                    Connection con) throws TorqueException {
0352:                if (criteria.getSelectColumns().size() == 0) {
0353:                    addSelectColumns(criteria);
0354:                }
0355:                correctBooleans(criteria);
0356:
0357:                setDbName(criteria);
0358:
0359:                // BasePeer returns a List of Value (Village) arrays.  The array
0360:                // order follows the order columns were placed in the Select clause.
0361:                if (con == null) {
0362:                    return BasePeer.doSelect(criteria);
0363:                } else {
0364:                    return BasePeer.doSelect(criteria, con);
0365:                }
0366:            }
0367:
0368:            /**
0369:             * The returned List will contain objects of the default type or
0370:             * objects that inherit from the default.
0371:             *
0372:             * @throws TorqueException Any exceptions caught during processing will be
0373:             *         rethrown wrapped into a TorqueException.
0374:             */
0375:            public static List populateObjects(List records)
0376:                    throws TorqueException {
0377:                List results = new ArrayList(records.size());
0378:
0379:                // populate the object(s)
0380:                for (int i = 0; i < records.size(); i++) {
0381:                    Record row = (Record) records.get(i);
0382:                    results.add(IssuePeer.row2Object(row, 1, IssuePeer
0383:                            .getOMClass()));
0384:                }
0385:                return results;
0386:            }
0387:
0388:            /**
0389:             * The class that the Peer will make instances of.
0390:             * If the BO is abstract then you must implement this method
0391:             * in the BO.
0392:             *
0393:             * @throws TorqueException Any exceptions caught during processing will be
0394:             *         rethrown wrapped into a TorqueException.
0395:             */
0396:            public static Class getOMClass() throws TorqueException {
0397:                return CLASS_DEFAULT;
0398:            }
0399:
0400:            /**
0401:             * Method to do updates.
0402:             *
0403:             * @param criteria object containing data that is used to create the UPDATE
0404:             *        statement.
0405:             * @throws TorqueException Any exceptions caught during processing will be
0406:             *         rethrown wrapped into a TorqueException.
0407:             */
0408:            public static void doUpdate(Criteria criteria)
0409:                    throws TorqueException {
0410:                BaseIssuePeer.doUpdate(criteria, (Connection) null);
0411:            }
0412:
0413:            /**
0414:             * Method to do updates.  This method is to be used during a transaction,
0415:             * otherwise use the doUpdate(Criteria) method.  It will take care of
0416:             * the connection details internally.
0417:             *
0418:             * @param criteria object containing data that is used to create the UPDATE
0419:             *        statement.
0420:             * @param con the connection to use
0421:             * @throws TorqueException Any exceptions caught during processing will be
0422:             *         rethrown wrapped into a TorqueException.
0423:             */
0424:            public static void doUpdate(Criteria criteria, Connection con)
0425:                    throws TorqueException {
0426:                Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
0427:                correctBooleans(criteria);
0428:
0429:                selectCriteria.put(ISSUE_ID, criteria.remove(ISSUE_ID));
0430:
0431:                setDbName(criteria);
0432:
0433:                if (con == null) {
0434:                    BasePeer.doUpdate(selectCriteria, criteria);
0435:                } else {
0436:                    BasePeer.doUpdate(selectCriteria, criteria, con);
0437:                }
0438:            }
0439:
0440:            /**
0441:             * Method to do deletes.
0442:             *
0443:             * @param criteria object containing data that is used DELETE from database.
0444:             * @throws TorqueException Any exceptions caught during processing will be
0445:             *         rethrown wrapped into a TorqueException.
0446:             */
0447:            public static void doDelete(Criteria criteria)
0448:                    throws TorqueException {
0449:                IssuePeer.doDelete(criteria, (Connection) null);
0450:            }
0451:
0452:            /**
0453:             * Method to do deletes.  This method is to be used during a transaction,
0454:             * otherwise use the doDelete(Criteria) method.  It will take care of
0455:             * the connection details internally.
0456:             *
0457:             * @param criteria object containing data that is used DELETE from database.
0458:             * @param con the connection to use
0459:             * @throws TorqueException Any exceptions caught during processing will be
0460:             *         rethrown wrapped into a TorqueException.
0461:             */
0462:            public static void doDelete(Criteria criteria, Connection con)
0463:                    throws TorqueException {
0464:                correctBooleans(criteria);
0465:
0466:                setDbName(criteria);
0467:
0468:                if (con == null) {
0469:                    BasePeer.doDelete(criteria);
0470:                } else {
0471:                    BasePeer.doDelete(criteria, con);
0472:                }
0473:            }
0474:
0475:            /**
0476:             * Method to do selects
0477:             *
0478:             * @throws TorqueException Any exceptions caught during processing will be
0479:             *         rethrown wrapped into a TorqueException.
0480:             */
0481:            public static List doSelect(Issue obj) throws TorqueException {
0482:                return doSelect(buildSelectCriteria(obj));
0483:            }
0484:
0485:            /**
0486:             * Method to do inserts
0487:             *
0488:             * @throws TorqueException Any exceptions caught during processing will be
0489:             *         rethrown wrapped into a TorqueException.
0490:             */
0491:            public static void doInsert(Issue obj) throws TorqueException {
0492:                obj.setPrimaryKey(doInsert(buildCriteria(obj)));
0493:                obj.setNew(false);
0494:                obj.setModified(false);
0495:            }
0496:
0497:            /**
0498:             * @param obj the data object to update in the database.
0499:             * @throws TorqueException Any exceptions caught during processing will be
0500:             *         rethrown wrapped into a TorqueException.
0501:             */
0502:            public static void doUpdate(Issue obj) throws TorqueException {
0503:                doUpdate(buildCriteria(obj));
0504:                obj.setModified(false);
0505:            }
0506:
0507:            /**
0508:             * @param obj the data object to delete in the database.
0509:             * @throws TorqueException Any exceptions caught during processing will be
0510:             *         rethrown wrapped into a TorqueException.
0511:             */
0512:            public static void doDelete(Issue obj) throws TorqueException {
0513:                doDelete(buildSelectCriteria(obj));
0514:            }
0515:
0516:            /**
0517:             * Method to do inserts.  This method is to be used during a transaction,
0518:             * otherwise use the doInsert(Issue) method.  It will take
0519:             * care of the connection details internally.
0520:             *
0521:             * @param obj the data object to insert into the database.
0522:             * @param con the connection to use
0523:             * @throws TorqueException Any exceptions caught during processing will be
0524:             *         rethrown wrapped into a TorqueException.
0525:             */
0526:            public static void doInsert(Issue obj, Connection con)
0527:                    throws TorqueException {
0528:                obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
0529:                obj.setNew(false);
0530:                obj.setModified(false);
0531:            }
0532:
0533:            /**
0534:             * Method to do update.  This method is to be used during a transaction,
0535:             * otherwise use the doUpdate(Issue) method.  It will take
0536:             * care of the connection details internally.
0537:             *
0538:             * @param obj the data object to update in the database.
0539:             * @param con the connection to use
0540:             * @throws TorqueException Any exceptions caught during processing will be
0541:             *         rethrown wrapped into a TorqueException.
0542:             */
0543:            public static void doUpdate(Issue obj, Connection con)
0544:                    throws TorqueException {
0545:                doUpdate(buildCriteria(obj), con);
0546:                obj.setModified(false);
0547:            }
0548:
0549:            /**
0550:             * Method to delete.  This method is to be used during a transaction,
0551:             * otherwise use the doDelete(Issue) method.  It will take
0552:             * care of the connection details internally.
0553:             *
0554:             * @param obj the data object to delete in the database.
0555:             * @param con the connection to use
0556:             * @throws TorqueException Any exceptions caught during processing will be
0557:             *         rethrown wrapped into a TorqueException.
0558:             */
0559:            public static void doDelete(Issue obj, Connection con)
0560:                    throws TorqueException {
0561:                doDelete(buildSelectCriteria(obj), con);
0562:            }
0563:
0564:            /**
0565:             * Method to do deletes.
0566:             *
0567:             * @param pk ObjectKey that is used DELETE from database.
0568:             * @throws TorqueException Any exceptions caught during processing will be
0569:             *         rethrown wrapped into a TorqueException.
0570:             */
0571:            public static void doDelete(ObjectKey pk) throws TorqueException {
0572:                BaseIssuePeer.doDelete(pk, (Connection) null);
0573:            }
0574:
0575:            /**
0576:             * Method to delete.  This method is to be used during a transaction,
0577:             * otherwise use the doDelete(ObjectKey) method.  It will take
0578:             * care of the connection details internally.
0579:             *
0580:             * @param pk the primary key for the object to delete in the database.
0581:             * @param con the connection to use
0582:             * @throws TorqueException Any exceptions caught during processing will be
0583:             *         rethrown wrapped into a TorqueException.
0584:             */
0585:            public static void doDelete(ObjectKey pk, Connection con)
0586:                    throws TorqueException {
0587:                doDelete(buildCriteria(pk), con);
0588:            }
0589:
0590:            /** Build a Criteria object from an ObjectKey */
0591:            public static Criteria buildCriteria(ObjectKey pk) {
0592:                Criteria criteria = new Criteria();
0593:                criteria.add(ISSUE_ID, pk);
0594:                return criteria;
0595:            }
0596:
0597:            /** Build a Criteria object from the data object for this peer */
0598:            public static Criteria buildCriteria(Issue obj) {
0599:                Criteria criteria = new Criteria(DATABASE_NAME);
0600:                if (!obj.isNew())
0601:                    criteria.add(ISSUE_ID, obj.getIssueId());
0602:                criteria.add(ID_PREFIX, obj.getIdPrefix());
0603:                criteria.add(ID_COUNT, obj.getIdCount());
0604:                criteria.add(ID_DOMAIN, obj.getIdDomain());
0605:                criteria.add(TYPE_ID, obj.getTypeId());
0606:                criteria.add(MODULE_ID, obj.getModuleId());
0607:                criteria.add(CREATED_TRANS_ID, obj.getCreatedTransId());
0608:                criteria.add(LAST_TRANS_ID, obj.getLastTransId());
0609:                criteria.add(DELETED, obj.getDeleted());
0610:                criteria.add(MOVED, obj.getMoved());
0611:                return criteria;
0612:            }
0613:
0614:            /** Build a Criteria object from the data object for this peer, skipping all binary columns */
0615:            public static Criteria buildSelectCriteria(Issue obj) {
0616:                Criteria criteria = new Criteria(DATABASE_NAME);
0617:                if (!obj.isNew()) {
0618:                    criteria.add(ISSUE_ID, obj.getIssueId());
0619:                }
0620:                criteria.add(ID_PREFIX, obj.getIdPrefix());
0621:                criteria.add(ID_COUNT, obj.getIdCount());
0622:                criteria.add(ID_DOMAIN, obj.getIdDomain());
0623:                criteria.add(TYPE_ID, obj.getTypeId());
0624:                criteria.add(MODULE_ID, obj.getModuleId());
0625:                criteria.add(CREATED_TRANS_ID, obj.getCreatedTransId());
0626:                criteria.add(LAST_TRANS_ID, obj.getLastTransId());
0627:                criteria.add(DELETED, obj.getDeleted());
0628:                criteria.add(MOVED, obj.getMoved());
0629:                return criteria;
0630:            }
0631:
0632:            /**
0633:             * Retrieve a single object by pk
0634:             *
0635:             * @param pk the primary key
0636:             * @throws TorqueException Any exceptions caught during processing will be
0637:             *         rethrown wrapped into a TorqueException.
0638:             * @throws NoRowsException Primary key was not found in database.
0639:             * @throws TooManyRowsException Primary key was not found in database.
0640:             */
0641:            public static Issue retrieveByPK(Long pk) throws TorqueException,
0642:                    NoRowsException, TooManyRowsException {
0643:                return retrieveByPK(SimpleKey.keyFor(pk));
0644:            }
0645:
0646:            /**
0647:             * Retrieve a single object by pk
0648:             *
0649:             * @param pk the primary key
0650:             * @param con the connection to use
0651:             * @throws TorqueException Any exceptions caught during processing will be
0652:             *         rethrown wrapped into a TorqueException.
0653:             * @throws NoRowsException Primary key was not found in database.
0654:             * @throws TooManyRowsException Primary key was not found in database.
0655:             */
0656:            public static Issue retrieveByPK(Long pk, Connection con)
0657:                    throws TorqueException, NoRowsException,
0658:                    TooManyRowsException {
0659:                return retrieveByPK(SimpleKey.keyFor(pk), con);
0660:            }
0661:
0662:            /**
0663:             * Retrieve a single object by pk
0664:             *
0665:             * @param pk the primary key
0666:             * @throws TorqueException Any exceptions caught during processing will be
0667:             *         rethrown wrapped into a TorqueException.
0668:             * @throws NoRowsException Primary key was not found in database.
0669:             * @throws TooManyRowsException Primary key was not found in database.
0670:             */
0671:            public static Issue retrieveByPK(ObjectKey pk)
0672:                    throws TorqueException, NoRowsException,
0673:                    TooManyRowsException {
0674:                Connection db = null;
0675:                Issue retVal = null;
0676:                try {
0677:                    db = Torque.getConnection(DATABASE_NAME);
0678:                    retVal = retrieveByPK(pk, db);
0679:                } finally {
0680:                    Torque.closeConnection(db);
0681:                }
0682:                return retVal;
0683:            }
0684:
0685:            /**
0686:             * Retrieve a single object by pk
0687:             *
0688:             * @param pk the primary key
0689:             * @param con the connection to use
0690:             * @throws TorqueException Any exceptions caught during processing will be
0691:             *         rethrown wrapped into a TorqueException.
0692:             * @throws NoRowsException Primary key was not found in database.
0693:             * @throws TooManyRowsException Primary key was not found in database.
0694:             */
0695:            public static Issue retrieveByPK(ObjectKey pk, Connection con)
0696:                    throws TorqueException, NoRowsException,
0697:                    TooManyRowsException {
0698:                Criteria criteria = buildCriteria(pk);
0699:                List v = doSelect(criteria, con);
0700:                if (v.size() == 0) {
0701:                    throw new NoRowsException("Failed to select a row.");
0702:                } else if (v.size() > 1) {
0703:                    throw new TooManyRowsException(
0704:                            "Failed to select only one row.");
0705:                } else {
0706:                    return (Issue) v.get(0);
0707:                }
0708:            }
0709:
0710:            /**
0711:             * Retrieve a multiple objects by pk
0712:             *
0713:             * @param pks List of primary keys
0714:             * @throws TorqueException Any exceptions caught during processing will be
0715:             *         rethrown wrapped into a TorqueException.
0716:             */
0717:            public static List retrieveByPKs(List pks) throws TorqueException {
0718:                Connection db = null;
0719:                List retVal = null;
0720:                try {
0721:                    db = Torque.getConnection(DATABASE_NAME);
0722:                    retVal = retrieveByPKs(pks, db);
0723:                } finally {
0724:                    Torque.closeConnection(db);
0725:                }
0726:                return retVal;
0727:            }
0728:
0729:            /**
0730:             * Retrieve a multiple objects by pk
0731:             *
0732:             * @param pks List of primary keys
0733:             * @param dbcon the connection to use
0734:             * @throws TorqueException Any exceptions caught during processing will be
0735:             *         rethrown wrapped into a TorqueException.
0736:             */
0737:            public static List retrieveByPKs(List pks, Connection dbcon)
0738:                    throws TorqueException {
0739:                List objs = null;
0740:                if (pks == null || pks.size() == 0) {
0741:                    objs = new LinkedList();
0742:                } else {
0743:                    Criteria criteria = new Criteria();
0744:                    criteria.addIn(ISSUE_ID, pks);
0745:                    objs = doSelect(criteria, dbcon);
0746:                }
0747:                return objs;
0748:            }
0749:
0750:            /**
0751:             * selects a collection of Issue objects pre-filled with their
0752:             * ScarabModule objects.
0753:             *
0754:             * This method is protected by default in order to keep the public
0755:             * api reasonable.  You can provide public methods for those you
0756:             * actually need in IssuePeer.
0757:             *
0758:             * @throws TorqueException Any exceptions caught during processing will be
0759:             *         rethrown wrapped into a TorqueException.
0760:             */
0761:            protected static List doSelectJoinScarabModule(Criteria criteria)
0762:                    throws TorqueException {
0763:                return doSelectJoinScarabModule(criteria, null);
0764:            }
0765:
0766:            /**
0767:             * selects a collection of Issue objects pre-filled with their
0768:             * ScarabModule objects.
0769:             *
0770:             * This method is protected by default in order to keep the public
0771:             * api reasonable.  You can provide public methods for those you
0772:             * actually need in IssuePeer.
0773:             *
0774:             * @throws TorqueException Any exceptions caught during processing will be
0775:             *         rethrown wrapped into a TorqueException.
0776:             */
0777:            protected static List doSelectJoinScarabModule(Criteria criteria,
0778:                    Connection conn) throws TorqueException {
0779:                setDbName(criteria);
0780:
0781:                IssuePeer.addSelectColumns(criteria);
0782:                int offset = numColumns + 1;
0783:                ScarabModulePeer.addSelectColumns(criteria);
0784:
0785:                criteria.addJoin(IssuePeer.MODULE_ID,
0786:                        ScarabModulePeer.MODULE_ID);
0787:
0788:                correctBooleans(criteria);
0789:
0790:                List rows;
0791:                if (conn == null) {
0792:                    rows = BasePeer.doSelect(criteria);
0793:                } else {
0794:                    rows = BasePeer.doSelect(criteria, conn);
0795:                }
0796:
0797:                List results = new ArrayList();
0798:
0799:                for (int i = 0; i < rows.size(); i++) {
0800:                    Record row = (Record) rows.get(i);
0801:
0802:                    Class omClass = IssuePeer.getOMClass();
0803:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
0804:                    omClass = ScarabModulePeer.getOMClass(row, offset);
0805:                    ScarabModule obj2 = (ScarabModule) ScarabModulePeer
0806:                            .row2Object(row, offset, omClass);
0807:
0808:                    boolean newObject = true;
0809:                    for (int j = 0; j < results.size(); j++) {
0810:                        Issue temp_obj1 = (Issue) results.get(j);
0811:                        ScarabModule temp_obj2 = (ScarabModule) temp_obj1
0812:                                .getModule();
0813:                        if (temp_obj2.getPrimaryKey().equals(
0814:                                obj2.getPrimaryKey())) {
0815:                            newObject = false;
0816:                            temp_obj2.addIssue(obj1);
0817:                            break;
0818:                        }
0819:                    }
0820:                    if (newObject) {
0821:                        obj2.initIssues();
0822:                        obj2.addIssue(obj1);
0823:                    }
0824:                    results.add(obj1);
0825:                }
0826:                return results;
0827:            }
0828:
0829:            /**
0830:             * selects a collection of Issue objects pre-filled with their
0831:             * IssueType objects.
0832:             *
0833:             * This method is protected by default in order to keep the public
0834:             * api reasonable.  You can provide public methods for those you
0835:             * actually need in IssuePeer.
0836:             *
0837:             * @throws TorqueException Any exceptions caught during processing will be
0838:             *         rethrown wrapped into a TorqueException.
0839:             */
0840:            protected static List doSelectJoinIssueType(Criteria criteria)
0841:                    throws TorqueException {
0842:                return doSelectJoinIssueType(criteria, null);
0843:            }
0844:
0845:            /**
0846:             * selects a collection of Issue objects pre-filled with their
0847:             * IssueType objects.
0848:             *
0849:             * This method is protected by default in order to keep the public
0850:             * api reasonable.  You can provide public methods for those you
0851:             * actually need in IssuePeer.
0852:             *
0853:             * @throws TorqueException Any exceptions caught during processing will be
0854:             *         rethrown wrapped into a TorqueException.
0855:             */
0856:            protected static List doSelectJoinIssueType(Criteria criteria,
0857:                    Connection conn) throws TorqueException {
0858:                setDbName(criteria);
0859:
0860:                IssuePeer.addSelectColumns(criteria);
0861:                int offset = numColumns + 1;
0862:                IssueTypePeer.addSelectColumns(criteria);
0863:
0864:                criteria
0865:                        .addJoin(IssuePeer.TYPE_ID, IssueTypePeer.ISSUE_TYPE_ID);
0866:
0867:                correctBooleans(criteria);
0868:
0869:                List rows;
0870:                if (conn == null) {
0871:                    rows = BasePeer.doSelect(criteria);
0872:                } else {
0873:                    rows = BasePeer.doSelect(criteria, conn);
0874:                }
0875:
0876:                List results = new ArrayList();
0877:
0878:                for (int i = 0; i < rows.size(); i++) {
0879:                    Record row = (Record) rows.get(i);
0880:
0881:                    Class omClass = IssuePeer.getOMClass();
0882:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
0883:                    omClass = IssueTypePeer.getOMClass();
0884:                    IssueType obj2 = (IssueType) IssueTypePeer.row2Object(row,
0885:                            offset, omClass);
0886:
0887:                    boolean newObject = true;
0888:                    for (int j = 0; j < results.size(); j++) {
0889:                        Issue temp_obj1 = (Issue) results.get(j);
0890:                        IssueType temp_obj2 = (IssueType) temp_obj1
0891:                                .getIssueType();
0892:                        if (temp_obj2.getPrimaryKey().equals(
0893:                                obj2.getPrimaryKey())) {
0894:                            newObject = false;
0895:                            temp_obj2.addIssue(obj1);
0896:                            break;
0897:                        }
0898:                    }
0899:                    if (newObject) {
0900:                        obj2.initIssues();
0901:                        obj2.addIssue(obj1);
0902:                    }
0903:                    results.add(obj1);
0904:                }
0905:                return results;
0906:            }
0907:
0908:            /**
0909:             * selects a collection of Issue objects pre-filled with their
0910:             * ActivitySet objects.
0911:             *
0912:             * This method is protected by default in order to keep the public
0913:             * api reasonable.  You can provide public methods for those you
0914:             * actually need in IssuePeer.
0915:             *
0916:             * @throws TorqueException Any exceptions caught during processing will be
0917:             *         rethrown wrapped into a TorqueException.
0918:             */
0919:            protected static List doSelectJoinActivitySetRelatedByCreatedTransId(
0920:                    Criteria criteria) throws TorqueException {
0921:                return doSelectJoinActivitySetRelatedByCreatedTransId(criteria,
0922:                        null);
0923:            }
0924:
0925:            /**
0926:             * selects a collection of Issue objects pre-filled with their
0927:             * ActivitySet objects.
0928:             *
0929:             * This method is protected by default in order to keep the public
0930:             * api reasonable.  You can provide public methods for those you
0931:             * actually need in IssuePeer.
0932:             *
0933:             * @throws TorqueException Any exceptions caught during processing will be
0934:             *         rethrown wrapped into a TorqueException.
0935:             */
0936:            protected static List doSelectJoinActivitySetRelatedByCreatedTransId(
0937:                    Criteria criteria, Connection conn) throws TorqueException {
0938:                setDbName(criteria);
0939:
0940:                IssuePeer.addSelectColumns(criteria);
0941:                int offset = numColumns + 1;
0942:                ActivitySetPeer.addSelectColumns(criteria);
0943:
0944:                criteria.addJoin(IssuePeer.CREATED_TRANS_ID,
0945:                        ActivitySetPeer.TRANSACTION_ID);
0946:
0947:                correctBooleans(criteria);
0948:
0949:                List rows;
0950:                if (conn == null) {
0951:                    rows = BasePeer.doSelect(criteria);
0952:                } else {
0953:                    rows = BasePeer.doSelect(criteria, conn);
0954:                }
0955:
0956:                List results = new ArrayList();
0957:
0958:                for (int i = 0; i < rows.size(); i++) {
0959:                    Record row = (Record) rows.get(i);
0960:
0961:                    Class omClass = IssuePeer.getOMClass();
0962:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
0963:                    omClass = ActivitySetPeer.getOMClass();
0964:                    ActivitySet obj2 = (ActivitySet) ActivitySetPeer
0965:                            .row2Object(row, offset, omClass);
0966:
0967:                    boolean newObject = true;
0968:                    for (int j = 0; j < results.size(); j++) {
0969:                        Issue temp_obj1 = (Issue) results.get(j);
0970:                        ActivitySet temp_obj2 = (ActivitySet) temp_obj1
0971:                                .getActivitySetRelatedByCreatedTransId();
0972:                        if (temp_obj2.getPrimaryKey().equals(
0973:                                obj2.getPrimaryKey())) {
0974:                            newObject = false;
0975:                            temp_obj2.addIssueRelatedByCreatedTransId(obj1);
0976:                            break;
0977:                        }
0978:                    }
0979:                    if (newObject) {
0980:                        obj2.initIssuesRelatedByCreatedTransId();
0981:                        obj2.addIssueRelatedByCreatedTransId(obj1);
0982:                    }
0983:                    results.add(obj1);
0984:                }
0985:                return results;
0986:            }
0987:
0988:            /**
0989:             * selects a collection of Issue objects pre-filled with their
0990:             * ActivitySet objects.
0991:             *
0992:             * This method is protected by default in order to keep the public
0993:             * api reasonable.  You can provide public methods for those you
0994:             * actually need in IssuePeer.
0995:             *
0996:             * @throws TorqueException Any exceptions caught during processing will be
0997:             *         rethrown wrapped into a TorqueException.
0998:             */
0999:            protected static List doSelectJoinActivitySetRelatedByLastTransId(
1000:                    Criteria criteria) throws TorqueException {
1001:                return doSelectJoinActivitySetRelatedByLastTransId(criteria,
1002:                        null);
1003:            }
1004:
1005:            /**
1006:             * selects a collection of Issue objects pre-filled with their
1007:             * ActivitySet objects.
1008:             *
1009:             * This method is protected by default in order to keep the public
1010:             * api reasonable.  You can provide public methods for those you
1011:             * actually need in IssuePeer.
1012:             *
1013:             * @throws TorqueException Any exceptions caught during processing will be
1014:             *         rethrown wrapped into a TorqueException.
1015:             */
1016:            protected static List doSelectJoinActivitySetRelatedByLastTransId(
1017:                    Criteria criteria, Connection conn) throws TorqueException {
1018:                setDbName(criteria);
1019:
1020:                IssuePeer.addSelectColumns(criteria);
1021:                int offset = numColumns + 1;
1022:                ActivitySetPeer.addSelectColumns(criteria);
1023:
1024:                criteria.addJoin(IssuePeer.LAST_TRANS_ID,
1025:                        ActivitySetPeer.TRANSACTION_ID);
1026:
1027:                correctBooleans(criteria);
1028:
1029:                List rows;
1030:                if (conn == null) {
1031:                    rows = BasePeer.doSelect(criteria);
1032:                } else {
1033:                    rows = BasePeer.doSelect(criteria, conn);
1034:                }
1035:
1036:                List results = new ArrayList();
1037:
1038:                for (int i = 0; i < rows.size(); i++) {
1039:                    Record row = (Record) rows.get(i);
1040:
1041:                    Class omClass = IssuePeer.getOMClass();
1042:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
1043:                    omClass = ActivitySetPeer.getOMClass();
1044:                    ActivitySet obj2 = (ActivitySet) ActivitySetPeer
1045:                            .row2Object(row, offset, omClass);
1046:
1047:                    boolean newObject = true;
1048:                    for (int j = 0; j < results.size(); j++) {
1049:                        Issue temp_obj1 = (Issue) results.get(j);
1050:                        ActivitySet temp_obj2 = (ActivitySet) temp_obj1
1051:                                .getActivitySetRelatedByLastTransId();
1052:                        if (temp_obj2.getPrimaryKey().equals(
1053:                                obj2.getPrimaryKey())) {
1054:                            newObject = false;
1055:                            temp_obj2.addIssueRelatedByLastTransId(obj1);
1056:                            break;
1057:                        }
1058:                    }
1059:                    if (newObject) {
1060:                        obj2.initIssuesRelatedByLastTransId();
1061:                        obj2.addIssueRelatedByLastTransId(obj1);
1062:                    }
1063:                    results.add(obj1);
1064:                }
1065:                return results;
1066:            }
1067:
1068:            /**
1069:             * selects a collection of Issue objects pre-filled with
1070:             * all related objects.
1071:             *
1072:             * This method is protected by default in order to keep the public
1073:             * api reasonable.  You can provide public methods for those you
1074:             * actually need in IssuePeer.
1075:             *
1076:             * @throws TorqueException Any exceptions caught during processing will be
1077:             *         rethrown wrapped into a TorqueException.
1078:             */
1079:            protected static List doSelectJoinAllExceptScarabModule(
1080:                    Criteria criteria) throws TorqueException {
1081:                return doSelectJoinAllExceptScarabModule(criteria, null);
1082:            }
1083:
1084:            /**
1085:             * selects a collection of Issue objects pre-filled with
1086:             * all related objects.
1087:             *
1088:             * This method is protected by default in order to keep the public
1089:             * api reasonable.  You can provide public methods for those you
1090:             * actually need in IssuePeer.
1091:             *
1092:             * @throws TorqueException Any exceptions caught during processing will be
1093:             *         rethrown wrapped into a TorqueException.
1094:             */
1095:            protected static List doSelectJoinAllExceptScarabModule(
1096:                    Criteria criteria, Connection conn) throws TorqueException {
1097:                setDbName(criteria);
1098:
1099:                addSelectColumns(criteria);
1100:                int offset2 = numColumns + 1;
1101:
1102:                IssueTypePeer.addSelectColumns(criteria);
1103:                criteria
1104:                        .addJoin(IssuePeer.TYPE_ID, IssueTypePeer.ISSUE_TYPE_ID);
1105:                int offset3 = offset2 + IssueTypePeer.numColumns;
1106:
1107:                ActivitySetPeer.addSelectColumns(criteria);
1108:                criteria.addJoin(IssuePeer.CREATED_TRANS_ID,
1109:                        ActivitySetPeer.TRANSACTION_ID);
1110:                int offset4 = offset3 + ActivitySetPeer.numColumns;
1111:
1112:                ActivitySetPeer.addSelectColumns(criteria);
1113:                criteria.addJoin(IssuePeer.LAST_TRANS_ID,
1114:                        ActivitySetPeer.TRANSACTION_ID);
1115:
1116:                correctBooleans(criteria);
1117:
1118:                List rows;
1119:                if (conn == null) {
1120:                    rows = BasePeer.doSelect(criteria);
1121:                } else {
1122:                    rows = BasePeer.doSelect(criteria, conn);
1123:                }
1124:
1125:                List results = new ArrayList();
1126:
1127:                for (int i = 0; i < rows.size(); i++) {
1128:                    Record row = (Record) rows.get(i);
1129:
1130:                    Class omClass = IssuePeer.getOMClass();
1131:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
1132:
1133:                    omClass = IssueTypePeer.getOMClass();
1134:                    IssueType obj2 = (IssueType) IssueTypePeer.row2Object(row,
1135:                            offset2, omClass);
1136:
1137:                    boolean newObject = true;
1138:                    for (int j = 0; j < results.size(); j++) {
1139:                        Issue temp_obj1 = (Issue) results.get(j);
1140:                        IssueType temp_obj2 = (IssueType) temp_obj1
1141:                                .getIssueType();
1142:                        if (temp_obj2.getPrimaryKey().equals(
1143:                                obj2.getPrimaryKey())) {
1144:                            newObject = false;
1145:                            temp_obj2.addIssue(obj1);
1146:                            break;
1147:                        }
1148:                    }
1149:                    if (newObject) {
1150:                        obj2.initIssues();
1151:                        obj2.addIssue(obj1);
1152:                    }
1153:
1154:                    omClass = ActivitySetPeer.getOMClass();
1155:                    ActivitySet obj3 = (ActivitySet) ActivitySetPeer
1156:                            .row2Object(row, offset3, omClass);
1157:
1158:                    newObject = true;
1159:                    for (int j = 0; j < results.size(); j++) {
1160:                        Issue temp_obj1 = (Issue) results.get(j);
1161:                        ActivitySet temp_obj3 = (ActivitySet) temp_obj1
1162:                                .getActivitySetRelatedByCreatedTransId();
1163:                        if (temp_obj3.getPrimaryKey().equals(
1164:                                obj3.getPrimaryKey())) {
1165:                            newObject = false;
1166:                            temp_obj3.addIssueRelatedByCreatedTransId(obj1);
1167:                            break;
1168:                        }
1169:                    }
1170:                    if (newObject) {
1171:                        obj3.initIssuesRelatedByCreatedTransId();
1172:                        obj3.addIssueRelatedByCreatedTransId(obj1);
1173:                    }
1174:
1175:                    omClass = ActivitySetPeer.getOMClass();
1176:                    ActivitySet obj4 = (ActivitySet) ActivitySetPeer
1177:                            .row2Object(row, offset4, omClass);
1178:
1179:                    newObject = true;
1180:                    for (int j = 0; j < results.size(); j++) {
1181:                        Issue temp_obj1 = (Issue) results.get(j);
1182:                        ActivitySet temp_obj4 = (ActivitySet) temp_obj1
1183:                                .getActivitySetRelatedByLastTransId();
1184:                        if (temp_obj4.getPrimaryKey().equals(
1185:                                obj4.getPrimaryKey())) {
1186:                            newObject = false;
1187:                            temp_obj4.addIssueRelatedByLastTransId(obj1);
1188:                            break;
1189:                        }
1190:                    }
1191:                    if (newObject) {
1192:                        obj4.initIssuesRelatedByLastTransId();
1193:                        obj4.addIssueRelatedByLastTransId(obj1);
1194:                    }
1195:                    results.add(obj1);
1196:                }
1197:                return results;
1198:            }
1199:
1200:            /**
1201:             * selects a collection of Issue objects pre-filled with
1202:             * all related objects.
1203:             *
1204:             * This method is protected by default in order to keep the public
1205:             * api reasonable.  You can provide public methods for those you
1206:             * actually need in IssuePeer.
1207:             *
1208:             * @throws TorqueException Any exceptions caught during processing will be
1209:             *         rethrown wrapped into a TorqueException.
1210:             */
1211:            protected static List doSelectJoinAllExceptIssueType(
1212:                    Criteria criteria) throws TorqueException {
1213:                return doSelectJoinAllExceptIssueType(criteria, null);
1214:            }
1215:
1216:            /**
1217:             * selects a collection of Issue objects pre-filled with
1218:             * all related objects.
1219:             *
1220:             * This method is protected by default in order to keep the public
1221:             * api reasonable.  You can provide public methods for those you
1222:             * actually need in IssuePeer.
1223:             *
1224:             * @throws TorqueException Any exceptions caught during processing will be
1225:             *         rethrown wrapped into a TorqueException.
1226:             */
1227:            protected static List doSelectJoinAllExceptIssueType(
1228:                    Criteria criteria, Connection conn) throws TorqueException {
1229:                setDbName(criteria);
1230:
1231:                addSelectColumns(criteria);
1232:                int offset2 = numColumns + 1;
1233:
1234:                ScarabModulePeer.addSelectColumns(criteria);
1235:                criteria.addJoin(IssuePeer.MODULE_ID,
1236:                        ScarabModulePeer.MODULE_ID);
1237:                int offset3 = offset2 + ScarabModulePeer.numColumns;
1238:
1239:                ActivitySetPeer.addSelectColumns(criteria);
1240:                criteria.addJoin(IssuePeer.CREATED_TRANS_ID,
1241:                        ActivitySetPeer.TRANSACTION_ID);
1242:                int offset4 = offset3 + ActivitySetPeer.numColumns;
1243:
1244:                ActivitySetPeer.addSelectColumns(criteria);
1245:                criteria.addJoin(IssuePeer.LAST_TRANS_ID,
1246:                        ActivitySetPeer.TRANSACTION_ID);
1247:
1248:                correctBooleans(criteria);
1249:
1250:                List rows;
1251:                if (conn == null) {
1252:                    rows = BasePeer.doSelect(criteria);
1253:                } else {
1254:                    rows = BasePeer.doSelect(criteria, conn);
1255:                }
1256:
1257:                List results = new ArrayList();
1258:
1259:                for (int i = 0; i < rows.size(); i++) {
1260:                    Record row = (Record) rows.get(i);
1261:
1262:                    Class omClass = IssuePeer.getOMClass();
1263:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
1264:
1265:                    omClass = ScarabModulePeer.getOMClass(row, offset2);
1266:                    ScarabModule obj2 = (ScarabModule) ScarabModulePeer
1267:                            .row2Object(row, offset2, omClass);
1268:
1269:                    boolean newObject = true;
1270:                    for (int j = 0; j < results.size(); j++) {
1271:                        Issue temp_obj1 = (Issue) results.get(j);
1272:                        ScarabModule temp_obj2 = (ScarabModule) temp_obj1
1273:                                .getModule();
1274:                        if (temp_obj2.getPrimaryKey().equals(
1275:                                obj2.getPrimaryKey())) {
1276:                            newObject = false;
1277:                            temp_obj2.addIssue(obj1);
1278:                            break;
1279:                        }
1280:                    }
1281:                    if (newObject) {
1282:                        obj2.initIssues();
1283:                        obj2.addIssue(obj1);
1284:                    }
1285:
1286:                    omClass = ActivitySetPeer.getOMClass();
1287:                    ActivitySet obj3 = (ActivitySet) ActivitySetPeer
1288:                            .row2Object(row, offset3, omClass);
1289:
1290:                    newObject = true;
1291:                    for (int j = 0; j < results.size(); j++) {
1292:                        Issue temp_obj1 = (Issue) results.get(j);
1293:                        ActivitySet temp_obj3 = (ActivitySet) temp_obj1
1294:                                .getActivitySetRelatedByCreatedTransId();
1295:                        if (temp_obj3.getPrimaryKey().equals(
1296:                                obj3.getPrimaryKey())) {
1297:                            newObject = false;
1298:                            temp_obj3.addIssueRelatedByCreatedTransId(obj1);
1299:                            break;
1300:                        }
1301:                    }
1302:                    if (newObject) {
1303:                        obj3.initIssuesRelatedByCreatedTransId();
1304:                        obj3.addIssueRelatedByCreatedTransId(obj1);
1305:                    }
1306:
1307:                    omClass = ActivitySetPeer.getOMClass();
1308:                    ActivitySet obj4 = (ActivitySet) ActivitySetPeer
1309:                            .row2Object(row, offset4, omClass);
1310:
1311:                    newObject = true;
1312:                    for (int j = 0; j < results.size(); j++) {
1313:                        Issue temp_obj1 = (Issue) results.get(j);
1314:                        ActivitySet temp_obj4 = (ActivitySet) temp_obj1
1315:                                .getActivitySetRelatedByLastTransId();
1316:                        if (temp_obj4.getPrimaryKey().equals(
1317:                                obj4.getPrimaryKey())) {
1318:                            newObject = false;
1319:                            temp_obj4.addIssueRelatedByLastTransId(obj1);
1320:                            break;
1321:                        }
1322:                    }
1323:                    if (newObject) {
1324:                        obj4.initIssuesRelatedByLastTransId();
1325:                        obj4.addIssueRelatedByLastTransId(obj1);
1326:                    }
1327:                    results.add(obj1);
1328:                }
1329:                return results;
1330:            }
1331:
1332:            /**
1333:             * selects a collection of Issue objects pre-filled with
1334:             * all related objects.
1335:             *
1336:             * This method is protected by default in order to keep the public
1337:             * api reasonable.  You can provide public methods for those you
1338:             * actually need in IssuePeer.
1339:             *
1340:             * @throws TorqueException Any exceptions caught during processing will be
1341:             *         rethrown wrapped into a TorqueException.
1342:             */
1343:            protected static List doSelectJoinAllExceptActivitySetRelatedByCreatedTransId(
1344:                    Criteria criteria) throws TorqueException {
1345:                return doSelectJoinAllExceptActivitySetRelatedByCreatedTransId(
1346:                        criteria, null);
1347:            }
1348:
1349:            /**
1350:             * selects a collection of Issue objects pre-filled with
1351:             * all related objects.
1352:             *
1353:             * This method is protected by default in order to keep the public
1354:             * api reasonable.  You can provide public methods for those you
1355:             * actually need in IssuePeer.
1356:             *
1357:             * @throws TorqueException Any exceptions caught during processing will be
1358:             *         rethrown wrapped into a TorqueException.
1359:             */
1360:            protected static List doSelectJoinAllExceptActivitySetRelatedByCreatedTransId(
1361:                    Criteria criteria, Connection conn) throws TorqueException {
1362:                setDbName(criteria);
1363:
1364:                addSelectColumns(criteria);
1365:                int offset2 = numColumns + 1;
1366:
1367:                ScarabModulePeer.addSelectColumns(criteria);
1368:                criteria.addJoin(IssuePeer.MODULE_ID,
1369:                        ScarabModulePeer.MODULE_ID);
1370:                int offset3 = offset2 + ScarabModulePeer.numColumns;
1371:
1372:                IssueTypePeer.addSelectColumns(criteria);
1373:                criteria
1374:                        .addJoin(IssuePeer.TYPE_ID, IssueTypePeer.ISSUE_TYPE_ID);
1375:                int offset4 = offset3 + IssueTypePeer.numColumns;
1376:
1377:                correctBooleans(criteria);
1378:
1379:                List rows;
1380:                if (conn == null) {
1381:                    rows = BasePeer.doSelect(criteria);
1382:                } else {
1383:                    rows = BasePeer.doSelect(criteria, conn);
1384:                }
1385:
1386:                List results = new ArrayList();
1387:
1388:                for (int i = 0; i < rows.size(); i++) {
1389:                    Record row = (Record) rows.get(i);
1390:
1391:                    Class omClass = IssuePeer.getOMClass();
1392:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
1393:
1394:                    omClass = ScarabModulePeer.getOMClass(row, offset2);
1395:                    ScarabModule obj2 = (ScarabModule) ScarabModulePeer
1396:                            .row2Object(row, offset2, omClass);
1397:
1398:                    boolean newObject = true;
1399:                    for (int j = 0; j < results.size(); j++) {
1400:                        Issue temp_obj1 = (Issue) results.get(j);
1401:                        ScarabModule temp_obj2 = (ScarabModule) temp_obj1
1402:                                .getModule();
1403:                        if (temp_obj2.getPrimaryKey().equals(
1404:                                obj2.getPrimaryKey())) {
1405:                            newObject = false;
1406:                            temp_obj2.addIssue(obj1);
1407:                            break;
1408:                        }
1409:                    }
1410:                    if (newObject) {
1411:                        obj2.initIssues();
1412:                        obj2.addIssue(obj1);
1413:                    }
1414:
1415:                    omClass = IssueTypePeer.getOMClass();
1416:                    IssueType obj3 = (IssueType) IssueTypePeer.row2Object(row,
1417:                            offset3, omClass);
1418:
1419:                    newObject = true;
1420:                    for (int j = 0; j < results.size(); j++) {
1421:                        Issue temp_obj1 = (Issue) results.get(j);
1422:                        IssueType temp_obj3 = (IssueType) temp_obj1
1423:                                .getIssueType();
1424:                        if (temp_obj3.getPrimaryKey().equals(
1425:                                obj3.getPrimaryKey())) {
1426:                            newObject = false;
1427:                            temp_obj3.addIssue(obj1);
1428:                            break;
1429:                        }
1430:                    }
1431:                    if (newObject) {
1432:                        obj3.initIssues();
1433:                        obj3.addIssue(obj1);
1434:                    }
1435:
1436:                    results.add(obj1);
1437:                }
1438:                return results;
1439:            }
1440:
1441:            /**
1442:             * selects a collection of Issue 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 IssuePeer.
1448:             *
1449:             * @throws TorqueException Any exceptions caught during processing will be
1450:             *         rethrown wrapped into a TorqueException.
1451:             */
1452:            protected static List doSelectJoinAllExceptActivitySetRelatedByLastTransId(
1453:                    Criteria criteria) throws TorqueException {
1454:                return doSelectJoinAllExceptActivitySetRelatedByLastTransId(
1455:                        criteria, null);
1456:            }
1457:
1458:            /**
1459:             * selects a collection of Issue objects pre-filled with
1460:             * all related objects.
1461:             *
1462:             * This method is protected by default in order to keep the public
1463:             * api reasonable.  You can provide public methods for those you
1464:             * actually need in IssuePeer.
1465:             *
1466:             * @throws TorqueException Any exceptions caught during processing will be
1467:             *         rethrown wrapped into a TorqueException.
1468:             */
1469:            protected static List doSelectJoinAllExceptActivitySetRelatedByLastTransId(
1470:                    Criteria criteria, Connection conn) throws TorqueException {
1471:                setDbName(criteria);
1472:
1473:                addSelectColumns(criteria);
1474:                int offset2 = numColumns + 1;
1475:
1476:                ScarabModulePeer.addSelectColumns(criteria);
1477:                criteria.addJoin(IssuePeer.MODULE_ID,
1478:                        ScarabModulePeer.MODULE_ID);
1479:                int offset3 = offset2 + ScarabModulePeer.numColumns;
1480:
1481:                IssueTypePeer.addSelectColumns(criteria);
1482:                criteria
1483:                        .addJoin(IssuePeer.TYPE_ID, IssueTypePeer.ISSUE_TYPE_ID);
1484:                int offset4 = offset3 + IssueTypePeer.numColumns;
1485:
1486:                correctBooleans(criteria);
1487:
1488:                List rows;
1489:                if (conn == null) {
1490:                    rows = BasePeer.doSelect(criteria);
1491:                } else {
1492:                    rows = BasePeer.doSelect(criteria, conn);
1493:                }
1494:
1495:                List results = new ArrayList();
1496:
1497:                for (int i = 0; i < rows.size(); i++) {
1498:                    Record row = (Record) rows.get(i);
1499:
1500:                    Class omClass = IssuePeer.getOMClass();
1501:                    Issue obj1 = (Issue) IssuePeer.row2Object(row, 1, omClass);
1502:
1503:                    omClass = ScarabModulePeer.getOMClass(row, offset2);
1504:                    ScarabModule obj2 = (ScarabModule) ScarabModulePeer
1505:                            .row2Object(row, offset2, omClass);
1506:
1507:                    boolean newObject = true;
1508:                    for (int j = 0; j < results.size(); j++) {
1509:                        Issue temp_obj1 = (Issue) results.get(j);
1510:                        ScarabModule temp_obj2 = (ScarabModule) temp_obj1
1511:                                .getModule();
1512:                        if (temp_obj2.getPrimaryKey().equals(
1513:                                obj2.getPrimaryKey())) {
1514:                            newObject = false;
1515:                            temp_obj2.addIssue(obj1);
1516:                            break;
1517:                        }
1518:                    }
1519:                    if (newObject) {
1520:                        obj2.initIssues();
1521:                        obj2.addIssue(obj1);
1522:                    }
1523:
1524:                    omClass = IssueTypePeer.getOMClass();
1525:                    IssueType obj3 = (IssueType) IssueTypePeer.row2Object(row,
1526:                            offset3, omClass);
1527:
1528:                    newObject = true;
1529:                    for (int j = 0; j < results.size(); j++) {
1530:                        Issue temp_obj1 = (Issue) results.get(j);
1531:                        IssueType temp_obj3 = (IssueType) temp_obj1
1532:                                .getIssueType();
1533:                        if (temp_obj3.getPrimaryKey().equals(
1534:                                obj3.getPrimaryKey())) {
1535:                            newObject = false;
1536:                            temp_obj3.addIssue(obj1);
1537:                            break;
1538:                        }
1539:                    }
1540:                    if (newObject) {
1541:                        obj3.initIssues();
1542:                        obj3.addIssue(obj1);
1543:                    }
1544:
1545:                    results.add(obj1);
1546:                }
1547:                return results;
1548:            }
1549:
1550:            /**
1551:             * Returns the TableMap related to this peer.  This method is not
1552:             * needed for general use but a specific application could have a need.
1553:             *
1554:             * @throws TorqueException Any exceptions caught during processing will be
1555:             *         rethrown wrapped into a TorqueException.
1556:             */
1557:            protected static TableMap getTableMap() throws TorqueException {
1558:                return Torque.getDatabaseMap(DATABASE_NAME)
1559:                        .getTable(TABLE_NAME);
1560:            }
1561:
1562:            private static void setDbName(Criteria crit) {
1563:                // Set the correct dbName if it has not been overridden
1564:                // crit.getDbName will return the same object if not set to
1565:                // another value so == check is okay and faster
1566:                if (crit.getDbName() == Torque.getDefaultDB()) {
1567:                    crit.setDbName(DATABASE_NAME);
1568:                }
1569:            }
1570:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.