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