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


0001:        package org.tigris.scarab.om;
0002:
0003:        import java.math.BigDecimal;
0004:        import java.sql.Connection;
0005:        import java.util.ArrayList;
0006:        import java.util.Collections;
0007:        import java.util.Date;
0008:        import java.util.List;
0009:
0010:        import org.apache.commons.lang.ObjectUtils;
0011:        import org.apache.fulcrum.intake.Retrievable;
0012:        import org.apache.torque.TorqueException;
0013:        import org.apache.torque.om.BaseObject;
0014:        import org.apache.torque.om.ComboKey;
0015:        import org.apache.torque.om.DateKey;
0016:        import org.apache.torque.om.NumberKey;
0017:        import org.apache.torque.om.ObjectKey;
0018:        import org.apache.torque.om.SimpleKey;
0019:        import org.apache.torque.om.StringKey;
0020:        import org.apache.torque.om.Persistent;
0021:        import org.apache.torque.util.Criteria;
0022:        import org.apache.torque.util.Transaction;
0023:
0024:        /**
0025:         * You should not use this class directly.  It should not even be
0026:         * extended all references should be to Attachment
0027:         */
0028:        public abstract class BaseAttachment extends BaseObject implements 
0029:                org.apache.fulcrum.intake.Retrievable {
0030:            /** The Peer class */
0031:            private static final AttachmentPeer peer = new AttachmentPeer();
0032:
0033:            /** The value for the attachmentId field */
0034:            private Long attachmentId;
0035:
0036:            /** The value for the issueId field */
0037:            private Long issueId;
0038:
0039:            /** The value for the typeId field */
0040:            private Integer typeId;
0041:
0042:            /** The value for the name field */
0043:            private String name;
0044:
0045:            /** The value for the data field */
0046:            private String data;
0047:
0048:            /** The value for the fileName field */
0049:            private String fileName;
0050:
0051:            /** The value for the mimeType field */
0052:            private String mimeType;
0053:
0054:            /** The value for the modifiedBy field */
0055:            private Integer modifiedBy;
0056:
0057:            /** The value for the createdBy field */
0058:            private Integer createdBy;
0059:
0060:            /** The value for the modifiedDate field */
0061:            private Date modifiedDate;
0062:
0063:            /** The value for the createdDate field */
0064:            private Date createdDate;
0065:
0066:            /** The value for the deleted field */
0067:            private boolean deleted = false;
0068:
0069:            /**
0070:             * Get the AttachmentId
0071:             *
0072:             * @return Long
0073:             */
0074:            public Long getAttachmentId() {
0075:                return attachmentId;
0076:            }
0077:
0078:            /**
0079:             * Set the value of AttachmentId
0080:             *
0081:             * @param v new value
0082:             */
0083:            public void setAttachmentId(Long v) throws TorqueException {
0084:
0085:                if (!ObjectUtils.equals(this .attachmentId, v)) {
0086:                    this .attachmentId = v;
0087:                    setModified(true);
0088:                }
0089:
0090:                // update associated Activity
0091:                if (collActivitys != null) {
0092:                    for (int i = 0; i < collActivitys.size(); i++) {
0093:                        ((Activity) collActivitys.get(i)).setAttachmentId(v);
0094:                    }
0095:                }
0096:
0097:                // update associated ActivitySet
0098:                if (collActivitySets != null) {
0099:                    for (int i = 0; i < collActivitySets.size(); i++) {
0100:                        ((ActivitySet) collActivitySets.get(i))
0101:                                .setAttachmentId(v);
0102:                    }
0103:                }
0104:            }
0105:
0106:            /**
0107:             * Get the IssueId
0108:             *
0109:             * @return Long
0110:             */
0111:            public Long getIssueId() {
0112:                return issueId;
0113:            }
0114:
0115:            /**
0116:             * Set the value of IssueId
0117:             *
0118:             * @param v new value
0119:             */
0120:            public void setIssueId(Long v) throws TorqueException {
0121:
0122:                if (!ObjectUtils.equals(this .issueId, v)) {
0123:                    this .issueId = v;
0124:                    setModified(true);
0125:                }
0126:
0127:                if (aIssue != null
0128:                        && !ObjectUtils.equals(aIssue.getIssueId(), v)) {
0129:                    aIssue = null;
0130:                }
0131:
0132:            }
0133:
0134:            /**
0135:             * Get the TypeId
0136:             *
0137:             * @return Integer
0138:             */
0139:            public Integer getTypeId() {
0140:                return typeId;
0141:            }
0142:
0143:            /**
0144:             * Set the value of TypeId
0145:             *
0146:             * @param v new value
0147:             */
0148:            public void setTypeId(Integer v) throws TorqueException {
0149:
0150:                if (!ObjectUtils.equals(this .typeId, v)) {
0151:                    this .typeId = v;
0152:                    setModified(true);
0153:                }
0154:
0155:                if (aAttachmentType != null
0156:                        && !ObjectUtils.equals(aAttachmentType
0157:                                .getAttachmentTypeId(), v)) {
0158:                    aAttachmentType = null;
0159:                }
0160:
0161:            }
0162:
0163:            /**
0164:             * Get the Name
0165:             *
0166:             * @return String
0167:             */
0168:            public String getName() {
0169:                return name;
0170:            }
0171:
0172:            /**
0173:             * Set the value of Name
0174:             *
0175:             * @param v new value
0176:             */
0177:            public void setName(String v) {
0178:
0179:                if (!ObjectUtils.equals(this .name, v)) {
0180:                    this .name = v;
0181:                    setModified(true);
0182:                }
0183:
0184:            }
0185:
0186:            /**
0187:             * Get the Data
0188:             *
0189:             * @return String
0190:             */
0191:            public String getData() {
0192:                return data;
0193:            }
0194:
0195:            /**
0196:             * Set the value of Data
0197:             *
0198:             * @param v new value
0199:             */
0200:            public void setData(String v) {
0201:
0202:                if (!ObjectUtils.equals(this .data, v)) {
0203:                    this .data = v;
0204:                    setModified(true);
0205:                }
0206:
0207:            }
0208:
0209:            /**
0210:             * Get the FileName
0211:             *
0212:             * @return String
0213:             */
0214:            public String getFileName() {
0215:                return fileName;
0216:            }
0217:
0218:            /**
0219:             * Set the value of FileName
0220:             *
0221:             * @param v new value
0222:             */
0223:            public void setFileName(String v) {
0224:
0225:                if (!ObjectUtils.equals(this .fileName, v)) {
0226:                    this .fileName = v;
0227:                    setModified(true);
0228:                }
0229:
0230:            }
0231:
0232:            /**
0233:             * Get the MimeType
0234:             *
0235:             * @return String
0236:             */
0237:            public String getMimeType() {
0238:                return mimeType;
0239:            }
0240:
0241:            /**
0242:             * Set the value of MimeType
0243:             *
0244:             * @param v new value
0245:             */
0246:            public void setMimeType(String v) {
0247:
0248:                if (!ObjectUtils.equals(this .mimeType, v)) {
0249:                    this .mimeType = v;
0250:                    setModified(true);
0251:                }
0252:
0253:            }
0254:
0255:            /**
0256:             * Get the ModifiedBy
0257:             *
0258:             * @return Integer
0259:             */
0260:            public Integer getModifiedBy() {
0261:                return modifiedBy;
0262:            }
0263:
0264:            /**
0265:             * Set the value of ModifiedBy
0266:             *
0267:             * @param v new value
0268:             */
0269:            public void setModifiedBy(Integer v) throws TorqueException {
0270:
0271:                if (!ObjectUtils.equals(this .modifiedBy, v)) {
0272:                    this .modifiedBy = v;
0273:                    setModified(true);
0274:                }
0275:
0276:                if (aScarabUserRelatedByModifiedBy != null
0277:                        && !ObjectUtils.equals(aScarabUserRelatedByModifiedBy
0278:                                .getUserId(), v)) {
0279:                    aScarabUserRelatedByModifiedBy = null;
0280:                }
0281:
0282:            }
0283:
0284:            /**
0285:             * Get the CreatedBy
0286:             *
0287:             * @return Integer
0288:             */
0289:            public Integer getCreatedBy() {
0290:                return createdBy;
0291:            }
0292:
0293:            /**
0294:             * Set the value of CreatedBy
0295:             *
0296:             * @param v new value
0297:             */
0298:            public void setCreatedBy(Integer v) throws TorqueException {
0299:
0300:                if (!ObjectUtils.equals(this .createdBy, v)) {
0301:                    this .createdBy = v;
0302:                    setModified(true);
0303:                }
0304:
0305:                if (aScarabUserRelatedByCreatedBy != null
0306:                        && !ObjectUtils.equals(aScarabUserRelatedByCreatedBy
0307:                                .getUserId(), v)) {
0308:                    aScarabUserRelatedByCreatedBy = null;
0309:                }
0310:
0311:            }
0312:
0313:            /**
0314:             * Get the ModifiedDate
0315:             *
0316:             * @return Date
0317:             */
0318:            public Date getModifiedDate() {
0319:                return modifiedDate;
0320:            }
0321:
0322:            /**
0323:             * Set the value of ModifiedDate
0324:             *
0325:             * @param v new value
0326:             */
0327:            public void setModifiedDate(Date v) {
0328:
0329:                if (!ObjectUtils.equals(this .modifiedDate, v)) {
0330:                    this .modifiedDate = v;
0331:                    setModified(true);
0332:                }
0333:
0334:            }
0335:
0336:            /**
0337:             * Get the CreatedDate
0338:             *
0339:             * @return Date
0340:             */
0341:            public Date getCreatedDate() {
0342:                return createdDate;
0343:            }
0344:
0345:            /**
0346:             * Set the value of CreatedDate
0347:             *
0348:             * @param v new value
0349:             */
0350:            public void setCreatedDate(Date v) {
0351:
0352:                if (!ObjectUtils.equals(this .createdDate, v)) {
0353:                    this .createdDate = v;
0354:                    setModified(true);
0355:                }
0356:
0357:            }
0358:
0359:            /**
0360:             * Get the Deleted
0361:             *
0362:             * @return boolean
0363:             */
0364:            public boolean getDeleted() {
0365:                return deleted;
0366:            }
0367:
0368:            /**
0369:             * Set the value of Deleted
0370:             *
0371:             * @param v new value
0372:             */
0373:            public void setDeleted(boolean v) {
0374:
0375:                if (this .deleted != v) {
0376:                    this .deleted = v;
0377:                    setModified(true);
0378:                }
0379:
0380:            }
0381:
0382:            private Issue aIssue;
0383:
0384:            /**
0385:             * Declares an association between this object and a Issue object
0386:             *
0387:             * @param v Issue
0388:             * @throws TorqueException
0389:             */
0390:            public void setIssue(Issue v) throws TorqueException {
0391:                if (v == null) {
0392:                    setIssueId((Long) null);
0393:                } else {
0394:                    setIssueId(v.getIssueId());
0395:                }
0396:                aIssue = v;
0397:            }
0398:
0399:            /**
0400:             * Returns the associated Issue object.
0401:             * If it was not retrieved before, the object is retrieved from
0402:             * the database
0403:             *
0404:             * @return the associated Issue object
0405:             * @throws TorqueException
0406:             */
0407:            public Issue getIssue() throws TorqueException {
0408:                if (aIssue == null && (!ObjectUtils.equals(this .issueId, null))) {
0409:                    aIssue = IssueManager.getInstance(SimpleKey
0410:                            .keyFor(this .issueId));
0411:                }
0412:                return aIssue;
0413:            }
0414:
0415:            /**
0416:             * Return the associated Issue object
0417:             * If it was not retrieved before, the object is retrieved from
0418:             * the database using the passed connection
0419:             *
0420:             * @param connection the connection used to retrieve the associated object
0421:             *        from the database, if it was not retrieved before
0422:             * @return the associated Issue object
0423:             * @throws TorqueException
0424:             */
0425:            public Issue getIssue(Connection connection) throws TorqueException {
0426:                if (aIssue == null && (!ObjectUtils.equals(this .issueId, null))) {
0427:                    aIssue = IssueManager.getCachedInstance(SimpleKey
0428:                            .keyFor(this .issueId));
0429:                    if (aIssue == null) {
0430:                        aIssue = IssuePeer.retrieveByPK(SimpleKey
0431:                                .keyFor(this .issueId), connection);
0432:                        IssueManager.putInstance(aIssue);
0433:                    }
0434:                }
0435:                return aIssue;
0436:            }
0437:
0438:            /**
0439:             * Provides convenient way to set a relationship based on a
0440:             * ObjectKey, for example
0441:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0442:             *
0443:             */
0444:            public void setIssueKey(ObjectKey key) throws TorqueException {
0445:
0446:                setIssueId(new Long(((NumberKey) key).longValue()));
0447:            }
0448:
0449:            private AttachmentType aAttachmentType;
0450:
0451:            /**
0452:             * Declares an association between this object and a AttachmentType object
0453:             *
0454:             * @param v AttachmentType
0455:             * @throws TorqueException
0456:             */
0457:            public void setAttachmentType(AttachmentType v)
0458:                    throws TorqueException {
0459:                if (v == null) {
0460:                    setTypeId((Integer) null);
0461:                } else {
0462:                    setTypeId(v.getAttachmentTypeId());
0463:                }
0464:                aAttachmentType = v;
0465:            }
0466:
0467:            /**
0468:             * Returns the associated AttachmentType object.
0469:             * If it was not retrieved before, the object is retrieved from
0470:             * the database
0471:             *
0472:             * @return the associated AttachmentType object
0473:             * @throws TorqueException
0474:             */
0475:            public AttachmentType getAttachmentType() throws TorqueException {
0476:                if (aAttachmentType == null
0477:                        && (!ObjectUtils.equals(this .typeId, null))) {
0478:                    aAttachmentType = AttachmentTypeManager
0479:                            .getInstance(SimpleKey.keyFor(this .typeId));
0480:                }
0481:                return aAttachmentType;
0482:            }
0483:
0484:            /**
0485:             * Return the associated AttachmentType object
0486:             * If it was not retrieved before, the object is retrieved from
0487:             * the database using the passed connection
0488:             *
0489:             * @param connection the connection used to retrieve the associated object
0490:             *        from the database, if it was not retrieved before
0491:             * @return the associated AttachmentType object
0492:             * @throws TorqueException
0493:             */
0494:            public AttachmentType getAttachmentType(Connection connection)
0495:                    throws TorqueException {
0496:                if (aAttachmentType == null
0497:                        && (!ObjectUtils.equals(this .typeId, null))) {
0498:                    aAttachmentType = AttachmentTypeManager
0499:                            .getCachedInstance(SimpleKey.keyFor(this .typeId));
0500:                    if (aAttachmentType == null) {
0501:                        aAttachmentType = AttachmentTypePeer.retrieveByPK(
0502:                                SimpleKey.keyFor(this .typeId), connection);
0503:                        AttachmentTypeManager.putInstance(aAttachmentType);
0504:                    }
0505:                }
0506:                return aAttachmentType;
0507:            }
0508:
0509:            /**
0510:             * Provides convenient way to set a relationship based on a
0511:             * ObjectKey, for example
0512:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0513:             *
0514:             */
0515:            public void setAttachmentTypeKey(ObjectKey key)
0516:                    throws TorqueException {
0517:
0518:                setTypeId(new Integer(((NumberKey) key).intValue()));
0519:            }
0520:
0521:            private ScarabUser aScarabUserRelatedByCreatedBy;
0522:
0523:            /**
0524:             * Declares an association between this object and a ScarabUser object
0525:             *
0526:             * @param v ScarabUser
0527:             * @throws TorqueException
0528:             */
0529:            public void setScarabUserRelatedByCreatedBy(ScarabUser v)
0530:                    throws TorqueException {
0531:                if (v == null) {
0532:                    setCreatedBy((Integer) null);
0533:                } else {
0534:                    setCreatedBy(v.getUserId());
0535:                }
0536:                aScarabUserRelatedByCreatedBy = v;
0537:            }
0538:
0539:            /**
0540:             * Returns the associated ScarabUser object.
0541:             * If it was not retrieved before, the object is retrieved from
0542:             * the database
0543:             *
0544:             * @return the associated ScarabUser object
0545:             * @throws TorqueException
0546:             */
0547:            public ScarabUser getScarabUserRelatedByCreatedBy()
0548:                    throws TorqueException {
0549:                if (aScarabUserRelatedByCreatedBy == null
0550:                        && (!ObjectUtils.equals(this .createdBy, null))) {
0551:                    aScarabUserRelatedByCreatedBy = ScarabUserManager
0552:                            .getInstance(SimpleKey.keyFor(this .createdBy));
0553:                }
0554:                return aScarabUserRelatedByCreatedBy;
0555:            }
0556:
0557:            /**
0558:             * Return the associated ScarabUser object
0559:             * If it was not retrieved before, the object is retrieved from
0560:             * the database using the passed connection
0561:             *
0562:             * @param connection the connection used to retrieve the associated object
0563:             *        from the database, if it was not retrieved before
0564:             * @return the associated ScarabUser object
0565:             * @throws TorqueException
0566:             */
0567:            public ScarabUser getScarabUserRelatedByCreatedBy(
0568:                    Connection connection) throws TorqueException {
0569:                if (aScarabUserRelatedByCreatedBy == null
0570:                        && (!ObjectUtils.equals(this .createdBy, null))) {
0571:                    aScarabUserRelatedByCreatedBy = ScarabUserManager
0572:                            .getCachedInstance(SimpleKey.keyFor(this .createdBy));
0573:                    if (aScarabUserRelatedByCreatedBy == null) {
0574:                        aScarabUserRelatedByCreatedBy = ScarabUserImplPeer
0575:                                .retrieveScarabUserImplByPK(SimpleKey
0576:                                        .keyFor(this .createdBy), connection);
0577:                        ScarabUserManager
0578:                                .putInstance(aScarabUserRelatedByCreatedBy);
0579:                    }
0580:                }
0581:                return aScarabUserRelatedByCreatedBy;
0582:            }
0583:
0584:            /**
0585:             * Provides convenient way to set a relationship based on a
0586:             * ObjectKey, for example
0587:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0588:             *
0589:             */
0590:            public void setScarabUserRelatedByCreatedByKey(ObjectKey key)
0591:                    throws TorqueException {
0592:
0593:                setCreatedBy(new Integer(((NumberKey) key).intValue()));
0594:            }
0595:
0596:            private ScarabUser aScarabUserRelatedByModifiedBy;
0597:
0598:            /**
0599:             * Declares an association between this object and a ScarabUser object
0600:             *
0601:             * @param v ScarabUser
0602:             * @throws TorqueException
0603:             */
0604:            public void setScarabUserRelatedByModifiedBy(ScarabUser v)
0605:                    throws TorqueException {
0606:                if (v == null) {
0607:                    setModifiedBy((Integer) null);
0608:                } else {
0609:                    setModifiedBy(v.getUserId());
0610:                }
0611:                aScarabUserRelatedByModifiedBy = v;
0612:            }
0613:
0614:            /**
0615:             * Returns the associated ScarabUser object.
0616:             * If it was not retrieved before, the object is retrieved from
0617:             * the database
0618:             *
0619:             * @return the associated ScarabUser object
0620:             * @throws TorqueException
0621:             */
0622:            public ScarabUser getScarabUserRelatedByModifiedBy()
0623:                    throws TorqueException {
0624:                if (aScarabUserRelatedByModifiedBy == null
0625:                        && (!ObjectUtils.equals(this .modifiedBy, null))) {
0626:                    aScarabUserRelatedByModifiedBy = ScarabUserManager
0627:                            .getInstance(SimpleKey.keyFor(this .modifiedBy));
0628:                }
0629:                return aScarabUserRelatedByModifiedBy;
0630:            }
0631:
0632:            /**
0633:             * Return the associated ScarabUser object
0634:             * If it was not retrieved before, the object is retrieved from
0635:             * the database using the passed connection
0636:             *
0637:             * @param connection the connection used to retrieve the associated object
0638:             *        from the database, if it was not retrieved before
0639:             * @return the associated ScarabUser object
0640:             * @throws TorqueException
0641:             */
0642:            public ScarabUser getScarabUserRelatedByModifiedBy(
0643:                    Connection connection) throws TorqueException {
0644:                if (aScarabUserRelatedByModifiedBy == null
0645:                        && (!ObjectUtils.equals(this .modifiedBy, null))) {
0646:                    aScarabUserRelatedByModifiedBy = ScarabUserManager
0647:                            .getCachedInstance(SimpleKey
0648:                                    .keyFor(this .modifiedBy));
0649:                    if (aScarabUserRelatedByModifiedBy == null) {
0650:                        aScarabUserRelatedByModifiedBy = ScarabUserImplPeer
0651:                                .retrieveScarabUserImplByPK(SimpleKey
0652:                                        .keyFor(this .modifiedBy), connection);
0653:                        ScarabUserManager
0654:                                .putInstance(aScarabUserRelatedByModifiedBy);
0655:                    }
0656:                }
0657:                return aScarabUserRelatedByModifiedBy;
0658:            }
0659:
0660:            /**
0661:             * Provides convenient way to set a relationship based on a
0662:             * ObjectKey, for example
0663:             * <code>bar.setFooKey(foo.getPrimaryKey())</code>
0664:             *
0665:             */
0666:            public void setScarabUserRelatedByModifiedByKey(ObjectKey key)
0667:                    throws TorqueException {
0668:
0669:                setModifiedBy(new Integer(((NumberKey) key).intValue()));
0670:            }
0671:
0672:            /**
0673:             * Collection to store aggregation of collActivitys
0674:             */
0675:            protected List collActivitys;
0676:
0677:            /**
0678:             * Temporary storage of collActivitys to save a possible db hit in
0679:             * the event objects are add to the collection, but the
0680:             * complete collection is never requested.
0681:             */
0682:            protected void initActivitys() {
0683:                if (collActivitys == null) {
0684:                    collActivitys = new ArrayList();
0685:                }
0686:            }
0687:
0688:            /**
0689:             * Method called to associate a Activity object to this object
0690:             * through the Activity foreign key attribute
0691:             *
0692:             * @param l Activity
0693:             * @throws TorqueException
0694:             */
0695:            public void addActivity(Activity l) throws TorqueException {
0696:                getActivitys().add(l);
0697:                l.setAttachment((Attachment) this );
0698:            }
0699:
0700:            /**
0701:             * The criteria used to select the current contents of collActivitys
0702:             */
0703:            private Criteria lastActivitysCriteria = null;
0704:
0705:            /**
0706:             * If this collection has already been initialized, returns
0707:             * the collection. Otherwise returns the results of
0708:             * getActivitys(new Criteria())
0709:             *
0710:             * @return the collection of associated objects
0711:             * @throws TorqueException
0712:             */
0713:            public List getActivitys() throws TorqueException {
0714:                if (collActivitys == null) {
0715:                    collActivitys = getActivitys(new Criteria(10));
0716:                }
0717:                return collActivitys;
0718:            }
0719:
0720:            /**
0721:             * If this collection has already been initialized with
0722:             * an identical criteria, it returns the collection.
0723:             * Otherwise if this Attachment has previously
0724:             * been saved, it will retrieve related Activitys from storage.
0725:             * If this Attachment is new, it will return
0726:             * an empty collection or the current collection, the criteria
0727:             * is ignored on a new object.
0728:             *
0729:             * @throws TorqueException
0730:             */
0731:            public List getActivitys(Criteria criteria) throws TorqueException {
0732:                if (collActivitys == null) {
0733:                    if (isNew()) {
0734:                        collActivitys = new ArrayList();
0735:                    } else {
0736:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0737:                                getAttachmentId());
0738:                        collActivitys = ActivityPeer.doSelect(criteria);
0739:                    }
0740:                } else {
0741:                    // criteria has no effect for a new object
0742:                    if (!isNew()) {
0743:                        // the following code is to determine if a new query is
0744:                        // called for.  If the criteria is the same as the last
0745:                        // one, just return the collection.
0746:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0747:                                getAttachmentId());
0748:                        if (!lastActivitysCriteria.equals(criteria)) {
0749:                            collActivitys = ActivityPeer.doSelect(criteria);
0750:                        }
0751:                    }
0752:                }
0753:                lastActivitysCriteria = criteria;
0754:
0755:                return collActivitys;
0756:            }
0757:
0758:            /**
0759:             * If this collection has already been initialized, returns
0760:             * the collection. Otherwise returns the results of
0761:             * getActivitys(new Criteria(),Connection)
0762:             * This method takes in the Connection also as input so that
0763:             * referenced objects can also be obtained using a Connection
0764:             * that is taken as input
0765:             */
0766:            public List getActivitys(Connection con) throws TorqueException {
0767:                if (collActivitys == null) {
0768:                    collActivitys = getActivitys(new Criteria(10), con);
0769:                }
0770:                return collActivitys;
0771:            }
0772:
0773:            /**
0774:             * If this collection has already been initialized with
0775:             * an identical criteria, it returns the collection.
0776:             * Otherwise if this Attachment has previously
0777:             * been saved, it will retrieve related Activitys from storage.
0778:             * If this Attachment is new, it will return
0779:             * an empty collection or the current collection, the criteria
0780:             * is ignored on a new object.
0781:             * This method takes in the Connection also as input so that
0782:             * referenced objects can also be obtained using a Connection
0783:             * that is taken as input
0784:             */
0785:            public List getActivitys(Criteria criteria, Connection con)
0786:                    throws TorqueException {
0787:                if (collActivitys == null) {
0788:                    if (isNew()) {
0789:                        collActivitys = new ArrayList();
0790:                    } else {
0791:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0792:                                getAttachmentId());
0793:                        collActivitys = ActivityPeer.doSelect(criteria, con);
0794:                    }
0795:                } else {
0796:                    // criteria has no effect for a new object
0797:                    if (!isNew()) {
0798:                        // the following code is to determine if a new query is
0799:                        // called for.  If the criteria is the same as the last
0800:                        // one, just return the collection.
0801:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0802:                                getAttachmentId());
0803:                        if (!lastActivitysCriteria.equals(criteria)) {
0804:                            collActivitys = ActivityPeer
0805:                                    .doSelect(criteria, con);
0806:                        }
0807:                    }
0808:                }
0809:                lastActivitysCriteria = criteria;
0810:
0811:                return collActivitys;
0812:            }
0813:
0814:            /**
0815:             * If this collection has already been initialized with
0816:             * an identical criteria, it returns the collection.
0817:             * Otherwise if this Attachment is new, it will return
0818:             * an empty collection; or if this Attachment has previously
0819:             * been saved, it will retrieve related Activitys from storage.
0820:             *
0821:             * This method is protected by default in order to keep the public
0822:             * api reasonable.  You can provide public methods for those you
0823:             * actually need in Attachment.
0824:             */
0825:            protected List getActivitysJoinIssue(Criteria criteria)
0826:                    throws TorqueException {
0827:                if (collActivitys == null) {
0828:                    if (isNew()) {
0829:                        collActivitys = new ArrayList();
0830:                    } else {
0831:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0832:                                getAttachmentId());
0833:                        collActivitys = ActivityPeer
0834:                                .doSelectJoinIssue(criteria);
0835:                    }
0836:                } else {
0837:                    // the following code is to determine if a new query is
0838:                    // called for.  If the criteria is the same as the last
0839:                    // one, just return the collection.
0840:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
0841:                    if (!lastActivitysCriteria.equals(criteria)) {
0842:                        collActivitys = ActivityPeer
0843:                                .doSelectJoinIssue(criteria);
0844:                    }
0845:                }
0846:                lastActivitysCriteria = criteria;
0847:
0848:                return collActivitys;
0849:            }
0850:
0851:            /**
0852:             * If this collection has already been initialized with
0853:             * an identical criteria, it returns the collection.
0854:             * Otherwise if this Attachment is new, it will return
0855:             * an empty collection; or if this Attachment has previously
0856:             * been saved, it will retrieve related Activitys from storage.
0857:             *
0858:             * This method is protected by default in order to keep the public
0859:             * api reasonable.  You can provide public methods for those you
0860:             * actually need in Attachment.
0861:             */
0862:            protected List getActivitysJoinAttribute(Criteria criteria)
0863:                    throws TorqueException {
0864:                if (collActivitys == null) {
0865:                    if (isNew()) {
0866:                        collActivitys = new ArrayList();
0867:                    } else {
0868:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0869:                                getAttachmentId());
0870:                        collActivitys = ActivityPeer
0871:                                .doSelectJoinAttribute(criteria);
0872:                    }
0873:                } else {
0874:                    // the following code is to determine if a new query is
0875:                    // called for.  If the criteria is the same as the last
0876:                    // one, just return the collection.
0877:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
0878:                    if (!lastActivitysCriteria.equals(criteria)) {
0879:                        collActivitys = ActivityPeer
0880:                                .doSelectJoinAttribute(criteria);
0881:                    }
0882:                }
0883:                lastActivitysCriteria = criteria;
0884:
0885:                return collActivitys;
0886:            }
0887:
0888:            /**
0889:             * If this collection has already been initialized with
0890:             * an identical criteria, it returns the collection.
0891:             * Otherwise if this Attachment is new, it will return
0892:             * an empty collection; or if this Attachment has previously
0893:             * been saved, it will retrieve related Activitys from storage.
0894:             *
0895:             * This method is protected by default in order to keep the public
0896:             * api reasonable.  You can provide public methods for those you
0897:             * actually need in Attachment.
0898:             */
0899:            protected List getActivitysJoinActivitySet(Criteria criteria)
0900:                    throws TorqueException {
0901:                if (collActivitys == null) {
0902:                    if (isNew()) {
0903:                        collActivitys = new ArrayList();
0904:                    } else {
0905:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0906:                                getAttachmentId());
0907:                        collActivitys = ActivityPeer
0908:                                .doSelectJoinActivitySet(criteria);
0909:                    }
0910:                } else {
0911:                    // the following code is to determine if a new query is
0912:                    // called for.  If the criteria is the same as the last
0913:                    // one, just return the collection.
0914:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
0915:                    if (!lastActivitysCriteria.equals(criteria)) {
0916:                        collActivitys = ActivityPeer
0917:                                .doSelectJoinActivitySet(criteria);
0918:                    }
0919:                }
0920:                lastActivitysCriteria = criteria;
0921:
0922:                return collActivitys;
0923:            }
0924:
0925:            /**
0926:             * If this collection has already been initialized with
0927:             * an identical criteria, it returns the collection.
0928:             * Otherwise if this Attachment is new, it will return
0929:             * an empty collection; or if this Attachment has previously
0930:             * been saved, it will retrieve related Activitys from storage.
0931:             *
0932:             * This method is protected by default in order to keep the public
0933:             * api reasonable.  You can provide public methods for those you
0934:             * actually need in Attachment.
0935:             */
0936:            protected List getActivitysJoinScarabUserImplRelatedByOldUserId(
0937:                    Criteria criteria) throws TorqueException {
0938:                if (collActivitys == null) {
0939:                    if (isNew()) {
0940:                        collActivitys = new ArrayList();
0941:                    } else {
0942:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0943:                                getAttachmentId());
0944:                        collActivitys = ActivityPeer
0945:                                .doSelectJoinScarabUserImplRelatedByOldUserId(criteria);
0946:                    }
0947:                } else {
0948:                    // the following code is to determine if a new query is
0949:                    // called for.  If the criteria is the same as the last
0950:                    // one, just return the collection.
0951:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
0952:                    if (!lastActivitysCriteria.equals(criteria)) {
0953:                        collActivitys = ActivityPeer
0954:                                .doSelectJoinScarabUserImplRelatedByOldUserId(criteria);
0955:                    }
0956:                }
0957:                lastActivitysCriteria = criteria;
0958:
0959:                return collActivitys;
0960:            }
0961:
0962:            /**
0963:             * If this collection has already been initialized with
0964:             * an identical criteria, it returns the collection.
0965:             * Otherwise if this Attachment is new, it will return
0966:             * an empty collection; or if this Attachment has previously
0967:             * been saved, it will retrieve related Activitys from storage.
0968:             *
0969:             * This method is protected by default in order to keep the public
0970:             * api reasonable.  You can provide public methods for those you
0971:             * actually need in Attachment.
0972:             */
0973:            protected List getActivitysJoinScarabUserImplRelatedByNewUserId(
0974:                    Criteria criteria) throws TorqueException {
0975:                if (collActivitys == null) {
0976:                    if (isNew()) {
0977:                        collActivitys = new ArrayList();
0978:                    } else {
0979:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
0980:                                getAttachmentId());
0981:                        collActivitys = ActivityPeer
0982:                                .doSelectJoinScarabUserImplRelatedByNewUserId(criteria);
0983:                    }
0984:                } else {
0985:                    // the following code is to determine if a new query is
0986:                    // called for.  If the criteria is the same as the last
0987:                    // one, just return the collection.
0988:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
0989:                    if (!lastActivitysCriteria.equals(criteria)) {
0990:                        collActivitys = ActivityPeer
0991:                                .doSelectJoinScarabUserImplRelatedByNewUserId(criteria);
0992:                    }
0993:                }
0994:                lastActivitysCriteria = criteria;
0995:
0996:                return collActivitys;
0997:            }
0998:
0999:            /**
1000:             * If this collection has already been initialized with
1001:             * an identical criteria, it returns the collection.
1002:             * Otherwise if this Attachment is new, it will return
1003:             * an empty collection; or if this Attachment has previously
1004:             * been saved, it will retrieve related Activitys from storage.
1005:             *
1006:             * This method is protected by default in order to keep the public
1007:             * api reasonable.  You can provide public methods for those you
1008:             * actually need in Attachment.
1009:             */
1010:            protected List getActivitysJoinAttributeOptionRelatedByOldOptionId(
1011:                    Criteria criteria) throws TorqueException {
1012:                if (collActivitys == null) {
1013:                    if (isNew()) {
1014:                        collActivitys = new ArrayList();
1015:                    } else {
1016:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
1017:                                getAttachmentId());
1018:                        collActivitys = ActivityPeer
1019:                                .doSelectJoinAttributeOptionRelatedByOldOptionId(criteria);
1020:                    }
1021:                } else {
1022:                    // the following code is to determine if a new query is
1023:                    // called for.  If the criteria is the same as the last
1024:                    // one, just return the collection.
1025:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
1026:                    if (!lastActivitysCriteria.equals(criteria)) {
1027:                        collActivitys = ActivityPeer
1028:                                .doSelectJoinAttributeOptionRelatedByOldOptionId(criteria);
1029:                    }
1030:                }
1031:                lastActivitysCriteria = criteria;
1032:
1033:                return collActivitys;
1034:            }
1035:
1036:            /**
1037:             * If this collection has already been initialized with
1038:             * an identical criteria, it returns the collection.
1039:             * Otherwise if this Attachment is new, it will return
1040:             * an empty collection; or if this Attachment has previously
1041:             * been saved, it will retrieve related Activitys from storage.
1042:             *
1043:             * This method is protected by default in order to keep the public
1044:             * api reasonable.  You can provide public methods for those you
1045:             * actually need in Attachment.
1046:             */
1047:            protected List getActivitysJoinAttributeOptionRelatedByNewOptionId(
1048:                    Criteria criteria) throws TorqueException {
1049:                if (collActivitys == null) {
1050:                    if (isNew()) {
1051:                        collActivitys = new ArrayList();
1052:                    } else {
1053:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
1054:                                getAttachmentId());
1055:                        collActivitys = ActivityPeer
1056:                                .doSelectJoinAttributeOptionRelatedByNewOptionId(criteria);
1057:                    }
1058:                } else {
1059:                    // the following code is to determine if a new query is
1060:                    // called for.  If the criteria is the same as the last
1061:                    // one, just return the collection.
1062:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
1063:                    if (!lastActivitysCriteria.equals(criteria)) {
1064:                        collActivitys = ActivityPeer
1065:                                .doSelectJoinAttributeOptionRelatedByNewOptionId(criteria);
1066:                    }
1067:                }
1068:                lastActivitysCriteria = criteria;
1069:
1070:                return collActivitys;
1071:            }
1072:
1073:            /**
1074:             * If this collection has already been initialized with
1075:             * an identical criteria, it returns the collection.
1076:             * Otherwise if this Attachment is new, it will return
1077:             * an empty collection; or if this Attachment has previously
1078:             * been saved, it will retrieve related Activitys from storage.
1079:             *
1080:             * This method is protected by default in order to keep the public
1081:             * api reasonable.  You can provide public methods for those you
1082:             * actually need in Attachment.
1083:             */
1084:            protected List getActivitysJoinAttachment(Criteria criteria)
1085:                    throws TorqueException {
1086:                if (collActivitys == null) {
1087:                    if (isNew()) {
1088:                        collActivitys = new ArrayList();
1089:                    } else {
1090:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
1091:                                getAttachmentId());
1092:                        collActivitys = ActivityPeer
1093:                                .doSelectJoinAttachment(criteria);
1094:                    }
1095:                } else {
1096:                    // the following code is to determine if a new query is
1097:                    // called for.  If the criteria is the same as the last
1098:                    // one, just return the collection.
1099:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
1100:                    if (!lastActivitysCriteria.equals(criteria)) {
1101:                        collActivitys = ActivityPeer
1102:                                .doSelectJoinAttachment(criteria);
1103:                    }
1104:                }
1105:                lastActivitysCriteria = criteria;
1106:
1107:                return collActivitys;
1108:            }
1109:
1110:            /**
1111:             * If this collection has already been initialized with
1112:             * an identical criteria, it returns the collection.
1113:             * Otherwise if this Attachment is new, it will return
1114:             * an empty collection; or if this Attachment has previously
1115:             * been saved, it will retrieve related Activitys from storage.
1116:             *
1117:             * This method is protected by default in order to keep the public
1118:             * api reasonable.  You can provide public methods for those you
1119:             * actually need in Attachment.
1120:             */
1121:            protected List getActivitysJoinDepend(Criteria criteria)
1122:                    throws TorqueException {
1123:                if (collActivitys == null) {
1124:                    if (isNew()) {
1125:                        collActivitys = new ArrayList();
1126:                    } else {
1127:                        criteria.add(ActivityPeer.ATTACHMENT_ID,
1128:                                getAttachmentId());
1129:                        collActivitys = ActivityPeer
1130:                                .doSelectJoinDepend(criteria);
1131:                    }
1132:                } else {
1133:                    // the following code is to determine if a new query is
1134:                    // called for.  If the criteria is the same as the last
1135:                    // one, just return the collection.
1136:                    criteria.add(ActivityPeer.ATTACHMENT_ID, getAttachmentId());
1137:                    if (!lastActivitysCriteria.equals(criteria)) {
1138:                        collActivitys = ActivityPeer
1139:                                .doSelectJoinDepend(criteria);
1140:                    }
1141:                }
1142:                lastActivitysCriteria = criteria;
1143:
1144:                return collActivitys;
1145:            }
1146:
1147:            /**
1148:             * Collection to store aggregation of collActivitySets
1149:             */
1150:            protected List collActivitySets;
1151:
1152:            /**
1153:             * Temporary storage of collActivitySets to save a possible db hit in
1154:             * the event objects are add to the collection, but the
1155:             * complete collection is never requested.
1156:             */
1157:            protected void initActivitySets() {
1158:                if (collActivitySets == null) {
1159:                    collActivitySets = new ArrayList();
1160:                }
1161:            }
1162:
1163:            /**
1164:             * Method called to associate a ActivitySet object to this object
1165:             * through the ActivitySet foreign key attribute
1166:             *
1167:             * @param l ActivitySet
1168:             * @throws TorqueException
1169:             */
1170:            public void addActivitySet(ActivitySet l) throws TorqueException {
1171:                getActivitySets().add(l);
1172:                l.setAttachment((Attachment) this );
1173:            }
1174:
1175:            /**
1176:             * The criteria used to select the current contents of collActivitySets
1177:             */
1178:            private Criteria lastActivitySetsCriteria = null;
1179:
1180:            /**
1181:             * If this collection has already been initialized, returns
1182:             * the collection. Otherwise returns the results of
1183:             * getActivitySets(new Criteria())
1184:             *
1185:             * @return the collection of associated objects
1186:             * @throws TorqueException
1187:             */
1188:            public List getActivitySets() throws TorqueException {
1189:                if (collActivitySets == null) {
1190:                    collActivitySets = getActivitySets(new Criteria(10));
1191:                }
1192:                return collActivitySets;
1193:            }
1194:
1195:            /**
1196:             * If this collection has already been initialized with
1197:             * an identical criteria, it returns the collection.
1198:             * Otherwise if this Attachment has previously
1199:             * been saved, it will retrieve related ActivitySets from storage.
1200:             * If this Attachment is new, it will return
1201:             * an empty collection or the current collection, the criteria
1202:             * is ignored on a new object.
1203:             *
1204:             * @throws TorqueException
1205:             */
1206:            public List getActivitySets(Criteria criteria)
1207:                    throws TorqueException {
1208:                if (collActivitySets == null) {
1209:                    if (isNew()) {
1210:                        collActivitySets = new ArrayList();
1211:                    } else {
1212:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1213:                                getAttachmentId());
1214:                        collActivitySets = ActivitySetPeer.doSelect(criteria);
1215:                    }
1216:                } else {
1217:                    // criteria has no effect for a new object
1218:                    if (!isNew()) {
1219:                        // the following code is to determine if a new query is
1220:                        // called for.  If the criteria is the same as the last
1221:                        // one, just return the collection.
1222:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1223:                                getAttachmentId());
1224:                        if (!lastActivitySetsCriteria.equals(criteria)) {
1225:                            collActivitySets = ActivitySetPeer
1226:                                    .doSelect(criteria);
1227:                        }
1228:                    }
1229:                }
1230:                lastActivitySetsCriteria = criteria;
1231:
1232:                return collActivitySets;
1233:            }
1234:
1235:            /**
1236:             * If this collection has already been initialized, returns
1237:             * the collection. Otherwise returns the results of
1238:             * getActivitySets(new Criteria(),Connection)
1239:             * This method takes in the Connection also as input so that
1240:             * referenced objects can also be obtained using a Connection
1241:             * that is taken as input
1242:             */
1243:            public List getActivitySets(Connection con) throws TorqueException {
1244:                if (collActivitySets == null) {
1245:                    collActivitySets = getActivitySets(new Criteria(10), con);
1246:                }
1247:                return collActivitySets;
1248:            }
1249:
1250:            /**
1251:             * If this collection has already been initialized with
1252:             * an identical criteria, it returns the collection.
1253:             * Otherwise if this Attachment has previously
1254:             * been saved, it will retrieve related ActivitySets from storage.
1255:             * If this Attachment is new, it will return
1256:             * an empty collection or the current collection, the criteria
1257:             * is ignored on a new object.
1258:             * This method takes in the Connection also as input so that
1259:             * referenced objects can also be obtained using a Connection
1260:             * that is taken as input
1261:             */
1262:            public List getActivitySets(Criteria criteria, Connection con)
1263:                    throws TorqueException {
1264:                if (collActivitySets == null) {
1265:                    if (isNew()) {
1266:                        collActivitySets = new ArrayList();
1267:                    } else {
1268:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1269:                                getAttachmentId());
1270:                        collActivitySets = ActivitySetPeer.doSelect(criteria,
1271:                                con);
1272:                    }
1273:                } else {
1274:                    // criteria has no effect for a new object
1275:                    if (!isNew()) {
1276:                        // the following code is to determine if a new query is
1277:                        // called for.  If the criteria is the same as the last
1278:                        // one, just return the collection.
1279:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1280:                                getAttachmentId());
1281:                        if (!lastActivitySetsCriteria.equals(criteria)) {
1282:                            collActivitySets = ActivitySetPeer.doSelect(
1283:                                    criteria, con);
1284:                        }
1285:                    }
1286:                }
1287:                lastActivitySetsCriteria = criteria;
1288:
1289:                return collActivitySets;
1290:            }
1291:
1292:            /**
1293:             * If this collection has already been initialized with
1294:             * an identical criteria, it returns the collection.
1295:             * Otherwise if this Attachment is new, it will return
1296:             * an empty collection; or if this Attachment has previously
1297:             * been saved, it will retrieve related ActivitySets from storage.
1298:             *
1299:             * This method is protected by default in order to keep the public
1300:             * api reasonable.  You can provide public methods for those you
1301:             * actually need in Attachment.
1302:             */
1303:            protected List getActivitySetsJoinScarabUserImpl(Criteria criteria)
1304:                    throws TorqueException {
1305:                if (collActivitySets == null) {
1306:                    if (isNew()) {
1307:                        collActivitySets = new ArrayList();
1308:                    } else {
1309:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1310:                                getAttachmentId());
1311:                        collActivitySets = ActivitySetPeer
1312:                                .doSelectJoinScarabUserImpl(criteria);
1313:                    }
1314:                } else {
1315:                    // the following code is to determine if a new query is
1316:                    // called for.  If the criteria is the same as the last
1317:                    // one, just return the collection.
1318:                    criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1319:                            getAttachmentId());
1320:                    if (!lastActivitySetsCriteria.equals(criteria)) {
1321:                        collActivitySets = ActivitySetPeer
1322:                                .doSelectJoinScarabUserImpl(criteria);
1323:                    }
1324:                }
1325:                lastActivitySetsCriteria = criteria;
1326:
1327:                return collActivitySets;
1328:            }
1329:
1330:            /**
1331:             * If this collection has already been initialized with
1332:             * an identical criteria, it returns the collection.
1333:             * Otherwise if this Attachment is new, it will return
1334:             * an empty collection; or if this Attachment has previously
1335:             * been saved, it will retrieve related ActivitySets from storage.
1336:             *
1337:             * This method is protected by default in order to keep the public
1338:             * api reasonable.  You can provide public methods for those you
1339:             * actually need in Attachment.
1340:             */
1341:            protected List getActivitySetsJoinActivitySetType(Criteria criteria)
1342:                    throws TorqueException {
1343:                if (collActivitySets == null) {
1344:                    if (isNew()) {
1345:                        collActivitySets = new ArrayList();
1346:                    } else {
1347:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1348:                                getAttachmentId());
1349:                        collActivitySets = ActivitySetPeer
1350:                                .doSelectJoinActivitySetType(criteria);
1351:                    }
1352:                } else {
1353:                    // the following code is to determine if a new query is
1354:                    // called for.  If the criteria is the same as the last
1355:                    // one, just return the collection.
1356:                    criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1357:                            getAttachmentId());
1358:                    if (!lastActivitySetsCriteria.equals(criteria)) {
1359:                        collActivitySets = ActivitySetPeer
1360:                                .doSelectJoinActivitySetType(criteria);
1361:                    }
1362:                }
1363:                lastActivitySetsCriteria = criteria;
1364:
1365:                return collActivitySets;
1366:            }
1367:
1368:            /**
1369:             * If this collection has already been initialized with
1370:             * an identical criteria, it returns the collection.
1371:             * Otherwise if this Attachment is new, it will return
1372:             * an empty collection; or if this Attachment has previously
1373:             * been saved, it will retrieve related ActivitySets from storage.
1374:             *
1375:             * This method is protected by default in order to keep the public
1376:             * api reasonable.  You can provide public methods for those you
1377:             * actually need in Attachment.
1378:             */
1379:            protected List getActivitySetsJoinAttachment(Criteria criteria)
1380:                    throws TorqueException {
1381:                if (collActivitySets == null) {
1382:                    if (isNew()) {
1383:                        collActivitySets = new ArrayList();
1384:                    } else {
1385:                        criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1386:                                getAttachmentId());
1387:                        collActivitySets = ActivitySetPeer
1388:                                .doSelectJoinAttachment(criteria);
1389:                    }
1390:                } else {
1391:                    // the following code is to determine if a new query is
1392:                    // called for.  If the criteria is the same as the last
1393:                    // one, just return the collection.
1394:                    criteria.add(ActivitySetPeer.ATTACHMENT_ID,
1395:                            getAttachmentId());
1396:                    if (!lastActivitySetsCriteria.equals(criteria)) {
1397:                        collActivitySets = ActivitySetPeer
1398:                                .doSelectJoinAttachment(criteria);
1399:                    }
1400:                }
1401:                lastActivitySetsCriteria = criteria;
1402:
1403:                return collActivitySets;
1404:            }
1405:
1406:            private static List fieldNames = null;
1407:
1408:            /**
1409:             * Generate a list of field names.
1410:             *
1411:             * @return a list of field names
1412:             */
1413:            public static synchronized List getFieldNames() {
1414:                if (fieldNames == null) {
1415:                    fieldNames = new ArrayList();
1416:                    fieldNames.add("AttachmentId");
1417:                    fieldNames.add("IssueId");
1418:                    fieldNames.add("TypeId");
1419:                    fieldNames.add("Name");
1420:                    fieldNames.add("Data");
1421:                    fieldNames.add("FileName");
1422:                    fieldNames.add("MimeType");
1423:                    fieldNames.add("ModifiedBy");
1424:                    fieldNames.add("CreatedBy");
1425:                    fieldNames.add("ModifiedDate");
1426:                    fieldNames.add("CreatedDate");
1427:                    fieldNames.add("Deleted");
1428:                    fieldNames = Collections.unmodifiableList(fieldNames);
1429:                }
1430:                return fieldNames;
1431:            }
1432:
1433:            /**
1434:             * Retrieves a field from the object by name passed in as a String.
1435:             *
1436:             * @param name field name
1437:             * @return value
1438:             */
1439:            public Object getByName(String name) {
1440:                if (name.equals("AttachmentId")) {
1441:                    return getAttachmentId();
1442:                }
1443:                if (name.equals("IssueId")) {
1444:                    return getIssueId();
1445:                }
1446:                if (name.equals("TypeId")) {
1447:                    return getTypeId();
1448:                }
1449:                if (name.equals("Name")) {
1450:                    return getName();
1451:                }
1452:                if (name.equals("Data")) {
1453:                    return getData();
1454:                }
1455:                if (name.equals("FileName")) {
1456:                    return getFileName();
1457:                }
1458:                if (name.equals("MimeType")) {
1459:                    return getMimeType();
1460:                }
1461:                if (name.equals("ModifiedBy")) {
1462:                    return getModifiedBy();
1463:                }
1464:                if (name.equals("CreatedBy")) {
1465:                    return getCreatedBy();
1466:                }
1467:                if (name.equals("ModifiedDate")) {
1468:                    return getModifiedDate();
1469:                }
1470:                if (name.equals("CreatedDate")) {
1471:                    return getCreatedDate();
1472:                }
1473:                if (name.equals("Deleted")) {
1474:                    return Boolean.valueOf(getDeleted());
1475:                }
1476:                return null;
1477:            }
1478:
1479:            /**
1480:             * Retrieves a field from the object by name passed in
1481:             * as a String.  The String must be one of the static
1482:             * Strings defined in this Class' Peer.
1483:             *
1484:             * @param name peer name
1485:             * @return value
1486:             */
1487:            public Object getByPeerName(String name) {
1488:                if (name.equals(AttachmentPeer.ATTACHMENT_ID)) {
1489:                    return getAttachmentId();
1490:                }
1491:                if (name.equals(AttachmentPeer.ISSUE_ID)) {
1492:                    return getIssueId();
1493:                }
1494:                if (name.equals(AttachmentPeer.ATTACHMENT_TYPE_ID)) {
1495:                    return getTypeId();
1496:                }
1497:                if (name.equals(AttachmentPeer.ATTACHMENT_NAME)) {
1498:                    return getName();
1499:                }
1500:                if (name.equals(AttachmentPeer.ATTACHMENT_DATA)) {
1501:                    return getData();
1502:                }
1503:                if (name.equals(AttachmentPeer.ATTACHMENT_FILE_PATH)) {
1504:                    return getFileName();
1505:                }
1506:                if (name.equals(AttachmentPeer.ATTACHMENT_MIME_TYPE)) {
1507:                    return getMimeType();
1508:                }
1509:                if (name.equals(AttachmentPeer.MODIFIED_BY)) {
1510:                    return getModifiedBy();
1511:                }
1512:                if (name.equals(AttachmentPeer.CREATED_BY)) {
1513:                    return getCreatedBy();
1514:                }
1515:                if (name.equals(AttachmentPeer.MODIFIED_DATE)) {
1516:                    return getModifiedDate();
1517:                }
1518:                if (name.equals(AttachmentPeer.CREATED_DATE)) {
1519:                    return getCreatedDate();
1520:                }
1521:                if (name.equals(AttachmentPeer.DELETED)) {
1522:                    return Boolean.valueOf(getDeleted());
1523:                }
1524:                return null;
1525:            }
1526:
1527:            /**
1528:             * Retrieves a field from the object by Position as specified
1529:             * in the xml schema.  Zero-based.
1530:             *
1531:             * @param pos position in xml schema
1532:             * @return value
1533:             */
1534:            public Object getByPosition(int pos) {
1535:                if (pos == 0) {
1536:                    return getAttachmentId();
1537:                }
1538:                if (pos == 1) {
1539:                    return getIssueId();
1540:                }
1541:                if (pos == 2) {
1542:                    return getTypeId();
1543:                }
1544:                if (pos == 3) {
1545:                    return getName();
1546:                }
1547:                if (pos == 4) {
1548:                    return getData();
1549:                }
1550:                if (pos == 5) {
1551:                    return getFileName();
1552:                }
1553:                if (pos == 6) {
1554:                    return getMimeType();
1555:                }
1556:                if (pos == 7) {
1557:                    return getModifiedBy();
1558:                }
1559:                if (pos == 8) {
1560:                    return getCreatedBy();
1561:                }
1562:                if (pos == 9) {
1563:                    return getModifiedDate();
1564:                }
1565:                if (pos == 10) {
1566:                    return getCreatedDate();
1567:                }
1568:                if (pos == 11) {
1569:                    return Boolean.valueOf(getDeleted());
1570:                }
1571:                return null;
1572:            }
1573:
1574:            /**
1575:             * Stores the object in the database.  If the object is new,
1576:             * it inserts it; otherwise an update is performed.
1577:             *
1578:             * @throws TorqueException
1579:             */
1580:            public void save() throws TorqueException {
1581:                save(AttachmentPeer.getMapBuilder().getDatabaseMap().getName());
1582:            }
1583:
1584:            /**
1585:             * Stores the object in the database.  If the object is new,
1586:             * it inserts it; otherwise an update is performed.
1587:             * Note: this code is here because the method body is
1588:             * auto-generated conditionally and therefore needs to be
1589:             * in this file instead of in the super class, BaseObject.
1590:             *
1591:             * @param dbName
1592:             * @throws TorqueException
1593:             */
1594:            public void save(String dbName) throws TorqueException {
1595:                Connection con = null;
1596:                try {
1597:                    con = Transaction.begin(dbName);
1598:                    save(con);
1599:                    Transaction.commit(con);
1600:                } catch (TorqueException e) {
1601:                    Transaction.safeRollback(con);
1602:                    throw e;
1603:                }
1604:            }
1605:
1606:            /** flag to prevent endless save loop, if this object is referenced
1607:              by another object which falls in this transaction. */
1608:            private boolean alreadyInSave = false;
1609:
1610:            /**
1611:             * Stores the object in the database.  If the object is new,
1612:             * it inserts it; otherwise an update is performed.  This method
1613:             * is meant to be used as part of a transaction, otherwise use
1614:             * the save() method and the connection details will be handled
1615:             * internally
1616:             *
1617:             * @param con
1618:             * @throws TorqueException
1619:             */
1620:            public void save(Connection con) throws TorqueException {
1621:                if (!alreadyInSave) {
1622:                    alreadyInSave = true;
1623:
1624:                    // If this object has been modified, then save it to the database.
1625:                    if (isModified()) {
1626:                        if (isNew()) {
1627:                            AttachmentPeer.doInsert((Attachment) this , con);
1628:                            setNew(false);
1629:                        } else {
1630:                            AttachmentPeer.doUpdate((Attachment) this , con);
1631:                        }
1632:
1633:                        if (isCacheOnSave()) {
1634:                            AttachmentManager.putInstance(this );
1635:                        }
1636:                    }
1637:
1638:                    if (collActivitys != null) {
1639:                        for (int i = 0; i < collActivitys.size(); i++) {
1640:                            ((Activity) collActivitys.get(i)).save(con);
1641:                        }
1642:                    }
1643:
1644:                    if (collActivitySets != null) {
1645:                        for (int i = 0; i < collActivitySets.size(); i++) {
1646:                            ((ActivitySet) collActivitySets.get(i)).save(con);
1647:                        }
1648:                    }
1649:                    alreadyInSave = false;
1650:                }
1651:            }
1652:
1653:            /**
1654:             * Specify whether to cache the object after saving to the db.
1655:             * This method returns true
1656:             */
1657:            protected boolean isCacheOnSave() {
1658:                return true;
1659:            }
1660:
1661:            /**
1662:             * Set the PrimaryKey using ObjectKey.
1663:             *
1664:             * @param key attachmentId ObjectKey
1665:             */
1666:            public void setPrimaryKey(ObjectKey key) throws TorqueException {
1667:                setAttachmentId(new Long(((NumberKey) key).longValue()));
1668:            }
1669:
1670:            /**
1671:             * Set the PrimaryKey using a String.
1672:             *
1673:             * @param key
1674:             */
1675:            public void setPrimaryKey(String key) throws TorqueException {
1676:                setAttachmentId(new Long(key));
1677:            }
1678:
1679:            /**
1680:             * returns an id that differentiates this object from others
1681:             * of its class.
1682:             */
1683:            public ObjectKey getPrimaryKey() {
1684:                return SimpleKey.keyFor(getAttachmentId());
1685:            }
1686:
1687:            /**
1688:             * get an id that differentiates this object from others
1689:             * of its class.
1690:             */
1691:            public String getQueryKey() {
1692:                if (getPrimaryKey() == null) {
1693:                    return "";
1694:                } else {
1695:                    return getPrimaryKey().toString();
1696:                }
1697:            }
1698:
1699:            /**
1700:             * set an id that differentiates this object from others
1701:             * of its class.
1702:             */
1703:            public void setQueryKey(String key) throws TorqueException {
1704:                setPrimaryKey(key);
1705:            }
1706:
1707:            /**
1708:             * Makes a copy of this object.
1709:             * It creates a new object filling in the simple attributes.
1710:             * It then fills all the association collections and sets the
1711:             * related objects to isNew=true.
1712:             */
1713:            public Attachment copy() throws TorqueException {
1714:                return copyInto(new Attachment());
1715:            }
1716:
1717:            protected Attachment copyInto(Attachment copyObj)
1718:                    throws TorqueException {
1719:                copyObj.setAttachmentId(attachmentId);
1720:                copyObj.setIssueId(issueId);
1721:                copyObj.setTypeId(typeId);
1722:                copyObj.setName(name);
1723:                copyObj.setData(data);
1724:                copyObj.setFileName(fileName);
1725:                copyObj.setMimeType(mimeType);
1726:                copyObj.setModifiedBy(modifiedBy);
1727:                copyObj.setCreatedBy(createdBy);
1728:                copyObj.setModifiedDate(modifiedDate);
1729:                copyObj.setCreatedDate(createdDate);
1730:                copyObj.setDeleted(deleted);
1731:
1732:                copyObj.setAttachmentId((Long) null);
1733:
1734:                List v = getActivitys();
1735:                if (v != null) {
1736:                    for (int i = 0; i < v.size(); i++) {
1737:                        Activity obj = (Activity) v.get(i);
1738:                        copyObj.addActivity(obj.copy());
1739:                    }
1740:                } else {
1741:                    copyObj.collActivitys = null;
1742:                }
1743:
1744:                v = getActivitySets();
1745:                if (v != null) {
1746:                    for (int i = 0; i < v.size(); i++) {
1747:                        ActivitySet obj = (ActivitySet) v.get(i);
1748:                        copyObj.addActivitySet(obj.copy());
1749:                    }
1750:                } else {
1751:                    copyObj.collActivitySets = null;
1752:                }
1753:                return copyObj;
1754:            }
1755:
1756:            /**
1757:             * returns a peer instance associated with this om.  Since Peer classes
1758:             * are not to have any instance attributes, this method returns the
1759:             * same instance for all member of this class. The method could therefore
1760:             * be static, but this would prevent one from overriding the behavior.
1761:             */
1762:            public AttachmentPeer getPeer() {
1763:                return peer;
1764:            }
1765:
1766:            public String toString() {
1767:                StringBuffer str = new StringBuffer();
1768:                str.append("Attachment:\n");
1769:                str.append("AttachmentId = ").append(getAttachmentId()).append(
1770:                        "\n");
1771:                str.append("IssueId = ").append(getIssueId()).append("\n");
1772:                str.append("TypeId = ").append(getTypeId()).append("\n");
1773:                str.append("Name = ").append(getName()).append("\n");
1774:                str.append("Data = ").append(getData()).append("\n");
1775:                str.append("FileName = ").append(getFileName()).append("\n");
1776:                str.append("MimeType = ").append(getMimeType()).append("\n");
1777:                str.append("ModifiedBy = ").append(getModifiedBy())
1778:                        .append("\n");
1779:                str.append("CreatedBy = ").append(getCreatedBy()).append("\n");
1780:                str.append("ModifiedDate = ").append(getModifiedDate()).append(
1781:                        "\n");
1782:                str.append("CreatedDate = ").append(getCreatedDate()).append(
1783:                        "\n");
1784:                str.append("Deleted = ").append(getDeleted()).append("\n");
1785:                return (str.toString());
1786:            }
1787:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.