001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex005.pos;
004:
005: import com.completex.objective.components.persistency.key.impl.DefaultNaturalKeyFactory;
006: import java.util.Date;
007: import java.util.HashMap;
008: import java.util.Map;
009: import java.io.InputStream;
010: import java.math.BigDecimal;
011: import java.math.BigInteger;
012: import java.sql.Clob;
013: import java.sql.Blob;
014: import com.completex.objective.components.persistency.*;
015: import com.completex.objective.components.persistency.key.impl.DefaultNaturalKeyFactory;
016:
017: import java.util.Date;
018:
019: public class CustomerOrderPO extends PersistentObject implements
020: java.io.Externalizable {
021: //
022: // Complex object related:
023: //
024:
025: //
026: private static Map registeredMasters;
027: private static Object lock = new Object();
028:
029: protected Object classLock() {
030: return lock;
031: }
032:
033: protected void instantiateRegisteredMasters() {
034: if (registeredMasters == null) {
035: synchronized (lock) {
036: if (registeredMasters == null) {
037: registeredMasters = new HashMap();
038: }
039: }
040: }
041: }
042:
043: protected Map registeredMasters() {
044: return registeredMasters;
045: }
046:
047: //
048: //
049: //
050:
051: public static final String TABLE_CUSTOMER_ORDER = "CUSTOMER_ORDER";
052:
053: public CustomerOrderPO() {
054: super (new Record(table));
055: }
056:
057: public CustomerOrderPO(Long orderId) {
058: this ();
059: setOrderId(orderId);
060: }
061:
062: public static final String COL_ORDER_ID = "ORDER_ID";
063: public static final String TCOL_ORDER_ID = "CUSTOMER_ORDER.ORDER_ID";
064: public static final int ICOL_ORDER_ID = 0;
065: public static final int JDBC_TYPE_ORDER_ID = -5;
066:
067: public static final String COL_PARENT_ORDER_ID = "PARENT_ORDER_ID";
068: public static final String TCOL_PARENT_ORDER_ID = "CUSTOMER_ORDER.PARENT_ORDER_ID";
069: public static final int ICOL_PARENT_ORDER_ID = 1;
070: public static final int JDBC_TYPE_PARENT_ORDER_ID = -5;
071:
072: public static final String COL_CUSTOMER_ID = "CUSTOMER_ID";
073: public static final String TCOL_CUSTOMER_ID = "CUSTOMER_ORDER.CUSTOMER_ID";
074: public static final int ICOL_CUSTOMER_ID = 2;
075: public static final int JDBC_TYPE_CUSTOMER_ID = -5;
076:
077: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
078: public static final String TCOL_LAST_UPDATED = "CUSTOMER_ORDER.LAST_UPDATED";
079: public static final int ICOL_LAST_UPDATED = 3;
080: public static final int JDBC_TYPE_LAST_UPDATED = 91;
081:
082: public static final String COL_CREATION_DATE = "CREATION_DATE";
083: public static final String TCOL_CREATION_DATE = "CUSTOMER_ORDER.CREATION_DATE";
084: public static final int ICOL_CREATION_DATE = 4;
085: public static final int JDBC_TYPE_CREATION_DATE = 91;
086:
087: private static final MetaTable table = new MetaTable(
088: "CUSTOMER_ORDER", "CUSTOMER_ORDER", 5, 1);
089:
090: static {
091: table.setStaticFinal(true);
092: //
093: // Meta Foreign Keys:
094: //
095: table.addToForeignKey("CUSTOMER_ORDER", new ForeignKeyEntry(
096: "ORDER_ID", "PARENT_ORDER_ID"));
097: //
098: // Meta Natural Key:
099: //
100: // naturalKey has no context
101:
102: //
103: // Meta Columns:
104: //
105:
106: final MetaColumn metaOrderId = new MetaColumn(ICOL_ORDER_ID,
107: "ORDER_ID", "ORDER_ID", table);
108: metaOrderId.setPrimaryKey(true);
109: metaOrderId.setRequired(true);
110: metaOrderId.setOptimisticLock(false);
111: metaOrderId.setType(ColumnType.LONG);
112: metaOrderId.setColumnSize(0);
113: metaOrderId.setRemarks("");
114: metaOrderId.setDecimalDigits(0);
115: metaOrderId.setAutoGenerated(true);
116: metaOrderId.setAutoIncrement(false);
117: metaOrderId.setJdbcType(-5);
118: metaOrderId
119: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.SimpleSequenceKeyGeneratorImpl());
120: {
121: HashMap staticAttributes = new HashMap();
122: staticAttributes.put("name", "CUSTOMER_ORDER_SEQ");
123: metaOrderId.setGeneratorStaticAttributes(staticAttributes);
124: }
125: metaOrderId.initializeKeyGenerator();
126: table.addToPrimaryKey(new Integer(ICOL_ORDER_ID));
127: table.addColumn(metaOrderId);
128:
129: final MetaColumn metaParentOrderId = new MetaColumn(
130: ICOL_PARENT_ORDER_ID, "PARENT_ORDER_ID",
131: "PARENT_ORDER_ID", table);
132: metaParentOrderId.setPrimaryKey(false);
133: metaParentOrderId.setRequired(false);
134: metaParentOrderId.setOptimisticLock(false);
135: metaParentOrderId.setType(ColumnType.LONG);
136: metaParentOrderId.setColumnSize(0);
137: metaParentOrderId.setRemarks("");
138: metaParentOrderId.setDecimalDigits(0);
139: metaParentOrderId.setAutoGenerated(false);
140: metaParentOrderId.setAutoIncrement(false);
141: metaParentOrderId.setJdbcType(-5);
142: table.addColumn(metaParentOrderId);
143:
144: final MetaColumn metaCustomerId = new MetaColumn(
145: ICOL_CUSTOMER_ID, "CUSTOMER_ID", "CUSTOMER_ID", table);
146: metaCustomerId.setPrimaryKey(false);
147: metaCustomerId.setRequired(true);
148: metaCustomerId.setOptimisticLock(false);
149: metaCustomerId.setType(ColumnType.LONG);
150: metaCustomerId.setColumnSize(0);
151: metaCustomerId.setRemarks("");
152: metaCustomerId.setDecimalDigits(0);
153: metaCustomerId.setAutoGenerated(false);
154: metaCustomerId.setAutoIncrement(false);
155: metaCustomerId.setJdbcType(-5);
156: table.addColumn(metaCustomerId);
157:
158: final MetaColumn metaLastUpdated = new MetaColumn(
159: ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
160: table);
161: metaLastUpdated.setPrimaryKey(false);
162: metaLastUpdated.setRequired(false);
163: metaLastUpdated.setOptimisticLock(false);
164: metaLastUpdated.setType(ColumnType.DATE);
165: metaLastUpdated.setColumnSize(0);
166: metaLastUpdated.setRemarks("");
167: metaLastUpdated.setDecimalDigits(0);
168: metaLastUpdated.setAutoGenerated(true);
169: metaLastUpdated.setAutoIncrement(false);
170: metaLastUpdated.setJdbcType(91);
171: metaLastUpdated
172: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
173: metaLastUpdated.initializeKeyGenerator();
174: table.addColumn(metaLastUpdated);
175:
176: final MetaColumn metaCreationDate = new MetaColumn(
177: ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
178: table);
179: metaCreationDate.setPrimaryKey(false);
180: metaCreationDate.setRequired(false);
181: metaCreationDate.setOptimisticLock(false);
182: metaCreationDate.setType(ColumnType.DATE);
183: metaCreationDate.setColumnSize(0);
184: metaCreationDate.setRemarks("");
185: metaCreationDate.setDecimalDigits(0);
186: metaCreationDate.setAutoGenerated(true);
187: metaCreationDate.setAutoIncrement(false);
188: metaCreationDate.setJdbcType(91);
189: metaCreationDate
190: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
191: metaCreationDate.initializeKeyGenerator();
192: table.addColumn(metaCreationDate);
193:
194: }
195:
196: private Long orderId;
197: private Long parentOrderId;
198: private Long customerId;
199: private Date lastUpdated;
200: private Date creationDate;
201:
202: //
203: // orderId:
204: //
205: public Long getOrderId() {
206: return this .orderId;
207: }
208:
209: public void setOrderId(Long orderId) {
210: if (record2().setObject(ICOL_ORDER_ID, orderId)) {
211: this .orderId = orderId;
212: }
213: }
214:
215: public boolean izNullOrderId() {
216: return record2().getObject(ICOL_ORDER_ID) == null;
217: }
218:
219: public void setNullOrderId() {
220: if (record2().setObject(ICOL_ORDER_ID, null)) {
221: this .orderId = null;
222: }
223: }
224:
225: //
226: // parentOrderId:
227: //
228: public Long getParentOrderId() {
229: return this .parentOrderId;
230: }
231:
232: public void setParentOrderId(Long parentOrderId) {
233: if (record2().setObject(ICOL_PARENT_ORDER_ID, parentOrderId)) {
234: this .parentOrderId = parentOrderId;
235: }
236: }
237:
238: public boolean izNullParentOrderId() {
239: return record2().getObject(ICOL_PARENT_ORDER_ID) == null;
240: }
241:
242: public void setNullParentOrderId() {
243: if (record2().setObject(ICOL_PARENT_ORDER_ID, null)) {
244: this .parentOrderId = null;
245: }
246: }
247:
248: //
249: // customerId:
250: //
251: public Long getCustomerId() {
252: return this .customerId;
253: }
254:
255: public void setCustomerId(Long customerId) {
256: if (record2().setObject(ICOL_CUSTOMER_ID, customerId)) {
257: this .customerId = customerId;
258: }
259: }
260:
261: public boolean izNullCustomerId() {
262: return record2().getObject(ICOL_CUSTOMER_ID) == null;
263: }
264:
265: public void setNullCustomerId() {
266: if (record2().setObject(ICOL_CUSTOMER_ID, null)) {
267: this .customerId = null;
268: }
269: }
270:
271: //
272: // lastUpdated:
273: //
274: public Date getLastUpdated() {
275: return this .lastUpdated;
276: }
277:
278: public void setLastUpdated(Date lastUpdated) {
279: if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
280: this .lastUpdated = lastUpdated;
281: }
282: }
283:
284: public boolean izNullLastUpdated() {
285: return record2().getObject(ICOL_LAST_UPDATED) == null;
286: }
287:
288: public void setNullLastUpdated() {
289: if (record2().setObject(ICOL_LAST_UPDATED, null)) {
290: this .lastUpdated = null;
291: }
292: }
293:
294: //
295: // creationDate:
296: //
297: public Date getCreationDate() {
298: return this .creationDate;
299: }
300:
301: public void setCreationDate(Date creationDate) {
302: if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
303: this .creationDate = creationDate;
304: }
305: }
306:
307: public boolean izNullCreationDate() {
308: return record2().getObject(ICOL_CREATION_DATE) == null;
309: }
310:
311: public void setNullCreationDate() {
312: if (record2().setObject(ICOL_CREATION_DATE, null)) {
313: this .creationDate = null;
314: }
315: }
316:
317: public void toBeanFields() {
318: toBeanFields(this );
319: }
320:
321: public void toBeanFields(PersistentObject from) {
322: orderId = (Long) from.record2().getObject(ICOL_ORDER_ID);
323: parentOrderId = (Long) from.record2().getObject(
324: ICOL_PARENT_ORDER_ID);
325: customerId = (Long) from.record2().getObject(ICOL_CUSTOMER_ID);
326: lastUpdated = (Date) from.record2()
327: .getObject(ICOL_LAST_UPDATED);
328: creationDate = (Date) from.record2().getObject(
329: ICOL_CREATION_DATE);
330: super .toBeanFields(from);
331: }
332:
333: public void fromBeanFields(PersistentObject persistentObject) {
334: CustomerOrderPO from = (CustomerOrderPO) persistentObject;
335: record2().getEntry(ICOL_ORDER_ID).setUnmarkedValue(
336: from.orderId, from.orderId);
337: record2().getEntry(ICOL_PARENT_ORDER_ID).setUnmarkedValue(
338: from.parentOrderId, from.parentOrderId);
339: record2().getEntry(ICOL_CUSTOMER_ID).setUnmarkedValue(
340: from.customerId, from.customerId);
341: record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
342: from.lastUpdated, from.lastUpdated);
343: record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
344: from.creationDate, from.creationDate);
345: super .fromBeanFieldsDataSaved(persistentObject);
346: }
347:
348: public String toString() {
349:
350: StringBuffer buffer = new StringBuffer();
351: buffer.append("{ " + "class = ").append(
352: this .getClass().getName()).append(" " + "table = ")
353: .append(TABLE_CUSTOMER_ORDER).append(" columns = {");
354:
355: if (record() != null) {
356: buffer.append(COL_ORDER_ID).append(" = ").append(
357: record().getObject(ICOL_ORDER_ID)).append(" ");
358: buffer.append(COL_PARENT_ORDER_ID).append(" = ").append(
359: record().getObject(ICOL_PARENT_ORDER_ID)).append(
360: " ");
361: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
362: record().getObject(ICOL_CUSTOMER_ID)).append(" ");
363: buffer.append(COL_LAST_UPDATED).append(" = ").append(
364: record().getObject(ICOL_LAST_UPDATED)).append(" ");
365: buffer.append(COL_CREATION_DATE).append(" = ").append(
366: record().getObject(ICOL_CREATION_DATE)).append(" ");
367: } else {
368: buffer.append(COL_ORDER_ID).append(" = ").append(orderId)
369: .append(" ");
370: buffer.append(COL_PARENT_ORDER_ID).append(" = ").append(
371: parentOrderId).append(" ");
372: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
373: customerId).append(" ");
374: buffer.append(COL_LAST_UPDATED).append(" = ").append(
375: lastUpdated).append(" ");
376: buffer.append(COL_CREATION_DATE).append(" = ").append(
377: creationDate).append(" ");
378: }
379: buffer.append("}}");
380: return buffer.toString();
381: }
382:
383: // naturalKey has no context
384:
385: /**
386: * Equals by Basic Peristent object fields (without children objects)
387: */
388: public boolean equalsBasic(Object value) {
389: if (this == value)
390: return true;
391: if (value == null || getClass() != value.getClass())
392: return false;
393:
394: CustomerOrderPO that = (CustomerOrderPO) value;
395:
396: if (orderId != null ? !orderId.equals(that.orderId)
397: : that.orderId != null)
398: return false;
399: if (parentOrderId != null ? !parentOrderId
400: .equals(that.parentOrderId)
401: : that.parentOrderId != null)
402: return false;
403: if (customerId != null ? !customerId.equals(that.customerId)
404: : that.customerId != null)
405: return false;
406: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
407: : that.lastUpdated != null)
408: return false;
409: if (creationDate != null ? !creationDate
410: .equals(that.creationDate) : that.creationDate != null)
411: return false;
412: return true;
413: }
414:
415: /**
416: * hashCode by Basic Peristent object fields (without children objects)
417: */
418: public int hashCodeBasic() {
419: int result;
420: long temp;
421: result = (orderId != null ? orderId.hashCode() : 0);
422: result = 29
423: * result
424: + (parentOrderId != null ? parentOrderId.hashCode() : 0);
425: result = 29 * result
426: + (customerId != null ? customerId.hashCode() : 0);
427: result = 29 * result
428: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
429: result = 29 * result
430: + (creationDate != null ? creationDate.hashCode() : 0);
431:
432: return result;
433: }
434: }
|