Source Code Cross Referenced for BaseRIssueTypeOption.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 RIssueTypeOption
027:         */
028:        public abstract class BaseRIssueTypeOption extends BaseObject implements 
029:                org.apache.fulcrum.intake.Retrievable {
030:            /** The Peer class */
031:            private static final RIssueTypeOptionPeer peer = new RIssueTypeOptionPeer();
032:
033:            /** The value for the issueTypeId field */
034:            private Integer issueTypeId;
035:
036:            /** The value for the optionId field */
037:            private Integer optionId;
038:
039:            /** The value for the active field */
040:            private boolean active = true;
041:
042:            /** The value for the locked field */
043:            private boolean locked = false;
044:
045:            /** The value for the order field */
046:            private int order = -1;
047:
048:            /** The value for the weight field */
049:            private int weight = -1;
050:
051:            /**
052:             * Get the IssueTypeId
053:             *
054:             * @return Integer
055:             */
056:            public Integer getIssueTypeId() {
057:                return issueTypeId;
058:            }
059:
060:            /**
061:             * Set the value of IssueTypeId
062:             *
063:             * @param v new value
064:             */
065:            public void setIssueTypeId(Integer v) throws TorqueException {
066:
067:                if (!ObjectUtils.equals(this .issueTypeId, v)) {
068:                    this .issueTypeId = v;
069:                    setModified(true);
070:                }
071:
072:                if (aIssueType != null
073:                        && !ObjectUtils.equals(aIssueType.getIssueTypeId(), v)) {
074:                    aIssueType = null;
075:                }
076:
077:            }
078:
079:            /**
080:             * Get the OptionId
081:             *
082:             * @return Integer
083:             */
084:            public Integer getOptionId() {
085:                return optionId;
086:            }
087:
088:            /**
089:             * Set the value of OptionId
090:             *
091:             * @param v new value
092:             */
093:            public void setOptionId(Integer v) throws TorqueException {
094:
095:                if (!ObjectUtils.equals(this .optionId, v)) {
096:                    this .optionId = v;
097:                    setModified(true);
098:                }
099:
100:                if (aAttributeOption != null
101:                        && !ObjectUtils.equals(aAttributeOption.getOptionId(),
102:                                v)) {
103:                    aAttributeOption = null;
104:                }
105:
106:            }
107:
108:            /**
109:             * Get the Active
110:             *
111:             * @return boolean
112:             */
113:            public boolean getActive() {
114:                return active;
115:            }
116:
117:            /**
118:             * Set the value of Active
119:             *
120:             * @param v new value
121:             */
122:            public void setActive(boolean v) {
123:
124:                if (this .active != v) {
125:                    this .active = v;
126:                    setModified(true);
127:                }
128:
129:            }
130:
131:            /**
132:             * Get the Locked
133:             *
134:             * @return boolean
135:             */
136:            public boolean getLocked() {
137:                return locked;
138:            }
139:
140:            /**
141:             * Set the value of Locked
142:             *
143:             * @param v new value
144:             */
145:            public void setLocked(boolean v) {
146:
147:                if (this .locked != v) {
148:                    this .locked = v;
149:                    setModified(true);
150:                }
151:
152:            }
153:
154:            /**
155:             * Get the Order
156:             *
157:             * @return int
158:             */
159:            public int getOrder() {
160:                return order;
161:            }
162:
163:            /**
164:             * Set the value of Order
165:             *
166:             * @param v new value
167:             */
168:            public void setOrder(int v) {
169:
170:                if (this .order != v) {
171:                    this .order = v;
172:                    setModified(true);
173:                }
174:
175:            }
176:
177:            /**
178:             * Get the Weight
179:             *
180:             * @return int
181:             */
182:            public int getWeight() {
183:                return weight;
184:            }
185:
186:            /**
187:             * Set the value of Weight
188:             *
189:             * @param v new value
190:             */
191:            public void setWeight(int v) {
192:
193:                if (this .weight != v) {
194:                    this .weight = v;
195:                    setModified(true);
196:                }
197:
198:            }
199:
200:            private AttributeOption aAttributeOption;
201:
202:            /**
203:             * Declares an association between this object and a AttributeOption object
204:             *
205:             * @param v AttributeOption
206:             * @throws TorqueException
207:             */
208:            public void setAttributeOption(AttributeOption v)
209:                    throws TorqueException {
210:                if (v == null) {
211:                    setOptionId((Integer) null);
212:                } else {
213:                    setOptionId(v.getOptionId());
214:                }
215:                aAttributeOption = v;
216:            }
217:
218:            /**
219:             * Returns the associated AttributeOption object.
220:             * If it was not retrieved before, the object is retrieved from
221:             * the database
222:             *
223:             * @return the associated AttributeOption object
224:             * @throws TorqueException
225:             */
226:            public AttributeOption getAttributeOption() throws TorqueException {
227:                if (aAttributeOption == null
228:                        && (!ObjectUtils.equals(this .optionId, null))) {
229:                    aAttributeOption = AttributeOptionManager
230:                            .getInstance(SimpleKey.keyFor(this .optionId));
231:                }
232:                return aAttributeOption;
233:            }
234:
235:            /**
236:             * Return the associated AttributeOption object
237:             * If it was not retrieved before, the object is retrieved from
238:             * the database using the passed connection
239:             *
240:             * @param connection the connection used to retrieve the associated object
241:             *        from the database, if it was not retrieved before
242:             * @return the associated AttributeOption object
243:             * @throws TorqueException
244:             */
245:            public AttributeOption getAttributeOption(Connection connection)
246:                    throws TorqueException {
247:                if (aAttributeOption == null
248:                        && (!ObjectUtils.equals(this .optionId, null))) {
249:                    aAttributeOption = AttributeOptionManager
250:                            .getCachedInstance(SimpleKey.keyFor(this .optionId));
251:                    if (aAttributeOption == null) {
252:                        aAttributeOption = AttributeOptionPeer.retrieveByPK(
253:                                SimpleKey.keyFor(this .optionId), connection);
254:                        AttributeOptionManager.putInstance(aAttributeOption);
255:                    }
256:                }
257:                return aAttributeOption;
258:            }
259:
260:            /**
261:             * Provides convenient way to set a relationship based on a
262:             * ObjectKey, for example
263:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
264:             *
265:             */
266:            public void setAttributeOptionKey(ObjectKey key)
267:                    throws TorqueException {
268:
269:                setOptionId(new Integer(((NumberKey) key).intValue()));
270:            }
271:
272:            private IssueType aIssueType;
273:
274:            /**
275:             * Declares an association between this object and a IssueType object
276:             *
277:             * @param v IssueType
278:             * @throws TorqueException
279:             */
280:            public void setIssueType(IssueType v) throws TorqueException {
281:                if (v == null) {
282:                    setIssueTypeId((Integer) null);
283:                } else {
284:                    setIssueTypeId(v.getIssueTypeId());
285:                }
286:                aIssueType = v;
287:            }
288:
289:            /**
290:             * Returns the associated IssueType object.
291:             * If it was not retrieved before, the object is retrieved from
292:             * the database
293:             *
294:             * @return the associated IssueType object
295:             * @throws TorqueException
296:             */
297:            public IssueType getIssueType() throws TorqueException {
298:                if (aIssueType == null
299:                        && (!ObjectUtils.equals(this .issueTypeId, null))) {
300:                    aIssueType = IssueTypeManager.getInstance(SimpleKey
301:                            .keyFor(this .issueTypeId));
302:                }
303:                return aIssueType;
304:            }
305:
306:            /**
307:             * Return the associated IssueType object
308:             * If it was not retrieved before, the object is retrieved from
309:             * the database using the passed connection
310:             *
311:             * @param connection the connection used to retrieve the associated object
312:             *        from the database, if it was not retrieved before
313:             * @return the associated IssueType object
314:             * @throws TorqueException
315:             */
316:            public IssueType getIssueType(Connection connection)
317:                    throws TorqueException {
318:                if (aIssueType == null
319:                        && (!ObjectUtils.equals(this .issueTypeId, null))) {
320:                    aIssueType = IssueTypeManager.getCachedInstance(SimpleKey
321:                            .keyFor(this .issueTypeId));
322:                    if (aIssueType == null) {
323:                        aIssueType = IssueTypePeer.retrieveByPK(SimpleKey
324:                                .keyFor(this .issueTypeId), connection);
325:                        IssueTypeManager.putInstance(aIssueType);
326:                    }
327:                }
328:                return aIssueType;
329:            }
330:
331:            /**
332:             * Provides convenient way to set a relationship based on a
333:             * ObjectKey, for example
334:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
335:             *
336:             */
337:            public void setIssueTypeKey(ObjectKey key) throws TorqueException {
338:
339:                setIssueTypeId(new Integer(((NumberKey) key).intValue()));
340:            }
341:
342:            private static List fieldNames = null;
343:
344:            /**
345:             * Generate a list of field names.
346:             *
347:             * @return a list of field names
348:             */
349:            public static synchronized List getFieldNames() {
350:                if (fieldNames == null) {
351:                    fieldNames = new ArrayList();
352:                    fieldNames.add("IssueTypeId");
353:                    fieldNames.add("OptionId");
354:                    fieldNames.add("Active");
355:                    fieldNames.add("Locked");
356:                    fieldNames.add("Order");
357:                    fieldNames.add("Weight");
358:                    fieldNames = Collections.unmodifiableList(fieldNames);
359:                }
360:                return fieldNames;
361:            }
362:
363:            /**
364:             * Retrieves a field from the object by name passed in as a String.
365:             *
366:             * @param name field name
367:             * @return value
368:             */
369:            public Object getByName(String name) {
370:                if (name.equals("IssueTypeId")) {
371:                    return getIssueTypeId();
372:                }
373:                if (name.equals("OptionId")) {
374:                    return getOptionId();
375:                }
376:                if (name.equals("Active")) {
377:                    return Boolean.valueOf(getActive());
378:                }
379:                if (name.equals("Locked")) {
380:                    return Boolean.valueOf(getLocked());
381:                }
382:                if (name.equals("Order")) {
383:                    return new Integer(getOrder());
384:                }
385:                if (name.equals("Weight")) {
386:                    return new Integer(getWeight());
387:                }
388:                return null;
389:            }
390:
391:            /**
392:             * Retrieves a field from the object by name passed in
393:             * as a String.  The String must be one of the static
394:             * Strings defined in this Class' Peer.
395:             *
396:             * @param name peer name
397:             * @return value
398:             */
399:            public Object getByPeerName(String name) {
400:                if (name.equals(RIssueTypeOptionPeer.ISSUE_TYPE_ID)) {
401:                    return getIssueTypeId();
402:                }
403:                if (name.equals(RIssueTypeOptionPeer.OPTION_ID)) {
404:                    return getOptionId();
405:                }
406:                if (name.equals(RIssueTypeOptionPeer.ACTIVE)) {
407:                    return Boolean.valueOf(getActive());
408:                }
409:                if (name.equals(RIssueTypeOptionPeer.LOCKED)) {
410:                    return Boolean.valueOf(getLocked());
411:                }
412:                if (name.equals(RIssueTypeOptionPeer.PREFERRED_ORDER)) {
413:                    return new Integer(getOrder());
414:                }
415:                if (name.equals(RIssueTypeOptionPeer.WEIGHT)) {
416:                    return new Integer(getWeight());
417:                }
418:                return null;
419:            }
420:
421:            /**
422:             * Retrieves a field from the object by Position as specified
423:             * in the xml schema.  Zero-based.
424:             *
425:             * @param pos position in xml schema
426:             * @return value
427:             */
428:            public Object getByPosition(int pos) {
429:                if (pos == 0) {
430:                    return getIssueTypeId();
431:                }
432:                if (pos == 1) {
433:                    return getOptionId();
434:                }
435:                if (pos == 2) {
436:                    return Boolean.valueOf(getActive());
437:                }
438:                if (pos == 3) {
439:                    return Boolean.valueOf(getLocked());
440:                }
441:                if (pos == 4) {
442:                    return new Integer(getOrder());
443:                }
444:                if (pos == 5) {
445:                    return new Integer(getWeight());
446:                }
447:                return null;
448:            }
449:
450:            /**
451:             * Stores the object in the database.  If the object is new,
452:             * it inserts it; otherwise an update is performed.
453:             *
454:             * @throws TorqueException
455:             */
456:            public void save() throws TorqueException {
457:                save(RIssueTypeOptionPeer.getMapBuilder().getDatabaseMap()
458:                        .getName());
459:            }
460:
461:            /**
462:             * Stores the object in the database.  If the object is new,
463:             * it inserts it; otherwise an update is performed.
464:             * Note: this code is here because the method body is
465:             * auto-generated conditionally and therefore needs to be
466:             * in this file instead of in the super class, BaseObject.
467:             *
468:             * @param dbName
469:             * @throws TorqueException
470:             */
471:            public void save(String dbName) throws TorqueException {
472:                Connection con = null;
473:                try {
474:                    con = Transaction.begin(dbName);
475:                    save(con);
476:                    Transaction.commit(con);
477:                } catch (TorqueException e) {
478:                    Transaction.safeRollback(con);
479:                    throw e;
480:                }
481:            }
482:
483:            /** flag to prevent endless save loop, if this object is referenced
484:              by another object which falls in this transaction. */
485:            private boolean alreadyInSave = false;
486:
487:            /**
488:             * Stores the object in the database.  If the object is new,
489:             * it inserts it; otherwise an update is performed.  This method
490:             * is meant to be used as part of a transaction, otherwise use
491:             * the save() method and the connection details will be handled
492:             * internally
493:             *
494:             * @param con
495:             * @throws TorqueException
496:             */
497:            public void save(Connection con) throws TorqueException {
498:                if (!alreadyInSave) {
499:                    alreadyInSave = true;
500:
501:                    // If this object has been modified, then save it to the database.
502:                    if (isModified()) {
503:                        if (isNew()) {
504:                            RIssueTypeOptionPeer.doInsert(
505:                                    (RIssueTypeOption) this , con);
506:                            setNew(false);
507:                        } else {
508:                            RIssueTypeOptionPeer.doUpdate(
509:                                    (RIssueTypeOption) this , con);
510:                        }
511:
512:                        if (isCacheOnSave()) {
513:                            RIssueTypeOptionManager.putInstance(this );
514:                        }
515:                    }
516:
517:                    alreadyInSave = false;
518:                }
519:            }
520:
521:            /**
522:             * Specify whether to cache the object after saving to the db.
523:             * This method returns true
524:             */
525:            protected boolean isCacheOnSave() {
526:                return true;
527:            }
528:
529:            private final SimpleKey[] pks = new SimpleKey[2];
530:            private final ComboKey comboPK = new ComboKey(pks);
531:
532:            /**
533:             * Set the PrimaryKey with an ObjectKey
534:             *
535:             * @param key
536:             */
537:            public void setPrimaryKey(ObjectKey key) throws TorqueException {
538:                SimpleKey[] keys = (SimpleKey[]) key.getValue();
539:                SimpleKey tmpKey = null;
540:                setIssueTypeId(new Integer(((NumberKey) keys[0]).intValue()));
541:                setOptionId(new Integer(((NumberKey) keys[1]).intValue()));
542:            }
543:
544:            /**
545:             * Set the PrimaryKey using SimpleKeys.
546:             *
547:             * @param issueTypeId Integer
548:             * @param optionId Integer
549:             */
550:            public void setPrimaryKey(Integer issueTypeId, Integer optionId)
551:                    throws TorqueException {
552:                setIssueTypeId(issueTypeId);
553:                setOptionId(optionId);
554:            }
555:
556:            /**
557:             * Set the PrimaryKey using a String.
558:             */
559:            public void setPrimaryKey(String key) throws TorqueException {
560:                setPrimaryKey(new ComboKey(key));
561:            }
562:
563:            /**
564:             * returns an id that differentiates this object from others
565:             * of its class.
566:             */
567:            public ObjectKey getPrimaryKey() {
568:                pks[0] = SimpleKey.keyFor(getIssueTypeId());
569:                pks[1] = SimpleKey.keyFor(getOptionId());
570:                return comboPK;
571:            }
572:
573:            /**
574:             * get an id that differentiates this object from others
575:             * of its class.
576:             */
577:            public String getQueryKey() {
578:                if (getPrimaryKey() == null) {
579:                    return "";
580:                } else {
581:                    return getPrimaryKey().toString();
582:                }
583:            }
584:
585:            /**
586:             * set an id that differentiates this object from others
587:             * of its class.
588:             */
589:            public void setQueryKey(String key) throws TorqueException {
590:                setPrimaryKey(key);
591:            }
592:
593:            /**
594:             * Makes a copy of this object.
595:             * It creates a new object filling in the simple attributes.
596:             * It then fills all the association collections and sets the
597:             * related objects to isNew=true.
598:             */
599:            public RIssueTypeOption copy() throws TorqueException {
600:                return copyInto(new RIssueTypeOption());
601:            }
602:
603:            protected RIssueTypeOption copyInto(RIssueTypeOption copyObj)
604:                    throws TorqueException {
605:                copyObj.setIssueTypeId(issueTypeId);
606:                copyObj.setOptionId(optionId);
607:                copyObj.setActive(active);
608:                copyObj.setLocked(locked);
609:                copyObj.setOrder(order);
610:                copyObj.setWeight(weight);
611:
612:                copyObj.setIssueTypeId((Integer) null);
613:                copyObj.setOptionId((Integer) null);
614:
615:                return copyObj;
616:            }
617:
618:            /**
619:             * returns a peer instance associated with this om.  Since Peer classes
620:             * are not to have any instance attributes, this method returns the
621:             * same instance for all member of this class. The method could therefore
622:             * be static, but this would prevent one from overriding the behavior.
623:             */
624:            public RIssueTypeOptionPeer getPeer() {
625:                return peer;
626:            }
627:
628:            public String toString() {
629:                StringBuffer str = new StringBuffer();
630:                str.append("RIssueTypeOption:\n");
631:                str.append("IssueTypeId = ").append(getIssueTypeId()).append(
632:                        "\n");
633:                str.append("OptionId = ").append(getOptionId()).append("\n");
634:                str.append("Active = ").append(getActive()).append("\n");
635:                str.append("Locked = ").append(getLocked()).append("\n");
636:                str.append("Order = ").append(getOrder()).append("\n");
637:                str.append("Weight = ").append(getWeight()).append("\n");
638:                return (str.toString());
639:            }
640:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.