Source Code Cross Referenced for BaseScarabModulePeer.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 BaseScarabModulePeer 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_MODULE";
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(ScarabModuleMapBuilder.CLASS_NAME);
0050:            }
0051:
0052:            /** the column name for the MODULE_ID field */
0053:            public static final String MODULE_ID;
0054:            /** the column name for the MODULE_NAME field */
0055:            public static final String MODULE_NAME;
0056:            /** the column name for the DOMAIN field */
0057:            public static final String DOMAIN;
0058:            /** the column name for the MODULE_CODE field */
0059:            public static final String MODULE_CODE;
0060:            /** the column name for the MODULE_DESCRIPTION field */
0061:            public static final String MODULE_DESCRIPTION;
0062:            /** the column name for the MODULE_URL field */
0063:            public static final String MODULE_URL;
0064:            /** the column name for the ARCHIVE_EMAIL field */
0065:            public static final String ARCHIVE_EMAIL;
0066:            /** the column name for the PARENT_ID field */
0067:            public static final String PARENT_ID;
0068:            /** the column name for the OWNER_ID field */
0069:            public static final String OWNER_ID;
0070:            /** the column name for the QA_CONTACT_ID field */
0071:            public static final String QA_CONTACT_ID;
0072:            /** the column name for the DELETED field */
0073:            public static final String DELETED;
0074:            /** the column name for the LOCKED field */
0075:            public static final String LOCKED;
0076:            /** the column name for the CLASS_KEY field */
0077:            public static final String CLASS_KEY;
0078:
0079:            static {
0080:                MODULE_ID = "SCARAB_MODULE.MODULE_ID";
0081:                MODULE_NAME = "SCARAB_MODULE.MODULE_NAME";
0082:                DOMAIN = "SCARAB_MODULE.DOMAIN";
0083:                MODULE_CODE = "SCARAB_MODULE.MODULE_CODE";
0084:                MODULE_DESCRIPTION = "SCARAB_MODULE.MODULE_DESCRIPTION";
0085:                MODULE_URL = "SCARAB_MODULE.MODULE_URL";
0086:                ARCHIVE_EMAIL = "SCARAB_MODULE.ARCHIVE_EMAIL";
0087:                PARENT_ID = "SCARAB_MODULE.PARENT_ID";
0088:                OWNER_ID = "SCARAB_MODULE.OWNER_ID";
0089:                QA_CONTACT_ID = "SCARAB_MODULE.QA_CONTACT_ID";
0090:                DELETED = "SCARAB_MODULE.DELETED";
0091:                LOCKED = "SCARAB_MODULE.LOCKED";
0092:                CLASS_KEY = "SCARAB_MODULE.CLASS_KEY";
0093:                if (Torque.isInit()) {
0094:                    try {
0095:                        getMapBuilder(ScarabModuleMapBuilder.CLASS_NAME);
0096:                    } catch (Exception e) {
0097:                        log.error("Could not initialize Peer", e);
0098:                        throw new RuntimeException(e);
0099:                    }
0100:                } else {
0101:                    Torque
0102:                            .registerMapBuilder(ScarabModuleMapBuilder.CLASS_NAME);
0103:                }
0104:            }
0105:
0106:            /** number of columns for this peer */
0107:            public static final int numColumns = 13;
0108:
0109:            /** A class that can be returned by this peer. */
0110:            protected static final String CLASSNAME_DEFAULT = "org.tigris.scarab.om.ScarabModule";
0111:
0112:            /** A class that can be returned by this peer. */
0113:            protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
0114:
0115:            /**
0116:             * Class object initialization method.
0117:             *
0118:             * @param className name of the class to initialize
0119:             * @return the initialized class
0120:             */
0121:            private static Class initClass(String className) {
0122:                Class c = null;
0123:                try {
0124:                    c = Class.forName(className);
0125:                } catch (Throwable t) {
0126:                    log
0127:                            .error(
0128:                                    "A FATAL ERROR has occurred which should not "
0129:                                            + "have happened under any circumstance.  Please notify "
0130:                                            + "the Torque developers <torque-dev@db.apache.org> "
0131:                                            + "and give as many details as possible (including the error "
0132:                                            + "stack trace).", t);
0133:
0134:                    // Error objects should always be propogated.
0135:                    if (t instanceof  Error) {
0136:                        throw (Error) t.fillInStackTrace();
0137:                    }
0138:                }
0139:                return c;
0140:            }
0141:
0142:            /**
0143:             * Get the list of objects for a ResultSet.  Please not that your
0144:             * resultset MUST return columns in the right order.  You can use
0145:             * getFieldNames() in BaseObject to get the correct sequence.
0146:             *
0147:             * @param results the ResultSet
0148:             * @return the list of objects
0149:             * @throws TorqueException Any exceptions caught during processing will be
0150:             *         rethrown wrapped into a TorqueException.
0151:             */
0152:            public static List resultSet2Objects(java.sql.ResultSet results)
0153:                    throws TorqueException {
0154:                try {
0155:                    QueryDataSet qds = null;
0156:                    List rows = null;
0157:                    try {
0158:                        qds = new QueryDataSet(results);
0159:                        rows = getSelectResults(qds);
0160:                    } finally {
0161:                        if (qds != null) {
0162:                            qds.close();
0163:                        }
0164:                    }
0165:
0166:                    return populateObjects(rows);
0167:                } catch (SQLException e) {
0168:                    throw new TorqueException(e);
0169:                } catch (DataSetException e) {
0170:                    throw new TorqueException(e);
0171:                }
0172:            }
0173:
0174:            /** A key representing a particular subclass */
0175:            public static final int CLASSKEY_1 = 1;
0176:
0177:            /** A class that can be returned by this peer. */
0178:            public static final String CLASSNAME_1 = "org.tigris.scarab.om.ScarabModuleContainer";
0179:
0180:            /** A class that can be returned by this peer. */
0181:            public static final Class CLASS_1 = initClass(CLASSNAME_1);
0182:
0183:            /**
0184:             * Method to do inserts.
0185:             *
0186:             * @param criteria object used to create the INSERT statement.
0187:             * @throws TorqueException Any exceptions caught during processing will be
0188:             *         rethrown wrapped into a TorqueException.
0189:             */
0190:            public static ObjectKey doInsert(Criteria criteria)
0191:                    throws TorqueException {
0192:                return BaseScarabModulePeer.doInsert(criteria,
0193:                        (Connection) null);
0194:            }
0195:
0196:            /**
0197:             * Method to do inserts.  This method is to be used during a transaction,
0198:             * otherwise use the doInsert(Criteria) method.  It will take care of
0199:             * the connection details internally.
0200:             *
0201:             * @param criteria object used to create the INSERT statement.
0202:             * @param con the connection to use
0203:             * @throws TorqueException Any exceptions caught during processing will be
0204:             *         rethrown wrapped into a TorqueException.
0205:             */
0206:            public static ObjectKey doInsert(Criteria criteria, Connection con)
0207:                    throws TorqueException {
0208:                correctBooleans(criteria);
0209:
0210:                setDbName(criteria);
0211:
0212:                if (con == null) {
0213:                    return BasePeer.doInsert(criteria);
0214:                } else {
0215:                    return BasePeer.doInsert(criteria, con);
0216:                }
0217:            }
0218:
0219:            /**
0220:             * Add all the columns needed to create a new object.
0221:             *
0222:             * @param criteria object containing the columns to add.
0223:             * @throws TorqueException Any exceptions caught during processing will be
0224:             *         rethrown wrapped into a TorqueException.
0225:             */
0226:            public static void addSelectColumns(Criteria criteria)
0227:                    throws TorqueException {
0228:                criteria.addSelectColumn(MODULE_ID);
0229:                criteria.addSelectColumn(MODULE_NAME);
0230:                criteria.addSelectColumn(DOMAIN);
0231:                criteria.addSelectColumn(MODULE_CODE);
0232:                criteria.addSelectColumn(MODULE_DESCRIPTION);
0233:                criteria.addSelectColumn(MODULE_URL);
0234:                criteria.addSelectColumn(ARCHIVE_EMAIL);
0235:                criteria.addSelectColumn(PARENT_ID);
0236:                criteria.addSelectColumn(OWNER_ID);
0237:                criteria.addSelectColumn(QA_CONTACT_ID);
0238:                criteria.addSelectColumn(DELETED);
0239:                criteria.addSelectColumn(LOCKED);
0240:                criteria.addSelectColumn(CLASS_KEY);
0241:            }
0242:
0243:            /**
0244:             * changes the boolean values in the criteria to the appropriate type,
0245:             * whenever a booleanchar or booleanint column is involved.
0246:             * This enables the user to create criteria using Boolean values
0247:             * for booleanchar or booleanint columns
0248:             * @param criteria the criteria in which the boolean values should be corrected
0249:             */
0250:            public static void correctBooleans(Criteria criteria) {
0251:                // check for conversion from boolean to int
0252:                if (criteria.containsKey(DELETED)) {
0253:                    Object possibleBoolean = criteria.get(DELETED);
0254:                    if (possibleBoolean instanceof  Boolean) {
0255:                        criteria.add(DELETED, ((Boolean) possibleBoolean)
0256:                                .booleanValue() ? 1 : 0);
0257:                    }
0258:                }
0259:                // check for conversion from boolean to int
0260:                if (criteria.containsKey(LOCKED)) {
0261:                    Object possibleBoolean = criteria.get(LOCKED);
0262:                    if (possibleBoolean instanceof  Boolean) {
0263:                        criteria.add(LOCKED, ((Boolean) possibleBoolean)
0264:                                .booleanValue() ? 1 : 0);
0265:                    }
0266:                }
0267:            }
0268:
0269:            /**
0270:             * Create a new object of type cls from a resultset row starting
0271:             * from a specified offset.  This is done so that you can select
0272:             * other rows than just those needed for this object.  You may
0273:             * for example want to create two objects from the same row.
0274:             *
0275:             * @throws TorqueException Any exceptions caught during processing will be
0276:             *         rethrown wrapped into a TorqueException.
0277:             */
0278:            public static ScarabModule row2Object(Record row, int offset,
0279:                    Class cls) throws TorqueException {
0280:                try {
0281:                    ScarabModule obj = (ScarabModule) cls.newInstance();
0282:                    ScarabModulePeer.populateObject(row, offset, obj);
0283:                    obj.setModified(false);
0284:                    obj.setNew(false);
0285:
0286:                    return obj;
0287:                } catch (InstantiationException e) {
0288:                    throw new TorqueException(e);
0289:                } catch (IllegalAccessException e) {
0290:                    throw new TorqueException(e);
0291:                }
0292:            }
0293:
0294:            /**
0295:             * Populates an object from a resultset row starting
0296:             * from a specified offset.  This is done so that you can select
0297:             * other rows than just those needed for this object.  You may
0298:             * for example want to create two objects from the same row.
0299:             *
0300:             * @throws TorqueException Any exceptions caught during processing will be
0301:             *         rethrown wrapped into a TorqueException.
0302:             */
0303:            public static void populateObject(Record row, int offset,
0304:                    ScarabModule obj) throws TorqueException {
0305:                try {
0306:                    obj.setModuleId(row.getValue(offset + 0).asIntegerObj());
0307:                    obj.setRealName(row.getValue(offset + 1).asString());
0308:                    obj.setDomain(row.getValue(offset + 2).asString());
0309:                    obj.setCode(row.getValue(offset + 3).asString());
0310:                    obj.setDescription(row.getValue(offset + 4).asString());
0311:                    obj.setUrl(row.getValue(offset + 5).asString());
0312:                    obj.setArchiveEmail(row.getValue(offset + 6).asString());
0313:                    obj.setParentId(row.getValue(offset + 7).asIntegerObj());
0314:                    obj.setOwnerId(row.getValue(offset + 8).asIntegerObj());
0315:                    obj.setQaContactId(row.getValue(offset + 9).asIntegerObj());
0316:                    obj.setDeleted(row.getValue(offset + 10).asBoolean());
0317:                    obj.setLocked(row.getValue(offset + 11).asBoolean());
0318:                    obj.setClassKey(row.getValue(offset + 12).asInt());
0319:                } catch (DataSetException e) {
0320:                    throw new TorqueException(e);
0321:                }
0322:            }
0323:
0324:            /**
0325:             * Method to do selects.
0326:             *
0327:             * @param criteria object used to create the SELECT statement.
0328:             * @return List of selected Objects
0329:             * @throws TorqueException Any exceptions caught during processing will be
0330:             *         rethrown wrapped into a TorqueException.
0331:             */
0332:            public static List doSelect(Criteria criteria)
0333:                    throws TorqueException {
0334:                return populateObjects(doSelectVillageRecords(criteria));
0335:            }
0336:
0337:            /**
0338:             * Method to do selects within a transaction.
0339:             *
0340:             * @param criteria object used to create the SELECT statement.
0341:             * @param con the connection to use
0342:             * @return List of selected Objects
0343:             * @throws TorqueException Any exceptions caught during processing will be
0344:             *         rethrown wrapped into a TorqueException.
0345:             */
0346:            public static List doSelect(Criteria criteria, Connection con)
0347:                    throws TorqueException {
0348:                return populateObjects(doSelectVillageRecords(criteria, con));
0349:            }
0350:
0351:            /**
0352:             * Grabs the raw Village records to be formed into objects.
0353:             * This method handles connections internally.  The Record objects
0354:             * returned by this method should be considered readonly.  Do not
0355:             * alter the data and call save(), your results may vary, but are
0356:             * certainly likely to result in hard to track MT bugs.
0357:             *
0358:             * @throws TorqueException Any exceptions caught during processing will be
0359:             *         rethrown wrapped into a TorqueException.
0360:             */
0361:            public static List doSelectVillageRecords(Criteria criteria)
0362:                    throws TorqueException {
0363:                return BaseScarabModulePeer.doSelectVillageRecords(criteria,
0364:                        (Connection) null);
0365:            }
0366:
0367:            /**
0368:             * Grabs the raw Village records to be formed into objects.
0369:             * This method should be used for transactions
0370:             *
0371:             * @param criteria object used to create the SELECT statement.
0372:             * @param con the connection to use
0373:             * @throws TorqueException Any exceptions caught during processing will be
0374:             *         rethrown wrapped into a TorqueException.
0375:             */
0376:            public static List doSelectVillageRecords(Criteria criteria,
0377:                    Connection con) throws TorqueException {
0378:                if (criteria.getSelectColumns().size() == 0) {
0379:                    addSelectColumns(criteria);
0380:                }
0381:                correctBooleans(criteria);
0382:
0383:                setDbName(criteria);
0384:
0385:                // BasePeer returns a List of Value (Village) arrays.  The array
0386:                // order follows the order columns were placed in the Select clause.
0387:                if (con == null) {
0388:                    return BasePeer.doSelect(criteria);
0389:                } else {
0390:                    return BasePeer.doSelect(criteria, con);
0391:                }
0392:            }
0393:
0394:            /**
0395:             * The returned List will contain objects of the default type or
0396:             * objects that inherit from the default.
0397:             *
0398:             * @throws TorqueException Any exceptions caught during processing will be
0399:             *         rethrown wrapped into a TorqueException.
0400:             */
0401:            public static List populateObjects(List records)
0402:                    throws TorqueException {
0403:                List results = new ArrayList(records.size());
0404:
0405:                // populate the object(s)
0406:                for (int i = 0; i < records.size(); i++) {
0407:                    Record row = (Record) records.get(i);
0408:                    results.add(ScarabModulePeer.row2Object(row, 1,
0409:                            ScarabModulePeer.getOMClass(row, 1)));
0410:                }
0411:                return results;
0412:            }
0413:
0414:            /**
0415:             * The returned Class will contain objects of the default type or
0416:             * objects that inherit from the default.
0417:             *
0418:             * @throws TorqueException Any exceptions caught during processing will be
0419:             *         rethrown wrapped into a TorqueException.
0420:             */
0421:            public static Class getOMClass(Record record, int offset)
0422:                    throws TorqueException {
0423:                Class c = null;
0424:                try {
0425:                    Class omClass = null;
0426:                    int classKey = record.getValue(offset - 1 + 13).asInt();
0427:                    if (classKey == CLASSKEY_1) {
0428:                        omClass = CLASS_1;
0429:                    } else {
0430:                        omClass = getOMClass();
0431:                    }
0432:                    c = omClass;
0433:                } catch (Exception e) {
0434:                    throw new TorqueException(e);
0435:                }
0436:                return c;
0437:            }
0438:
0439:            /**
0440:             * The class that the Peer will make instances of.
0441:             * If the BO is abstract then you must implement this method
0442:             * in the BO.
0443:             *
0444:             * @throws TorqueException Any exceptions caught during processing will be
0445:             *         rethrown wrapped into a TorqueException.
0446:             */
0447:            public static Class getOMClass() throws TorqueException {
0448:                return CLASS_DEFAULT;
0449:            }
0450:
0451:            /**
0452:             * Method to do updates.
0453:             *
0454:             * @param criteria object containing data that is used to create the UPDATE
0455:             *        statement.
0456:             * @throws TorqueException Any exceptions caught during processing will be
0457:             *         rethrown wrapped into a TorqueException.
0458:             */
0459:            public static void doUpdate(Criteria criteria)
0460:                    throws TorqueException {
0461:                BaseScarabModulePeer.doUpdate(criteria, (Connection) null);
0462:            }
0463:
0464:            /**
0465:             * Method to do updates.  This method is to be used during a transaction,
0466:             * otherwise use the doUpdate(Criteria) method.  It will take care of
0467:             * the connection details internally.
0468:             *
0469:             * @param criteria object containing data that is used to create the UPDATE
0470:             *        statement.
0471:             * @param con the connection to use
0472:             * @throws TorqueException Any exceptions caught during processing will be
0473:             *         rethrown wrapped into a TorqueException.
0474:             */
0475:            public static void doUpdate(Criteria criteria, Connection con)
0476:                    throws TorqueException {
0477:                Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
0478:                correctBooleans(criteria);
0479:
0480:                selectCriteria.put(MODULE_ID, criteria.remove(MODULE_ID));
0481:
0482:                setDbName(criteria);
0483:
0484:                if (con == null) {
0485:                    BasePeer.doUpdate(selectCriteria, criteria);
0486:                } else {
0487:                    BasePeer.doUpdate(selectCriteria, criteria, con);
0488:                }
0489:            }
0490:
0491:            /**
0492:             * Method to do deletes.
0493:             *
0494:             * @param criteria object containing data that is used DELETE from database.
0495:             * @throws TorqueException Any exceptions caught during processing will be
0496:             *         rethrown wrapped into a TorqueException.
0497:             */
0498:            public static void doDelete(Criteria criteria)
0499:                    throws TorqueException {
0500:                ScarabModulePeer.doDelete(criteria, (Connection) null);
0501:            }
0502:
0503:            /**
0504:             * Method to do deletes.  This method is to be used during a transaction,
0505:             * otherwise use the doDelete(Criteria) method.  It will take care of
0506:             * the connection details internally.
0507:             *
0508:             * @param criteria object containing data that is used DELETE from database.
0509:             * @param con the connection to use
0510:             * @throws TorqueException Any exceptions caught during processing will be
0511:             *         rethrown wrapped into a TorqueException.
0512:             */
0513:            public static void doDelete(Criteria criteria, Connection con)
0514:                    throws TorqueException {
0515:                correctBooleans(criteria);
0516:
0517:                setDbName(criteria);
0518:
0519:                if (con == null) {
0520:                    BasePeer.doDelete(criteria);
0521:                } else {
0522:                    BasePeer.doDelete(criteria, con);
0523:                }
0524:            }
0525:
0526:            /**
0527:             * Method to do selects
0528:             *
0529:             * @throws TorqueException Any exceptions caught during processing will be
0530:             *         rethrown wrapped into a TorqueException.
0531:             */
0532:            public static List doSelect(ScarabModule obj)
0533:                    throws TorqueException {
0534:                return doSelect(buildSelectCriteria(obj));
0535:            }
0536:
0537:            /**
0538:             * Method to do inserts
0539:             *
0540:             * @throws TorqueException Any exceptions caught during processing will be
0541:             *         rethrown wrapped into a TorqueException.
0542:             */
0543:            public static void doInsert(ScarabModule obj)
0544:                    throws TorqueException {
0545:                obj.setPrimaryKey(doInsert(buildCriteria(obj)));
0546:                obj.setNew(false);
0547:                obj.setModified(false);
0548:            }
0549:
0550:            /**
0551:             * @param obj the data object to update in the database.
0552:             * @throws TorqueException Any exceptions caught during processing will be
0553:             *         rethrown wrapped into a TorqueException.
0554:             */
0555:            public static void doUpdate(ScarabModule obj)
0556:                    throws TorqueException {
0557:                doUpdate(buildCriteria(obj));
0558:                obj.setModified(false);
0559:            }
0560:
0561:            /**
0562:             * @param obj the data object to delete in the database.
0563:             * @throws TorqueException Any exceptions caught during processing will be
0564:             *         rethrown wrapped into a TorqueException.
0565:             */
0566:            public static void doDelete(ScarabModule obj)
0567:                    throws TorqueException {
0568:                doDelete(buildSelectCriteria(obj));
0569:            }
0570:
0571:            /**
0572:             * Method to do inserts.  This method is to be used during a transaction,
0573:             * otherwise use the doInsert(ScarabModule) method.  It will take
0574:             * care of the connection details internally.
0575:             *
0576:             * @param obj the data object to insert into the database.
0577:             * @param con the connection to use
0578:             * @throws TorqueException Any exceptions caught during processing will be
0579:             *         rethrown wrapped into a TorqueException.
0580:             */
0581:            public static void doInsert(ScarabModule obj, Connection con)
0582:                    throws TorqueException {
0583:                obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
0584:                obj.setNew(false);
0585:                obj.setModified(false);
0586:            }
0587:
0588:            /**
0589:             * Method to do update.  This method is to be used during a transaction,
0590:             * otherwise use the doUpdate(ScarabModule) method.  It will take
0591:             * care of the connection details internally.
0592:             *
0593:             * @param obj the data object to update in the database.
0594:             * @param con the connection to use
0595:             * @throws TorqueException Any exceptions caught during processing will be
0596:             *         rethrown wrapped into a TorqueException.
0597:             */
0598:            public static void doUpdate(ScarabModule obj, Connection con)
0599:                    throws TorqueException {
0600:                doUpdate(buildCriteria(obj), con);
0601:                obj.setModified(false);
0602:            }
0603:
0604:            /**
0605:             * Method to delete.  This method is to be used during a transaction,
0606:             * otherwise use the doDelete(ScarabModule) method.  It will take
0607:             * care of the connection details internally.
0608:             *
0609:             * @param obj the data object to delete in the database.
0610:             * @param con the connection to use
0611:             * @throws TorqueException Any exceptions caught during processing will be
0612:             *         rethrown wrapped into a TorqueException.
0613:             */
0614:            public static void doDelete(ScarabModule obj, Connection con)
0615:                    throws TorqueException {
0616:                doDelete(buildSelectCriteria(obj), con);
0617:            }
0618:
0619:            /**
0620:             * Method to do deletes.
0621:             *
0622:             * @param pk ObjectKey that is used DELETE from database.
0623:             * @throws TorqueException Any exceptions caught during processing will be
0624:             *         rethrown wrapped into a TorqueException.
0625:             */
0626:            public static void doDelete(ObjectKey pk) throws TorqueException {
0627:                BaseScarabModulePeer.doDelete(pk, (Connection) null);
0628:            }
0629:
0630:            /**
0631:             * Method to delete.  This method is to be used during a transaction,
0632:             * otherwise use the doDelete(ObjectKey) method.  It will take
0633:             * care of the connection details internally.
0634:             *
0635:             * @param pk the primary key for the object to delete in the database.
0636:             * @param con the connection to use
0637:             * @throws TorqueException Any exceptions caught during processing will be
0638:             *         rethrown wrapped into a TorqueException.
0639:             */
0640:            public static void doDelete(ObjectKey pk, Connection con)
0641:                    throws TorqueException {
0642:                doDelete(buildCriteria(pk), con);
0643:            }
0644:
0645:            /** Build a Criteria object from an ObjectKey */
0646:            public static Criteria buildCriteria(ObjectKey pk) {
0647:                Criteria criteria = new Criteria();
0648:                criteria.add(MODULE_ID, pk);
0649:                return criteria;
0650:            }
0651:
0652:            /** Build a Criteria object from the data object for this peer */
0653:            public static Criteria buildCriteria(ScarabModule obj) {
0654:                Criteria criteria = new Criteria(DATABASE_NAME);
0655:                if (!obj.isNew())
0656:                    criteria.add(MODULE_ID, obj.getModuleId());
0657:                criteria.add(MODULE_NAME, obj.getRealName());
0658:                criteria.add(DOMAIN, obj.getDomain());
0659:                criteria.add(MODULE_CODE, obj.getCode());
0660:                criteria.add(MODULE_DESCRIPTION, obj.getDescription());
0661:                criteria.add(MODULE_URL, obj.getUrl());
0662:                criteria.add(ARCHIVE_EMAIL, obj.getArchiveEmail());
0663:                criteria.add(PARENT_ID, obj.getParentId());
0664:                criteria.add(OWNER_ID, obj.getOwnerId());
0665:                criteria.add(QA_CONTACT_ID, obj.getQaContactId());
0666:                criteria.add(DELETED, obj.getDeleted());
0667:                criteria.add(LOCKED, obj.getLocked());
0668:                criteria.add(CLASS_KEY, obj.getClassKey());
0669:                return criteria;
0670:            }
0671:
0672:            /** Build a Criteria object from the data object for this peer, skipping all binary columns */
0673:            public static Criteria buildSelectCriteria(ScarabModule obj) {
0674:                Criteria criteria = new Criteria(DATABASE_NAME);
0675:                if (!obj.isNew()) {
0676:                    criteria.add(MODULE_ID, obj.getModuleId());
0677:                }
0678:                criteria.add(MODULE_NAME, obj.getRealName());
0679:                criteria.add(DOMAIN, obj.getDomain());
0680:                criteria.add(MODULE_CODE, obj.getCode());
0681:                criteria.add(MODULE_DESCRIPTION, obj.getDescription());
0682:                criteria.add(MODULE_URL, obj.getUrl());
0683:                criteria.add(ARCHIVE_EMAIL, obj.getArchiveEmail());
0684:                criteria.add(PARENT_ID, obj.getParentId());
0685:                criteria.add(OWNER_ID, obj.getOwnerId());
0686:                criteria.add(QA_CONTACT_ID, obj.getQaContactId());
0687:                criteria.add(DELETED, obj.getDeleted());
0688:                criteria.add(LOCKED, obj.getLocked());
0689:                criteria.add(CLASS_KEY, obj.getClassKey());
0690:                return criteria;
0691:            }
0692:
0693:            /**
0694:             * Retrieve a single object by pk
0695:             *
0696:             * @param pk the primary key
0697:             * @throws TorqueException Any exceptions caught during processing will be
0698:             *         rethrown wrapped into a TorqueException.
0699:             * @throws NoRowsException Primary key was not found in database.
0700:             * @throws TooManyRowsException Primary key was not found in database.
0701:             */
0702:            public static ScarabModule retrieveByPK(Integer pk)
0703:                    throws TorqueException, NoRowsException,
0704:                    TooManyRowsException {
0705:                return retrieveByPK(SimpleKey.keyFor(pk));
0706:            }
0707:
0708:            /**
0709:             * Retrieve a single object by pk
0710:             *
0711:             * @param pk the primary key
0712:             * @param con the connection to use
0713:             * @throws TorqueException Any exceptions caught during processing will be
0714:             *         rethrown wrapped into a TorqueException.
0715:             * @throws NoRowsException Primary key was not found in database.
0716:             * @throws TooManyRowsException Primary key was not found in database.
0717:             */
0718:            public static ScarabModule retrieveByPK(Integer pk, Connection con)
0719:                    throws TorqueException, NoRowsException,
0720:                    TooManyRowsException {
0721:                return retrieveByPK(SimpleKey.keyFor(pk), con);
0722:            }
0723:
0724:            /**
0725:             * Retrieve a single object by pk
0726:             *
0727:             * @param pk the primary key
0728:             * @throws TorqueException Any exceptions caught during processing will be
0729:             *         rethrown wrapped into a TorqueException.
0730:             * @throws NoRowsException Primary key was not found in database.
0731:             * @throws TooManyRowsException Primary key was not found in database.
0732:             */
0733:            public static ScarabModule retrieveByPK(ObjectKey pk)
0734:                    throws TorqueException, NoRowsException,
0735:                    TooManyRowsException {
0736:                Connection db = null;
0737:                ScarabModule retVal = null;
0738:                try {
0739:                    db = Torque.getConnection(DATABASE_NAME);
0740:                    retVal = retrieveByPK(pk, db);
0741:                } finally {
0742:                    Torque.closeConnection(db);
0743:                }
0744:                return retVal;
0745:            }
0746:
0747:            /**
0748:             * Retrieve a single object by pk
0749:             *
0750:             * @param pk the primary key
0751:             * @param con the connection to use
0752:             * @throws TorqueException Any exceptions caught during processing will be
0753:             *         rethrown wrapped into a TorqueException.
0754:             * @throws NoRowsException Primary key was not found in database.
0755:             * @throws TooManyRowsException Primary key was not found in database.
0756:             */
0757:            public static ScarabModule retrieveByPK(ObjectKey pk, Connection con)
0758:                    throws TorqueException, NoRowsException,
0759:                    TooManyRowsException {
0760:                Criteria criteria = buildCriteria(pk);
0761:                List v = doSelect(criteria, con);
0762:                if (v.size() == 0) {
0763:                    throw new NoRowsException("Failed to select a row.");
0764:                } else if (v.size() > 1) {
0765:                    throw new TooManyRowsException(
0766:                            "Failed to select only one row.");
0767:                } else {
0768:                    return (ScarabModule) v.get(0);
0769:                }
0770:            }
0771:
0772:            /**
0773:             * Retrieve a multiple objects by pk
0774:             *
0775:             * @param pks List of primary keys
0776:             * @throws TorqueException Any exceptions caught during processing will be
0777:             *         rethrown wrapped into a TorqueException.
0778:             */
0779:            public static List retrieveByPKs(List pks) throws TorqueException {
0780:                Connection db = null;
0781:                List retVal = null;
0782:                try {
0783:                    db = Torque.getConnection(DATABASE_NAME);
0784:                    retVal = retrieveByPKs(pks, db);
0785:                } finally {
0786:                    Torque.closeConnection(db);
0787:                }
0788:                return retVal;
0789:            }
0790:
0791:            /**
0792:             * Retrieve a multiple objects by pk
0793:             *
0794:             * @param pks List of primary keys
0795:             * @param dbcon the connection to use
0796:             * @throws TorqueException Any exceptions caught during processing will be
0797:             *         rethrown wrapped into a TorqueException.
0798:             */
0799:            public static List retrieveByPKs(List pks, Connection dbcon)
0800:                    throws TorqueException {
0801:                List objs = null;
0802:                if (pks == null || pks.size() == 0) {
0803:                    objs = new LinkedList();
0804:                } else {
0805:                    Criteria criteria = new Criteria();
0806:                    criteria.addIn(MODULE_ID, pks);
0807:                    objs = doSelect(criteria, dbcon);
0808:                }
0809:                return objs;
0810:            }
0811:
0812:            /**
0813:             * selects a collection of ScarabModule objects pre-filled with their
0814:             * ScarabUserImpl objects.
0815:             *
0816:             * This method is protected by default in order to keep the public
0817:             * api reasonable.  You can provide public methods for those you
0818:             * actually need in ScarabModulePeer.
0819:             *
0820:             * @throws TorqueException Any exceptions caught during processing will be
0821:             *         rethrown wrapped into a TorqueException.
0822:             */
0823:            protected static List doSelectJoinScarabUserImplRelatedByOwnerId(
0824:                    Criteria criteria) throws TorqueException {
0825:                return doSelectJoinScarabUserImplRelatedByOwnerId(criteria,
0826:                        null);
0827:            }
0828:
0829:            /**
0830:             * selects a collection of ScarabModule objects pre-filled with their
0831:             * ScarabUserImpl 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 ScarabModulePeer.
0836:             *
0837:             * @throws TorqueException Any exceptions caught during processing will be
0838:             *         rethrown wrapped into a TorqueException.
0839:             */
0840:            protected static List doSelectJoinScarabUserImplRelatedByOwnerId(
0841:                    Criteria criteria, Connection conn) throws TorqueException {
0842:                setDbName(criteria);
0843:
0844:                ScarabModulePeer.addSelectColumns(criteria);
0845:                int offset = numColumns + 1;
0846:                ScarabUserImplPeer.addSelectColumns(criteria);
0847:
0848:                criteria.addJoin(ScarabModulePeer.OWNER_ID,
0849:                        ScarabUserImplPeer.USER_ID);
0850:
0851:                correctBooleans(criteria);
0852:
0853:                List rows;
0854:                if (conn == null) {
0855:                    rows = BasePeer.doSelect(criteria);
0856:                } else {
0857:                    rows = BasePeer.doSelect(criteria, conn);
0858:                }
0859:
0860:                List results = new ArrayList();
0861:
0862:                for (int i = 0; i < rows.size(); i++) {
0863:                    Record row = (Record) rows.get(i);
0864:
0865:                    Class omClass = ScarabModulePeer.getOMClass(row, 1);
0866:                    ScarabModule obj1 = (ScarabModule) ScarabModulePeer
0867:                            .row2Object(row, 1, omClass);
0868:                    omClass = ScarabUserImplPeer.getOMClass();
0869:                    ScarabUserImpl obj2 = (ScarabUserImpl) ScarabUserImplPeer
0870:                            .row2Object(row, offset, omClass);
0871:
0872:                    boolean newObject = true;
0873:                    for (int j = 0; j < results.size(); j++) {
0874:                        ScarabModule temp_obj1 = (ScarabModule) results.get(j);
0875:                        ScarabUserImpl temp_obj2 = (ScarabUserImpl) temp_obj1
0876:                                .getScarabUserRelatedByOwnerId();
0877:                        if (temp_obj2.getPrimaryKey().equals(
0878:                                obj2.getPrimaryKey())) {
0879:                            newObject = false;
0880:                            temp_obj2.addScarabModuleRelatedByOwnerId(obj1);
0881:                            break;
0882:                        }
0883:                    }
0884:                    if (newObject) {
0885:                        obj2.initScarabModulesRelatedByOwnerId();
0886:                        obj2.addScarabModuleRelatedByOwnerId(obj1);
0887:                    }
0888:                    results.add(obj1);
0889:                }
0890:                return results;
0891:            }
0892:
0893:            /**
0894:             * selects a collection of ScarabModule objects pre-filled with their
0895:             * ScarabUserImpl objects.
0896:             *
0897:             * This method is protected by default in order to keep the public
0898:             * api reasonable.  You can provide public methods for those you
0899:             * actually need in ScarabModulePeer.
0900:             *
0901:             * @throws TorqueException Any exceptions caught during processing will be
0902:             *         rethrown wrapped into a TorqueException.
0903:             */
0904:            protected static List doSelectJoinScarabUserImplRelatedByQaContactId(
0905:                    Criteria criteria) throws TorqueException {
0906:                return doSelectJoinScarabUserImplRelatedByQaContactId(criteria,
0907:                        null);
0908:            }
0909:
0910:            /**
0911:             * selects a collection of ScarabModule objects pre-filled with their
0912:             * ScarabUserImpl objects.
0913:             *
0914:             * This method is protected by default in order to keep the public
0915:             * api reasonable.  You can provide public methods for those you
0916:             * actually need in ScarabModulePeer.
0917:             *
0918:             * @throws TorqueException Any exceptions caught during processing will be
0919:             *         rethrown wrapped into a TorqueException.
0920:             */
0921:            protected static List doSelectJoinScarabUserImplRelatedByQaContactId(
0922:                    Criteria criteria, Connection conn) throws TorqueException {
0923:                setDbName(criteria);
0924:
0925:                ScarabModulePeer.addSelectColumns(criteria);
0926:                int offset = numColumns + 1;
0927:                ScarabUserImplPeer.addSelectColumns(criteria);
0928:
0929:                criteria.addJoin(ScarabModulePeer.QA_CONTACT_ID,
0930:                        ScarabUserImplPeer.USER_ID);
0931:
0932:                correctBooleans(criteria);
0933:
0934:                List rows;
0935:                if (conn == null) {
0936:                    rows = BasePeer.doSelect(criteria);
0937:                } else {
0938:                    rows = BasePeer.doSelect(criteria, conn);
0939:                }
0940:
0941:                List results = new ArrayList();
0942:
0943:                for (int i = 0; i < rows.size(); i++) {
0944:                    Record row = (Record) rows.get(i);
0945:
0946:                    Class omClass = ScarabModulePeer.getOMClass(row, 1);
0947:                    ScarabModule obj1 = (ScarabModule) ScarabModulePeer
0948:                            .row2Object(row, 1, omClass);
0949:                    omClass = ScarabUserImplPeer.getOMClass();
0950:                    ScarabUserImpl obj2 = (ScarabUserImpl) ScarabUserImplPeer
0951:                            .row2Object(row, offset, omClass);
0952:
0953:                    boolean newObject = true;
0954:                    for (int j = 0; j < results.size(); j++) {
0955:                        ScarabModule temp_obj1 = (ScarabModule) results.get(j);
0956:                        ScarabUserImpl temp_obj2 = (ScarabUserImpl) temp_obj1
0957:                                .getScarabUserRelatedByQaContactId();
0958:                        if (temp_obj2.getPrimaryKey().equals(
0959:                                obj2.getPrimaryKey())) {
0960:                            newObject = false;
0961:                            temp_obj2.addScarabModuleRelatedByQaContactId(obj1);
0962:                            break;
0963:                        }
0964:                    }
0965:                    if (newObject) {
0966:                        obj2.initScarabModulesRelatedByQaContactId();
0967:                        obj2.addScarabModuleRelatedByQaContactId(obj1);
0968:                    }
0969:                    results.add(obj1);
0970:                }
0971:                return results;
0972:            }
0973:
0974:            /**
0975:             * selects a collection of ScarabModule objects pre-filled with
0976:             * all related objects.
0977:             *
0978:             * This method is protected by default in order to keep the public
0979:             * api reasonable.  You can provide public methods for those you
0980:             * actually need in ScarabModulePeer.
0981:             *
0982:             * @throws TorqueException Any exceptions caught during processing will be
0983:             *         rethrown wrapped into a TorqueException.
0984:             */
0985:            protected static List doSelectJoinAllExceptScarabModule(
0986:                    Criteria criteria) throws TorqueException {
0987:                return doSelectJoinAllExceptScarabModule(criteria, null);
0988:            }
0989:
0990:            /**
0991:             * selects a collection of ScarabModule objects pre-filled with
0992:             * all related objects.
0993:             *
0994:             * This method is protected by default in order to keep the public
0995:             * api reasonable.  You can provide public methods for those you
0996:             * actually need in ScarabModulePeer.
0997:             *
0998:             * @throws TorqueException Any exceptions caught during processing will be
0999:             *         rethrown wrapped into a TorqueException.
1000:             */
1001:            protected static List doSelectJoinAllExceptScarabModule(
1002:                    Criteria criteria, Connection conn) throws TorqueException {
1003:                setDbName(criteria);
1004:
1005:                addSelectColumns(criteria);
1006:                int offset2 = numColumns + 1;
1007:
1008:                ScarabUserImplPeer.addSelectColumns(criteria);
1009:                criteria.addJoin(ScarabModulePeer.OWNER_ID,
1010:                        ScarabUserImplPeer.USER_ID);
1011:                int offset3 = offset2 + ScarabUserImplPeer.numColumns;
1012:
1013:                ScarabUserImplPeer.addSelectColumns(criteria);
1014:                criteria.addJoin(ScarabModulePeer.QA_CONTACT_ID,
1015:                        ScarabUserImplPeer.USER_ID);
1016:
1017:                correctBooleans(criteria);
1018:
1019:                List rows;
1020:                if (conn == null) {
1021:                    rows = BasePeer.doSelect(criteria);
1022:                } else {
1023:                    rows = BasePeer.doSelect(criteria, conn);
1024:                }
1025:
1026:                List results = new ArrayList();
1027:
1028:                for (int i = 0; i < rows.size(); i++) {
1029:                    Record row = (Record) rows.get(i);
1030:
1031:                    Class omClass = ScarabModulePeer.getOMClass(row, 1);
1032:                    ScarabModule obj1 = (ScarabModule) ScarabModulePeer
1033:                            .row2Object(row, 1, omClass);
1034:
1035:                    omClass = ScarabUserImplPeer.getOMClass();
1036:                    ScarabUserImpl obj2 = (ScarabUserImpl) ScarabUserImplPeer
1037:                            .row2Object(row, offset2, omClass);
1038:
1039:                    boolean newObject = true;
1040:                    for (int j = 0; j < results.size(); j++) {
1041:                        ScarabModule temp_obj1 = (ScarabModule) results.get(j);
1042:                        ScarabUserImpl temp_obj2 = (ScarabUserImpl) temp_obj1
1043:                                .getScarabUserRelatedByOwnerId();
1044:                        if (temp_obj2.getPrimaryKey().equals(
1045:                                obj2.getPrimaryKey())) {
1046:                            newObject = false;
1047:                            temp_obj2.addScarabModuleRelatedByOwnerId(obj1);
1048:                            break;
1049:                        }
1050:                    }
1051:                    if (newObject) {
1052:                        obj2.initScarabModulesRelatedByOwnerId();
1053:                        obj2.addScarabModuleRelatedByOwnerId(obj1);
1054:                    }
1055:
1056:                    omClass = ScarabUserImplPeer.getOMClass();
1057:                    ScarabUserImpl obj3 = (ScarabUserImpl) ScarabUserImplPeer
1058:                            .row2Object(row, offset3, omClass);
1059:
1060:                    newObject = true;
1061:                    for (int j = 0; j < results.size(); j++) {
1062:                        ScarabModule temp_obj1 = (ScarabModule) results.get(j);
1063:                        ScarabUserImpl temp_obj3 = (ScarabUserImpl) temp_obj1
1064:                                .getScarabUserRelatedByQaContactId();
1065:                        if (temp_obj3.getPrimaryKey().equals(
1066:                                obj3.getPrimaryKey())) {
1067:                            newObject = false;
1068:                            temp_obj3.addScarabModuleRelatedByQaContactId(obj1);
1069:                            break;
1070:                        }
1071:                    }
1072:                    if (newObject) {
1073:                        obj3.initScarabModulesRelatedByQaContactId();
1074:                        obj3.addScarabModuleRelatedByQaContactId(obj1);
1075:                    }
1076:                    results.add(obj1);
1077:                }
1078:                return results;
1079:            }
1080:
1081:            /**
1082:             * selects a collection of ScarabModule objects pre-filled with
1083:             * all related objects.
1084:             *
1085:             * This method is protected by default in order to keep the public
1086:             * api reasonable.  You can provide public methods for those you
1087:             * actually need in ScarabModulePeer.
1088:             *
1089:             * @throws TorqueException Any exceptions caught during processing will be
1090:             *         rethrown wrapped into a TorqueException.
1091:             */
1092:            protected static List doSelectJoinAllExceptScarabUserImplRelatedByOwnerId(
1093:                    Criteria criteria) throws TorqueException {
1094:                return doSelectJoinAllExceptScarabUserImplRelatedByOwnerId(
1095:                        criteria, null);
1096:            }
1097:
1098:            /**
1099:             * selects a collection of ScarabModule objects pre-filled with
1100:             * all related objects.
1101:             *
1102:             * This method is protected by default in order to keep the public
1103:             * api reasonable.  You can provide public methods for those you
1104:             * actually need in ScarabModulePeer.
1105:             *
1106:             * @throws TorqueException Any exceptions caught during processing will be
1107:             *         rethrown wrapped into a TorqueException.
1108:             */
1109:            protected static List doSelectJoinAllExceptScarabUserImplRelatedByOwnerId(
1110:                    Criteria criteria, Connection conn) throws TorqueException {
1111:                setDbName(criteria);
1112:
1113:                addSelectColumns(criteria);
1114:                int offset2 = numColumns + 1;
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 = ScarabModulePeer.getOMClass(row, 1);
1131:                    ScarabModule obj1 = (ScarabModule) ScarabModulePeer
1132:                            .row2Object(row, 1, omClass);
1133:
1134:                    results.add(obj1);
1135:                }
1136:                return results;
1137:            }
1138:
1139:            /**
1140:             * selects a collection of ScarabModule objects pre-filled with
1141:             * all related objects.
1142:             *
1143:             * This method is protected by default in order to keep the public
1144:             * api reasonable.  You can provide public methods for those you
1145:             * actually need in ScarabModulePeer.
1146:             *
1147:             * @throws TorqueException Any exceptions caught during processing will be
1148:             *         rethrown wrapped into a TorqueException.
1149:             */
1150:            protected static List doSelectJoinAllExceptScarabUserImplRelatedByQaContactId(
1151:                    Criteria criteria) throws TorqueException {
1152:                return doSelectJoinAllExceptScarabUserImplRelatedByQaContactId(
1153:                        criteria, null);
1154:            }
1155:
1156:            /**
1157:             * selects a collection of ScarabModule objects pre-filled with
1158:             * all related objects.
1159:             *
1160:             * This method is protected by default in order to keep the public
1161:             * api reasonable.  You can provide public methods for those you
1162:             * actually need in ScarabModulePeer.
1163:             *
1164:             * @throws TorqueException Any exceptions caught during processing will be
1165:             *         rethrown wrapped into a TorqueException.
1166:             */
1167:            protected static List doSelectJoinAllExceptScarabUserImplRelatedByQaContactId(
1168:                    Criteria criteria, Connection conn) throws TorqueException {
1169:                setDbName(criteria);
1170:
1171:                addSelectColumns(criteria);
1172:                int offset2 = numColumns + 1;
1173:
1174:                correctBooleans(criteria);
1175:
1176:                List rows;
1177:                if (conn == null) {
1178:                    rows = BasePeer.doSelect(criteria);
1179:                } else {
1180:                    rows = BasePeer.doSelect(criteria, conn);
1181:                }
1182:
1183:                List results = new ArrayList();
1184:
1185:                for (int i = 0; i < rows.size(); i++) {
1186:                    Record row = (Record) rows.get(i);
1187:
1188:                    Class omClass = ScarabModulePeer.getOMClass(row, 1);
1189:                    ScarabModule obj1 = (ScarabModule) ScarabModulePeer
1190:                            .row2Object(row, 1, omClass);
1191:
1192:                    results.add(obj1);
1193:                }
1194:                return results;
1195:            }
1196:
1197:            /**
1198:             * Returns the TableMap related to this peer.  This method is not
1199:             * needed for general use but a specific application could have a need.
1200:             *
1201:             * @throws TorqueException Any exceptions caught during processing will be
1202:             *         rethrown wrapped into a TorqueException.
1203:             */
1204:            protected static TableMap getTableMap() throws TorqueException {
1205:                return Torque.getDatabaseMap(DATABASE_NAME)
1206:                        .getTable(TABLE_NAME);
1207:            }
1208:
1209:            private static void setDbName(Criteria crit) {
1210:                // Set the correct dbName if it has not been overridden
1211:                // crit.getDbName will return the same object if not set to
1212:                // another value so == check is okay and faster
1213:                if (crit.getDbName() == Torque.getDefaultDB()) {
1214:                    crit.setDbName(DATABASE_NAME);
1215:                }
1216:            }
1217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.