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