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: public class InventoryPO extends PersistentObject implements
018: java.io.Externalizable {
019: //
020: // Complex object related:
021: //
022:
023: //
024: private static Map registeredMasters;
025: private static Object lock = new Object();
026:
027: protected Object classLock() {
028: return lock;
029: }
030:
031: protected void instantiateRegisteredMasters() {
032: if (registeredMasters == null) {
033: synchronized (lock) {
034: if (registeredMasters == null) {
035: registeredMasters = new HashMap();
036: }
037: }
038: }
039: }
040:
041: protected Map registeredMasters() {
042: return registeredMasters;
043: }
044:
045: //
046: //
047: //
048:
049: public static final String TABLE_INVENTORY = "INVENTORY";
050:
051: public InventoryPO() {
052: super (new Record(table));
053: }
054:
055: public InventoryPO(String itemId) {
056: this ();
057: setItemId(itemId);
058: }
059:
060: public static final String COL_ITEM_ID = "ITEM_ID";
061: public static final String TCOL_ITEM_ID = "INVENTORY.ITEM_ID";
062: public static final int ICOL_ITEM_ID = 0;
063: public static final int JDBC_TYPE_ITEM_ID = 12;
064:
065: public static final String COL_QUANTITY = "QTY";
066: public static final String TCOL_QUANTITY = "INVENTORY.QTY";
067: public static final int ICOL_QUANTITY = 1;
068: public static final int JDBC_TYPE_QUANTITY = 4;
069:
070: private static final MetaTable table = new MetaTable("INVENTORY",
071: "INVENTORY", 2, 1);
072:
073: static {
074: table.setStaticFinal(true);
075: //
076: // Meta Foreign Keys:
077: //
078: //
079: // Meta Natural Key:
080: //
081: // naturalKey has no context
082:
083: //
084: // Meta Columns:
085: //
086:
087: final MetaColumn metaItemId = new MetaColumn(ICOL_ITEM_ID,
088: "ITEM_ID", "ITEM_ID", table);
089: metaItemId.setPrimaryKey(true);
090: metaItemId.setRequired(true);
091: metaItemId.setOptimisticLock(false);
092: metaItemId.setType(ColumnType.STRING);
093: metaItemId.setColumnSize(10);
094: metaItemId.setRemarks("");
095: metaItemId.setDecimalDigits(0);
096: metaItemId.setAutoGenerated(false);
097: metaItemId.setAutoIncrement(false);
098: metaItemId.setJdbcType(12);
099: table.addToPrimaryKey(new Integer(ICOL_ITEM_ID));
100: table.addColumn(metaItemId);
101:
102: final MetaColumn metaQuantity = new MetaColumn(ICOL_QUANTITY,
103: "QTY", "QUANTITY", table);
104: metaQuantity.setPrimaryKey(false);
105: metaQuantity.setRequired(true);
106: metaQuantity.setOptimisticLock(false);
107: metaQuantity.setType(ColumnType.LONG_PRIMITIVE);
108: metaQuantity.setColumnSize(0);
109: metaQuantity.setRemarks("");
110: metaQuantity.setDecimalDigits(0);
111: metaQuantity.setAutoGenerated(false);
112: metaQuantity.setAutoIncrement(false);
113: metaQuantity.setJdbcType(4);
114: table.addColumn(metaQuantity);
115:
116: }
117:
118: private String itemId;
119: private long quantity;
120:
121: //
122: // itemId:
123: //
124: public String getItemId() {
125: return this .itemId;
126: }
127:
128: public void setItemId(String itemId) {
129: if (record2().setObject(ICOL_ITEM_ID, itemId)) {
130: this .itemId = itemId;
131: }
132: }
133:
134: public boolean izNullItemId() {
135: return record2().getObject(ICOL_ITEM_ID) == null;
136: }
137:
138: public void setNullItemId() {
139: if (record2().setObject(ICOL_ITEM_ID, null)) {
140: this .itemId = null;
141: }
142: }
143:
144: //
145: // quantity:
146: //
147: public long getQuantity() {
148: return this .quantity;
149: }
150:
151: public void setQuantity(long quantity) {
152: if (record2().setObject(ICOL_QUANTITY, long2Number(quantity))) {
153: this .quantity = quantity;
154: }
155: }
156:
157: public boolean izNullQuantity() {
158: return record2().getObject(ICOL_QUANTITY) == null;
159: }
160:
161: public void setNullQuantity() {
162: if (record2().setObject(ICOL_QUANTITY, null)) {
163: this .quantity = Number2long(null);
164: }
165: }
166:
167: public void toBeanFields() {
168: toBeanFields(this );
169: }
170:
171: public void toBeanFields(PersistentObject from) {
172: itemId = (String) from.record2().getObject(ICOL_ITEM_ID);
173: quantity = Number2long((Number) from.record2().getObject(
174: ICOL_QUANTITY));
175: super .toBeanFields(from);
176: }
177:
178: public void fromBeanFields(PersistentObject persistentObject) {
179: InventoryPO from = (InventoryPO) persistentObject;
180: record2().getEntry(ICOL_ITEM_ID).setUnmarkedValue(from.itemId,
181: from.itemId);
182: record2().getEntry(ICOL_QUANTITY).setUnmarkedValue(
183: from.long2Number(quantity), from.long2Number(quantity));
184: super .fromBeanFieldsDataSaved(persistentObject);
185: }
186:
187: public String toString() {
188:
189: StringBuffer buffer = new StringBuffer();
190: buffer.append("{ " + "class = ").append(
191: this .getClass().getName()).append(" " + "table = ")
192: .append(TABLE_INVENTORY).append(" columns = {");
193:
194: if (record() != null) {
195: buffer.append(COL_ITEM_ID).append(" = ").append(
196: record().getObject(ICOL_ITEM_ID)).append(" ");
197: buffer.append(COL_QUANTITY).append(" = ").append(
198: record().getObject(ICOL_QUANTITY)).append(" ");
199: } else {
200: buffer.append(COL_ITEM_ID).append(" = ").append(itemId)
201: .append(" ");
202: buffer.append(COL_QUANTITY).append(" = ").append(quantity)
203: .append(" ");
204: }
205: buffer.append("}}");
206: return buffer.toString();
207: }
208:
209: // naturalKey has no context
210:
211: /**
212: * Equals by Basic Peristent object fields (without children objects)
213: */
214: public boolean equalsBasic(Object value) {
215: if (this == value)
216: return true;
217: if (value == null || getClass() != value.getClass())
218: return false;
219:
220: InventoryPO that = (InventoryPO) value;
221:
222: if (itemId != null ? !itemId.equals(that.itemId)
223: : that.itemId != null)
224: return false;
225: if (quantity != that.quantity)
226: return false;
227: return true;
228: }
229:
230: /**
231: * hashCode by Basic Peristent object fields (without children objects)
232: */
233: public int hashCodeBasic() {
234: int result;
235: long temp;
236: result = (itemId != null ? itemId.hashCode() : 0);
237: result = 29 * result + (int) (quantity ^ (quantity >>> 32));
238:
239: return result;
240: }
241: }
|