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