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 SupplierPO 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_SUPPLIER = "SUPPLIER";
050:
051: public SupplierPO() {
052: super (new Record(table));
053: }
054:
055: public SupplierPO(Long suppId) {
056: this ();
057: setSuppId(suppId);
058: }
059:
060: public static final String COL_SUPP_ID = "SUPP_ID";
061: public static final String TCOL_SUPP_ID = "SUPPLIER.SUPP_ID";
062: public static final int ICOL_SUPP_ID = 0;
063: public static final int JDBC_TYPE_SUPP_ID = 4;
064:
065: public static final String COL_NAME = "NAME";
066: public static final String TCOL_NAME = "SUPPLIER.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_STATUS = "STATUS";
071: public static final String TCOL_STATUS = "SUPPLIER.STATUS";
072: public static final int ICOL_STATUS = 2;
073: public static final int JDBC_TYPE_STATUS = 12;
074:
075: public static final String COL_ADDRESS1 = "ADDR1";
076: public static final String TCOL_ADDRESS1 = "SUPPLIER.ADDR1";
077: public static final int ICOL_ADDRESS1 = 3;
078: public static final int JDBC_TYPE_ADDRESS1 = 12;
079:
080: public static final String COL_ADDRESS2 = "ADDR2";
081: public static final String TCOL_ADDRESS2 = "SUPPLIER.ADDR2";
082: public static final int ICOL_ADDRESS2 = 4;
083: public static final int JDBC_TYPE_ADDRESS2 = 12;
084:
085: public static final String COL_CITY = "CITY";
086: public static final String TCOL_CITY = "SUPPLIER.CITY";
087: public static final int ICOL_CITY = 5;
088: public static final int JDBC_TYPE_CITY = 12;
089:
090: public static final String COL_STATE = "STATE";
091: public static final String TCOL_STATE = "SUPPLIER.STATE";
092: public static final int ICOL_STATE = 6;
093: public static final int JDBC_TYPE_STATE = 12;
094:
095: public static final String COL_ZIP = "ZIP";
096: public static final String TCOL_ZIP = "SUPPLIER.ZIP";
097: public static final int ICOL_ZIP = 7;
098: public static final int JDBC_TYPE_ZIP = 12;
099:
100: public static final String COL_PHONE = "PHONE";
101: public static final String TCOL_PHONE = "SUPPLIER.PHONE";
102: public static final int ICOL_PHONE = 8;
103: public static final int JDBC_TYPE_PHONE = 12;
104:
105: private static final MetaTable table = new MetaTable("SUPPLIER",
106: "SUPPLIER", 9, 1);
107:
108: static {
109: table.setStaticFinal(true);
110: //
111: // Meta Foreign Keys:
112: //
113: //
114: // Meta Natural Key:
115: //
116: // naturalKey has no context
117:
118: //
119: // Meta Columns:
120: //
121:
122: final MetaColumn metaSuppId = new MetaColumn(ICOL_SUPP_ID,
123: "SUPP_ID", "SUPP_ID", table);
124: metaSuppId.setPrimaryKey(true);
125: metaSuppId.setRequired(true);
126: metaSuppId.setOptimisticLock(false);
127: metaSuppId.setType(ColumnType.LONG);
128: metaSuppId.setColumnSize(0);
129: metaSuppId.setRemarks("");
130: metaSuppId.setDecimalDigits(0);
131: metaSuppId.setAutoGenerated(false);
132: metaSuppId.setAutoIncrement(false);
133: metaSuppId.setJdbcType(4);
134: table.addToPrimaryKey(new Integer(ICOL_SUPP_ID));
135: table.addColumn(metaSuppId);
136:
137: final MetaColumn metaName = new MetaColumn(ICOL_NAME, "NAME",
138: "NAME", table);
139: metaName.setPrimaryKey(false);
140: metaName.setRequired(false);
141: metaName.setOptimisticLock(false);
142: metaName.setType(ColumnType.STRING);
143: metaName.setColumnSize(80);
144: metaName.setRemarks("");
145: metaName.setDecimalDigits(0);
146: metaName.setAutoGenerated(false);
147: metaName.setAutoIncrement(false);
148: metaName.setJdbcType(12);
149: table.addColumn(metaName);
150:
151: final MetaColumn metaStatus = new MetaColumn(ICOL_STATUS,
152: "STATUS", "STATUS", table);
153: metaStatus.setPrimaryKey(false);
154: metaStatus.setRequired(true);
155: metaStatus.setOptimisticLock(false);
156: metaStatus.setType(ColumnType.STRING);
157: metaStatus.setColumnSize(2);
158: metaStatus.setRemarks("");
159: metaStatus.setDecimalDigits(0);
160: metaStatus.setAutoGenerated(false);
161: metaStatus.setAutoIncrement(false);
162: metaStatus.setJdbcType(12);
163: table.addColumn(metaStatus);
164:
165: final MetaColumn metaAddress1 = new MetaColumn(ICOL_ADDRESS1,
166: "ADDR1", "ADDRESS1", table);
167: metaAddress1.setPrimaryKey(false);
168: metaAddress1.setRequired(false);
169: metaAddress1.setOptimisticLock(false);
170: metaAddress1.setType(ColumnType.STRING);
171: metaAddress1.setColumnSize(80);
172: metaAddress1.setRemarks("");
173: metaAddress1.setDecimalDigits(0);
174: metaAddress1.setAutoGenerated(false);
175: metaAddress1.setAutoIncrement(false);
176: metaAddress1.setJdbcType(12);
177: table.addColumn(metaAddress1);
178:
179: final MetaColumn metaAddress2 = new MetaColumn(ICOL_ADDRESS2,
180: "ADDR2", "ADDRESS2", table);
181: metaAddress2.setPrimaryKey(false);
182: metaAddress2.setRequired(false);
183: metaAddress2.setOptimisticLock(false);
184: metaAddress2.setType(ColumnType.STRING);
185: metaAddress2.setColumnSize(80);
186: metaAddress2.setRemarks("");
187: metaAddress2.setDecimalDigits(0);
188: metaAddress2.setAutoGenerated(false);
189: metaAddress2.setAutoIncrement(false);
190: metaAddress2.setJdbcType(12);
191: table.addColumn(metaAddress2);
192:
193: final MetaColumn metaCity = new MetaColumn(ICOL_CITY, "CITY",
194: "CITY", table);
195: metaCity.setPrimaryKey(false);
196: metaCity.setRequired(false);
197: metaCity.setOptimisticLock(false);
198: metaCity.setType(ColumnType.STRING);
199: metaCity.setColumnSize(80);
200: metaCity.setRemarks("");
201: metaCity.setDecimalDigits(0);
202: metaCity.setAutoGenerated(false);
203: metaCity.setAutoIncrement(false);
204: metaCity.setJdbcType(12);
205: table.addColumn(metaCity);
206:
207: final MetaColumn metaState = new MetaColumn(ICOL_STATE,
208: "STATE", "STATE", table);
209: metaState.setPrimaryKey(false);
210: metaState.setRequired(false);
211: metaState.setOptimisticLock(false);
212: metaState.setType(ColumnType.STRING);
213: metaState.setColumnSize(80);
214: metaState.setRemarks("");
215: metaState.setDecimalDigits(0);
216: metaState.setAutoGenerated(false);
217: metaState.setAutoIncrement(false);
218: metaState.setJdbcType(12);
219: table.addColumn(metaState);
220:
221: final MetaColumn metaZip = new MetaColumn(ICOL_ZIP, "ZIP",
222: "ZIP", table);
223: metaZip.setPrimaryKey(false);
224: metaZip.setRequired(false);
225: metaZip.setOptimisticLock(false);
226: metaZip.setType(ColumnType.STRING);
227: metaZip.setColumnSize(5);
228: metaZip.setRemarks("");
229: metaZip.setDecimalDigits(0);
230: metaZip.setAutoGenerated(false);
231: metaZip.setAutoIncrement(false);
232: metaZip.setJdbcType(12);
233: table.addColumn(metaZip);
234:
235: final MetaColumn metaPhone = new MetaColumn(ICOL_PHONE,
236: "PHONE", "PHONE", table);
237: metaPhone.setPrimaryKey(false);
238: metaPhone.setRequired(false);
239: metaPhone.setOptimisticLock(false);
240: metaPhone.setType(ColumnType.STRING);
241: metaPhone.setColumnSize(80);
242: metaPhone.setRemarks("");
243: metaPhone.setDecimalDigits(0);
244: metaPhone.setAutoGenerated(false);
245: metaPhone.setAutoIncrement(false);
246: metaPhone.setJdbcType(12);
247: table.addColumn(metaPhone);
248:
249: }
250:
251: private Long suppId;
252: private String name;
253: private String status;
254: private String address1;
255: private String address2;
256: private String city;
257: private String state;
258: private String zip;
259: private String phone;
260:
261: //
262: // suppId:
263: //
264: public Long getSuppId() {
265: return this .suppId;
266: }
267:
268: public void setSuppId(Long suppId) {
269: if (record2().setObject(ICOL_SUPP_ID, suppId)) {
270: this .suppId = suppId;
271: }
272: }
273:
274: public boolean izNullSuppId() {
275: return record2().getObject(ICOL_SUPP_ID) == null;
276: }
277:
278: public void setNullSuppId() {
279: if (record2().setObject(ICOL_SUPP_ID, null)) {
280: this .suppId = null;
281: }
282: }
283:
284: //
285: // name:
286: //
287: public String getName() {
288: return this .name;
289: }
290:
291: public void setName(String name) {
292: if (record2().setObject(ICOL_NAME, name)) {
293: this .name = name;
294: }
295: }
296:
297: public boolean izNullName() {
298: return record2().getObject(ICOL_NAME) == null;
299: }
300:
301: public void setNullName() {
302: if (record2().setObject(ICOL_NAME, null)) {
303: this .name = null;
304: }
305: }
306:
307: //
308: // status:
309: //
310: public String getStatus() {
311: return this .status;
312: }
313:
314: public void setStatus(String status) {
315: if (record2().setObject(ICOL_STATUS, status)) {
316: this .status = status;
317: }
318: }
319:
320: public boolean izNullStatus() {
321: return record2().getObject(ICOL_STATUS) == null;
322: }
323:
324: public void setNullStatus() {
325: if (record2().setObject(ICOL_STATUS, null)) {
326: this .status = null;
327: }
328: }
329:
330: //
331: // address1:
332: //
333: public String getAddress1() {
334: return this .address1;
335: }
336:
337: public void setAddress1(String address1) {
338: if (record2().setObject(ICOL_ADDRESS1, address1)) {
339: this .address1 = address1;
340: }
341: }
342:
343: public boolean izNullAddress1() {
344: return record2().getObject(ICOL_ADDRESS1) == null;
345: }
346:
347: public void setNullAddress1() {
348: if (record2().setObject(ICOL_ADDRESS1, null)) {
349: this .address1 = null;
350: }
351: }
352:
353: //
354: // address2:
355: //
356: public String getAddress2() {
357: return this .address2;
358: }
359:
360: public void setAddress2(String address2) {
361: if (record2().setObject(ICOL_ADDRESS2, address2)) {
362: this .address2 = address2;
363: }
364: }
365:
366: public boolean izNullAddress2() {
367: return record2().getObject(ICOL_ADDRESS2) == null;
368: }
369:
370: public void setNullAddress2() {
371: if (record2().setObject(ICOL_ADDRESS2, null)) {
372: this .address2 = null;
373: }
374: }
375:
376: //
377: // city:
378: //
379: public String getCity() {
380: return this .city;
381: }
382:
383: public void setCity(String city) {
384: if (record2().setObject(ICOL_CITY, city)) {
385: this .city = city;
386: }
387: }
388:
389: public boolean izNullCity() {
390: return record2().getObject(ICOL_CITY) == null;
391: }
392:
393: public void setNullCity() {
394: if (record2().setObject(ICOL_CITY, null)) {
395: this .city = null;
396: }
397: }
398:
399: //
400: // state:
401: //
402: public String getState() {
403: return this .state;
404: }
405:
406: public void setState(String state) {
407: if (record2().setObject(ICOL_STATE, state)) {
408: this .state = state;
409: }
410: }
411:
412: public boolean izNullState() {
413: return record2().getObject(ICOL_STATE) == null;
414: }
415:
416: public void setNullState() {
417: if (record2().setObject(ICOL_STATE, null)) {
418: this .state = null;
419: }
420: }
421:
422: //
423: // zip:
424: //
425: public String getZip() {
426: return this .zip;
427: }
428:
429: public void setZip(String zip) {
430: if (record2().setObject(ICOL_ZIP, zip)) {
431: this .zip = zip;
432: }
433: }
434:
435: public boolean izNullZip() {
436: return record2().getObject(ICOL_ZIP) == null;
437: }
438:
439: public void setNullZip() {
440: if (record2().setObject(ICOL_ZIP, null)) {
441: this .zip = null;
442: }
443: }
444:
445: //
446: // phone:
447: //
448: public String getPhone() {
449: return this .phone;
450: }
451:
452: public void setPhone(String phone) {
453: if (record2().setObject(ICOL_PHONE, phone)) {
454: this .phone = phone;
455: }
456: }
457:
458: public boolean izNullPhone() {
459: return record2().getObject(ICOL_PHONE) == null;
460: }
461:
462: public void setNullPhone() {
463: if (record2().setObject(ICOL_PHONE, null)) {
464: this .phone = null;
465: }
466: }
467:
468: public void toBeanFields() {
469: toBeanFields(this );
470: }
471:
472: public void toBeanFields(PersistentObject from) {
473: suppId = (Long) from.record2().getObject(ICOL_SUPP_ID);
474: name = (String) from.record2().getObject(ICOL_NAME);
475: status = (String) from.record2().getObject(ICOL_STATUS);
476: address1 = (String) from.record2().getObject(ICOL_ADDRESS1);
477: address2 = (String) from.record2().getObject(ICOL_ADDRESS2);
478: city = (String) from.record2().getObject(ICOL_CITY);
479: state = (String) from.record2().getObject(ICOL_STATE);
480: zip = (String) from.record2().getObject(ICOL_ZIP);
481: phone = (String) from.record2().getObject(ICOL_PHONE);
482: super .toBeanFields(from);
483: }
484:
485: public void fromBeanFields(PersistentObject persistentObject) {
486: SupplierPO from = (SupplierPO) persistentObject;
487: record2().getEntry(ICOL_SUPP_ID).setUnmarkedValue(from.suppId,
488: from.suppId);
489: record2().getEntry(ICOL_NAME).setUnmarkedValue(from.name,
490: from.name);
491: record2().getEntry(ICOL_STATUS).setUnmarkedValue(from.status,
492: from.status);
493: record2().getEntry(ICOL_ADDRESS1).setUnmarkedValue(
494: from.address1, from.address1);
495: record2().getEntry(ICOL_ADDRESS2).setUnmarkedValue(
496: from.address2, from.address2);
497: record2().getEntry(ICOL_CITY).setUnmarkedValue(from.city,
498: from.city);
499: record2().getEntry(ICOL_STATE).setUnmarkedValue(from.state,
500: from.state);
501: record2().getEntry(ICOL_ZIP).setUnmarkedValue(from.zip,
502: from.zip);
503: record2().getEntry(ICOL_PHONE).setUnmarkedValue(from.phone,
504: from.phone);
505: super .fromBeanFieldsDataSaved(persistentObject);
506: }
507:
508: public String toString() {
509:
510: StringBuffer buffer = new StringBuffer();
511: buffer.append("{ " + "class = ").append(
512: this .getClass().getName()).append(" " + "table = ")
513: .append(TABLE_SUPPLIER).append(" columns = {");
514:
515: if (record() != null) {
516: buffer.append(COL_SUPP_ID).append(" = ").append(
517: record().getObject(ICOL_SUPP_ID)).append(" ");
518: buffer.append(COL_NAME).append(" = ").append(
519: record().getObject(ICOL_NAME)).append(" ");
520: buffer.append(COL_STATUS).append(" = ").append(
521: record().getObject(ICOL_STATUS)).append(" ");
522: buffer.append(COL_ADDRESS1).append(" = ").append(
523: record().getObject(ICOL_ADDRESS1)).append(" ");
524: buffer.append(COL_ADDRESS2).append(" = ").append(
525: record().getObject(ICOL_ADDRESS2)).append(" ");
526: buffer.append(COL_CITY).append(" = ").append(
527: record().getObject(ICOL_CITY)).append(" ");
528: buffer.append(COL_STATE).append(" = ").append(
529: record().getObject(ICOL_STATE)).append(" ");
530: buffer.append(COL_ZIP).append(" = ").append(
531: record().getObject(ICOL_ZIP)).append(" ");
532: buffer.append(COL_PHONE).append(" = ").append(
533: record().getObject(ICOL_PHONE)).append(" ");
534: } else {
535: buffer.append(COL_SUPP_ID).append(" = ").append(suppId)
536: .append(" ");
537: buffer.append(COL_NAME).append(" = ").append(name).append(
538: " ");
539: buffer.append(COL_STATUS).append(" = ").append(status)
540: .append(" ");
541: buffer.append(COL_ADDRESS1).append(" = ").append(address1)
542: .append(" ");
543: buffer.append(COL_ADDRESS2).append(" = ").append(address2)
544: .append(" ");
545: buffer.append(COL_CITY).append(" = ").append(city).append(
546: " ");
547: buffer.append(COL_STATE).append(" = ").append(state)
548: .append(" ");
549: buffer.append(COL_ZIP).append(" = ").append(zip)
550: .append(" ");
551: buffer.append(COL_PHONE).append(" = ").append(phone)
552: .append(" ");
553: }
554: buffer.append("}}");
555: return buffer.toString();
556: }
557:
558: // naturalKey has no context
559:
560: /**
561: * Equals by Basic Peristent object fields (without children objects)
562: */
563: public boolean equalsBasic(Object value) {
564: if (this == value)
565: return true;
566: if (value == null || getClass() != value.getClass())
567: return false;
568:
569: SupplierPO that = (SupplierPO) value;
570:
571: if (suppId != null ? !suppId.equals(that.suppId)
572: : that.suppId != null)
573: return false;
574: if (name != null ? !name.equals(that.name) : that.name != null)
575: return false;
576: if (status != null ? !status.equals(that.status)
577: : that.status != null)
578: return false;
579: if (address1 != null ? !address1.equals(that.address1)
580: : that.address1 != null)
581: return false;
582: if (address2 != null ? !address2.equals(that.address2)
583: : that.address2 != null)
584: return false;
585: if (city != null ? !city.equals(that.city) : that.city != null)
586: return false;
587: if (state != null ? !state.equals(that.state)
588: : that.state != null)
589: return false;
590: if (zip != null ? !zip.equals(that.zip) : that.zip != null)
591: return false;
592: if (phone != null ? !phone.equals(that.phone)
593: : that.phone != null)
594: return false;
595: return true;
596: }
597:
598: /**
599: * hashCode by Basic Peristent object fields (without children objects)
600: */
601: public int hashCodeBasic() {
602: int result;
603: long temp;
604: result = (suppId != null ? suppId.hashCode() : 0);
605: result = 29 * result + (name != null ? name.hashCode() : 0);
606: result = 29 * result + (status != null ? status.hashCode() : 0);
607: result = 29 * result
608: + (address1 != null ? address1.hashCode() : 0);
609: result = 29 * result
610: + (address2 != null ? address2.hashCode() : 0);
611: result = 29 * result + (city != null ? city.hashCode() : 0);
612: result = 29 * result + (state != null ? state.hashCode() : 0);
613: result = 29 * result + (zip != null ? zip.hashCode() : 0);
614: result = 29 * result + (phone != null ? phone.hashCode() : 0);
615:
616: return result;
617: }
618: }
|