Source Code Cross Referenced for BaseDepend.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.util.ArrayList;
0006:        import java.util.Collections;
0007:        import java.util.Date;
0008:        import java.util.List;
0009:
0010:        import org.apache.commons.lang.ObjectUtils;
0011:        import org.apache.fulcrum.intake.Retrievable;
0012:        import org.apache.torque.TorqueException;
0013:        import org.apache.torque.om.BaseObject;
0014:        import org.apache.torque.om.ComboKey;
0015:        import org.apache.torque.om.DateKey;
0016:        import org.apache.torque.om.NumberKey;
0017:        import org.apache.torque.om.ObjectKey;
0018:        import org.apache.torque.om.SimpleKey;
0019:        import org.apache.torque.om.StringKey;
0020:        import org.apache.torque.om.Persistent;
0021:        import org.apache.torque.util.Criteria;
0022:        import org.apache.torque.util.Transaction;
0023:
0024:        /**
0025:         * You should not use this class directly.  It should not even be
0026:         * extended all references should be to Depend
0027:         */
0028:        public abstract class BaseDepend extends BaseObject implements 
0029:                org.apache.fulcrum.intake.Retrievable {
0030:            /** The Peer class */
0031:            private static final DependPeer peer = new DependPeer();
0032:
0033:            /** The value for the dependId field */
0034:            private Integer dependId;
0035:
0036:            /** The value for the observedId field */
0037:            private Long observedId;
0038:
0039:            /** The value for the observerId field */
0040:            private Long observerId;
0041:
0042:            /** The value for the typeId field */
0043:            private Integer typeId;
0044:
0045:            /** The value for the deleted field */
0046:            private boolean deleted = false;
0047:
0048:            /**
0049:             * Get the DependId
0050:             *
0051:             * @return Integer
0052:             */
0053:            public Integer getDependId() {
0054:                return dependId;
0055:            }
0056:
0057:            /**
0058:             * Set the value of DependId
0059:             *
0060:             * @param v new value
0061:             */
0062:            public void setDependId(Integer v) throws TorqueException {
0063:
0064:                if (!ObjectUtils.equals(this .dependId, v)) {
0065:                    this .dependId = v;
0066:                    setModified(true);
0067:                }
0068:
0069:                // update associated Activity
0070:                if (collActivitys != null) {
0071:                    for (int i = 0; i < collActivitys.size(); i++) {
0072:                        ((Activity) collActivitys.get(i)).setDependId(v);
0073:                    }
0074:                }
0075:            }
0076:
0077:            /**
0078:             * Get the ObservedId
0079:             *
0080:             * @return Long
0081:             */
0082:            public Long getObservedId() {
0083:                return observedId;
0084:            }
0085:
0086:            /**
0087:             * Set the value of ObservedId
0088:             *
0089:             * @param v new value
0090:             */
0091:            public void setObservedId(Long v) throws TorqueException {
0092:
0093:                if (!ObjectUtils.equals(this .observedId, v)) {
0094:                    this .observedId = v;
0095:                    setModified(true);
0096:                }
0097:
0098:                if (aIssueRelatedByObservedId != null
0099:                        && !ObjectUtils.equals(aIssueRelatedByObservedId
0100:                                .getIssueId(), v)) {
0101:                    aIssueRelatedByObservedId = null;
0102:                }
0103:
0104:            }
0105:
0106:            /**
0107:             * Get the ObserverId
0108:             *
0109:             * @return Long
0110:             */
0111:            public Long getObserverId() {
0112:                return observerId;
0113:            }
0114:
0115:            /**
0116:             * Set the value of ObserverId
0117:             *
0118:             * @param v new value
0119:             */
0120:            public void setObserverId(Long v) throws TorqueException {
0121:
0122:                if (!ObjectUtils.equals(this .observerId, v)) {
0123:                    this .observerId = v;
0124:                    setModified(true);
0125:                }
0126:
0127:                if (aIssueRelatedByObserverId != null
0128:                        && !ObjectUtils.equals(aIssueRelatedByObserverId
0129:                                .getIssueId(), v)) {
0130:                    aIssueRelatedByObserverId = null;
0131:                }
0132:
0133:            }
0134:
0135:            /**
0136:             * Get the TypeId
0137:             *
0138:             * @return Integer
0139:             */
0140:            public Integer getTypeId() {
0141:                return typeId;
0142:            }
0143:
0144:            /**
0145:             * Set the value of TypeId
0146:             *
0147:             * @param v new value
0148:             */
0149:            public void setTypeId(Integer v) throws TorqueException {
0150:
0151:                if (!ObjectUtils.equals(this .typeId, v)) {
0152:                    this .typeId = v;
0153:                    setModified(true);
0154:                }
0155:
0156:                if (aDependType != null
0157:                        && !ObjectUtils
0158:                                .equals(aDependType.getDependTypeId(), v)) {
0159:                    aDependType = null;
0160:                }
0161:
0162:            }
0163:
0164:            /**
0165:             * Get the Deleted
0166:             *
0167:             * @return boolean
0168:             */
0169:            public boolean getDeleted() {
0170:                return deleted;
0171:            }
0172:
0173:            /**
0174:             * Set the value of Deleted
0175:             *
0176:             * @param v new value
0177:             */
0178:            public void setDeleted(boolean v) {
0179:
0180:                if (this .deleted != v) {
0181:                    this .deleted = v;
0182:                    setModified(true);
0183:                }
0184:
0185:            }
0186:
0187:            private Issue aIssueRelatedByObservedId;
0188:
0189:            /**
0190:             * Declares an association between this object and a Issue object
0191:             *
0192:             * @param v Issue
0193:             * @throws TorqueException
0194:             */
0195:            public void setIssueRelatedByObservedId(Issue v)
0196:                    throws TorqueException {
0197:                if (v == null) {
0198:                    setObservedId((Long) null);
0199:                } else {
0200:                    setObservedId(v.getIssueId());
0201:                }
0202:                aIssueRelatedByObservedId = v;
0203:            }
0204:
0205:            /**
0206:             * Returns the associated Issue object.
0207:             * If it was not retrieved before, the object is retrieved from
0208:             * the database
0209:             *
0210:             * @return the associated Issue object
0211:             * @throws TorqueException
0212:             */
0213:            public Issue getIssueRelatedByObservedId() throws TorqueException {
0214:                if (aIssueRelatedByObservedId == null
0215:                        && (!ObjectUtils.equals(this .observedId, null))) {
0216:                    aIssueRelatedByObservedId = IssueManager
0217:                            .getInstance(SimpleKey.keyFor(this .observedId));
0218:                }
0219:                return aIssueRelatedByObservedId;
0220:            }
0221:
0222:            /**
0223:             * Return the associated Issue object
0224:             * If it was not retrieved before, the object is retrieved from
0225:             * the database using the passed connection
0226:             *
0227:             * @param connection the connection used to retrieve the associated object
0228:             *        from the database, if it was not retrieved before
0229:             * @return the associated Issue object
0230:             * @throws TorqueException
0231:             */
0232:            public Issue getIssueRelatedByObservedId(Connection connection)
0233:                    throws TorqueException {
0234:                if (aIssueRelatedByObservedId == null
0235:                        && (!ObjectUtils.equals(this .observedId, null))) {
0236:                    aIssueRelatedByObservedId = IssueManager
0237:                            .getCachedInstance(SimpleKey
0238:                                    .keyFor(this .observedId));
0239:                    if (aIssueRelatedByObservedId == null) {
0240:                        aIssueRelatedByObservedId = IssuePeer.retrieveByPK(
0241:                                SimpleKey.keyFor(this .observedId), connection);
0242:                        IssueManager.putInstance(aIssueRelatedByObservedId);
0243:                    }
0244:                }
0245:                return aIssueRelatedByObservedId;
0246:            }
0247:
0248:            /**
0249:             * Provides convenient way to set a relationship based on a
0250:             * ObjectKey, for example
0251:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0252:             *
0253:             */
0254:            public void setIssueRelatedByObservedIdKey(ObjectKey key)
0255:                    throws TorqueException {
0256:
0257:                setObservedId(new Long(((NumberKey) key).longValue()));
0258:            }
0259:
0260:            private Issue aIssueRelatedByObserverId;
0261:
0262:            /**
0263:             * Declares an association between this object and a Issue object
0264:             *
0265:             * @param v Issue
0266:             * @throws TorqueException
0267:             */
0268:            public void setIssueRelatedByObserverId(Issue v)
0269:                    throws TorqueException {
0270:                if (v == null) {
0271:                    setObserverId((Long) null);
0272:                } else {
0273:                    setObserverId(v.getIssueId());
0274:                }
0275:                aIssueRelatedByObserverId = v;
0276:            }
0277:
0278:            /**
0279:             * Returns the associated Issue object.
0280:             * If it was not retrieved before, the object is retrieved from
0281:             * the database
0282:             *
0283:             * @return the associated Issue object
0284:             * @throws TorqueException
0285:             */
0286:            public Issue getIssueRelatedByObserverId() throws TorqueException {
0287:                if (aIssueRelatedByObserverId == null
0288:                        && (!ObjectUtils.equals(this .observerId, null))) {
0289:                    aIssueRelatedByObserverId = IssueManager
0290:                            .getInstance(SimpleKey.keyFor(this .observerId));
0291:                }
0292:                return aIssueRelatedByObserverId;
0293:            }
0294:
0295:            /**
0296:             * Return the associated Issue object
0297:             * If it was not retrieved before, the object is retrieved from
0298:             * the database using the passed connection
0299:             *
0300:             * @param connection the connection used to retrieve the associated object
0301:             *        from the database, if it was not retrieved before
0302:             * @return the associated Issue object
0303:             * @throws TorqueException
0304:             */
0305:            public Issue getIssueRelatedByObserverId(Connection connection)
0306:                    throws TorqueException {
0307:                if (aIssueRelatedByObserverId == null
0308:                        && (!ObjectUtils.equals(this .observerId, null))) {
0309:                    aIssueRelatedByObserverId = IssueManager
0310:                            .getCachedInstance(SimpleKey
0311:                                    .keyFor(this .observerId));
0312:                    if (aIssueRelatedByObserverId == null) {
0313:                        aIssueRelatedByObserverId = IssuePeer.retrieveByPK(
0314:                                SimpleKey.keyFor(this .observerId), connection);
0315:                        IssueManager.putInstance(aIssueRelatedByObserverId);
0316:                    }
0317:                }
0318:                return aIssueRelatedByObserverId;
0319:            }
0320:
0321:            /**
0322:             * Provides convenient way to set a relationship based on a
0323:             * ObjectKey, for example
0324:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0325:             *
0326:             */
0327:            public void setIssueRelatedByObserverIdKey(ObjectKey key)
0328:                    throws TorqueException {
0329:
0330:                setObserverId(new Long(((NumberKey) key).longValue()));
0331:            }
0332:
0333:            private DependType aDependType;
0334:
0335:            /**
0336:             * Declares an association between this object and a DependType object
0337:             *
0338:             * @param v DependType
0339:             * @throws TorqueException
0340:             */
0341:            public void setDependType(DependType v) throws TorqueException {
0342:                if (v == null) {
0343:                    setTypeId((Integer) null);
0344:                } else {
0345:                    setTypeId(v.getDependTypeId());
0346:                }
0347:                aDependType = v;
0348:            }
0349:
0350:            /**
0351:             * Returns the associated DependType object.
0352:             * If it was not retrieved before, the object is retrieved from
0353:             * the database
0354:             *
0355:             * @return the associated DependType object
0356:             * @throws TorqueException
0357:             */
0358:            public DependType getDependType() throws TorqueException {
0359:                if (aDependType == null
0360:                        && (!ObjectUtils.equals(this .typeId, null))) {
0361:                    aDependType = DependTypeManager.getInstance(SimpleKey
0362:                            .keyFor(this .typeId));
0363:                }
0364:                return aDependType;
0365:            }
0366:
0367:            /**
0368:             * Return the associated DependType object
0369:             * If it was not retrieved before, the object is retrieved from
0370:             * the database using the passed connection
0371:             *
0372:             * @param connection the connection used to retrieve the associated object
0373:             *        from the database, if it was not retrieved before
0374:             * @return the associated DependType object
0375:             * @throws TorqueException
0376:             */
0377:            public DependType getDependType(Connection connection)
0378:                    throws TorqueException {
0379:                if (aDependType == null
0380:                        && (!ObjectUtils.equals(this .typeId, null))) {
0381:                    aDependType = DependTypeManager.getCachedInstance(SimpleKey
0382:                            .keyFor(this .typeId));
0383:                    if (aDependType == null) {
0384:                        aDependType = DependTypePeer.retrieveByPK(SimpleKey
0385:                                .keyFor(this .typeId), connection);
0386:                        DependTypeManager.putInstance(aDependType);
0387:                    }
0388:                }
0389:                return aDependType;
0390:            }
0391:
0392:            /**
0393:             * Provides convenient way to set a relationship based on a
0394:             * ObjectKey, for example
0395:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0396:             *
0397:             */
0398:            public void setDependTypeKey(ObjectKey key) throws TorqueException {
0399:
0400:                setTypeId(new Integer(((NumberKey) key).intValue()));
0401:            }
0402:
0403:            /**
0404:             * Collection to store aggregation of collActivitys
0405:             */
0406:            protected List collActivitys;
0407:
0408:            /**
0409:             * Temporary storage of collActivitys to save a possible db hit in
0410:             * the event objects are add to the collection, but the
0411:             * complete collection is never requested.
0412:             */
0413:            protected void initActivitys() {
0414:                if (collActivitys == null) {
0415:                    collActivitys = new ArrayList();
0416:                }
0417:            }
0418:
0419:            /**
0420:             * Method called to associate a Activity object to this object
0421:             * through the Activity foreign key attribute
0422:             *
0423:             * @param l Activity
0424:             * @throws TorqueException
0425:             */
0426:            public void addActivity(Activity l) throws TorqueException {
0427:                getActivitys().add(l);
0428:                l.setDepend((Depend) this );
0429:            }
0430:
0431:            /**
0432:             * The criteria used to select the current contents of collActivitys
0433:             */
0434:            private Criteria lastActivitysCriteria = null;
0435:
0436:            /**
0437:             * If this collection has already been initialized, returns
0438:             * the collection. Otherwise returns the results of
0439:             * getActivitys(new Criteria())
0440:             *
0441:             * @return the collection of associated objects
0442:             * @throws TorqueException
0443:             */
0444:            public List getActivitys() throws TorqueException {
0445:                if (collActivitys == null) {
0446:                    collActivitys = getActivitys(new Criteria(10));
0447:                }
0448:                return collActivitys;
0449:            }
0450:
0451:            /**
0452:             * If this collection has already been initialized with
0453:             * an identical criteria, it returns the collection.
0454:             * Otherwise if this Depend has previously
0455:             * been saved, it will retrieve related Activitys from storage.
0456:             * If this Depend is new, it will return
0457:             * an empty collection or the current collection, the criteria
0458:             * is ignored on a new object.
0459:             *
0460:             * @throws TorqueException
0461:             */
0462:            public List getActivitys(Criteria criteria) throws TorqueException {
0463:                if (collActivitys == null) {
0464:                    if (isNew()) {
0465:                        collActivitys = new ArrayList();
0466:                    } else {
0467:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0468:                        collActivitys = ActivityPeer.doSelect(criteria);
0469:                    }
0470:                } else {
0471:                    // criteria has no effect for a new object
0472:                    if (!isNew()) {
0473:                        // the following code is to determine if a new query is
0474:                        // called for.  If the criteria is the same as the last
0475:                        // one, just return the collection.
0476:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0477:                        if (!lastActivitysCriteria.equals(criteria)) {
0478:                            collActivitys = ActivityPeer.doSelect(criteria);
0479:                        }
0480:                    }
0481:                }
0482:                lastActivitysCriteria = criteria;
0483:
0484:                return collActivitys;
0485:            }
0486:
0487:            /**
0488:             * If this collection has already been initialized, returns
0489:             * the collection. Otherwise returns the results of
0490:             * getActivitys(new Criteria(),Connection)
0491:             * This method takes in the Connection also as input so that
0492:             * referenced objects can also be obtained using a Connection
0493:             * that is taken as input
0494:             */
0495:            public List getActivitys(Connection con) throws TorqueException {
0496:                if (collActivitys == null) {
0497:                    collActivitys = getActivitys(new Criteria(10), con);
0498:                }
0499:                return collActivitys;
0500:            }
0501:
0502:            /**
0503:             * If this collection has already been initialized with
0504:             * an identical criteria, it returns the collection.
0505:             * Otherwise if this Depend has previously
0506:             * been saved, it will retrieve related Activitys from storage.
0507:             * If this Depend is new, it will return
0508:             * an empty collection or the current collection, the criteria
0509:             * is ignored on a new object.
0510:             * This method takes in the Connection also as input so that
0511:             * referenced objects can also be obtained using a Connection
0512:             * that is taken as input
0513:             */
0514:            public List getActivitys(Criteria criteria, Connection con)
0515:                    throws TorqueException {
0516:                if (collActivitys == null) {
0517:                    if (isNew()) {
0518:                        collActivitys = new ArrayList();
0519:                    } else {
0520:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0521:                        collActivitys = ActivityPeer.doSelect(criteria, con);
0522:                    }
0523:                } else {
0524:                    // criteria has no effect for a new object
0525:                    if (!isNew()) {
0526:                        // the following code is to determine if a new query is
0527:                        // called for.  If the criteria is the same as the last
0528:                        // one, just return the collection.
0529:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0530:                        if (!lastActivitysCriteria.equals(criteria)) {
0531:                            collActivitys = ActivityPeer
0532:                                    .doSelect(criteria, con);
0533:                        }
0534:                    }
0535:                }
0536:                lastActivitysCriteria = criteria;
0537:
0538:                return collActivitys;
0539:            }
0540:
0541:            /**
0542:             * If this collection has already been initialized with
0543:             * an identical criteria, it returns the collection.
0544:             * Otherwise if this Depend is new, it will return
0545:             * an empty collection; or if this Depend has previously
0546:             * been saved, it will retrieve related Activitys from storage.
0547:             *
0548:             * This method is protected by default in order to keep the public
0549:             * api reasonable.  You can provide public methods for those you
0550:             * actually need in Depend.
0551:             */
0552:            protected List getActivitysJoinIssue(Criteria criteria)
0553:                    throws TorqueException {
0554:                if (collActivitys == null) {
0555:                    if (isNew()) {
0556:                        collActivitys = new ArrayList();
0557:                    } else {
0558:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0559:                        collActivitys = ActivityPeer
0560:                                .doSelectJoinIssue(criteria);
0561:                    }
0562:                } else {
0563:                    // the following code is to determine if a new query is
0564:                    // called for.  If the criteria is the same as the last
0565:                    // one, just return the collection.
0566:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0567:                    if (!lastActivitysCriteria.equals(criteria)) {
0568:                        collActivitys = ActivityPeer
0569:                                .doSelectJoinIssue(criteria);
0570:                    }
0571:                }
0572:                lastActivitysCriteria = criteria;
0573:
0574:                return collActivitys;
0575:            }
0576:
0577:            /**
0578:             * If this collection has already been initialized with
0579:             * an identical criteria, it returns the collection.
0580:             * Otherwise if this Depend is new, it will return
0581:             * an empty collection; or if this Depend has previously
0582:             * been saved, it will retrieve related Activitys from storage.
0583:             *
0584:             * This method is protected by default in order to keep the public
0585:             * api reasonable.  You can provide public methods for those you
0586:             * actually need in Depend.
0587:             */
0588:            protected List getActivitysJoinAttribute(Criteria criteria)
0589:                    throws TorqueException {
0590:                if (collActivitys == null) {
0591:                    if (isNew()) {
0592:                        collActivitys = new ArrayList();
0593:                    } else {
0594:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0595:                        collActivitys = ActivityPeer
0596:                                .doSelectJoinAttribute(criteria);
0597:                    }
0598:                } else {
0599:                    // the following code is to determine if a new query is
0600:                    // called for.  If the criteria is the same as the last
0601:                    // one, just return the collection.
0602:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0603:                    if (!lastActivitysCriteria.equals(criteria)) {
0604:                        collActivitys = ActivityPeer
0605:                                .doSelectJoinAttribute(criteria);
0606:                    }
0607:                }
0608:                lastActivitysCriteria = criteria;
0609:
0610:                return collActivitys;
0611:            }
0612:
0613:            /**
0614:             * If this collection has already been initialized with
0615:             * an identical criteria, it returns the collection.
0616:             * Otherwise if this Depend is new, it will return
0617:             * an empty collection; or if this Depend has previously
0618:             * been saved, it will retrieve related Activitys from storage.
0619:             *
0620:             * This method is protected by default in order to keep the public
0621:             * api reasonable.  You can provide public methods for those you
0622:             * actually need in Depend.
0623:             */
0624:            protected List getActivitysJoinActivitySet(Criteria criteria)
0625:                    throws TorqueException {
0626:                if (collActivitys == null) {
0627:                    if (isNew()) {
0628:                        collActivitys = new ArrayList();
0629:                    } else {
0630:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0631:                        collActivitys = ActivityPeer
0632:                                .doSelectJoinActivitySet(criteria);
0633:                    }
0634:                } else {
0635:                    // the following code is to determine if a new query is
0636:                    // called for.  If the criteria is the same as the last
0637:                    // one, just return the collection.
0638:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0639:                    if (!lastActivitysCriteria.equals(criteria)) {
0640:                        collActivitys = ActivityPeer
0641:                                .doSelectJoinActivitySet(criteria);
0642:                    }
0643:                }
0644:                lastActivitysCriteria = criteria;
0645:
0646:                return collActivitys;
0647:            }
0648:
0649:            /**
0650:             * If this collection has already been initialized with
0651:             * an identical criteria, it returns the collection.
0652:             * Otherwise if this Depend is new, it will return
0653:             * an empty collection; or if this Depend has previously
0654:             * been saved, it will retrieve related Activitys from storage.
0655:             *
0656:             * This method is protected by default in order to keep the public
0657:             * api reasonable.  You can provide public methods for those you
0658:             * actually need in Depend.
0659:             */
0660:            protected List getActivitysJoinScarabUserImplRelatedByOldUserId(
0661:                    Criteria criteria) throws TorqueException {
0662:                if (collActivitys == null) {
0663:                    if (isNew()) {
0664:                        collActivitys = new ArrayList();
0665:                    } else {
0666:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0667:                        collActivitys = ActivityPeer
0668:                                .doSelectJoinScarabUserImplRelatedByOldUserId(criteria);
0669:                    }
0670:                } else {
0671:                    // the following code is to determine if a new query is
0672:                    // called for.  If the criteria is the same as the last
0673:                    // one, just return the collection.
0674:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0675:                    if (!lastActivitysCriteria.equals(criteria)) {
0676:                        collActivitys = ActivityPeer
0677:                                .doSelectJoinScarabUserImplRelatedByOldUserId(criteria);
0678:                    }
0679:                }
0680:                lastActivitysCriteria = criteria;
0681:
0682:                return collActivitys;
0683:            }
0684:
0685:            /**
0686:             * If this collection has already been initialized with
0687:             * an identical criteria, it returns the collection.
0688:             * Otherwise if this Depend is new, it will return
0689:             * an empty collection; or if this Depend has previously
0690:             * been saved, it will retrieve related Activitys from storage.
0691:             *
0692:             * This method is protected by default in order to keep the public
0693:             * api reasonable.  You can provide public methods for those you
0694:             * actually need in Depend.
0695:             */
0696:            protected List getActivitysJoinScarabUserImplRelatedByNewUserId(
0697:                    Criteria criteria) throws TorqueException {
0698:                if (collActivitys == null) {
0699:                    if (isNew()) {
0700:                        collActivitys = new ArrayList();
0701:                    } else {
0702:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0703:                        collActivitys = ActivityPeer
0704:                                .doSelectJoinScarabUserImplRelatedByNewUserId(criteria);
0705:                    }
0706:                } else {
0707:                    // the following code is to determine if a new query is
0708:                    // called for.  If the criteria is the same as the last
0709:                    // one, just return the collection.
0710:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0711:                    if (!lastActivitysCriteria.equals(criteria)) {
0712:                        collActivitys = ActivityPeer
0713:                                .doSelectJoinScarabUserImplRelatedByNewUserId(criteria);
0714:                    }
0715:                }
0716:                lastActivitysCriteria = criteria;
0717:
0718:                return collActivitys;
0719:            }
0720:
0721:            /**
0722:             * If this collection has already been initialized with
0723:             * an identical criteria, it returns the collection.
0724:             * Otherwise if this Depend is new, it will return
0725:             * an empty collection; or if this Depend has previously
0726:             * been saved, it will retrieve related Activitys from storage.
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 Depend.
0731:             */
0732:            protected List getActivitysJoinAttributeOptionRelatedByOldOptionId(
0733:                    Criteria criteria) throws TorqueException {
0734:                if (collActivitys == null) {
0735:                    if (isNew()) {
0736:                        collActivitys = new ArrayList();
0737:                    } else {
0738:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0739:                        collActivitys = ActivityPeer
0740:                                .doSelectJoinAttributeOptionRelatedByOldOptionId(criteria);
0741:                    }
0742:                } else {
0743:                    // the following code is to determine if a new query is
0744:                    // called for.  If the criteria is the same as the last
0745:                    // one, just return the collection.
0746:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0747:                    if (!lastActivitysCriteria.equals(criteria)) {
0748:                        collActivitys = ActivityPeer
0749:                                .doSelectJoinAttributeOptionRelatedByOldOptionId(criteria);
0750:                    }
0751:                }
0752:                lastActivitysCriteria = criteria;
0753:
0754:                return collActivitys;
0755:            }
0756:
0757:            /**
0758:             * If this collection has already been initialized with
0759:             * an identical criteria, it returns the collection.
0760:             * Otherwise if this Depend is new, it will return
0761:             * an empty collection; or if this Depend has previously
0762:             * been saved, it will retrieve related Activitys from storage.
0763:             *
0764:             * This method is protected by default in order to keep the public
0765:             * api reasonable.  You can provide public methods for those you
0766:             * actually need in Depend.
0767:             */
0768:            protected List getActivitysJoinAttributeOptionRelatedByNewOptionId(
0769:                    Criteria criteria) throws TorqueException {
0770:                if (collActivitys == null) {
0771:                    if (isNew()) {
0772:                        collActivitys = new ArrayList();
0773:                    } else {
0774:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0775:                        collActivitys = ActivityPeer
0776:                                .doSelectJoinAttributeOptionRelatedByNewOptionId(criteria);
0777:                    }
0778:                } else {
0779:                    // the following code is to determine if a new query is
0780:                    // called for.  If the criteria is the same as the last
0781:                    // one, just return the collection.
0782:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0783:                    if (!lastActivitysCriteria.equals(criteria)) {
0784:                        collActivitys = ActivityPeer
0785:                                .doSelectJoinAttributeOptionRelatedByNewOptionId(criteria);
0786:                    }
0787:                }
0788:                lastActivitysCriteria = criteria;
0789:
0790:                return collActivitys;
0791:            }
0792:
0793:            /**
0794:             * If this collection has already been initialized with
0795:             * an identical criteria, it returns the collection.
0796:             * Otherwise if this Depend is new, it will return
0797:             * an empty collection; or if this Depend has previously
0798:             * been saved, it will retrieve related Activitys from storage.
0799:             *
0800:             * This method is protected by default in order to keep the public
0801:             * api reasonable.  You can provide public methods for those you
0802:             * actually need in Depend.
0803:             */
0804:            protected List getActivitysJoinAttachment(Criteria criteria)
0805:                    throws TorqueException {
0806:                if (collActivitys == null) {
0807:                    if (isNew()) {
0808:                        collActivitys = new ArrayList();
0809:                    } else {
0810:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0811:                        collActivitys = ActivityPeer
0812:                                .doSelectJoinAttachment(criteria);
0813:                    }
0814:                } else {
0815:                    // the following code is to determine if a new query is
0816:                    // called for.  If the criteria is the same as the last
0817:                    // one, just return the collection.
0818:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0819:                    if (!lastActivitysCriteria.equals(criteria)) {
0820:                        collActivitys = ActivityPeer
0821:                                .doSelectJoinAttachment(criteria);
0822:                    }
0823:                }
0824:                lastActivitysCriteria = criteria;
0825:
0826:                return collActivitys;
0827:            }
0828:
0829:            /**
0830:             * If this collection has already been initialized with
0831:             * an identical criteria, it returns the collection.
0832:             * Otherwise if this Depend is new, it will return
0833:             * an empty collection; or if this Depend has previously
0834:             * been saved, it will retrieve related Activitys from storage.
0835:             *
0836:             * This method is protected by default in order to keep the public
0837:             * api reasonable.  You can provide public methods for those you
0838:             * actually need in Depend.
0839:             */
0840:            protected List getActivitysJoinDepend(Criteria criteria)
0841:                    throws TorqueException {
0842:                if (collActivitys == null) {
0843:                    if (isNew()) {
0844:                        collActivitys = new ArrayList();
0845:                    } else {
0846:                        criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0847:                        collActivitys = ActivityPeer
0848:                                .doSelectJoinDepend(criteria);
0849:                    }
0850:                } else {
0851:                    // the following code is to determine if a new query is
0852:                    // called for.  If the criteria is the same as the last
0853:                    // one, just return the collection.
0854:                    criteria.add(ActivityPeer.DEPEND_ID, getDependId());
0855:                    if (!lastActivitysCriteria.equals(criteria)) {
0856:                        collActivitys = ActivityPeer
0857:                                .doSelectJoinDepend(criteria);
0858:                    }
0859:                }
0860:                lastActivitysCriteria = criteria;
0861:
0862:                return collActivitys;
0863:            }
0864:
0865:            private static List fieldNames = null;
0866:
0867:            /**
0868:             * Generate a list of field names.
0869:             *
0870:             * @return a list of field names
0871:             */
0872:            public static synchronized List getFieldNames() {
0873:                if (fieldNames == null) {
0874:                    fieldNames = new ArrayList();
0875:                    fieldNames.add("DependId");
0876:                    fieldNames.add("ObservedId");
0877:                    fieldNames.add("ObserverId");
0878:                    fieldNames.add("TypeId");
0879:                    fieldNames.add("Deleted");
0880:                    fieldNames = Collections.unmodifiableList(fieldNames);
0881:                }
0882:                return fieldNames;
0883:            }
0884:
0885:            /**
0886:             * Retrieves a field from the object by name passed in as a String.
0887:             *
0888:             * @param name field name
0889:             * @return value
0890:             */
0891:            public Object getByName(String name) {
0892:                if (name.equals("DependId")) {
0893:                    return getDependId();
0894:                }
0895:                if (name.equals("ObservedId")) {
0896:                    return getObservedId();
0897:                }
0898:                if (name.equals("ObserverId")) {
0899:                    return getObserverId();
0900:                }
0901:                if (name.equals("TypeId")) {
0902:                    return getTypeId();
0903:                }
0904:                if (name.equals("Deleted")) {
0905:                    return Boolean.valueOf(getDeleted());
0906:                }
0907:                return null;
0908:            }
0909:
0910:            /**
0911:             * Retrieves a field from the object by name passed in
0912:             * as a String.  The String must be one of the static
0913:             * Strings defined in this Class' Peer.
0914:             *
0915:             * @param name peer name
0916:             * @return value
0917:             */
0918:            public Object getByPeerName(String name) {
0919:                if (name.equals(DependPeer.DEPEND_ID)) {
0920:                    return getDependId();
0921:                }
0922:                if (name.equals(DependPeer.OBSERVED_ID)) {
0923:                    return getObservedId();
0924:                }
0925:                if (name.equals(DependPeer.OBSERVER_ID)) {
0926:                    return getObserverId();
0927:                }
0928:                if (name.equals(DependPeer.DEPEND_TYPE_ID)) {
0929:                    return getTypeId();
0930:                }
0931:                if (name.equals(DependPeer.DELETED)) {
0932:                    return Boolean.valueOf(getDeleted());
0933:                }
0934:                return null;
0935:            }
0936:
0937:            /**
0938:             * Retrieves a field from the object by Position as specified
0939:             * in the xml schema.  Zero-based.
0940:             *
0941:             * @param pos position in xml schema
0942:             * @return value
0943:             */
0944:            public Object getByPosition(int pos) {
0945:                if (pos == 0) {
0946:                    return getDependId();
0947:                }
0948:                if (pos == 1) {
0949:                    return getObservedId();
0950:                }
0951:                if (pos == 2) {
0952:                    return getObserverId();
0953:                }
0954:                if (pos == 3) {
0955:                    return getTypeId();
0956:                }
0957:                if (pos == 4) {
0958:                    return Boolean.valueOf(getDeleted());
0959:                }
0960:                return null;
0961:            }
0962:
0963:            /**
0964:             * Stores the object in the database.  If the object is new,
0965:             * it inserts it; otherwise an update is performed.
0966:             *
0967:             * @throws TorqueException
0968:             */
0969:            public void save() throws TorqueException {
0970:                save(DependPeer.getMapBuilder().getDatabaseMap().getName());
0971:            }
0972:
0973:            /**
0974:             * Stores the object in the database.  If the object is new,
0975:             * it inserts it; otherwise an update is performed.
0976:             * Note: this code is here because the method body is
0977:             * auto-generated conditionally and therefore needs to be
0978:             * in this file instead of in the super class, BaseObject.
0979:             *
0980:             * @param dbName
0981:             * @throws TorqueException
0982:             */
0983:            public void save(String dbName) throws TorqueException {
0984:                Connection con = null;
0985:                try {
0986:                    con = Transaction.begin(dbName);
0987:                    save(con);
0988:                    Transaction.commit(con);
0989:                } catch (TorqueException e) {
0990:                    Transaction.safeRollback(con);
0991:                    throw e;
0992:                }
0993:            }
0994:
0995:            /** flag to prevent endless save loop, if this object is referenced
0996:              by another object which falls in this transaction. */
0997:            private boolean alreadyInSave = false;
0998:
0999:            /**
1000:             * Stores the object in the database.  If the object is new,
1001:             * it inserts it; otherwise an update is performed.  This method
1002:             * is meant to be used as part of a transaction, otherwise use
1003:             * the save() method and the connection details will be handled
1004:             * internally
1005:             *
1006:             * @param con
1007:             * @throws TorqueException
1008:             */
1009:            public void save(Connection con) throws TorqueException {
1010:                if (!alreadyInSave) {
1011:                    alreadyInSave = true;
1012:
1013:                    // If this object has been modified, then save it to the database.
1014:                    if (isModified()) {
1015:                        if (isNew()) {
1016:                            DependPeer.doInsert((Depend) this , con);
1017:                            setNew(false);
1018:                        } else {
1019:                            DependPeer.doUpdate((Depend) this , con);
1020:                        }
1021:
1022:                        if (isCacheOnSave()) {
1023:                            DependManager.putInstance(this );
1024:                        }
1025:                    }
1026:
1027:                    if (collActivitys != null) {
1028:                        for (int i = 0; i < collActivitys.size(); i++) {
1029:                            ((Activity) collActivitys.get(i)).save(con);
1030:                        }
1031:                    }
1032:                    alreadyInSave = false;
1033:                }
1034:            }
1035:
1036:            /**
1037:             * Specify whether to cache the object after saving to the db.
1038:             * This method returns true
1039:             */
1040:            protected boolean isCacheOnSave() {
1041:                return true;
1042:            }
1043:
1044:            /**
1045:             * Set the PrimaryKey using ObjectKey.
1046:             *
1047:             * @param key dependId ObjectKey
1048:             */
1049:            public void setPrimaryKey(ObjectKey key) throws TorqueException {
1050:                setDependId(new Integer(((NumberKey) key).intValue()));
1051:            }
1052:
1053:            /**
1054:             * Set the PrimaryKey using a String.
1055:             *
1056:             * @param key
1057:             */
1058:            public void setPrimaryKey(String key) throws TorqueException {
1059:                setDependId(new Integer(key));
1060:            }
1061:
1062:            /**
1063:             * returns an id that differentiates this object from others
1064:             * of its class.
1065:             */
1066:            public ObjectKey getPrimaryKey() {
1067:                return SimpleKey.keyFor(getDependId());
1068:            }
1069:
1070:            /**
1071:             * get an id that differentiates this object from others
1072:             * of its class.
1073:             */
1074:            public String getQueryKey() {
1075:                if (getPrimaryKey() == null) {
1076:                    return "";
1077:                } else {
1078:                    return getPrimaryKey().toString();
1079:                }
1080:            }
1081:
1082:            /**
1083:             * set an id that differentiates this object from others
1084:             * of its class.
1085:             */
1086:            public void setQueryKey(String key) throws TorqueException {
1087:                setPrimaryKey(key);
1088:            }
1089:
1090:            /**
1091:             * Makes a copy of this object.
1092:             * It creates a new object filling in the simple attributes.
1093:             * It then fills all the association collections and sets the
1094:             * related objects to isNew=true.
1095:             */
1096:            public Depend copy() throws TorqueException {
1097:                return copyInto(new Depend());
1098:            }
1099:
1100:            protected Depend copyInto(Depend copyObj) throws TorqueException {
1101:                copyObj.setDependId(dependId);
1102:                copyObj.setObservedId(observedId);
1103:                copyObj.setObserverId(observerId);
1104:                copyObj.setTypeId(typeId);
1105:                copyObj.setDeleted(deleted);
1106:
1107:                copyObj.setDependId((Integer) null);
1108:
1109:                List v = getActivitys();
1110:                if (v != null) {
1111:                    for (int i = 0; i < v.size(); i++) {
1112:                        Activity obj = (Activity) v.get(i);
1113:                        copyObj.addActivity(obj.copy());
1114:                    }
1115:                } else {
1116:                    copyObj.collActivitys = null;
1117:                }
1118:                return copyObj;
1119:            }
1120:
1121:            /**
1122:             * returns a peer instance associated with this om.  Since Peer classes
1123:             * are not to have any instance attributes, this method returns the
1124:             * same instance for all member of this class. The method could therefore
1125:             * be static, but this would prevent one from overriding the behavior.
1126:             */
1127:            public DependPeer getPeer() {
1128:                return peer;
1129:            }
1130:
1131:            public String toString() {
1132:                StringBuffer str = new StringBuffer();
1133:                str.append("Depend:\n");
1134:                str.append("DependId = ").append(getDependId()).append("\n");
1135:                str.append("ObservedId = ").append(getObservedId())
1136:                        .append("\n");
1137:                str.append("ObserverId = ").append(getObserverId())
1138:                        .append("\n");
1139:                str.append("TypeId = ").append(getTypeId()).append("\n");
1140:                str.append("Deleted = ").append(getDeleted()).append("\n");
1141:                return (str.toString());
1142:            }
1143:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.