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