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