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