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 ProductPO 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_PRODUCT = "PRODUCT";
050:
051: public ProductPO() {
052: super (new Record(table));
053: }
054:
055: public ProductPO(String productId) {
056: this ();
057: setProductId(productId);
058: }
059:
060: public static final String COL_PRODUCT_ID = "PRODUCT_ID";
061: public static final String TCOL_PRODUCT_ID = "PRODUCT.PRODUCT_ID";
062: public static final int ICOL_PRODUCT_ID = 0;
063: public static final int JDBC_TYPE_PRODUCT_ID = 12;
064:
065: public static final String COL_CATEGORY = "CATEGORY";
066: public static final String TCOL_CATEGORY = "PRODUCT.CATEGORY";
067: public static final int ICOL_CATEGORY = 1;
068: public static final int JDBC_TYPE_CATEGORY = 12;
069:
070: public static final String COL_NAME = "NAME";
071: public static final String TCOL_NAME = "PRODUCT.NAME";
072: public static final int ICOL_NAME = 2;
073: public static final int JDBC_TYPE_NAME = 12;
074:
075: public static final String COL_DESCN = "DESCN";
076: public static final String TCOL_DESCN = "PRODUCT.DESCN";
077: public static final int ICOL_DESCN = 3;
078: public static final int JDBC_TYPE_DESCN = 12;
079:
080: private static final MetaTable table = new MetaTable("PRODUCT",
081: "PRODUCT", 4, 1);
082:
083: static {
084: table.setStaticFinal(true);
085: //
086: // Meta Foreign Keys:
087: //
088: table.addToForeignKey("CATEGORY", new ForeignKeyEntry("CAT_ID",
089: "CATEGORY"));
090: //
091: // Meta Natural Key:
092: //
093: // naturalKey has no context
094:
095: //
096: // Meta Columns:
097: //
098:
099: final MetaColumn metaProductId = new MetaColumn(
100: ICOL_PRODUCT_ID, "PRODUCT_ID", "PRODUCT_ID", table);
101: metaProductId.setPrimaryKey(true);
102: metaProductId.setRequired(true);
103: metaProductId.setOptimisticLock(false);
104: metaProductId.setType(ColumnType.STRING);
105: metaProductId.setColumnSize(10);
106: metaProductId.setRemarks("");
107: metaProductId.setDecimalDigits(0);
108: metaProductId.setAutoGenerated(false);
109: metaProductId.setAutoIncrement(false);
110: metaProductId.setJdbcType(12);
111: table.addToPrimaryKey(new Integer(ICOL_PRODUCT_ID));
112: table.addColumn(metaProductId);
113:
114: final MetaColumn metaCategory = new MetaColumn(ICOL_CATEGORY,
115: "CATEGORY", "CATEGORY", table);
116: metaCategory.setPrimaryKey(false);
117: metaCategory.setRequired(true);
118: metaCategory.setOptimisticLock(false);
119: metaCategory.setType(ColumnType.STRING);
120: metaCategory.setColumnSize(10);
121: metaCategory.setRemarks("");
122: metaCategory.setDecimalDigits(0);
123: metaCategory.setAutoGenerated(false);
124: metaCategory.setAutoIncrement(false);
125: metaCategory.setJdbcType(12);
126: table.addColumn(metaCategory);
127:
128: final MetaColumn metaName = new MetaColumn(ICOL_NAME, "NAME",
129: "NAME", table);
130: metaName.setPrimaryKey(false);
131: metaName.setRequired(false);
132: metaName.setOptimisticLock(false);
133: metaName.setType(ColumnType.STRING);
134: metaName.setColumnSize(80);
135: metaName.setRemarks("");
136: metaName.setDecimalDigits(0);
137: metaName.setAutoGenerated(false);
138: metaName.setAutoIncrement(false);
139: metaName.setJdbcType(12);
140: table.addColumn(metaName);
141:
142: final MetaColumn metaDescn = new MetaColumn(ICOL_DESCN,
143: "DESCN", "DESCN", table);
144: metaDescn.setPrimaryKey(false);
145: metaDescn.setRequired(false);
146: metaDescn.setOptimisticLock(false);
147: metaDescn.setType(ColumnType.STRING);
148: metaDescn.setColumnSize(255);
149: metaDescn.setRemarks("");
150: metaDescn.setDecimalDigits(0);
151: metaDescn.setAutoGenerated(false);
152: metaDescn.setAutoIncrement(false);
153: metaDescn.setJdbcType(12);
154: table.addColumn(metaDescn);
155:
156: }
157:
158: private String productId;
159: private String category;
160: private String name;
161: private String descn;
162:
163: //
164: // productId:
165: //
166: public String getProductId() {
167: return this .productId;
168: }
169:
170: public void setProductId(String productId) {
171: if (record2().setObject(ICOL_PRODUCT_ID, productId)) {
172: this .productId = productId;
173: }
174: }
175:
176: public boolean izNullProductId() {
177: return record2().getObject(ICOL_PRODUCT_ID) == null;
178: }
179:
180: public void setNullProductId() {
181: if (record2().setObject(ICOL_PRODUCT_ID, null)) {
182: this .productId = null;
183: }
184: }
185:
186: //
187: // category:
188: //
189: public String getCategory() {
190: return this .category;
191: }
192:
193: public void setCategory(String category) {
194: if (record2().setObject(ICOL_CATEGORY, category)) {
195: this .category = category;
196: }
197: }
198:
199: public boolean izNullCategory() {
200: return record2().getObject(ICOL_CATEGORY) == null;
201: }
202:
203: public void setNullCategory() {
204: if (record2().setObject(ICOL_CATEGORY, null)) {
205: this .category = null;
206: }
207: }
208:
209: //
210: // name:
211: //
212: public String getName() {
213: return this .name;
214: }
215:
216: public void setName(String name) {
217: if (record2().setObject(ICOL_NAME, name)) {
218: this .name = name;
219: }
220: }
221:
222: public boolean izNullName() {
223: return record2().getObject(ICOL_NAME) == null;
224: }
225:
226: public void setNullName() {
227: if (record2().setObject(ICOL_NAME, null)) {
228: this .name = null;
229: }
230: }
231:
232: //
233: // descn:
234: //
235: public String getDescn() {
236: return this .descn;
237: }
238:
239: public void setDescn(String descn) {
240: if (record2().setObject(ICOL_DESCN, descn)) {
241: this .descn = descn;
242: }
243: }
244:
245: public boolean izNullDescn() {
246: return record2().getObject(ICOL_DESCN) == null;
247: }
248:
249: public void setNullDescn() {
250: if (record2().setObject(ICOL_DESCN, null)) {
251: this .descn = null;
252: }
253: }
254:
255: public void toBeanFields() {
256: toBeanFields(this );
257: }
258:
259: public void toBeanFields(PersistentObject from) {
260: productId = (String) from.record2().getObject(ICOL_PRODUCT_ID);
261: category = (String) from.record2().getObject(ICOL_CATEGORY);
262: name = (String) from.record2().getObject(ICOL_NAME);
263: descn = (String) from.record2().getObject(ICOL_DESCN);
264: super .toBeanFields(from);
265: }
266:
267: public void fromBeanFields(PersistentObject persistentObject) {
268: ProductPO from = (ProductPO) persistentObject;
269: record2().getEntry(ICOL_PRODUCT_ID).setUnmarkedValue(
270: from.productId, from.productId);
271: record2().getEntry(ICOL_CATEGORY).setUnmarkedValue(
272: from.category, from.category);
273: record2().getEntry(ICOL_NAME).setUnmarkedValue(from.name,
274: from.name);
275: record2().getEntry(ICOL_DESCN).setUnmarkedValue(from.descn,
276: from.descn);
277: super .fromBeanFieldsDataSaved(persistentObject);
278: }
279:
280: public String toString() {
281:
282: StringBuffer buffer = new StringBuffer();
283: buffer.append("{ " + "class = ").append(
284: this .getClass().getName()).append(" " + "table = ")
285: .append(TABLE_PRODUCT).append(" columns = {");
286:
287: if (record() != null) {
288: buffer.append(COL_PRODUCT_ID).append(" = ").append(
289: record().getObject(ICOL_PRODUCT_ID)).append(" ");
290: buffer.append(COL_CATEGORY).append(" = ").append(
291: record().getObject(ICOL_CATEGORY)).append(" ");
292: buffer.append(COL_NAME).append(" = ").append(
293: record().getObject(ICOL_NAME)).append(" ");
294: buffer.append(COL_DESCN).append(" = ").append(
295: record().getObject(ICOL_DESCN)).append(" ");
296: } else {
297: buffer.append(COL_PRODUCT_ID).append(" = ").append(
298: productId).append(" ");
299: buffer.append(COL_CATEGORY).append(" = ").append(category)
300: .append(" ");
301: buffer.append(COL_NAME).append(" = ").append(name).append(
302: " ");
303: buffer.append(COL_DESCN).append(" = ").append(descn)
304: .append(" ");
305: }
306: buffer.append("}}");
307: return buffer.toString();
308: }
309:
310: // naturalKey has no context
311:
312: /**
313: * Equals by Basic Peristent object fields (without children objects)
314: */
315: public boolean equalsBasic(Object value) {
316: if (this == value)
317: return true;
318: if (value == null || getClass() != value.getClass())
319: return false;
320:
321: ProductPO that = (ProductPO) value;
322:
323: if (productId != null ? !productId.equals(that.productId)
324: : that.productId != null)
325: return false;
326: if (category != null ? !category.equals(that.category)
327: : that.category != null)
328: return false;
329: if (name != null ? !name.equals(that.name) : that.name != null)
330: return false;
331: if (descn != null ? !descn.equals(that.descn)
332: : that.descn != null)
333: return false;
334: return true;
335: }
336:
337: /**
338: * hashCode by Basic Peristent object fields (without children objects)
339: */
340: public int hashCodeBasic() {
341: int result;
342: long temp;
343: result = (productId != null ? productId.hashCode() : 0);
344: result = 29 * result
345: + (category != null ? category.hashCode() : 0);
346: result = 29 * result + (name != null ? name.hashCode() : 0);
347: result = 29 * result + (descn != null ? descn.hashCode() : 0);
348:
349: return result;
350: }
351: }
|