001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.odal.petstore.persistence.gen.cmp;
004:
005: import com.completex.objective.components.persistency.*;
006: import java.sql.SQLException;
007: import java.util.List;
008: import java.util.ArrayList;
009: import java.util.Date;
010:
011: public class CmpOrder extends
012: com.odal.petstore.persistence.gen.pos.OrderPO implements
013: java.io.Externalizable {
014:
015: public CmpOrder() {
016: }
017:
018: public CmpOrder(long orderId) {
019: super (orderId);
020: }
021:
022: //
023: // Complex object part:
024: //
025: public static final String CPX_CHILD_LINE_ITEM = "lineItem";
026: protected static final com.completex.objective.components.persistency.type.TracingArrayListCollectionFactory LINE_ITEM_COLLECTION_FACTORY = new com.completex.objective.components.persistency.type.TracingArrayListCollectionFactory();
027: private List lineItems;
028:
029: protected static final int CPX_INDEX_LINE_ITEM = 0;
030:
031: public boolean complex() {
032: return true;
033: }
034:
035: protected Link[] links(QueryFactory queryFactory) {
036: try {
037: Link[] links = new Link[1];
038: Query query;
039: Link link;
040: query = queryFactory
041: .newQuery((PersistentObject) cpxFactoryLineItem());
042: link = new ChainedLink(
043: query,
044: new int[] { CmpOrder.ICOL_ORDER_ID, },
045: new int[] { com.odal.petstore.persistence.gen.pos.LineItemPO.ICOL_ORDER_ID, },
046: CPX_CHILD_LINE_ITEM);
047: link.setLazyRetrieval(true);
048: link.setCascadeInsert(true);
049: link.setCascadeUpdate(true);
050: link.setCascadeDelete(true);
051: link.setInsertBeforeParent(false);
052: query
053: .setMultipleResultFactory(LINE_ITEM_COLLECTION_FACTORY);
054: links[CPX_INDEX_LINE_ITEM] = link;
055: return links;
056: } catch (Exception e) {
057: throw new OdalRuntimePersistencyException(e);
058: }
059: }
060:
061: /**
062: *
063: * @return Child factory
064: */
065: protected com.odal.petstore.persistence.gen.pos.LineItemPO cpxFactoryLineItem() {
066: return new com.odal.petstore.persistence.gen.pos.LineItemPO();
067: }
068:
069: public List getLineItems() {
070: List value = (List) getChildObject(CPX_CHILD_LINE_ITEM,
071: this .lineItems);
072: return (this .lineItems = _ridOfLineItemsNull(value));
073: }
074:
075: public List _getLineItems() {
076: List value = (List) getChildObjectStraight(CPX_CHILD_LINE_ITEM,
077: this .lineItems);
078: return (this .lineItems = _ridOfLineItemsNull(value));
079: }
080:
081: public void setLineItems(List lineItems) {
082: this .lineItems = (List) setChildObjectSafe(CPX_CHILD_LINE_ITEM,
083: lineItems);
084: }
085:
086: public List addLineItems() {
087: List lineItems = (List) LINE_ITEM_COLLECTION_FACTORY
088: .newCollection();
089: java.util.Collection collection = lineItems;
090: handleAddCollection(collection);
091: setLineItems(lineItems);
092: return this .lineItems;
093: }
094:
095: protected List _ridOfLineItemsNull(List value) {
096: if (value == null) {
097: value = lazyLineItems();
098: }
099: return value;
100: }
101:
102: public boolean addLineItem(
103: com.odal.petstore.persistence.gen.pos.LineItemPO lineItem) {
104: return lazyLineItems().add(lineItem);
105: }
106:
107: protected List lazyLineItems() {
108: if (this .lineItems == null) {
109: addLineItems();
110: }
111: return this .lineItems;
112: }
113:
114: public boolean removeLineItem(
115: com.odal.petstore.persistence.gen.pos.LineItemPO lineItem) {
116: if (this .lineItems == null) {
117: return false;
118: }
119: return this .lineItems.remove(lineItem);
120: }
121:
122: protected void doUnflatten() {
123: unflatten(toLink(), CPX_CHILD_LINE_ITEM, lineItems);
124: }
125:
126: protected void doFlatten() {
127: flatten(lineItems);
128: }
129:
130: protected void doPreFlatten() {
131: _getLineItems();
132: }
133:
134: //
135: // Compound object part:
136: //
137:
138: private static com.odal.petstore.persistence.gen.pos.OrderStatusPO CPD_FACTORY_ORDER_STATUS;
139:
140: private transient int cpdIndexOrderStatus;
141:
142: protected void doSetupCompound() {
143: super .doSetupCompound();
144: cpdIndexOrderStatus = nextCompoundIndex();
145: compoundEntry(cpdIndexOrderStatus,
146: (PersistentObject) cpdFactoryOrderStatus()
147: .newPersistentInstance());
148: compoundCascadeDelete(cpdIndexOrderStatus, true);
149: compoundCascadeInsert(cpdIndexOrderStatus, true);
150: }
151:
152: protected com.odal.petstore.persistence.gen.pos.OrderStatusPO cpdFactoryOrderStatus() {
153: if (CPD_FACTORY_ORDER_STATUS == null) {
154: synchronized (com.odal.petstore.persistence.gen.pos.OrderStatusPO.class) {
155: if (CPD_FACTORY_ORDER_STATUS == null) {
156: CPD_FACTORY_ORDER_STATUS = new com.odal.petstore.persistence.gen.pos.OrderStatusPO();
157: }
158: }
159: }
160: return CPD_FACTORY_ORDER_STATUS;
161: }
162:
163: // Containment type - "is"
164: protected com.odal.petstore.persistence.gen.pos.OrderStatusPO extractCpdEntryOrderStatus() {
165: return (com.odal.petstore.persistence.gen.pos.OrderStatusPO) compoundEntry(cpdIndexOrderStatus);
166: }
167:
168: //
169: // timestamp:
170: //
171: public Date getTimestamp() {
172: return extractCpdEntryOrderStatus().getTimestamp();
173: }
174:
175: public void setTimestamp(Date timestamp) {
176: extractCpdEntryOrderStatus().setTimestamp(timestamp);
177: }
178:
179: public boolean izNullTimestamp() {
180: return extractCpdEntryOrderStatus().izNullTimestamp();
181: }
182:
183: public void setNullTimestamp() {
184: extractCpdEntryOrderStatus().setNullTimestamp();
185: }
186:
187: //
188: // status:
189: //
190: public String getStatus() {
191: return extractCpdEntryOrderStatus().getStatus();
192: }
193:
194: public void setStatus(String status) {
195: extractCpdEntryOrderStatus().setStatus(status);
196: }
197:
198: public boolean izNullStatus() {
199: return extractCpdEntryOrderStatus().izNullStatus();
200: }
201:
202: public void setNullStatus() {
203: extractCpdEntryOrderStatus().setNullStatus();
204: }
205:
206: public boolean compound() {
207: return true;
208: }
209:
210: }
|