001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex003.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 TaxiCarPO 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_TAXI_CAR = "TAXI_CAR";
052:
053: public TaxiCarPO() {
054: super (new Record(table));
055: }
056:
057: public TaxiCarPO(Long productId) {
058: this ();
059: setProductId(productId);
060: }
061:
062: public static final String COL_PRODUCT_ID = "PRODUCT_ID";
063: public static final String TCOL_PRODUCT_ID = "TAXI_CAR.PRODUCT_ID";
064: public static final int ICOL_PRODUCT_ID = 0;
065: public static final int JDBC_TYPE_PRODUCT_ID = -5;
066:
067: public static final String COL_TAXI_CAR_ATTR = "TAXI_CAR_ATTR";
068: public static final String TCOL_TAXI_CAR_ATTR = "TAXI_CAR.TAXI_CAR_ATTR";
069: public static final int ICOL_TAXI_CAR_ATTR = 1;
070: public static final int JDBC_TYPE_TAXI_CAR_ATTR = 12;
071:
072: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
073: public static final String TCOL_LAST_UPDATED = "TAXI_CAR.LAST_UPDATED";
074: public static final int ICOL_LAST_UPDATED = 2;
075: public static final int JDBC_TYPE_LAST_UPDATED = 91;
076:
077: public static final String COL_CREATION_DATE = "CREATION_DATE";
078: public static final String TCOL_CREATION_DATE = "TAXI_CAR.CREATION_DATE";
079: public static final int ICOL_CREATION_DATE = 3;
080: public static final int JDBC_TYPE_CREATION_DATE = 91;
081:
082: private static final MetaTable table = new MetaTable("TAXI_CAR",
083: "TAXI_CAR", 4, 1);
084:
085: static {
086: table.setStaticFinal(true);
087: //
088: // Meta Foreign Keys:
089: //
090: table.addToForeignKey("PRODUCT", new ForeignKeyEntry(
091: "PRODUCT_ID", "PRODUCT_ID"));
092: //
093: // Meta Natural Key:
094: //
095: // naturalKey has no context
096:
097: //
098: // Meta Columns:
099: //
100:
101: final MetaColumn metaProductId = new MetaColumn(
102: ICOL_PRODUCT_ID, "PRODUCT_ID", "PRODUCT_ID", table);
103: metaProductId.setPrimaryKey(true);
104: metaProductId.setRequired(true);
105: metaProductId.setOptimisticLock(false);
106: metaProductId.setType(ColumnType.LONG);
107: metaProductId.setColumnSize(0);
108: metaProductId.setRemarks("");
109: metaProductId.setDecimalDigits(0);
110: metaProductId.setAutoGenerated(false);
111: metaProductId.setAutoIncrement(false);
112: metaProductId.setJdbcType(-5);
113: table.addToPrimaryKey(new Integer(ICOL_PRODUCT_ID));
114: table.addColumn(metaProductId);
115:
116: final MetaColumn metaTaxiCarAttr = new MetaColumn(
117: ICOL_TAXI_CAR_ATTR, "TAXI_CAR_ATTR", "TAXI_CAR_ATTR",
118: table);
119: metaTaxiCarAttr.setPrimaryKey(false);
120: metaTaxiCarAttr.setRequired(true);
121: metaTaxiCarAttr.setOptimisticLock(false);
122: metaTaxiCarAttr.setType(ColumnType.STRING);
123: metaTaxiCarAttr.setColumnSize(1000);
124: metaTaxiCarAttr.setRemarks("");
125: metaTaxiCarAttr.setDecimalDigits(0);
126: metaTaxiCarAttr.setAutoGenerated(false);
127: metaTaxiCarAttr.setAutoIncrement(false);
128: metaTaxiCarAttr.setJdbcType(12);
129: table.addColumn(metaTaxiCarAttr);
130:
131: final MetaColumn metaLastUpdated = new MetaColumn(
132: ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
133: table);
134: metaLastUpdated.setPrimaryKey(false);
135: metaLastUpdated.setRequired(false);
136: metaLastUpdated.setOptimisticLock(false);
137: metaLastUpdated.setType(ColumnType.DATE);
138: metaLastUpdated.setColumnSize(0);
139: metaLastUpdated.setRemarks("");
140: metaLastUpdated.setDecimalDigits(0);
141: metaLastUpdated.setAutoGenerated(true);
142: metaLastUpdated.setAutoIncrement(false);
143: metaLastUpdated.setJdbcType(91);
144: metaLastUpdated
145: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
146: metaLastUpdated.initializeKeyGenerator();
147: table.addColumn(metaLastUpdated);
148:
149: final MetaColumn metaCreationDate = new MetaColumn(
150: ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
151: table);
152: metaCreationDate.setPrimaryKey(false);
153: metaCreationDate.setRequired(false);
154: metaCreationDate.setOptimisticLock(false);
155: metaCreationDate.setType(ColumnType.DATE);
156: metaCreationDate.setColumnSize(0);
157: metaCreationDate.setRemarks("");
158: metaCreationDate.setDecimalDigits(0);
159: metaCreationDate.setAutoGenerated(true);
160: metaCreationDate.setAutoIncrement(false);
161: metaCreationDate.setJdbcType(91);
162: metaCreationDate
163: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
164: metaCreationDate.initializeKeyGenerator();
165: table.addColumn(metaCreationDate);
166:
167: }
168:
169: private Long productId;
170: private String taxiCarAttr;
171: private Date lastUpdated;
172: private Date creationDate;
173:
174: //
175: // productId:
176: //
177: public Long getProductId() {
178: return this .productId;
179: }
180:
181: public void setProductId(Long productId) {
182: if (record2().setObject(ICOL_PRODUCT_ID, productId)) {
183: this .productId = productId;
184: }
185: }
186:
187: public boolean izNullProductId() {
188: return record2().getObject(ICOL_PRODUCT_ID) == null;
189: }
190:
191: public void setNullProductId() {
192: if (record2().setObject(ICOL_PRODUCT_ID, null)) {
193: this .productId = null;
194: }
195: }
196:
197: //
198: // taxiCarAttr:
199: //
200: public String getTaxiCarAttr() {
201: return this .taxiCarAttr;
202: }
203:
204: public void setTaxiCarAttr(String taxiCarAttr) {
205: if (record2().setObject(ICOL_TAXI_CAR_ATTR, taxiCarAttr)) {
206: this .taxiCarAttr = taxiCarAttr;
207: }
208: }
209:
210: public boolean izNullTaxiCarAttr() {
211: return record2().getObject(ICOL_TAXI_CAR_ATTR) == null;
212: }
213:
214: public void setNullTaxiCarAttr() {
215: if (record2().setObject(ICOL_TAXI_CAR_ATTR, null)) {
216: this .taxiCarAttr = null;
217: }
218: }
219:
220: //
221: // lastUpdated:
222: //
223: public Date getLastUpdated() {
224: return this .lastUpdated;
225: }
226:
227: public void setLastUpdated(Date lastUpdated) {
228: if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
229: this .lastUpdated = lastUpdated;
230: }
231: }
232:
233: public boolean izNullLastUpdated() {
234: return record2().getObject(ICOL_LAST_UPDATED) == null;
235: }
236:
237: public void setNullLastUpdated() {
238: if (record2().setObject(ICOL_LAST_UPDATED, null)) {
239: this .lastUpdated = null;
240: }
241: }
242:
243: //
244: // creationDate:
245: //
246: public Date getCreationDate() {
247: return this .creationDate;
248: }
249:
250: public void setCreationDate(Date creationDate) {
251: if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
252: this .creationDate = creationDate;
253: }
254: }
255:
256: public boolean izNullCreationDate() {
257: return record2().getObject(ICOL_CREATION_DATE) == null;
258: }
259:
260: public void setNullCreationDate() {
261: if (record2().setObject(ICOL_CREATION_DATE, null)) {
262: this .creationDate = null;
263: }
264: }
265:
266: public void toBeanFields() {
267: toBeanFields(this );
268: }
269:
270: public void toBeanFields(PersistentObject from) {
271: productId = (Long) from.record2().getObject(ICOL_PRODUCT_ID);
272: taxiCarAttr = (String) from.record2().getObject(
273: ICOL_TAXI_CAR_ATTR);
274: lastUpdated = (Date) from.record2()
275: .getObject(ICOL_LAST_UPDATED);
276: creationDate = (Date) from.record2().getObject(
277: ICOL_CREATION_DATE);
278: super .toBeanFields(from);
279: }
280:
281: public void fromBeanFields(PersistentObject persistentObject) {
282: TaxiCarPO from = (TaxiCarPO) persistentObject;
283: record2().getEntry(ICOL_PRODUCT_ID).setUnmarkedValue(
284: from.productId, from.productId);
285: record2().getEntry(ICOL_TAXI_CAR_ATTR).setUnmarkedValue(
286: from.taxiCarAttr, from.taxiCarAttr);
287: record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
288: from.lastUpdated, from.lastUpdated);
289: record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
290: from.creationDate, from.creationDate);
291: super .fromBeanFieldsDataSaved(persistentObject);
292: }
293:
294: public String toString() {
295:
296: StringBuffer buffer = new StringBuffer();
297: buffer.append("{ " + "class = ").append(
298: this .getClass().getName()).append(" " + "table = ")
299: .append(TABLE_TAXI_CAR).append(" columns = {");
300:
301: if (record() != null) {
302: buffer.append(COL_PRODUCT_ID).append(" = ").append(
303: record().getObject(ICOL_PRODUCT_ID)).append(" ");
304: buffer.append(COL_TAXI_CAR_ATTR).append(" = ").append(
305: record().getObject(ICOL_TAXI_CAR_ATTR)).append(" ");
306: buffer.append(COL_LAST_UPDATED).append(" = ").append(
307: record().getObject(ICOL_LAST_UPDATED)).append(" ");
308: buffer.append(COL_CREATION_DATE).append(" = ").append(
309: record().getObject(ICOL_CREATION_DATE)).append(" ");
310: } else {
311: buffer.append(COL_PRODUCT_ID).append(" = ").append(
312: productId).append(" ");
313: buffer.append(COL_TAXI_CAR_ATTR).append(" = ").append(
314: taxiCarAttr).append(" ");
315: buffer.append(COL_LAST_UPDATED).append(" = ").append(
316: lastUpdated).append(" ");
317: buffer.append(COL_CREATION_DATE).append(" = ").append(
318: creationDate).append(" ");
319: }
320: buffer.append("}}");
321: return buffer.toString();
322: }
323:
324: // naturalKey has no context
325:
326: /**
327: * Equals by Basic Peristent object fields (without children objects)
328: */
329: public boolean equalsBasic(Object value) {
330: if (this == value)
331: return true;
332: if (value == null || getClass() != value.getClass())
333: return false;
334:
335: TaxiCarPO that = (TaxiCarPO) value;
336:
337: if (productId != null ? !productId.equals(that.productId)
338: : that.productId != null)
339: return false;
340: if (taxiCarAttr != null ? !taxiCarAttr.equals(that.taxiCarAttr)
341: : that.taxiCarAttr != null)
342: return false;
343: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
344: : that.lastUpdated != null)
345: return false;
346: if (creationDate != null ? !creationDate
347: .equals(that.creationDate) : that.creationDate != null)
348: return false;
349: return true;
350: }
351:
352: /**
353: * hashCode by Basic Peristent object fields (without children objects)
354: */
355: public int hashCodeBasic() {
356: int result;
357: long temp;
358: result = (productId != null ? productId.hashCode() : 0);
359: result = 29 * result
360: + (taxiCarAttr != null ? taxiCarAttr.hashCode() : 0);
361: result = 29 * result
362: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
363: result = 29 * result
364: + (creationDate != null ? creationDate.hashCode() : 0);
365:
366: return result;
367: }
368: }
|