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 PoliceCarPO 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_POLICE_CAR = "POLICE_CAR";
052:
053: public PoliceCarPO() {
054: super (new Record(table));
055: }
056:
057: public PoliceCarPO(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 = "POLICE_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_POLICE_CAR_ATTR = "POLICE_CAR_ATTR";
068: public static final String TCOL_POLICE_CAR_ATTR = "POLICE_CAR.POLICE_CAR_ATTR";
069: public static final int ICOL_POLICE_CAR_ATTR = 1;
070: public static final int JDBC_TYPE_POLICE_CAR_ATTR = 12;
071:
072: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
073: public static final String TCOL_LAST_UPDATED = "POLICE_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 = "POLICE_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("POLICE_CAR",
083: "POLICE_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 metaPoliceCarAttr = new MetaColumn(
117: ICOL_POLICE_CAR_ATTR, "POLICE_CAR_ATTR",
118: "POLICE_CAR_ATTR", table);
119: metaPoliceCarAttr.setPrimaryKey(false);
120: metaPoliceCarAttr.setRequired(true);
121: metaPoliceCarAttr.setOptimisticLock(false);
122: metaPoliceCarAttr.setType(ColumnType.STRING);
123: metaPoliceCarAttr.setColumnSize(1000);
124: metaPoliceCarAttr.setRemarks("");
125: metaPoliceCarAttr.setDecimalDigits(0);
126: metaPoliceCarAttr.setAutoGenerated(false);
127: metaPoliceCarAttr.setAutoIncrement(false);
128: metaPoliceCarAttr.setJdbcType(12);
129: table.addColumn(metaPoliceCarAttr);
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 policeCarAttr;
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: // policeCarAttr:
199: //
200: public String getPoliceCarAttr() {
201: return this .policeCarAttr;
202: }
203:
204: public void setPoliceCarAttr(String policeCarAttr) {
205: if (record2().setObject(ICOL_POLICE_CAR_ATTR, policeCarAttr)) {
206: this .policeCarAttr = policeCarAttr;
207: }
208: }
209:
210: public boolean izNullPoliceCarAttr() {
211: return record2().getObject(ICOL_POLICE_CAR_ATTR) == null;
212: }
213:
214: public void setNullPoliceCarAttr() {
215: if (record2().setObject(ICOL_POLICE_CAR_ATTR, null)) {
216: this .policeCarAttr = 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: policeCarAttr = (String) from.record2().getObject(
273: ICOL_POLICE_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: PoliceCarPO from = (PoliceCarPO) persistentObject;
283: record2().getEntry(ICOL_PRODUCT_ID).setUnmarkedValue(
284: from.productId, from.productId);
285: record2().getEntry(ICOL_POLICE_CAR_ATTR).setUnmarkedValue(
286: from.policeCarAttr, from.policeCarAttr);
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_POLICE_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_POLICE_CAR_ATTR).append(" = ").append(
305: record().getObject(ICOL_POLICE_CAR_ATTR)).append(
306: " ");
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_POLICE_CAR_ATTR).append(" = ").append(
315: policeCarAttr).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: PoliceCarPO that = (PoliceCarPO) value;
337:
338: if (productId != null ? !productId.equals(that.productId)
339: : that.productId != null)
340: return false;
341: if (policeCarAttr != null ? !policeCarAttr
342: .equals(that.policeCarAttr)
343: : that.policeCarAttr != null)
344: return false;
345: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
346: : that.lastUpdated != null)
347: return false;
348: if (creationDate != null ? !creationDate
349: .equals(that.creationDate) : that.creationDate != null)
350: return false;
351: return true;
352: }
353:
354: /**
355: * hashCode by Basic Peristent object fields (without children objects)
356: */
357: public int hashCodeBasic() {
358: int result;
359: long temp;
360: result = (productId != null ? productId.hashCode() : 0);
361: result = 29
362: * result
363: + (policeCarAttr != null ? policeCarAttr.hashCode() : 0);
364: result = 29 * result
365: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
366: result = 29 * result
367: + (creationDate != null ? creationDate.hashCode() : 0);
368:
369: return result;
370: }
371: }
|