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