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