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