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 ProfilePO 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_PROFILE = "PROFILE";
050:
051: public ProfilePO() {
052: super (new Record(table));
053: }
054:
055: public ProfilePO(String userId) {
056: this ();
057: setUserId(userId);
058: }
059:
060: public static final String COL_USER_ID = "USER_ID";
061: public static final String TCOL_USER_ID = "PROFILE.USER_ID";
062: public static final int ICOL_USER_ID = 0;
063: public static final int JDBC_TYPE_USER_ID = 12;
064:
065: public static final String COL_LANG_PREF = "LANG_PREF";
066: public static final String TCOL_LANG_PREF = "PROFILE.LANG_PREF";
067: public static final int ICOL_LANG_PREF = 1;
068: public static final int JDBC_TYPE_LANG_PREF = 12;
069:
070: public static final String COL_FAV_CATEGORY = "FAV_CATEGORY";
071: public static final String TCOL_FAV_CATEGORY = "PROFILE.FAV_CATEGORY";
072: public static final int ICOL_FAV_CATEGORY = 2;
073: public static final int JDBC_TYPE_FAV_CATEGORY = 12;
074:
075: public static final String COL_MY_LIST_OPT = "MY_LIST_OPT";
076: public static final String TCOL_MY_LIST_OPT = "PROFILE.MY_LIST_OPT";
077: public static final int ICOL_MY_LIST_OPT = 3;
078: public static final int JDBC_TYPE_MY_LIST_OPT = 4;
079:
080: public static final String COL_BANNER_OPT = "BANNER_OPT";
081: public static final String TCOL_BANNER_OPT = "PROFILE.BANNER_OPT";
082: public static final int ICOL_BANNER_OPT = 4;
083: public static final int JDBC_TYPE_BANNER_OPT = 4;
084:
085: private static final MetaTable table = new MetaTable("PROFILE",
086: "PROFILE", 5, 1);
087:
088: static {
089: table.setStaticFinal(true);
090: //
091: // Meta Foreign Keys:
092: //
093: table.addToForeignKey("ACCOUNT", new ForeignKeyEntry("USER_ID",
094: "USER_ID"));
095: table.addToForeignKey("BANNER_DATA", new ForeignKeyEntry(
096: "FAV_CATEGORY", "FAV_CATEGORY"));
097: //
098: // Meta Natural Key:
099: //
100: // naturalKey has no context
101:
102: //
103: // Meta Columns:
104: //
105:
106: final MetaColumn metaUserId = new MetaColumn(ICOL_USER_ID,
107: "USER_ID", "USER_ID", table);
108: metaUserId.setPrimaryKey(true);
109: metaUserId.setRequired(true);
110: metaUserId.setOptimisticLock(false);
111: metaUserId.setType(ColumnType.STRING);
112: metaUserId.setColumnSize(80);
113: metaUserId.setRemarks("");
114: metaUserId.setDecimalDigits(0);
115: metaUserId.setAutoGenerated(false);
116: metaUserId.setAutoIncrement(false);
117: metaUserId.setJdbcType(12);
118: table.addToPrimaryKey(new Integer(ICOL_USER_ID));
119: table.addColumn(metaUserId);
120:
121: final MetaColumn metaLangPref = new MetaColumn(ICOL_LANG_PREF,
122: "LANG_PREF", "LANG_PREF", table);
123: metaLangPref.setPrimaryKey(false);
124: metaLangPref.setRequired(true);
125: metaLangPref.setOptimisticLock(false);
126: metaLangPref.setType(ColumnType.STRING);
127: metaLangPref.setColumnSize(80);
128: metaLangPref.setRemarks("");
129: metaLangPref.setDecimalDigits(0);
130: metaLangPref.setAutoGenerated(false);
131: metaLangPref.setAutoIncrement(false);
132: metaLangPref.setJdbcType(12);
133: table.addColumn(metaLangPref);
134:
135: final MetaColumn metaFavCategory = new MetaColumn(
136: ICOL_FAV_CATEGORY, "FAV_CATEGORY", "FAV_CATEGORY",
137: table);
138: metaFavCategory.setPrimaryKey(false);
139: metaFavCategory.setRequired(false);
140: metaFavCategory.setOptimisticLock(false);
141: metaFavCategory.setType(ColumnType.STRING);
142: metaFavCategory.setColumnSize(30);
143: metaFavCategory.setRemarks("");
144: metaFavCategory.setDecimalDigits(0);
145: metaFavCategory.setAutoGenerated(false);
146: metaFavCategory.setAutoIncrement(false);
147: metaFavCategory.setJdbcType(12);
148: table.addColumn(metaFavCategory);
149:
150: final MetaColumn metaMyListOpt = new MetaColumn(
151: ICOL_MY_LIST_OPT, "MY_LIST_OPT", "MY_LIST_OPT", table);
152: metaMyListOpt.setPrimaryKey(false);
153: metaMyListOpt.setRequired(false);
154: metaMyListOpt.setOptimisticLock(false);
155: metaMyListOpt.setType(ColumnType.LONG);
156: metaMyListOpt.setColumnSize(0);
157: metaMyListOpt.setRemarks("");
158: metaMyListOpt.setDecimalDigits(0);
159: metaMyListOpt.setAutoGenerated(false);
160: metaMyListOpt.setAutoIncrement(false);
161: metaMyListOpt.setJdbcType(4);
162: table.addColumn(metaMyListOpt);
163:
164: final MetaColumn metaBannerOpt = new MetaColumn(
165: ICOL_BANNER_OPT, "BANNER_OPT", "BANNER_OPT", table);
166: metaBannerOpt.setPrimaryKey(false);
167: metaBannerOpt.setRequired(false);
168: metaBannerOpt.setOptimisticLock(false);
169: metaBannerOpt.setType(ColumnType.LONG);
170: metaBannerOpt.setColumnSize(0);
171: metaBannerOpt.setRemarks("");
172: metaBannerOpt.setDecimalDigits(0);
173: metaBannerOpt.setAutoGenerated(false);
174: metaBannerOpt.setAutoIncrement(false);
175: metaBannerOpt.setJdbcType(4);
176: table.addColumn(metaBannerOpt);
177:
178: }
179:
180: private String userId;
181: private String langPref;
182: private String favCategory;
183: private Long myListOpt;
184: private Long bannerOpt;
185:
186: //
187: // userId:
188: //
189: public String getUserId() {
190: return this .userId;
191: }
192:
193: public void setUserId(String userId) {
194: if (record2().setObject(ICOL_USER_ID, userId)) {
195: this .userId = userId;
196: }
197: }
198:
199: public boolean izNullUserId() {
200: return record2().getObject(ICOL_USER_ID) == null;
201: }
202:
203: public void setNullUserId() {
204: if (record2().setObject(ICOL_USER_ID, null)) {
205: this .userId = null;
206: }
207: }
208:
209: //
210: // langPref:
211: //
212: public String getLangPref() {
213: return this .langPref;
214: }
215:
216: public void setLangPref(String langPref) {
217: if (record2().setObject(ICOL_LANG_PREF, langPref)) {
218: this .langPref = langPref;
219: }
220: }
221:
222: public boolean izNullLangPref() {
223: return record2().getObject(ICOL_LANG_PREF) == null;
224: }
225:
226: public void setNullLangPref() {
227: if (record2().setObject(ICOL_LANG_PREF, null)) {
228: this .langPref = null;
229: }
230: }
231:
232: //
233: // favCategory:
234: //
235: public String getFavCategory() {
236: return this .favCategory;
237: }
238:
239: public void setFavCategory(String favCategory) {
240: if (record2().setObject(ICOL_FAV_CATEGORY, favCategory)) {
241: this .favCategory = favCategory;
242: }
243: }
244:
245: public boolean izNullFavCategory() {
246: return record2().getObject(ICOL_FAV_CATEGORY) == null;
247: }
248:
249: public void setNullFavCategory() {
250: if (record2().setObject(ICOL_FAV_CATEGORY, null)) {
251: this .favCategory = null;
252: }
253: }
254:
255: //
256: // myListOpt:
257: //
258: public Long getMyListOpt() {
259: return this .myListOpt;
260: }
261:
262: public void setMyListOpt(Long myListOpt) {
263: if (record2().setObject(ICOL_MY_LIST_OPT, myListOpt)) {
264: this .myListOpt = myListOpt;
265: }
266: }
267:
268: public boolean izNullMyListOpt() {
269: return record2().getObject(ICOL_MY_LIST_OPT) == null;
270: }
271:
272: public void setNullMyListOpt() {
273: if (record2().setObject(ICOL_MY_LIST_OPT, null)) {
274: this .myListOpt = null;
275: }
276: }
277:
278: //
279: // bannerOpt:
280: //
281: public Long getBannerOpt() {
282: return this .bannerOpt;
283: }
284:
285: public void setBannerOpt(Long bannerOpt) {
286: if (record2().setObject(ICOL_BANNER_OPT, bannerOpt)) {
287: this .bannerOpt = bannerOpt;
288: }
289: }
290:
291: public boolean izNullBannerOpt() {
292: return record2().getObject(ICOL_BANNER_OPT) == null;
293: }
294:
295: public void setNullBannerOpt() {
296: if (record2().setObject(ICOL_BANNER_OPT, null)) {
297: this .bannerOpt = null;
298: }
299: }
300:
301: public void toBeanFields() {
302: toBeanFields(this );
303: }
304:
305: public void toBeanFields(PersistentObject from) {
306: userId = (String) from.record2().getObject(ICOL_USER_ID);
307: langPref = (String) from.record2().getObject(ICOL_LANG_PREF);
308: favCategory = (String) from.record2().getObject(
309: ICOL_FAV_CATEGORY);
310: myListOpt = (Long) from.record2().getObject(ICOL_MY_LIST_OPT);
311: bannerOpt = (Long) from.record2().getObject(ICOL_BANNER_OPT);
312: super .toBeanFields(from);
313: }
314:
315: public void fromBeanFields(PersistentObject persistentObject) {
316: ProfilePO from = (ProfilePO) persistentObject;
317: record2().getEntry(ICOL_USER_ID).setUnmarkedValue(from.userId,
318: from.userId);
319: record2().getEntry(ICOL_LANG_PREF).setUnmarkedValue(
320: from.langPref, from.langPref);
321: record2().getEntry(ICOL_FAV_CATEGORY).setUnmarkedValue(
322: from.favCategory, from.favCategory);
323: record2().getEntry(ICOL_MY_LIST_OPT).setUnmarkedValue(
324: from.myListOpt, from.myListOpt);
325: record2().getEntry(ICOL_BANNER_OPT).setUnmarkedValue(
326: from.bannerOpt, from.bannerOpt);
327: super .fromBeanFieldsDataSaved(persistentObject);
328: }
329:
330: public String toString() {
331:
332: StringBuffer buffer = new StringBuffer();
333: buffer.append("{ " + "class = ").append(
334: this .getClass().getName()).append(" " + "table = ")
335: .append(TABLE_PROFILE).append(" columns = {");
336:
337: if (record() != null) {
338: buffer.append(COL_USER_ID).append(" = ").append(
339: record().getObject(ICOL_USER_ID)).append(" ");
340: buffer.append(COL_LANG_PREF).append(" = ").append(
341: record().getObject(ICOL_LANG_PREF)).append(" ");
342: buffer.append(COL_FAV_CATEGORY).append(" = ").append(
343: record().getObject(ICOL_FAV_CATEGORY)).append(" ");
344: buffer.append(COL_MY_LIST_OPT).append(" = ").append(
345: record().getObject(ICOL_MY_LIST_OPT)).append(" ");
346: buffer.append(COL_BANNER_OPT).append(" = ").append(
347: record().getObject(ICOL_BANNER_OPT)).append(" ");
348: } else {
349: buffer.append(COL_USER_ID).append(" = ").append(userId)
350: .append(" ");
351: buffer.append(COL_LANG_PREF).append(" = ").append(langPref)
352: .append(" ");
353: buffer.append(COL_FAV_CATEGORY).append(" = ").append(
354: favCategory).append(" ");
355: buffer.append(COL_MY_LIST_OPT).append(" = ").append(
356: myListOpt).append(" ");
357: buffer.append(COL_BANNER_OPT).append(" = ").append(
358: bannerOpt).append(" ");
359: }
360: buffer.append("}}");
361: return buffer.toString();
362: }
363:
364: // naturalKey has no context
365:
366: /**
367: * Equals by Basic Peristent object fields (without children objects)
368: */
369: public boolean equalsBasic(Object value) {
370: if (this == value)
371: return true;
372: if (value == null || getClass() != value.getClass())
373: return false;
374:
375: ProfilePO that = (ProfilePO) value;
376:
377: if (userId != null ? !userId.equals(that.userId)
378: : that.userId != null)
379: return false;
380: if (langPref != null ? !langPref.equals(that.langPref)
381: : that.langPref != null)
382: return false;
383: if (favCategory != null ? !favCategory.equals(that.favCategory)
384: : that.favCategory != null)
385: return false;
386: if (myListOpt != null ? !myListOpt.equals(that.myListOpt)
387: : that.myListOpt != null)
388: return false;
389: if (bannerOpt != null ? !bannerOpt.equals(that.bannerOpt)
390: : that.bannerOpt != null)
391: return false;
392: return true;
393: }
394:
395: /**
396: * hashCode by Basic Peristent object fields (without children objects)
397: */
398: public int hashCodeBasic() {
399: int result;
400: long temp;
401: result = (userId != null ? userId.hashCode() : 0);
402: result = 29 * result
403: + (langPref != null ? langPref.hashCode() : 0);
404: result = 29 * result
405: + (favCategory != null ? favCategory.hashCode() : 0);
406: result = 29 * result
407: + (myListOpt != null ? myListOpt.hashCode() : 0);
408: result = 29 * result
409: + (bannerOpt != null ? bannerOpt.hashCode() : 0);
410:
411: return result;
412: }
413: }
|