Source Code Cross Referenced for BaseQuery.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 Query
0027:         */
0028:        public abstract class BaseQuery extends BaseObject implements 
0029:                org.apache.fulcrum.intake.Retrievable {
0030:            /** The Peer class */
0031:            private static final QueryPeer peer = new QueryPeer();
0032:
0033:            /** The value for the queryId field */
0034:            private Long queryId;
0035:
0036:            /** The value for the userId field */
0037:            private Integer userId;
0038:
0039:            /** The value for the name field */
0040:            private String name;
0041:
0042:            /** The value for the description field */
0043:            private String description;
0044:
0045:            /** The value for the value field */
0046:            private String value;
0047:
0048:            /** The value for the scopeId field */
0049:            private Integer scopeId;
0050:
0051:            /** The value for the issueTypeId field */
0052:            private Integer issueTypeId;
0053:
0054:            /** The value for the moduleId field */
0055:            private Integer moduleId;
0056:
0057:            /** The value for the listId field */
0058:            private Long listId;
0059:
0060:            /** The value for the deleted field */
0061:            private boolean deleted = false;
0062:
0063:            /** The value for the approved field */
0064:            private boolean approved = false;
0065:
0066:            /** The value for the createdDate field */
0067:            private Date createdDate;
0068:
0069:            /** The value for the subscriptionFrequencyId field */
0070:            private Integer subscriptionFrequencyId;
0071:
0072:            /** The value for the homePage field */
0073:            private boolean homePage = false;
0074:
0075:            /** The value for the order field */
0076:            private int order = 0;
0077:
0078:            /**
0079:             * Get the QueryId
0080:             *
0081:             * @return Long
0082:             */
0083:            public Long getQueryId() {
0084:                return queryId;
0085:            }
0086:
0087:            /**
0088:             * Set the value of QueryId
0089:             *
0090:             * @param v new value
0091:             */
0092:            public void setQueryId(Long v) throws TorqueException {
0093:
0094:                if (!ObjectUtils.equals(this .queryId, v)) {
0095:                    this .queryId = v;
0096:                    setModified(true);
0097:                }
0098:
0099:                // update associated RQueryUser
0100:                if (collRQueryUsers != null) {
0101:                    for (int i = 0; i < collRQueryUsers.size(); i++) {
0102:                        ((RQueryUser) collRQueryUsers.get(i)).setQueryId(v);
0103:                    }
0104:                }
0105:            }
0106:
0107:            /**
0108:             * Get the UserId
0109:             *
0110:             * @return Integer
0111:             */
0112:            public Integer getUserId() {
0113:                return userId;
0114:            }
0115:
0116:            /**
0117:             * Set the value of UserId
0118:             *
0119:             * @param v new value
0120:             */
0121:            public void setUserId(Integer v) throws TorqueException {
0122:
0123:                if (!ObjectUtils.equals(this .userId, v)) {
0124:                    this .userId = v;
0125:                    setModified(true);
0126:                }
0127:
0128:                if (aScarabUser != null
0129:                        && !ObjectUtils.equals(aScarabUser.getUserId(), v)) {
0130:                    aScarabUser = null;
0131:                }
0132:
0133:            }
0134:
0135:            /**
0136:             * Get the Name
0137:             *
0138:             * @return String
0139:             */
0140:            public String getName() {
0141:                return name;
0142:            }
0143:
0144:            /**
0145:             * Set the value of Name
0146:             *
0147:             * @param v new value
0148:             */
0149:            public void setName(String v) {
0150:
0151:                if (!ObjectUtils.equals(this .name, v)) {
0152:                    this .name = v;
0153:                    setModified(true);
0154:                }
0155:
0156:            }
0157:
0158:            /**
0159:             * Get the Description
0160:             *
0161:             * @return String
0162:             */
0163:            public String getDescription() {
0164:                return description;
0165:            }
0166:
0167:            /**
0168:             * Set the value of Description
0169:             *
0170:             * @param v new value
0171:             */
0172:            public void setDescription(String v) {
0173:
0174:                if (!ObjectUtils.equals(this .description, v)) {
0175:                    this .description = v;
0176:                    setModified(true);
0177:                }
0178:
0179:            }
0180:
0181:            /**
0182:             * Get the Value
0183:             *
0184:             * @return String
0185:             */
0186:            public String getValue() {
0187:                return value;
0188:            }
0189:
0190:            /**
0191:             * Set the value of Value
0192:             *
0193:             * @param v new value
0194:             */
0195:            public void setValue(String v) {
0196:
0197:                if (!ObjectUtils.equals(this .value, v)) {
0198:                    this .value = v;
0199:                    setModified(true);
0200:                }
0201:
0202:            }
0203:
0204:            /**
0205:             * Get the ScopeId
0206:             *
0207:             * @return Integer
0208:             */
0209:            public Integer getScopeId() {
0210:                return scopeId;
0211:            }
0212:
0213:            /**
0214:             * Set the value of ScopeId
0215:             *
0216:             * @param v new value
0217:             */
0218:            public void setScopeId(Integer v) throws TorqueException {
0219:
0220:                if (!ObjectUtils.equals(this .scopeId, v)) {
0221:                    this .scopeId = v;
0222:                    setModified(true);
0223:                }
0224:
0225:                if (aScope != null
0226:                        && !ObjectUtils.equals(aScope.getScopeId(), v)) {
0227:                    aScope = null;
0228:                }
0229:
0230:            }
0231:
0232:            /**
0233:             * Get the IssueTypeId
0234:             *
0235:             * @return Integer
0236:             */
0237:            public Integer getIssueTypeId() {
0238:                return issueTypeId;
0239:            }
0240:
0241:            /**
0242:             * Set the value of IssueTypeId
0243:             *
0244:             * @param v new value
0245:             */
0246:            public void setIssueTypeId(Integer v) throws TorqueException {
0247:
0248:                if (!ObjectUtils.equals(this .issueTypeId, v)) {
0249:                    this .issueTypeId = v;
0250:                    setModified(true);
0251:                }
0252:
0253:                if (aIssueType != null
0254:                        && !ObjectUtils.equals(aIssueType.getIssueTypeId(), v)) {
0255:                    aIssueType = null;
0256:                }
0257:
0258:            }
0259:
0260:            /**
0261:             * Get the ModuleId
0262:             *
0263:             * @return Integer
0264:             */
0265:            public Integer getModuleId() {
0266:                return moduleId;
0267:            }
0268:
0269:            /**
0270:             * Set the value of ModuleId
0271:             *
0272:             * @param v new value
0273:             */
0274:            public void setModuleId(Integer v) throws TorqueException {
0275:
0276:                if (!ObjectUtils.equals(this .moduleId, v)) {
0277:                    this .moduleId = v;
0278:                    setModified(true);
0279:                }
0280:
0281:                if (aModule != null
0282:                        && !ObjectUtils.equals(aModule.getModuleId(), v)) {
0283:                    aModule = null;
0284:                }
0285:
0286:            }
0287:
0288:            /**
0289:             * Get the ListId
0290:             *
0291:             * @return Long
0292:             */
0293:            public Long getListId() {
0294:                return listId;
0295:            }
0296:
0297:            /**
0298:             * Set the value of ListId
0299:             *
0300:             * @param v new value
0301:             */
0302:            public void setListId(Long v) throws TorqueException {
0303:
0304:                if (!ObjectUtils.equals(this .listId, v)) {
0305:                    this .listId = v;
0306:                    setModified(true);
0307:                }
0308:
0309:                if (aMITList != null
0310:                        && !ObjectUtils.equals(aMITList.getListId(), v)) {
0311:                    aMITList = null;
0312:                }
0313:
0314:            }
0315:
0316:            /**
0317:             * Get the Deleted
0318:             *
0319:             * @return boolean
0320:             */
0321:            public boolean getDeleted() {
0322:                return deleted;
0323:            }
0324:
0325:            /**
0326:             * Set the value of Deleted
0327:             *
0328:             * @param v new value
0329:             */
0330:            public void setDeleted(boolean v) {
0331:
0332:                if (this .deleted != v) {
0333:                    this .deleted = v;
0334:                    setModified(true);
0335:                }
0336:
0337:            }
0338:
0339:            /**
0340:             * Get the Approved
0341:             *
0342:             * @return boolean
0343:             */
0344:            public boolean getApproved() {
0345:                return approved;
0346:            }
0347:
0348:            /**
0349:             * Set the value of Approved
0350:             *
0351:             * @param v new value
0352:             */
0353:            public void setApproved(boolean v) {
0354:
0355:                if (this .approved != v) {
0356:                    this .approved = v;
0357:                    setModified(true);
0358:                }
0359:
0360:            }
0361:
0362:            /**
0363:             * Get the CreatedDate
0364:             *
0365:             * @return Date
0366:             */
0367:            public Date getCreatedDate() {
0368:                return createdDate;
0369:            }
0370:
0371:            /**
0372:             * Set the value of CreatedDate
0373:             *
0374:             * @param v new value
0375:             */
0376:            public void setCreatedDate(Date v) {
0377:
0378:                if (!ObjectUtils.equals(this .createdDate, v)) {
0379:                    this .createdDate = v;
0380:                    setModified(true);
0381:                }
0382:
0383:            }
0384:
0385:            /**
0386:             * Get the SubscriptionFrequencyId
0387:             *
0388:             * @return Integer
0389:             */
0390:            public Integer getSubscriptionFrequencyId() {
0391:                return subscriptionFrequencyId;
0392:            }
0393:
0394:            /**
0395:             * Set the value of SubscriptionFrequencyId
0396:             *
0397:             * @param v new value
0398:             */
0399:            public void setSubscriptionFrequencyId(Integer v)
0400:                    throws TorqueException {
0401:
0402:                if (!ObjectUtils.equals(this .subscriptionFrequencyId, v)) {
0403:                    this .subscriptionFrequencyId = v;
0404:                    setModified(true);
0405:                }
0406:
0407:                if (aFrequency != null
0408:                        && !ObjectUtils.equals(aFrequency.getFrequencyId(), v)) {
0409:                    aFrequency = null;
0410:                }
0411:
0412:            }
0413:
0414:            /**
0415:             * Get the HomePage
0416:             *
0417:             * @return boolean
0418:             */
0419:            public boolean getHomePage() {
0420:                return homePage;
0421:            }
0422:
0423:            /**
0424:             * Set the value of HomePage
0425:             *
0426:             * @param v new value
0427:             */
0428:            public void setHomePage(boolean v) {
0429:
0430:                if (this .homePage != v) {
0431:                    this .homePage = v;
0432:                    setModified(true);
0433:                }
0434:
0435:            }
0436:
0437:            /**
0438:             * Get the Order
0439:             *
0440:             * @return int
0441:             */
0442:            public int getOrder() {
0443:                return order;
0444:            }
0445:
0446:            /**
0447:             * Set the value of Order
0448:             *
0449:             * @param v new value
0450:             */
0451:            public void setOrder(int v) {
0452:
0453:                if (this .order != v) {
0454:                    this .order = v;
0455:                    setModified(true);
0456:                }
0457:
0458:            }
0459:
0460:            private ScarabUser aScarabUser;
0461:
0462:            /**
0463:             * Declares an association between this object and a ScarabUser object
0464:             *
0465:             * @param v ScarabUser
0466:             * @throws TorqueException
0467:             */
0468:            public void setScarabUser(ScarabUser v) throws TorqueException {
0469:                if (v == null) {
0470:                    setUserId((Integer) null);
0471:                } else {
0472:                    setUserId(v.getUserId());
0473:                }
0474:                aScarabUser = v;
0475:            }
0476:
0477:            /**
0478:             * Returns the associated ScarabUser object.
0479:             * If it was not retrieved before, the object is retrieved from
0480:             * the database
0481:             *
0482:             * @return the associated ScarabUser object
0483:             * @throws TorqueException
0484:             */
0485:            public ScarabUser getScarabUser() throws TorqueException {
0486:                if (aScarabUser == null
0487:                        && (!ObjectUtils.equals(this .userId, null))) {
0488:                    aScarabUser = ScarabUserManager.getInstance(SimpleKey
0489:                            .keyFor(this .userId));
0490:                }
0491:                return aScarabUser;
0492:            }
0493:
0494:            /**
0495:             * Return the associated ScarabUser object
0496:             * If it was not retrieved before, the object is retrieved from
0497:             * the database using the passed connection
0498:             *
0499:             * @param connection the connection used to retrieve the associated object
0500:             *        from the database, if it was not retrieved before
0501:             * @return the associated ScarabUser object
0502:             * @throws TorqueException
0503:             */
0504:            public ScarabUser getScarabUser(Connection connection)
0505:                    throws TorqueException {
0506:                if (aScarabUser == null
0507:                        && (!ObjectUtils.equals(this .userId, null))) {
0508:                    aScarabUser = ScarabUserManager.getCachedInstance(SimpleKey
0509:                            .keyFor(this .userId));
0510:                    if (aScarabUser == null) {
0511:                        aScarabUser = ScarabUserImplPeer
0512:                                .retrieveScarabUserImplByPK(SimpleKey
0513:                                        .keyFor(this .userId), connection);
0514:                        ScarabUserManager.putInstance(aScarabUser);
0515:                    }
0516:                }
0517:                return aScarabUser;
0518:            }
0519:
0520:            /**
0521:             * Provides convenient way to set a relationship based on a
0522:             * ObjectKey, for example
0523:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0524:             *
0525:             */
0526:            public void setScarabUserKey(ObjectKey key) throws TorqueException {
0527:
0528:                setUserId(new Integer(((NumberKey) key).intValue()));
0529:            }
0530:
0531:            private Scope aScope;
0532:
0533:            /**
0534:             * Declares an association between this object and a Scope object
0535:             *
0536:             * @param v Scope
0537:             * @throws TorqueException
0538:             */
0539:            public void setScope(Scope v) throws TorqueException {
0540:                if (v == null) {
0541:                    setScopeId((Integer) null);
0542:                } else {
0543:                    setScopeId(v.getScopeId());
0544:                }
0545:                aScope = v;
0546:            }
0547:
0548:            /**
0549:             * Returns the associated Scope object.
0550:             * If it was not retrieved before, the object is retrieved from
0551:             * the database
0552:             *
0553:             * @return the associated Scope object
0554:             * @throws TorqueException
0555:             */
0556:            public Scope getScope() throws TorqueException {
0557:                if (aScope == null && (!ObjectUtils.equals(this .scopeId, null))) {
0558:                    aScope = ScopeManager.getInstance(SimpleKey
0559:                            .keyFor(this .scopeId));
0560:                }
0561:                return aScope;
0562:            }
0563:
0564:            /**
0565:             * Return the associated Scope object
0566:             * If it was not retrieved before, the object is retrieved from
0567:             * the database using the passed connection
0568:             *
0569:             * @param connection the connection used to retrieve the associated object
0570:             *        from the database, if it was not retrieved before
0571:             * @return the associated Scope object
0572:             * @throws TorqueException
0573:             */
0574:            public Scope getScope(Connection connection) throws TorqueException {
0575:                if (aScope == null && (!ObjectUtils.equals(this .scopeId, null))) {
0576:                    aScope = ScopeManager.getCachedInstance(SimpleKey
0577:                            .keyFor(this .scopeId));
0578:                    if (aScope == null) {
0579:                        aScope = ScopePeer.retrieveByPK(SimpleKey
0580:                                .keyFor(this .scopeId), connection);
0581:                        ScopeManager.putInstance(aScope);
0582:                    }
0583:                }
0584:                return aScope;
0585:            }
0586:
0587:            /**
0588:             * Provides convenient way to set a relationship based on a
0589:             * ObjectKey, for example
0590:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0591:             *
0592:             */
0593:            public void setScopeKey(ObjectKey key) throws TorqueException {
0594:
0595:                setScopeId(new Integer(((NumberKey) key).intValue()));
0596:            }
0597:
0598:            private Module aModule;
0599:
0600:            /**
0601:             * Declares an association between this object and a Module object
0602:             *
0603:             * @param v Module
0604:             * @throws TorqueException
0605:             */
0606:            public void setModule(Module v) throws TorqueException {
0607:                if (v == null) {
0608:                    setModuleId((Integer) null);
0609:                } else {
0610:                    setModuleId(v.getModuleId());
0611:                }
0612:                aModule = v;
0613:            }
0614:
0615:            /**
0616:             * Returns the associated Module object.
0617:             * If it was not retrieved before, the object is retrieved from
0618:             * the database
0619:             *
0620:             * @return the associated Module object
0621:             * @throws TorqueException
0622:             */
0623:            public Module getModule() throws TorqueException {
0624:                if (aModule == null
0625:                        && (!ObjectUtils.equals(this .moduleId, null))) {
0626:                    aModule = ModuleManager.getInstance(SimpleKey
0627:                            .keyFor(this .moduleId));
0628:                }
0629:                return aModule;
0630:            }
0631:
0632:            /**
0633:             * Return the associated Module object
0634:             * If it was not retrieved before, the object is retrieved from
0635:             * the database using the passed connection
0636:             *
0637:             * @param connection the connection used to retrieve the associated object
0638:             *        from the database, if it was not retrieved before
0639:             * @return the associated Module object
0640:             * @throws TorqueException
0641:             */
0642:            public Module getModule(Connection connection)
0643:                    throws TorqueException {
0644:                if (aModule == null
0645:                        && (!ObjectUtils.equals(this .moduleId, null))) {
0646:                    aModule = ModuleManager.getCachedInstance(SimpleKey
0647:                            .keyFor(this .moduleId));
0648:                    if (aModule == null) {
0649:                        aModule = ScarabModulePeer.retrieveByPK(SimpleKey
0650:                                .keyFor(this .moduleId), connection);
0651:                        ModuleManager.putInstance(aModule);
0652:                    }
0653:                }
0654:                return aModule;
0655:            }
0656:
0657:            /**
0658:             * Provides convenient way to set a relationship based on a
0659:             * ObjectKey, for example
0660:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0661:             *
0662:             */
0663:            public void setModuleKey(ObjectKey key) throws TorqueException {
0664:
0665:                setModuleId(new Integer(((NumberKey) key).intValue()));
0666:            }
0667:
0668:            private IssueType aIssueType;
0669:
0670:            /**
0671:             * Declares an association between this object and a IssueType object
0672:             *
0673:             * @param v IssueType
0674:             * @throws TorqueException
0675:             */
0676:            public void setIssueType(IssueType v) throws TorqueException {
0677:                if (v == null) {
0678:                    setIssueTypeId((Integer) null);
0679:                } else {
0680:                    setIssueTypeId(v.getIssueTypeId());
0681:                }
0682:                aIssueType = v;
0683:            }
0684:
0685:            /**
0686:             * Returns the associated IssueType object.
0687:             * If it was not retrieved before, the object is retrieved from
0688:             * the database
0689:             *
0690:             * @return the associated IssueType object
0691:             * @throws TorqueException
0692:             */
0693:            public IssueType getIssueType() throws TorqueException {
0694:                if (aIssueType == null
0695:                        && (!ObjectUtils.equals(this .issueTypeId, null))) {
0696:                    aIssueType = IssueTypeManager.getInstance(SimpleKey
0697:                            .keyFor(this .issueTypeId));
0698:                }
0699:                return aIssueType;
0700:            }
0701:
0702:            /**
0703:             * Return the associated IssueType object
0704:             * If it was not retrieved before, the object is retrieved from
0705:             * the database using the passed connection
0706:             *
0707:             * @param connection the connection used to retrieve the associated object
0708:             *        from the database, if it was not retrieved before
0709:             * @return the associated IssueType object
0710:             * @throws TorqueException
0711:             */
0712:            public IssueType getIssueType(Connection connection)
0713:                    throws TorqueException {
0714:                if (aIssueType == null
0715:                        && (!ObjectUtils.equals(this .issueTypeId, null))) {
0716:                    aIssueType = IssueTypeManager.getCachedInstance(SimpleKey
0717:                            .keyFor(this .issueTypeId));
0718:                    if (aIssueType == null) {
0719:                        aIssueType = IssueTypePeer.retrieveByPK(SimpleKey
0720:                                .keyFor(this .issueTypeId), connection);
0721:                        IssueTypeManager.putInstance(aIssueType);
0722:                    }
0723:                }
0724:                return aIssueType;
0725:            }
0726:
0727:            /**
0728:             * Provides convenient way to set a relationship based on a
0729:             * ObjectKey, for example
0730:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0731:             *
0732:             */
0733:            public void setIssueTypeKey(ObjectKey key) throws TorqueException {
0734:
0735:                setIssueTypeId(new Integer(((NumberKey) key).intValue()));
0736:            }
0737:
0738:            private MITList aMITList;
0739:
0740:            /**
0741:             * Declares an association between this object and a MITList object
0742:             *
0743:             * @param v MITList
0744:             * @throws TorqueException
0745:             */
0746:            public void setMITList(MITList v) throws TorqueException {
0747:                if (v == null) {
0748:                    setListId((Long) null);
0749:                } else {
0750:                    setListId(v.getListId());
0751:                }
0752:                aMITList = v;
0753:            }
0754:
0755:            /**
0756:             * Returns the associated MITList object.
0757:             * If it was not retrieved before, the object is retrieved from
0758:             * the database
0759:             *
0760:             * @return the associated MITList object
0761:             * @throws TorqueException
0762:             */
0763:            public MITList getMITList() throws TorqueException {
0764:                if (aMITList == null
0765:                        && (!ObjectUtils.equals(this .listId, null))) {
0766:                    aMITList = MITListManager.getInstance(SimpleKey
0767:                            .keyFor(this .listId));
0768:                }
0769:                return aMITList;
0770:            }
0771:
0772:            /**
0773:             * Return the associated MITList object
0774:             * If it was not retrieved before, the object is retrieved from
0775:             * the database using the passed connection
0776:             *
0777:             * @param connection the connection used to retrieve the associated object
0778:             *        from the database, if it was not retrieved before
0779:             * @return the associated MITList object
0780:             * @throws TorqueException
0781:             */
0782:            public MITList getMITList(Connection connection)
0783:                    throws TorqueException {
0784:                if (aMITList == null
0785:                        && (!ObjectUtils.equals(this .listId, null))) {
0786:                    aMITList = MITListManager.getCachedInstance(SimpleKey
0787:                            .keyFor(this .listId));
0788:                    if (aMITList == null) {
0789:                        aMITList = MITListPeer.retrieveByPK(SimpleKey
0790:                                .keyFor(this .listId), connection);
0791:                        MITListManager.putInstance(aMITList);
0792:                    }
0793:                }
0794:                return aMITList;
0795:            }
0796:
0797:            /**
0798:             * Provides convenient way to set a relationship based on a
0799:             * ObjectKey, for example
0800:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0801:             *
0802:             */
0803:            public void setMITListKey(ObjectKey key) throws TorqueException {
0804:
0805:                setListId(new Long(((NumberKey) key).longValue()));
0806:            }
0807:
0808:            private Frequency aFrequency;
0809:
0810:            /**
0811:             * Declares an association between this object and a Frequency object
0812:             *
0813:             * @param v Frequency
0814:             * @throws TorqueException
0815:             */
0816:            public void setFrequency(Frequency v) throws TorqueException {
0817:                if (v == null) {
0818:                    setSubscriptionFrequencyId((Integer) null);
0819:                } else {
0820:                    setSubscriptionFrequencyId(v.getFrequencyId());
0821:                }
0822:                aFrequency = v;
0823:            }
0824:
0825:            /**
0826:             * Returns the associated Frequency object.
0827:             * If it was not retrieved before, the object is retrieved from
0828:             * the database
0829:             *
0830:             * @return the associated Frequency object
0831:             * @throws TorqueException
0832:             */
0833:            public Frequency getFrequency() throws TorqueException {
0834:                if (aFrequency == null
0835:                        && (!ObjectUtils.equals(this .subscriptionFrequencyId,
0836:                                null))) {
0837:                    aFrequency = FrequencyManager.getInstance(SimpleKey
0838:                            .keyFor(this .subscriptionFrequencyId));
0839:                }
0840:                return aFrequency;
0841:            }
0842:
0843:            /**
0844:             * Return the associated Frequency object
0845:             * If it was not retrieved before, the object is retrieved from
0846:             * the database using the passed connection
0847:             *
0848:             * @param connection the connection used to retrieve the associated object
0849:             *        from the database, if it was not retrieved before
0850:             * @return the associated Frequency object
0851:             * @throws TorqueException
0852:             */
0853:            public Frequency getFrequency(Connection connection)
0854:                    throws TorqueException {
0855:                if (aFrequency == null
0856:                        && (!ObjectUtils.equals(this .subscriptionFrequencyId,
0857:                                null))) {
0858:                    aFrequency = FrequencyManager.getCachedInstance(SimpleKey
0859:                            .keyFor(this .subscriptionFrequencyId));
0860:                    if (aFrequency == null) {
0861:                        aFrequency = FrequencyPeer.retrieveByPK(SimpleKey
0862:                                .keyFor(this .subscriptionFrequencyId),
0863:                                connection);
0864:                        FrequencyManager.putInstance(aFrequency);
0865:                    }
0866:                }
0867:                return aFrequency;
0868:            }
0869:
0870:            /**
0871:             * Provides convenient way to set a relationship based on a
0872:             * ObjectKey, for example
0873:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0874:             *
0875:             */
0876:            public void setFrequencyKey(ObjectKey key) throws TorqueException {
0877:
0878:                setSubscriptionFrequencyId(new Integer(((NumberKey) key)
0879:                        .intValue()));
0880:            }
0881:
0882:            /**
0883:             * Collection to store aggregation of collRQueryUsers
0884:             */
0885:            protected List collRQueryUsers;
0886:
0887:            /**
0888:             * Temporary storage of collRQueryUsers to save a possible db hit in
0889:             * the event objects are add to the collection, but the
0890:             * complete collection is never requested.
0891:             */
0892:            protected void initRQueryUsers() {
0893:                if (collRQueryUsers == null) {
0894:                    collRQueryUsers = new ArrayList();
0895:                }
0896:            }
0897:
0898:            /**
0899:             * Method called to associate a RQueryUser object to this object
0900:             * through the RQueryUser foreign key attribute
0901:             *
0902:             * @param l RQueryUser
0903:             * @throws TorqueException
0904:             */
0905:            public void addRQueryUser(RQueryUser l) throws TorqueException {
0906:                getRQueryUsers().add(l);
0907:                l.setQuery((Query) this );
0908:            }
0909:
0910:            /**
0911:             * The criteria used to select the current contents of collRQueryUsers
0912:             */
0913:            private Criteria lastRQueryUsersCriteria = null;
0914:
0915:            /**
0916:             * If this collection has already been initialized, returns
0917:             * the collection. Otherwise returns the results of
0918:             * getRQueryUsers(new Criteria())
0919:             *
0920:             * @return the collection of associated objects
0921:             * @throws TorqueException
0922:             */
0923:            public List getRQueryUsers() throws TorqueException {
0924:                if (collRQueryUsers == null) {
0925:                    collRQueryUsers = getRQueryUsers(new Criteria(10));
0926:                }
0927:                return collRQueryUsers;
0928:            }
0929:
0930:            /**
0931:             * If this collection has already been initialized with
0932:             * an identical criteria, it returns the collection.
0933:             * Otherwise if this Query has previously
0934:             * been saved, it will retrieve related RQueryUsers from storage.
0935:             * If this Query is new, it will return
0936:             * an empty collection or the current collection, the criteria
0937:             * is ignored on a new object.
0938:             *
0939:             * @throws TorqueException
0940:             */
0941:            public List getRQueryUsers(Criteria criteria)
0942:                    throws TorqueException {
0943:                if (collRQueryUsers == null) {
0944:                    if (isNew()) {
0945:                        collRQueryUsers = new ArrayList();
0946:                    } else {
0947:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
0948:                        collRQueryUsers = RQueryUserPeer.doSelect(criteria);
0949:                    }
0950:                } else {
0951:                    // criteria has no effect for a new object
0952:                    if (!isNew()) {
0953:                        // the following code is to determine if a new query is
0954:                        // called for.  If the criteria is the same as the last
0955:                        // one, just return the collection.
0956:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
0957:                        if (!lastRQueryUsersCriteria.equals(criteria)) {
0958:                            collRQueryUsers = RQueryUserPeer.doSelect(criteria);
0959:                        }
0960:                    }
0961:                }
0962:                lastRQueryUsersCriteria = criteria;
0963:
0964:                return collRQueryUsers;
0965:            }
0966:
0967:            /**
0968:             * If this collection has already been initialized, returns
0969:             * the collection. Otherwise returns the results of
0970:             * getRQueryUsers(new Criteria(),Connection)
0971:             * This method takes in the Connection also as input so that
0972:             * referenced objects can also be obtained using a Connection
0973:             * that is taken as input
0974:             */
0975:            public List getRQueryUsers(Connection con) throws TorqueException {
0976:                if (collRQueryUsers == null) {
0977:                    collRQueryUsers = getRQueryUsers(new Criteria(10), con);
0978:                }
0979:                return collRQueryUsers;
0980:            }
0981:
0982:            /**
0983:             * If this collection has already been initialized with
0984:             * an identical criteria, it returns the collection.
0985:             * Otherwise if this Query has previously
0986:             * been saved, it will retrieve related RQueryUsers from storage.
0987:             * If this Query is new, it will return
0988:             * an empty collection or the current collection, the criteria
0989:             * is ignored on a new object.
0990:             * This method takes in the Connection also as input so that
0991:             * referenced objects can also be obtained using a Connection
0992:             * that is taken as input
0993:             */
0994:            public List getRQueryUsers(Criteria criteria, Connection con)
0995:                    throws TorqueException {
0996:                if (collRQueryUsers == null) {
0997:                    if (isNew()) {
0998:                        collRQueryUsers = new ArrayList();
0999:                    } else {
1000:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1001:                        collRQueryUsers = RQueryUserPeer
1002:                                .doSelect(criteria, con);
1003:                    }
1004:                } else {
1005:                    // criteria has no effect for a new object
1006:                    if (!isNew()) {
1007:                        // the following code is to determine if a new query is
1008:                        // called for.  If the criteria is the same as the last
1009:                        // one, just return the collection.
1010:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1011:                        if (!lastRQueryUsersCriteria.equals(criteria)) {
1012:                            collRQueryUsers = RQueryUserPeer.doSelect(criteria,
1013:                                    con);
1014:                        }
1015:                    }
1016:                }
1017:                lastRQueryUsersCriteria = criteria;
1018:
1019:                return collRQueryUsers;
1020:            }
1021:
1022:            /**
1023:             * If this collection has already been initialized with
1024:             * an identical criteria, it returns the collection.
1025:             * Otherwise if this Query is new, it will return
1026:             * an empty collection; or if this Query has previously
1027:             * been saved, it will retrieve related RQueryUsers from storage.
1028:             *
1029:             * This method is protected by default in order to keep the public
1030:             * api reasonable.  You can provide public methods for those you
1031:             * actually need in Query.
1032:             */
1033:            protected List getRQueryUsersJoinQuery(Criteria criteria)
1034:                    throws TorqueException {
1035:                if (collRQueryUsers == null) {
1036:                    if (isNew()) {
1037:                        collRQueryUsers = new ArrayList();
1038:                    } else {
1039:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1040:                        collRQueryUsers = RQueryUserPeer
1041:                                .doSelectJoinQuery(criteria);
1042:                    }
1043:                } else {
1044:                    // the following code is to determine if a new query is
1045:                    // called for.  If the criteria is the same as the last
1046:                    // one, just return the collection.
1047:                    criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1048:                    if (!lastRQueryUsersCriteria.equals(criteria)) {
1049:                        collRQueryUsers = RQueryUserPeer
1050:                                .doSelectJoinQuery(criteria);
1051:                    }
1052:                }
1053:                lastRQueryUsersCriteria = criteria;
1054:
1055:                return collRQueryUsers;
1056:            }
1057:
1058:            /**
1059:             * If this collection has already been initialized with
1060:             * an identical criteria, it returns the collection.
1061:             * Otherwise if this Query is new, it will return
1062:             * an empty collection; or if this Query has previously
1063:             * been saved, it will retrieve related RQueryUsers from storage.
1064:             *
1065:             * This method is protected by default in order to keep the public
1066:             * api reasonable.  You can provide public methods for those you
1067:             * actually need in Query.
1068:             */
1069:            protected List getRQueryUsersJoinScarabUserImpl(Criteria criteria)
1070:                    throws TorqueException {
1071:                if (collRQueryUsers == null) {
1072:                    if (isNew()) {
1073:                        collRQueryUsers = new ArrayList();
1074:                    } else {
1075:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1076:                        collRQueryUsers = RQueryUserPeer
1077:                                .doSelectJoinScarabUserImpl(criteria);
1078:                    }
1079:                } else {
1080:                    // the following code is to determine if a new query is
1081:                    // called for.  If the criteria is the same as the last
1082:                    // one, just return the collection.
1083:                    criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1084:                    if (!lastRQueryUsersCriteria.equals(criteria)) {
1085:                        collRQueryUsers = RQueryUserPeer
1086:                                .doSelectJoinScarabUserImpl(criteria);
1087:                    }
1088:                }
1089:                lastRQueryUsersCriteria = criteria;
1090:
1091:                return collRQueryUsers;
1092:            }
1093:
1094:            /**
1095:             * If this collection has already been initialized with
1096:             * an identical criteria, it returns the collection.
1097:             * Otherwise if this Query is new, it will return
1098:             * an empty collection; or if this Query has previously
1099:             * been saved, it will retrieve related RQueryUsers from storage.
1100:             *
1101:             * This method is protected by default in order to keep the public
1102:             * api reasonable.  You can provide public methods for those you
1103:             * actually need in Query.
1104:             */
1105:            protected List getRQueryUsersJoinFrequency(Criteria criteria)
1106:                    throws TorqueException {
1107:                if (collRQueryUsers == null) {
1108:                    if (isNew()) {
1109:                        collRQueryUsers = new ArrayList();
1110:                    } else {
1111:                        criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1112:                        collRQueryUsers = RQueryUserPeer
1113:                                .doSelectJoinFrequency(criteria);
1114:                    }
1115:                } else {
1116:                    // the following code is to determine if a new query is
1117:                    // called for.  If the criteria is the same as the last
1118:                    // one, just return the collection.
1119:                    criteria.add(RQueryUserPeer.QUERY_ID, getQueryId());
1120:                    if (!lastRQueryUsersCriteria.equals(criteria)) {
1121:                        collRQueryUsers = RQueryUserPeer
1122:                                .doSelectJoinFrequency(criteria);
1123:                    }
1124:                }
1125:                lastRQueryUsersCriteria = criteria;
1126:
1127:                return collRQueryUsers;
1128:            }
1129:
1130:            private static List fieldNames = null;
1131:
1132:            /**
1133:             * Generate a list of field names.
1134:             *
1135:             * @return a list of field names
1136:             */
1137:            public static synchronized List getFieldNames() {
1138:                if (fieldNames == null) {
1139:                    fieldNames = new ArrayList();
1140:                    fieldNames.add("QueryId");
1141:                    fieldNames.add("UserId");
1142:                    fieldNames.add("Name");
1143:                    fieldNames.add("Description");
1144:                    fieldNames.add("Value");
1145:                    fieldNames.add("ScopeId");
1146:                    fieldNames.add("IssueTypeId");
1147:                    fieldNames.add("ModuleId");
1148:                    fieldNames.add("ListId");
1149:                    fieldNames.add("Deleted");
1150:                    fieldNames.add("Approved");
1151:                    fieldNames.add("CreatedDate");
1152:                    fieldNames.add("SubscriptionFrequencyId");
1153:                    fieldNames.add("HomePage");
1154:                    fieldNames.add("Order");
1155:                    fieldNames = Collections.unmodifiableList(fieldNames);
1156:                }
1157:                return fieldNames;
1158:            }
1159:
1160:            /**
1161:             * Retrieves a field from the object by name passed in as a String.
1162:             *
1163:             * @param name field name
1164:             * @return value
1165:             */
1166:            public Object getByName(String name) {
1167:                if (name.equals("QueryId")) {
1168:                    return getQueryId();
1169:                }
1170:                if (name.equals("UserId")) {
1171:                    return getUserId();
1172:                }
1173:                if (name.equals("Name")) {
1174:                    return getName();
1175:                }
1176:                if (name.equals("Description")) {
1177:                    return getDescription();
1178:                }
1179:                if (name.equals("Value")) {
1180:                    return getValue();
1181:                }
1182:                if (name.equals("ScopeId")) {
1183:                    return getScopeId();
1184:                }
1185:                if (name.equals("IssueTypeId")) {
1186:                    return getIssueTypeId();
1187:                }
1188:                if (name.equals("ModuleId")) {
1189:                    return getModuleId();
1190:                }
1191:                if (name.equals("ListId")) {
1192:                    return getListId();
1193:                }
1194:                if (name.equals("Deleted")) {
1195:                    return Boolean.valueOf(getDeleted());
1196:                }
1197:                if (name.equals("Approved")) {
1198:                    return Boolean.valueOf(getApproved());
1199:                }
1200:                if (name.equals("CreatedDate")) {
1201:                    return getCreatedDate();
1202:                }
1203:                if (name.equals("SubscriptionFrequencyId")) {
1204:                    return getSubscriptionFrequencyId();
1205:                }
1206:                if (name.equals("HomePage")) {
1207:                    return Boolean.valueOf(getHomePage());
1208:                }
1209:                if (name.equals("Order")) {
1210:                    return new Integer(getOrder());
1211:                }
1212:                return null;
1213:            }
1214:
1215:            /**
1216:             * Retrieves a field from the object by name passed in
1217:             * as a String.  The String must be one of the static
1218:             * Strings defined in this Class' Peer.
1219:             *
1220:             * @param name peer name
1221:             * @return value
1222:             */
1223:            public Object getByPeerName(String name) {
1224:                if (name.equals(QueryPeer.QUERY_ID)) {
1225:                    return getQueryId();
1226:                }
1227:                if (name.equals(QueryPeer.USER_ID)) {
1228:                    return getUserId();
1229:                }
1230:                if (name.equals(QueryPeer.NAME)) {
1231:                    return getName();
1232:                }
1233:                if (name.equals(QueryPeer.DESCRIPTION)) {
1234:                    return getDescription();
1235:                }
1236:                if (name.equals(QueryPeer.VALUE)) {
1237:                    return getValue();
1238:                }
1239:                if (name.equals(QueryPeer.SCOPE_ID)) {
1240:                    return getScopeId();
1241:                }
1242:                if (name.equals(QueryPeer.ISSUE_TYPE_ID)) {
1243:                    return getIssueTypeId();
1244:                }
1245:                if (name.equals(QueryPeer.MODULE_ID)) {
1246:                    return getModuleId();
1247:                }
1248:                if (name.equals(QueryPeer.LIST_ID)) {
1249:                    return getListId();
1250:                }
1251:                if (name.equals(QueryPeer.DELETED)) {
1252:                    return Boolean.valueOf(getDeleted());
1253:                }
1254:                if (name.equals(QueryPeer.APPROVED)) {
1255:                    return Boolean.valueOf(getApproved());
1256:                }
1257:                if (name.equals(QueryPeer.CREATED_DATE)) {
1258:                    return getCreatedDate();
1259:                }
1260:                if (name.equals(QueryPeer.SUBSCRIPTION_FREQUENCY_ID)) {
1261:                    return getSubscriptionFrequencyId();
1262:                }
1263:                if (name.equals(QueryPeer.HOME_PAGE)) {
1264:                    return Boolean.valueOf(getHomePage());
1265:                }
1266:                if (name.equals(QueryPeer.PREFERRED_ORDER)) {
1267:                    return new Integer(getOrder());
1268:                }
1269:                return null;
1270:            }
1271:
1272:            /**
1273:             * Retrieves a field from the object by Position as specified
1274:             * in the xml schema.  Zero-based.
1275:             *
1276:             * @param pos position in xml schema
1277:             * @return value
1278:             */
1279:            public Object getByPosition(int pos) {
1280:                if (pos == 0) {
1281:                    return getQueryId();
1282:                }
1283:                if (pos == 1) {
1284:                    return getUserId();
1285:                }
1286:                if (pos == 2) {
1287:                    return getName();
1288:                }
1289:                if (pos == 3) {
1290:                    return getDescription();
1291:                }
1292:                if (pos == 4) {
1293:                    return getValue();
1294:                }
1295:                if (pos == 5) {
1296:                    return getScopeId();
1297:                }
1298:                if (pos == 6) {
1299:                    return getIssueTypeId();
1300:                }
1301:                if (pos == 7) {
1302:                    return getModuleId();
1303:                }
1304:                if (pos == 8) {
1305:                    return getListId();
1306:                }
1307:                if (pos == 9) {
1308:                    return Boolean.valueOf(getDeleted());
1309:                }
1310:                if (pos == 10) {
1311:                    return Boolean.valueOf(getApproved());
1312:                }
1313:                if (pos == 11) {
1314:                    return getCreatedDate();
1315:                }
1316:                if (pos == 12) {
1317:                    return getSubscriptionFrequencyId();
1318:                }
1319:                if (pos == 13) {
1320:                    return Boolean.valueOf(getHomePage());
1321:                }
1322:                if (pos == 14) {
1323:                    return new Integer(getOrder());
1324:                }
1325:                return null;
1326:            }
1327:
1328:            /**
1329:             * Stores the object in the database.  If the object is new,
1330:             * it inserts it; otherwise an update is performed.
1331:             *
1332:             * @throws TorqueException
1333:             */
1334:            public void save() throws TorqueException {
1335:                save(QueryPeer.getMapBuilder().getDatabaseMap().getName());
1336:            }
1337:
1338:            /**
1339:             * Stores the object in the database.  If the object is new,
1340:             * it inserts it; otherwise an update is performed.
1341:             * Note: this code is here because the method body is
1342:             * auto-generated conditionally and therefore needs to be
1343:             * in this file instead of in the super class, BaseObject.
1344:             *
1345:             * @param dbName
1346:             * @throws TorqueException
1347:             */
1348:            public void save(String dbName) throws TorqueException {
1349:                Connection con = null;
1350:                try {
1351:                    con = Transaction.begin(dbName);
1352:                    save(con);
1353:                    Transaction.commit(con);
1354:                } catch (TorqueException e) {
1355:                    Transaction.safeRollback(con);
1356:                    throw e;
1357:                }
1358:            }
1359:
1360:            /** flag to prevent endless save loop, if this object is referenced
1361:              by another object which falls in this transaction. */
1362:            private boolean alreadyInSave = false;
1363:
1364:            /**
1365:             * Stores the object in the database.  If the object is new,
1366:             * it inserts it; otherwise an update is performed.  This method
1367:             * is meant to be used as part of a transaction, otherwise use
1368:             * the save() method and the connection details will be handled
1369:             * internally
1370:             *
1371:             * @param con
1372:             * @throws TorqueException
1373:             */
1374:            public void save(Connection con) throws TorqueException {
1375:                if (!alreadyInSave) {
1376:                    alreadyInSave = true;
1377:
1378:                    // If this object has been modified, then save it to the database.
1379:                    if (isModified()) {
1380:                        if (isNew()) {
1381:                            QueryPeer.doInsert((Query) this , con);
1382:                            setNew(false);
1383:                        } else {
1384:                            QueryPeer.doUpdate((Query) this , con);
1385:                        }
1386:
1387:                        if (isCacheOnSave()) {
1388:                            QueryManager.putInstance(this );
1389:                        }
1390:                    }
1391:
1392:                    if (collRQueryUsers != null) {
1393:                        for (int i = 0; i < collRQueryUsers.size(); i++) {
1394:                            ((RQueryUser) collRQueryUsers.get(i)).save(con);
1395:                        }
1396:                    }
1397:                    alreadyInSave = false;
1398:                }
1399:            }
1400:
1401:            /**
1402:             * Specify whether to cache the object after saving to the db.
1403:             * This method returns true
1404:             */
1405:            protected boolean isCacheOnSave() {
1406:                return true;
1407:            }
1408:
1409:            /**
1410:             * Set the PrimaryKey using ObjectKey.
1411:             *
1412:             * @param key queryId ObjectKey
1413:             */
1414:            public void setPrimaryKey(ObjectKey key) throws TorqueException {
1415:                setQueryId(new Long(((NumberKey) key).longValue()));
1416:            }
1417:
1418:            /**
1419:             * Set the PrimaryKey using a String.
1420:             *
1421:             * @param key
1422:             */
1423:            public void setPrimaryKey(String key) throws TorqueException {
1424:                setQueryId(new Long(key));
1425:            }
1426:
1427:            /**
1428:             * returns an id that differentiates this object from others
1429:             * of its class.
1430:             */
1431:            public ObjectKey getPrimaryKey() {
1432:                return SimpleKey.keyFor(getQueryId());
1433:            }
1434:
1435:            /**
1436:             * get an id that differentiates this object from others
1437:             * of its class.
1438:             */
1439:            public String getQueryKey() {
1440:                if (getPrimaryKey() == null) {
1441:                    return "";
1442:                } else {
1443:                    return getPrimaryKey().toString();
1444:                }
1445:            }
1446:
1447:            /**
1448:             * set an id that differentiates this object from others
1449:             * of its class.
1450:             */
1451:            public void setQueryKey(String key) throws TorqueException {
1452:                setPrimaryKey(key);
1453:            }
1454:
1455:            /**
1456:             * Makes a copy of this object.
1457:             * It creates a new object filling in the simple attributes.
1458:             * It then fills all the association collections and sets the
1459:             * related objects to isNew=true.
1460:             */
1461:            public Query copy() throws TorqueException {
1462:                return copyInto(new Query());
1463:            }
1464:
1465:            protected Query copyInto(Query copyObj) throws TorqueException {
1466:                copyObj.setQueryId(queryId);
1467:                copyObj.setUserId(userId);
1468:                copyObj.setName(name);
1469:                copyObj.setDescription(description);
1470:                copyObj.setValue(value);
1471:                copyObj.setScopeId(scopeId);
1472:                copyObj.setIssueTypeId(issueTypeId);
1473:                copyObj.setModuleId(moduleId);
1474:                copyObj.setListId(listId);
1475:                copyObj.setDeleted(deleted);
1476:                copyObj.setApproved(approved);
1477:                copyObj.setCreatedDate(createdDate);
1478:                copyObj.setSubscriptionFrequencyId(subscriptionFrequencyId);
1479:                copyObj.setHomePage(homePage);
1480:                copyObj.setOrder(order);
1481:
1482:                copyObj.setQueryId((Long) null);
1483:
1484:                List v = getRQueryUsers();
1485:                if (v != null) {
1486:                    for (int i = 0; i < v.size(); i++) {
1487:                        RQueryUser obj = (RQueryUser) v.get(i);
1488:                        copyObj.addRQueryUser(obj.copy());
1489:                    }
1490:                } else {
1491:                    copyObj.collRQueryUsers = null;
1492:                }
1493:                return copyObj;
1494:            }
1495:
1496:            /**
1497:             * returns a peer instance associated with this om.  Since Peer classes
1498:             * are not to have any instance attributes, this method returns the
1499:             * same instance for all member of this class. The method could therefore
1500:             * be static, but this would prevent one from overriding the behavior.
1501:             */
1502:            public QueryPeer getPeer() {
1503:                return peer;
1504:            }
1505:
1506:            public String toString() {
1507:                StringBuffer str = new StringBuffer();
1508:                str.append("Query:\n");
1509:                str.append("QueryId = ").append(getQueryId()).append("\n");
1510:                str.append("UserId = ").append(getUserId()).append("\n");
1511:                str.append("Name = ").append(getName()).append("\n");
1512:                str.append("Description = ").append(getDescription()).append(
1513:                        "\n");
1514:                str.append("Value = ").append(getValue()).append("\n");
1515:                str.append("ScopeId = ").append(getScopeId()).append("\n");
1516:                str.append("IssueTypeId = ").append(getIssueTypeId()).append(
1517:                        "\n");
1518:                str.append("ModuleId = ").append(getModuleId()).append("\n");
1519:                str.append("ListId = ").append(getListId()).append("\n");
1520:                str.append("Deleted = ").append(getDeleted()).append("\n");
1521:                str.append("Approved = ").append(getApproved()).append("\n");
1522:                str.append("CreatedDate = ").append(getCreatedDate()).append(
1523:                        "\n");
1524:                str.append("SubscriptionFrequencyId = ").append(
1525:                        getSubscriptionFrequencyId()).append("\n");
1526:                str.append("HomePage = ").append(getHomePage()).append("\n");
1527:                str.append("Order = ").append(getOrder()).append("\n");
1528:                return (str.toString());
1529:            }
1530:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.