001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.odal.petstore.persistence.gen.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 OrderStatusPO 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_ORDER_STATUS = "ORDER_STATUS";
052:
053: public OrderStatusPO() {
054: super (new Record(table));
055: }
056:
057: public OrderStatusPO(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 = "ORDER_STATUS.ORDER_ID";
064: public static final int ICOL_ORDER_ID = 0;
065: public static final int JDBC_TYPE_ORDER_ID = 4;
066:
067: public static final String COL_TIMESTAMP = "TIMESTAMP";
068: public static final String TCOL_TIMESTAMP = "ORDER_STATUS.TIMESTAMP";
069: public static final int ICOL_TIMESTAMP = 1;
070: public static final int JDBC_TYPE_TIMESTAMP = 91;
071:
072: public static final String COL_STATUS = "STATUS";
073: public static final String TCOL_STATUS = "ORDER_STATUS.STATUS";
074: public static final int ICOL_STATUS = 2;
075: public static final int JDBC_TYPE_STATUS = 12;
076:
077: private static final MetaTable table = new MetaTable(
078: "ORDER_STATUS", "ORDER_STATUS", 3, 1);
079:
080: static {
081: table.setStaticFinal(true);
082: //
083: // Meta Foreign Keys:
084: //
085: table.addToForeignKey("ORDERS", new ForeignKeyEntry("ORDER_ID",
086: "ORDER_ID"));
087: //
088: // Meta Natural Key:
089: //
090: // naturalKey has no context
091:
092: //
093: // Meta Columns:
094: //
095:
096: final MetaColumn metaOrderId = new MetaColumn(ICOL_ORDER_ID,
097: "ORDER_ID", "ORDER_ID", table);
098: metaOrderId.setPrimaryKey(true);
099: metaOrderId.setRequired(true);
100: metaOrderId.setOptimisticLock(false);
101: metaOrderId.setType(ColumnType.LONG_PRIMITIVE);
102: metaOrderId.setColumnSize(0);
103: metaOrderId.setRemarks("");
104: metaOrderId.setDecimalDigits(0);
105: metaOrderId.setAutoGenerated(false);
106: metaOrderId.setAutoIncrement(false);
107: metaOrderId.setJdbcType(4);
108: table.addToPrimaryKey(new Integer(ICOL_ORDER_ID));
109: table.addColumn(metaOrderId);
110:
111: final MetaColumn metaTimestamp = new MetaColumn(ICOL_TIMESTAMP,
112: "TIMESTAMP", "TIMESTAMP", table);
113: metaTimestamp.setPrimaryKey(false);
114: metaTimestamp.setRequired(true);
115: metaTimestamp.setOptimisticLock(false);
116: metaTimestamp.setType(ColumnType.DATE);
117: metaTimestamp.setColumnSize(0);
118: metaTimestamp.setRemarks("");
119: metaTimestamp.setDecimalDigits(0);
120: metaTimestamp.setAutoGenerated(true);
121: metaTimestamp.setAutoIncrement(false);
122: metaTimestamp.setJdbcType(91);
123: metaTimestamp
124: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
125: metaTimestamp.initializeKeyGenerator();
126: table.addColumn(metaTimestamp);
127:
128: final MetaColumn metaStatus = new MetaColumn(ICOL_STATUS,
129: "STATUS", "STATUS", table);
130: metaStatus.setPrimaryKey(false);
131: metaStatus.setRequired(true);
132: metaStatus.setOptimisticLock(false);
133: metaStatus.setType(ColumnType.STRING);
134: metaStatus.setColumnSize(2);
135: metaStatus.setRemarks("");
136: metaStatus.setDecimalDigits(0);
137: metaStatus.setAutoGenerated(false);
138: metaStatus.setAutoIncrement(false);
139: metaStatus.setJdbcType(12);
140: table.addColumn(metaStatus);
141:
142: }
143:
144: private long orderId;
145: private Date timestamp;
146: private String status;
147:
148: //
149: // orderId:
150: //
151: public long getOrderId() {
152: return this .orderId;
153: }
154:
155: public void setOrderId(long orderId) {
156: if (record2().setObject(ICOL_ORDER_ID, long2Number(orderId))) {
157: this .orderId = orderId;
158: }
159: }
160:
161: public boolean izNullOrderId() {
162: return record2().getObject(ICOL_ORDER_ID) == null;
163: }
164:
165: public void setNullOrderId() {
166: if (record2().setObject(ICOL_ORDER_ID, null)) {
167: this .orderId = Number2long(null);
168: }
169: }
170:
171: //
172: // timestamp:
173: //
174: public Date getTimestamp() {
175: return this .timestamp;
176: }
177:
178: public void setTimestamp(Date timestamp) {
179: if (record2().setObject(ICOL_TIMESTAMP, timestamp)) {
180: this .timestamp = timestamp;
181: }
182: }
183:
184: public boolean izNullTimestamp() {
185: return record2().getObject(ICOL_TIMESTAMP) == null;
186: }
187:
188: public void setNullTimestamp() {
189: if (record2().setObject(ICOL_TIMESTAMP, null)) {
190: this .timestamp = null;
191: }
192: }
193:
194: //
195: // status:
196: //
197: public String getStatus() {
198: return this .status;
199: }
200:
201: public void setStatus(String status) {
202: if (record2().setObject(ICOL_STATUS, status)) {
203: this .status = status;
204: }
205: }
206:
207: public boolean izNullStatus() {
208: return record2().getObject(ICOL_STATUS) == null;
209: }
210:
211: public void setNullStatus() {
212: if (record2().setObject(ICOL_STATUS, null)) {
213: this .status = null;
214: }
215: }
216:
217: public void toBeanFields() {
218: toBeanFields(this );
219: }
220:
221: public void toBeanFields(PersistentObject from) {
222: orderId = Number2long((Number) from.record2().getObject(
223: ICOL_ORDER_ID));
224: timestamp = (Date) from.record2().getObject(ICOL_TIMESTAMP);
225: status = (String) from.record2().getObject(ICOL_STATUS);
226: super .toBeanFields(from);
227: }
228:
229: public void fromBeanFields(PersistentObject persistentObject) {
230: OrderStatusPO from = (OrderStatusPO) persistentObject;
231: record2().getEntry(ICOL_ORDER_ID).setUnmarkedValue(
232: from.long2Number(orderId), from.long2Number(orderId));
233: record2().getEntry(ICOL_TIMESTAMP).setUnmarkedValue(
234: from.timestamp, from.timestamp);
235: record2().getEntry(ICOL_STATUS).setUnmarkedValue(from.status,
236: from.status);
237: super .fromBeanFieldsDataSaved(persistentObject);
238: }
239:
240: public String toString() {
241:
242: StringBuffer buffer = new StringBuffer();
243: buffer.append("{ " + "class = ").append(
244: this .getClass().getName()).append(" " + "table = ")
245: .append(TABLE_ORDER_STATUS).append(" columns = {");
246:
247: if (record() != null) {
248: buffer.append(COL_ORDER_ID).append(" = ").append(
249: record().getObject(ICOL_ORDER_ID)).append(" ");
250: buffer.append(COL_TIMESTAMP).append(" = ").append(
251: record().getObject(ICOL_TIMESTAMP)).append(" ");
252: buffer.append(COL_STATUS).append(" = ").append(
253: record().getObject(ICOL_STATUS)).append(" ");
254: } else {
255: buffer.append(COL_ORDER_ID).append(" = ").append(orderId)
256: .append(" ");
257: buffer.append(COL_TIMESTAMP).append(" = ")
258: .append(timestamp).append(" ");
259: buffer.append(COL_STATUS).append(" = ").append(status)
260: .append(" ");
261: }
262: buffer.append("}}");
263: return buffer.toString();
264: }
265:
266: // naturalKey has no context
267:
268: /**
269: * Equals by Basic Peristent object fields (without children objects)
270: */
271: public boolean equalsBasic(Object value) {
272: if (this == value)
273: return true;
274: if (value == null || getClass() != value.getClass())
275: return false;
276:
277: OrderStatusPO that = (OrderStatusPO) value;
278:
279: if (orderId != that.orderId)
280: return false;
281: if (timestamp != null ? !timestamp.equals(that.timestamp)
282: : that.timestamp != null)
283: return false;
284: if (status != null ? !status.equals(that.status)
285: : that.status != null)
286: return false;
287: return true;
288: }
289:
290: /**
291: * hashCode by Basic Peristent object fields (without children objects)
292: */
293: public int hashCodeBasic() {
294: int result;
295: long temp;
296: result = (int) (orderId ^ (orderId >>> 32));
297: result = 29 * result
298: + (timestamp != null ? timestamp.hashCode() : 0);
299: result = 29 * result + (status != null ? status.hashCode() : 0);
300:
301: return result;
302: }
303: }
|