Source Code Cross Referenced for BaseCondition.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) 


001:        package org.tigris.scarab.om;
002:
003:        import java.math.BigDecimal;
004:        import java.sql.Connection;
005:        import java.util.ArrayList;
006:        import java.util.Collections;
007:        import java.util.Date;
008:        import java.util.List;
009:
010:        import org.apache.commons.lang.ObjectUtils;
011:        import org.apache.fulcrum.intake.Retrievable;
012:        import org.apache.torque.TorqueException;
013:        import org.apache.torque.om.BaseObject;
014:        import org.apache.torque.om.ComboKey;
015:        import org.apache.torque.om.DateKey;
016:        import org.apache.torque.om.NumberKey;
017:        import org.apache.torque.om.ObjectKey;
018:        import org.apache.torque.om.SimpleKey;
019:        import org.apache.torque.om.StringKey;
020:        import org.apache.torque.om.Persistent;
021:        import org.apache.torque.util.Criteria;
022:        import org.apache.torque.util.Transaction;
023:
024:        /**
025:         * You should not use this class directly.  It should not even be
026:         * extended all references should be to Condition
027:         */
028:        public abstract class BaseCondition extends BaseObject implements 
029:                org.apache.fulcrum.intake.Retrievable {
030:            /** The Peer class */
031:            private static final ConditionPeer peer = new ConditionPeer();
032:
033:            /** The value for the conditionId field */
034:            private Long conditionId;
035:
036:            /** The value for the transitionId field */
037:            private Integer transitionId;
038:
039:            /** The value for the moduleId field */
040:            private Integer moduleId;
041:
042:            /** The value for the issueTypeId field */
043:            private Integer issueTypeId;
044:
045:            /** The value for the attributeId field */
046:            private Integer attributeId;
047:
048:            /** The value for the optionId field */
049:            private Integer optionId;
050:
051:            /**
052:             * Get the ConditionId
053:             *
054:             * @return Long
055:             */
056:            public Long getConditionId() {
057:                return conditionId;
058:            }
059:
060:            /**
061:             * Set the value of ConditionId
062:             *
063:             * @param v new value
064:             */
065:            public void setConditionId(Long v) {
066:
067:                if (!ObjectUtils.equals(this .conditionId, v)) {
068:                    this .conditionId = v;
069:                    setModified(true);
070:                }
071:
072:            }
073:
074:            /**
075:             * Get the TransitionId
076:             *
077:             * @return Integer
078:             */
079:            public Integer getTransitionId() {
080:                return transitionId;
081:            }
082:
083:            /**
084:             * Set the value of TransitionId
085:             *
086:             * @param v new value
087:             */
088:            public void setTransitionId(Integer v) throws TorqueException {
089:
090:                if (!ObjectUtils.equals(this .transitionId, v)) {
091:                    this .transitionId = v;
092:                    setModified(true);
093:                }
094:
095:                if (aTransition != null
096:                        && !ObjectUtils
097:                                .equals(aTransition.getTransitionId(), v)) {
098:                    aTransition = null;
099:                }
100:
101:            }
102:
103:            /**
104:             * Get the ModuleId
105:             *
106:             * @return Integer
107:             */
108:            public Integer getModuleId() {
109:                return moduleId;
110:            }
111:
112:            /**
113:             * Set the value of ModuleId
114:             *
115:             * @param v new value
116:             */
117:            public void setModuleId(Integer v) throws TorqueException {
118:
119:                if (!ObjectUtils.equals(this .moduleId, v)) {
120:                    this .moduleId = v;
121:                    setModified(true);
122:                }
123:
124:                if (aRModuleAttribute != null
125:                        && !ObjectUtils.equals(aRModuleAttribute.getModuleId(),
126:                                v)) {
127:                    aRModuleAttribute = null;
128:                }
129:
130:            }
131:
132:            /**
133:             * Get the IssueTypeId
134:             *
135:             * @return Integer
136:             */
137:            public Integer getIssueTypeId() {
138:                return issueTypeId;
139:            }
140:
141:            /**
142:             * Set the value of IssueTypeId
143:             *
144:             * @param v new value
145:             */
146:            public void setIssueTypeId(Integer v) throws TorqueException {
147:
148:                if (!ObjectUtils.equals(this .issueTypeId, v)) {
149:                    this .issueTypeId = v;
150:                    setModified(true);
151:                }
152:
153:                if (aRModuleAttribute != null
154:                        && !ObjectUtils.equals(aRModuleAttribute
155:                                .getIssueTypeId(), v)) {
156:                    aRModuleAttribute = null;
157:                }
158:
159:            }
160:
161:            /**
162:             * Get the AttributeId
163:             *
164:             * @return Integer
165:             */
166:            public Integer getAttributeId() {
167:                return attributeId;
168:            }
169:
170:            /**
171:             * Set the value of AttributeId
172:             *
173:             * @param v new value
174:             */
175:            public void setAttributeId(Integer v) throws TorqueException {
176:
177:                if (!ObjectUtils.equals(this .attributeId, v)) {
178:                    this .attributeId = v;
179:                    setModified(true);
180:                }
181:
182:                if (aRModuleAttribute != null
183:                        && !ObjectUtils.equals(aRModuleAttribute
184:                                .getAttributeId(), v)) {
185:                    aRModuleAttribute = null;
186:                }
187:
188:            }
189:
190:            /**
191:             * Get the OptionId
192:             *
193:             * @return Integer
194:             */
195:            public Integer getOptionId() {
196:                return optionId;
197:            }
198:
199:            /**
200:             * Set the value of OptionId
201:             *
202:             * @param v new value
203:             */
204:            public void setOptionId(Integer v) throws TorqueException {
205:
206:                if (!ObjectUtils.equals(this .optionId, v)) {
207:                    this .optionId = v;
208:                    setModified(true);
209:                }
210:
211:                if (aAttributeOption != null
212:                        && !ObjectUtils.equals(aAttributeOption.getOptionId(),
213:                                v)) {
214:                    aAttributeOption = null;
215:                }
216:
217:            }
218:
219:            private RModuleAttribute aRModuleAttribute;
220:
221:            /**
222:             * Declares an association between this object and a RModuleAttribute object
223:             *
224:             * @param v RModuleAttribute
225:             * @throws TorqueException
226:             */
227:            public void setRModuleAttribute(RModuleAttribute v)
228:                    throws TorqueException {
229:                if (v == null) {
230:                    setModuleId((Integer) null);
231:                } else {
232:                    setModuleId(v.getModuleId());
233:                }
234:                if (v == null) {
235:                    setAttributeId((Integer) null);
236:                } else {
237:                    setAttributeId(v.getAttributeId());
238:                }
239:                if (v == null) {
240:                    setIssueTypeId((Integer) null);
241:                } else {
242:                    setIssueTypeId(v.getIssueTypeId());
243:                }
244:                aRModuleAttribute = v;
245:            }
246:
247:            /**
248:             * Returns the associated RModuleAttribute object.
249:             * If it was not retrieved before, the object is retrieved from
250:             * the database
251:             *
252:             * @return the associated RModuleAttribute object
253:             * @throws TorqueException
254:             */
255:            public RModuleAttribute getRModuleAttribute()
256:                    throws TorqueException {
257:                if (aRModuleAttribute == null
258:                        && (!ObjectUtils.equals(this .moduleId, null)
259:                                && !ObjectUtils.equals(this .attributeId, null) && !ObjectUtils
260:                                .equals(this .issueTypeId, null))) {
261:                    SimpleKey[] keys = { SimpleKey.keyFor(this .moduleId),
262:                            SimpleKey.keyFor(this .attributeId),
263:                            SimpleKey.keyFor(this .issueTypeId) };
264:                    aRModuleAttribute = RModuleAttributeManager
265:                            .getInstance(new ComboKey(keys));
266:                }
267:                return aRModuleAttribute;
268:            }
269:
270:            /**
271:             * Return the associated RModuleAttribute object
272:             * If it was not retrieved before, the object is retrieved from
273:             * the database using the passed connection
274:             *
275:             * @param connection the connection used to retrieve the associated object
276:             *        from the database, if it was not retrieved before
277:             * @return the associated RModuleAttribute object
278:             * @throws TorqueException
279:             */
280:            public RModuleAttribute getRModuleAttribute(Connection connection)
281:                    throws TorqueException {
282:                if (aRModuleAttribute == null
283:                        && (!ObjectUtils.equals(this .moduleId, null)
284:                                && !ObjectUtils.equals(this .attributeId, null) && !ObjectUtils
285:                                .equals(this .issueTypeId, null))) {
286:                    SimpleKey[] keys = { SimpleKey.keyFor(this .moduleId),
287:                            SimpleKey.keyFor(this .attributeId),
288:                            SimpleKey.keyFor(this .issueTypeId) };
289:                    ComboKey comboid = new ComboKey(keys);
290:
291:                    aRModuleAttribute = RModuleAttributeManager
292:                            .getCachedInstance(comboid);
293:                    if (aRModuleAttribute == null) {
294:                        aRModuleAttribute = RModuleAttributePeer.retrieveByPK(
295:                                comboid, connection);
296:                        RModuleAttributeManager.putInstance(aRModuleAttribute);
297:                    }
298:                }
299:                return aRModuleAttribute;
300:            }
301:
302:            /**
303:             * Provides convenient way to set a relationship based on a
304:             * ObjectKey, for example
305:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
306:             *
307:             * Note: It is important that the xml schema used to create this class
308:             * maintains consistency in the order of related columns between
309:             * SCARAB_CONDITION and SCARAB_R_MODULE_ATTRIBUTE.
310:             * If for some reason this is impossible, this method should be
311:             * overridden in <code>Condition</code>.
312:             */
313:            public void setRModuleAttributeKey(ObjectKey key)
314:                    throws TorqueException {
315:                SimpleKey[] keys = (SimpleKey[]) key.getValue();
316:                setModuleId(new Integer(((NumberKey) keys[0]).intValue()));
317:
318:                setAttributeId(new Integer(((NumberKey) keys[1]).intValue()));
319:
320:                setIssueTypeId(new Integer(((NumberKey) keys[2]).intValue()));
321:
322:            }
323:
324:            private Transition aTransition;
325:
326:            /**
327:             * Declares an association between this object and a Transition object
328:             *
329:             * @param v Transition
330:             * @throws TorqueException
331:             */
332:            public void setTransition(Transition v) throws TorqueException {
333:                if (v == null) {
334:                    setTransitionId((Integer) null);
335:                } else {
336:                    setTransitionId(v.getTransitionId());
337:                }
338:                aTransition = v;
339:            }
340:
341:            /**
342:             * Returns the associated Transition object.
343:             * If it was not retrieved before, the object is retrieved from
344:             * the database
345:             *
346:             * @return the associated Transition object
347:             * @throws TorqueException
348:             */
349:            public Transition getTransition() throws TorqueException {
350:                if (aTransition == null
351:                        && (!ObjectUtils.equals(this .transitionId, null))) {
352:                    aTransition = TransitionManager.getInstance(SimpleKey
353:                            .keyFor(this .transitionId));
354:                }
355:                return aTransition;
356:            }
357:
358:            /**
359:             * Return the associated Transition object
360:             * If it was not retrieved before, the object is retrieved from
361:             * the database using the passed connection
362:             *
363:             * @param connection the connection used to retrieve the associated object
364:             *        from the database, if it was not retrieved before
365:             * @return the associated Transition object
366:             * @throws TorqueException
367:             */
368:            public Transition getTransition(Connection connection)
369:                    throws TorqueException {
370:                if (aTransition == null
371:                        && (!ObjectUtils.equals(this .transitionId, null))) {
372:                    aTransition = TransitionManager.getCachedInstance(SimpleKey
373:                            .keyFor(this .transitionId));
374:                    if (aTransition == null) {
375:                        aTransition = TransitionPeer.retrieveByPK(SimpleKey
376:                                .keyFor(this .transitionId), connection);
377:                        TransitionManager.putInstance(aTransition);
378:                    }
379:                }
380:                return aTransition;
381:            }
382:
383:            /**
384:             * Provides convenient way to set a relationship based on a
385:             * ObjectKey, for example
386:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
387:             *
388:             */
389:            public void setTransitionKey(ObjectKey key) throws TorqueException {
390:
391:                setTransitionId(new Integer(((NumberKey) key).intValue()));
392:            }
393:
394:            private Attribute aAttribute;
395:
396:            /**
397:             * Declares an association between this object and a Attribute object
398:             *
399:             * @param v Attribute
400:             * @throws TorqueException
401:             */
402:            public void setAttribute(Attribute v) throws TorqueException {
403:                if (v == null) {
404:                    setAttributeId((Integer) null);
405:                } else {
406:                    setAttributeId(v.getAttributeId());
407:                }
408:                aAttribute = v;
409:            }
410:
411:            /**
412:             * Returns the associated Attribute object.
413:             * If it was not retrieved before, the object is retrieved from
414:             * the database
415:             *
416:             * @return the associated Attribute object
417:             * @throws TorqueException
418:             */
419:            public Attribute getAttribute() throws TorqueException {
420:                if (aAttribute == null
421:                        && (!ObjectUtils.equals(this .attributeId, null))) {
422:                    aAttribute = AttributeManager.getInstance(SimpleKey
423:                            .keyFor(this .attributeId));
424:                }
425:                return aAttribute;
426:            }
427:
428:            /**
429:             * Return the associated Attribute object
430:             * If it was not retrieved before, the object is retrieved from
431:             * the database using the passed connection
432:             *
433:             * @param connection the connection used to retrieve the associated object
434:             *        from the database, if it was not retrieved before
435:             * @return the associated Attribute object
436:             * @throws TorqueException
437:             */
438:            public Attribute getAttribute(Connection connection)
439:                    throws TorqueException {
440:                if (aAttribute == null
441:                        && (!ObjectUtils.equals(this .attributeId, null))) {
442:                    aAttribute = AttributeManager.getCachedInstance(SimpleKey
443:                            .keyFor(this .attributeId));
444:                    if (aAttribute == null) {
445:                        aAttribute = AttributePeer.retrieveByPK(SimpleKey
446:                                .keyFor(this .attributeId), connection);
447:                        AttributeManager.putInstance(aAttribute);
448:                    }
449:                }
450:                return aAttribute;
451:            }
452:
453:            /**
454:             * Provides convenient way to set a relationship based on a
455:             * ObjectKey, for example
456:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
457:             *
458:             */
459:            public void setAttributeKey(ObjectKey key) throws TorqueException {
460:
461:                setAttributeId(new Integer(((NumberKey) key).intValue()));
462:            }
463:
464:            private AttributeOption aAttributeOption;
465:
466:            /**
467:             * Declares an association between this object and a AttributeOption object
468:             *
469:             * @param v AttributeOption
470:             * @throws TorqueException
471:             */
472:            public void setAttributeOption(AttributeOption v)
473:                    throws TorqueException {
474:                if (v == null) {
475:                    setOptionId((Integer) null);
476:                } else {
477:                    setOptionId(v.getOptionId());
478:                }
479:                aAttributeOption = v;
480:            }
481:
482:            /**
483:             * Returns the associated AttributeOption object.
484:             * If it was not retrieved before, the object is retrieved from
485:             * the database
486:             *
487:             * @return the associated AttributeOption object
488:             * @throws TorqueException
489:             */
490:            public AttributeOption getAttributeOption() throws TorqueException {
491:                if (aAttributeOption == null
492:                        && (!ObjectUtils.equals(this .optionId, null))) {
493:                    aAttributeOption = AttributeOptionManager
494:                            .getInstance(SimpleKey.keyFor(this .optionId));
495:                }
496:                return aAttributeOption;
497:            }
498:
499:            /**
500:             * Return the associated AttributeOption object
501:             * If it was not retrieved before, the object is retrieved from
502:             * the database using the passed connection
503:             *
504:             * @param connection the connection used to retrieve the associated object
505:             *        from the database, if it was not retrieved before
506:             * @return the associated AttributeOption object
507:             * @throws TorqueException
508:             */
509:            public AttributeOption getAttributeOption(Connection connection)
510:                    throws TorqueException {
511:                if (aAttributeOption == null
512:                        && (!ObjectUtils.equals(this .optionId, null))) {
513:                    aAttributeOption = AttributeOptionManager
514:                            .getCachedInstance(SimpleKey.keyFor(this .optionId));
515:                    if (aAttributeOption == null) {
516:                        aAttributeOption = AttributeOptionPeer.retrieveByPK(
517:                                SimpleKey.keyFor(this .optionId), connection);
518:                        AttributeOptionManager.putInstance(aAttributeOption);
519:                    }
520:                }
521:                return aAttributeOption;
522:            }
523:
524:            /**
525:             * Provides convenient way to set a relationship based on a
526:             * ObjectKey, for example
527:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
528:             *
529:             */
530:            public void setAttributeOptionKey(ObjectKey key)
531:                    throws TorqueException {
532:
533:                setOptionId(new Integer(((NumberKey) key).intValue()));
534:            }
535:
536:            private RModuleIssueType aRModuleIssueType;
537:
538:            /**
539:             * Declares an association between this object and a RModuleIssueType object
540:             *
541:             * @param v RModuleIssueType
542:             * @throws TorqueException
543:             */
544:            public void setRModuleIssueType(RModuleIssueType v)
545:                    throws TorqueException {
546:                if (v == null) {
547:                    setModuleId((Integer) null);
548:                } else {
549:                    setModuleId(v.getModuleId());
550:                }
551:                if (v == null) {
552:                    setIssueTypeId((Integer) null);
553:                } else {
554:                    setIssueTypeId(v.getIssueTypeId());
555:                }
556:                aRModuleIssueType = v;
557:            }
558:
559:            /**
560:             * Returns the associated RModuleIssueType object.
561:             * If it was not retrieved before, the object is retrieved from
562:             * the database
563:             *
564:             * @return the associated RModuleIssueType object
565:             * @throws TorqueException
566:             */
567:            public RModuleIssueType getRModuleIssueType()
568:                    throws TorqueException {
569:                if (aRModuleIssueType == null
570:                        && (!ObjectUtils.equals(this .moduleId, null) && !ObjectUtils
571:                                .equals(this .issueTypeId, null))) {
572:                    SimpleKey[] keys = { SimpleKey.keyFor(this .moduleId),
573:                            SimpleKey.keyFor(this .issueTypeId) };
574:                    aRModuleIssueType = RModuleIssueTypeManager
575:                            .getInstance(new ComboKey(keys));
576:                }
577:                return aRModuleIssueType;
578:            }
579:
580:            /**
581:             * Return the associated RModuleIssueType object
582:             * If it was not retrieved before, the object is retrieved from
583:             * the database using the passed connection
584:             *
585:             * @param connection the connection used to retrieve the associated object
586:             *        from the database, if it was not retrieved before
587:             * @return the associated RModuleIssueType object
588:             * @throws TorqueException
589:             */
590:            public RModuleIssueType getRModuleIssueType(Connection connection)
591:                    throws TorqueException {
592:                if (aRModuleIssueType == null
593:                        && (!ObjectUtils.equals(this .moduleId, null) && !ObjectUtils
594:                                .equals(this .issueTypeId, null))) {
595:                    SimpleKey[] keys = { SimpleKey.keyFor(this .moduleId),
596:                            SimpleKey.keyFor(this .issueTypeId) };
597:                    ComboKey comboid = new ComboKey(keys);
598:
599:                    aRModuleIssueType = RModuleIssueTypeManager
600:                            .getCachedInstance(comboid);
601:                    if (aRModuleIssueType == null) {
602:                        aRModuleIssueType = RModuleIssueTypePeer.retrieveByPK(
603:                                comboid, connection);
604:                        RModuleIssueTypeManager.putInstance(aRModuleIssueType);
605:                    }
606:                }
607:                return aRModuleIssueType;
608:            }
609:
610:            /**
611:             * Provides convenient way to set a relationship based on a
612:             * ObjectKey, for example
613:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
614:             *
615:             * Note: It is important that the xml schema used to create this class
616:             * maintains consistency in the order of related columns between
617:             * SCARAB_CONDITION and SCARAB_R_MODULE_ISSUE_TYPE.
618:             * If for some reason this is impossible, this method should be
619:             * overridden in <code>Condition</code>.
620:             */
621:            public void setRModuleIssueTypeKey(ObjectKey key)
622:                    throws TorqueException {
623:                SimpleKey[] keys = (SimpleKey[]) key.getValue();
624:                setModuleId(new Integer(((NumberKey) keys[0]).intValue()));
625:
626:                setIssueTypeId(new Integer(((NumberKey) keys[1]).intValue()));
627:
628:            }
629:
630:            private static List fieldNames = null;
631:
632:            /**
633:             * Generate a list of field names.
634:             *
635:             * @return a list of field names
636:             */
637:            public static synchronized List getFieldNames() {
638:                if (fieldNames == null) {
639:                    fieldNames = new ArrayList();
640:                    fieldNames.add("ConditionId");
641:                    fieldNames.add("TransitionId");
642:                    fieldNames.add("ModuleId");
643:                    fieldNames.add("IssueTypeId");
644:                    fieldNames.add("AttributeId");
645:                    fieldNames.add("OptionId");
646:                    fieldNames = Collections.unmodifiableList(fieldNames);
647:                }
648:                return fieldNames;
649:            }
650:
651:            /**
652:             * Retrieves a field from the object by name passed in as a String.
653:             *
654:             * @param name field name
655:             * @return value
656:             */
657:            public Object getByName(String name) {
658:                if (name.equals("ConditionId")) {
659:                    return getConditionId();
660:                }
661:                if (name.equals("TransitionId")) {
662:                    return getTransitionId();
663:                }
664:                if (name.equals("ModuleId")) {
665:                    return getModuleId();
666:                }
667:                if (name.equals("IssueTypeId")) {
668:                    return getIssueTypeId();
669:                }
670:                if (name.equals("AttributeId")) {
671:                    return getAttributeId();
672:                }
673:                if (name.equals("OptionId")) {
674:                    return getOptionId();
675:                }
676:                return null;
677:            }
678:
679:            /**
680:             * Retrieves a field from the object by name passed in
681:             * as a String.  The String must be one of the static
682:             * Strings defined in this Class' Peer.
683:             *
684:             * @param name peer name
685:             * @return value
686:             */
687:            public Object getByPeerName(String name) {
688:                if (name.equals(ConditionPeer.CONDITION_ID)) {
689:                    return getConditionId();
690:                }
691:                if (name.equals(ConditionPeer.TRANSITION_ID)) {
692:                    return getTransitionId();
693:                }
694:                if (name.equals(ConditionPeer.MODULE_ID)) {
695:                    return getModuleId();
696:                }
697:                if (name.equals(ConditionPeer.ISSUE_TYPE_ID)) {
698:                    return getIssueTypeId();
699:                }
700:                if (name.equals(ConditionPeer.ATTRIBUTE_ID)) {
701:                    return getAttributeId();
702:                }
703:                if (name.equals(ConditionPeer.OPTION_ID)) {
704:                    return getOptionId();
705:                }
706:                return null;
707:            }
708:
709:            /**
710:             * Retrieves a field from the object by Position as specified
711:             * in the xml schema.  Zero-based.
712:             *
713:             * @param pos position in xml schema
714:             * @return value
715:             */
716:            public Object getByPosition(int pos) {
717:                if (pos == 0) {
718:                    return getConditionId();
719:                }
720:                if (pos == 1) {
721:                    return getTransitionId();
722:                }
723:                if (pos == 2) {
724:                    return getModuleId();
725:                }
726:                if (pos == 3) {
727:                    return getIssueTypeId();
728:                }
729:                if (pos == 4) {
730:                    return getAttributeId();
731:                }
732:                if (pos == 5) {
733:                    return getOptionId();
734:                }
735:                return null;
736:            }
737:
738:            /**
739:             * Stores the object in the database.  If the object is new,
740:             * it inserts it; otherwise an update is performed.
741:             *
742:             * @throws TorqueException
743:             */
744:            public void save() throws TorqueException {
745:                save(ConditionPeer.getMapBuilder().getDatabaseMap().getName());
746:            }
747:
748:            /**
749:             * Stores the object in the database.  If the object is new,
750:             * it inserts it; otherwise an update is performed.
751:             * Note: this code is here because the method body is
752:             * auto-generated conditionally and therefore needs to be
753:             * in this file instead of in the super class, BaseObject.
754:             *
755:             * @param dbName
756:             * @throws TorqueException
757:             */
758:            public void save(String dbName) throws TorqueException {
759:                Connection con = null;
760:                try {
761:                    con = Transaction.begin(dbName);
762:                    save(con);
763:                    Transaction.commit(con);
764:                } catch (TorqueException e) {
765:                    Transaction.safeRollback(con);
766:                    throw e;
767:                }
768:            }
769:
770:            /** flag to prevent endless save loop, if this object is referenced
771:              by another object which falls in this transaction. */
772:            private boolean alreadyInSave = false;
773:
774:            /**
775:             * Stores the object in the database.  If the object is new,
776:             * it inserts it; otherwise an update is performed.  This method
777:             * is meant to be used as part of a transaction, otherwise use
778:             * the save() method and the connection details will be handled
779:             * internally
780:             *
781:             * @param con
782:             * @throws TorqueException
783:             */
784:            public void save(Connection con) throws TorqueException {
785:                if (!alreadyInSave) {
786:                    alreadyInSave = true;
787:
788:                    // If this object has been modified, then save it to the database.
789:                    if (isModified()) {
790:                        if (isNew()) {
791:                            ConditionPeer.doInsert((Condition) this , con);
792:                            setNew(false);
793:                        } else {
794:                            ConditionPeer.doUpdate((Condition) this , con);
795:                        }
796:
797:                        if (isCacheOnSave()) {
798:                            ConditionManager.putInstance(this );
799:                        }
800:                    }
801:
802:                    alreadyInSave = false;
803:                }
804:            }
805:
806:            /**
807:             * Specify whether to cache the object after saving to the db.
808:             * This method returns true
809:             */
810:            protected boolean isCacheOnSave() {
811:                return true;
812:            }
813:
814:            /**
815:             * Set the PrimaryKey using ObjectKey.
816:             *
817:             * @param key conditionId ObjectKey
818:             */
819:            public void setPrimaryKey(ObjectKey key)
820:
821:            {
822:                setConditionId(new Long(((NumberKey) key).longValue()));
823:            }
824:
825:            /**
826:             * Set the PrimaryKey using a String.
827:             *
828:             * @param key
829:             */
830:            public void setPrimaryKey(String key) {
831:                setConditionId(new Long(key));
832:            }
833:
834:            /**
835:             * returns an id that differentiates this object from others
836:             * of its class.
837:             */
838:            public ObjectKey getPrimaryKey() {
839:                return SimpleKey.keyFor(getConditionId());
840:            }
841:
842:            /**
843:             * get an id that differentiates this object from others
844:             * of its class.
845:             */
846:            public String getQueryKey() {
847:                if (getPrimaryKey() == null) {
848:                    return "";
849:                } else {
850:                    return getPrimaryKey().toString();
851:                }
852:            }
853:
854:            /**
855:             * set an id that differentiates this object from others
856:             * of its class.
857:             */
858:            public void setQueryKey(String key) throws TorqueException {
859:                setPrimaryKey(key);
860:            }
861:
862:            /**
863:             * Makes a copy of this object.
864:             * It creates a new object filling in the simple attributes.
865:             * It then fills all the association collections and sets the
866:             * related objects to isNew=true.
867:             */
868:            public Condition copy() throws TorqueException {
869:                return copyInto(new Condition());
870:            }
871:
872:            protected Condition copyInto(Condition copyObj)
873:                    throws TorqueException {
874:                copyObj.setConditionId(conditionId);
875:                copyObj.setTransitionId(transitionId);
876:                copyObj.setModuleId(moduleId);
877:                copyObj.setIssueTypeId(issueTypeId);
878:                copyObj.setAttributeId(attributeId);
879:                copyObj.setOptionId(optionId);
880:
881:                copyObj.setConditionId((Long) null);
882:
883:                return copyObj;
884:            }
885:
886:            /**
887:             * returns a peer instance associated with this om.  Since Peer classes
888:             * are not to have any instance attributes, this method returns the
889:             * same instance for all member of this class. The method could therefore
890:             * be static, but this would prevent one from overriding the behavior.
891:             */
892:            public ConditionPeer getPeer() {
893:                return peer;
894:            }
895:
896:            public String toString() {
897:                StringBuffer str = new StringBuffer();
898:                str.append("Condition:\n");
899:                str.append("ConditionId = ").append(getConditionId()).append(
900:                        "\n");
901:                str.append("TransitionId = ").append(getTransitionId()).append(
902:                        "\n");
903:                str.append("ModuleId = ").append(getModuleId()).append("\n");
904:                str.append("IssueTypeId = ").append(getIssueTypeId()).append(
905:                        "\n");
906:                str.append("AttributeId = ").append(getAttributeId()).append(
907:                        "\n");
908:                str.append("OptionId = ").append(getOptionId()).append("\n");
909:                return (str.toString());
910:            }
911:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.