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 CategoryPO 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_CATEGORY = "CATEGORY";
050:
051: public CategoryPO() {
052: super (new Record(table));
053: }
054:
055: public CategoryPO(String catId) {
056: this ();
057: setCatId(catId);
058: }
059:
060: public static final String COL_CAT_ID = "CAT_ID";
061: public static final String TCOL_CAT_ID = "CATEGORY.CAT_ID";
062: public static final int ICOL_CAT_ID = 0;
063: public static final int JDBC_TYPE_CAT_ID = 12;
064:
065: public static final String COL_NAME = "NAME";
066: public static final String TCOL_NAME = "CATEGORY.NAME";
067: public static final int ICOL_NAME = 1;
068: public static final int JDBC_TYPE_NAME = 12;
069:
070: public static final String COL_DESCN = "DESCN";
071: public static final String TCOL_DESCN = "CATEGORY.DESCN";
072: public static final int ICOL_DESCN = 2;
073: public static final int JDBC_TYPE_DESCN = 12;
074:
075: private static final MetaTable table = new MetaTable("CATEGORY",
076: "CATEGORY", 3, 1);
077:
078: static {
079: table.setStaticFinal(true);
080: //
081: // Meta Foreign Keys:
082: //
083: //
084: // Meta Natural Key:
085: //
086: // naturalKey has no context
087:
088: //
089: // Meta Columns:
090: //
091:
092: final MetaColumn metaCatId = new MetaColumn(ICOL_CAT_ID,
093: "CAT_ID", "CAT_ID", table);
094: metaCatId.setPrimaryKey(true);
095: metaCatId.setRequired(true);
096: metaCatId.setOptimisticLock(false);
097: metaCatId.setType(ColumnType.STRING);
098: metaCatId.setColumnSize(10);
099: metaCatId.setRemarks("");
100: metaCatId.setDecimalDigits(0);
101: metaCatId.setAutoGenerated(false);
102: metaCatId.setAutoIncrement(false);
103: metaCatId.setJdbcType(12);
104: table.addToPrimaryKey(new Integer(ICOL_CAT_ID));
105: table.addColumn(metaCatId);
106:
107: final MetaColumn metaName = new MetaColumn(ICOL_NAME, "NAME",
108: "NAME", table);
109: metaName.setPrimaryKey(false);
110: metaName.setRequired(false);
111: metaName.setOptimisticLock(false);
112: metaName.setType(ColumnType.STRING);
113: metaName.setColumnSize(80);
114: metaName.setRemarks("");
115: metaName.setDecimalDigits(0);
116: metaName.setAutoGenerated(false);
117: metaName.setAutoIncrement(false);
118: metaName.setJdbcType(12);
119: table.addColumn(metaName);
120:
121: final MetaColumn metaDescn = new MetaColumn(ICOL_DESCN,
122: "DESCN", "DESCN", table);
123: metaDescn.setPrimaryKey(false);
124: metaDescn.setRequired(false);
125: metaDescn.setOptimisticLock(false);
126: metaDescn.setType(ColumnType.STRING);
127: metaDescn.setColumnSize(255);
128: metaDescn.setRemarks("");
129: metaDescn.setDecimalDigits(0);
130: metaDescn.setAutoGenerated(false);
131: metaDescn.setAutoIncrement(false);
132: metaDescn.setJdbcType(12);
133: table.addColumn(metaDescn);
134:
135: }
136:
137: private String catId;
138: private String name;
139: private String descn;
140:
141: //
142: // catId:
143: //
144: public String getCatId() {
145: return this .catId;
146: }
147:
148: public void setCatId(String catId) {
149: if (record2().setObject(ICOL_CAT_ID, catId)) {
150: this .catId = catId;
151: }
152: }
153:
154: public boolean izNullCatId() {
155: return record2().getObject(ICOL_CAT_ID) == null;
156: }
157:
158: public void setNullCatId() {
159: if (record2().setObject(ICOL_CAT_ID, null)) {
160: this .catId = null;
161: }
162: }
163:
164: //
165: // name:
166: //
167: public String getName() {
168: return this .name;
169: }
170:
171: public void setName(String name) {
172: if (record2().setObject(ICOL_NAME, name)) {
173: this .name = name;
174: }
175: }
176:
177: public boolean izNullName() {
178: return record2().getObject(ICOL_NAME) == null;
179: }
180:
181: public void setNullName() {
182: if (record2().setObject(ICOL_NAME, null)) {
183: this .name = null;
184: }
185: }
186:
187: //
188: // descn:
189: //
190: public String getDescn() {
191: return this .descn;
192: }
193:
194: public void setDescn(String descn) {
195: if (record2().setObject(ICOL_DESCN, descn)) {
196: this .descn = descn;
197: }
198: }
199:
200: public boolean izNullDescn() {
201: return record2().getObject(ICOL_DESCN) == null;
202: }
203:
204: public void setNullDescn() {
205: if (record2().setObject(ICOL_DESCN, null)) {
206: this .descn = null;
207: }
208: }
209:
210: public void toBeanFields() {
211: toBeanFields(this );
212: }
213:
214: public void toBeanFields(PersistentObject from) {
215: catId = (String) from.record2().getObject(ICOL_CAT_ID);
216: name = (String) from.record2().getObject(ICOL_NAME);
217: descn = (String) from.record2().getObject(ICOL_DESCN);
218: super .toBeanFields(from);
219: }
220:
221: public void fromBeanFields(PersistentObject persistentObject) {
222: CategoryPO from = (CategoryPO) persistentObject;
223: record2().getEntry(ICOL_CAT_ID).setUnmarkedValue(from.catId,
224: from.catId);
225: record2().getEntry(ICOL_NAME).setUnmarkedValue(from.name,
226: from.name);
227: record2().getEntry(ICOL_DESCN).setUnmarkedValue(from.descn,
228: from.descn);
229: super .fromBeanFieldsDataSaved(persistentObject);
230: }
231:
232: public String toString() {
233:
234: StringBuffer buffer = new StringBuffer();
235: buffer.append("{ " + "class = ").append(
236: this .getClass().getName()).append(" " + "table = ")
237: .append(TABLE_CATEGORY).append(" columns = {");
238:
239: if (record() != null) {
240: buffer.append(COL_CAT_ID).append(" = ").append(
241: record().getObject(ICOL_CAT_ID)).append(" ");
242: buffer.append(COL_NAME).append(" = ").append(
243: record().getObject(ICOL_NAME)).append(" ");
244: buffer.append(COL_DESCN).append(" = ").append(
245: record().getObject(ICOL_DESCN)).append(" ");
246: } else {
247: buffer.append(COL_CAT_ID).append(" = ").append(catId)
248: .append(" ");
249: buffer.append(COL_NAME).append(" = ").append(name).append(
250: " ");
251: buffer.append(COL_DESCN).append(" = ").append(descn)
252: .append(" ");
253: }
254: buffer.append("}}");
255: return buffer.toString();
256: }
257:
258: // naturalKey has no context
259:
260: /**
261: * Equals by Basic Peristent object fields (without children objects)
262: */
263: public boolean equalsBasic(Object value) {
264: if (this == value)
265: return true;
266: if (value == null || getClass() != value.getClass())
267: return false;
268:
269: CategoryPO that = (CategoryPO) value;
270:
271: if (catId != null ? !catId.equals(that.catId)
272: : that.catId != null)
273: return false;
274: if (name != null ? !name.equals(that.name) : that.name != null)
275: return false;
276: if (descn != null ? !descn.equals(that.descn)
277: : that.descn != null)
278: return false;
279: return true;
280: }
281:
282: /**
283: * hashCode by Basic Peristent object fields (without children objects)
284: */
285: public int hashCodeBasic() {
286: int result;
287: long temp;
288: result = (catId != null ? catId.hashCode() : 0);
289: result = 29 * result + (name != null ? name.hashCode() : 0);
290: result = 29 * result + (descn != null ? descn.hashCode() : 0);
291:
292: return result;
293: }
294: }
|