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