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