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