001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex004.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: import java.util.Date;
018:
019: public class CustomerPO extends PersistentObject implements
020: java.io.Externalizable {
021: //
022: // Complex object related:
023: //
024:
025: //
026: private static Map registeredMasters;
027: private static Object lock = new Object();
028:
029: protected Object classLock() {
030: return lock;
031: }
032:
033: protected void instantiateRegisteredMasters() {
034: if (registeredMasters == null) {
035: synchronized (lock) {
036: if (registeredMasters == null) {
037: registeredMasters = new HashMap();
038: }
039: }
040: }
041: }
042:
043: protected Map registeredMasters() {
044: return registeredMasters;
045: }
046:
047: //
048: //
049: //
050:
051: public static final String TABLE_CUSTOMER = "CUSTOMER";
052:
053: public CustomerPO() {
054: super (new Record(table));
055: }
056:
057: public CustomerPO(Long customerId) {
058: this ();
059: setCustomerId(customerId);
060: }
061:
062: public static final String COL_CUSTOMER_ID = "CUSTOMER_ID";
063: public static final String TCOL_CUSTOMER_ID = "CUSTOMER.CUSTOMER_ID";
064: public static final int ICOL_CUSTOMER_ID = 0;
065: public static final int JDBC_TYPE_CUSTOMER_ID = -5;
066:
067: public static final String COL_CONTACT_ID = "CONTACT_ID";
068: public static final String TCOL_CONTACT_ID = "CUSTOMER.CONTACT_ID";
069: public static final int ICOL_CONTACT_ID = 1;
070: public static final int JDBC_TYPE_CONTACT_ID = -5;
071:
072: public static final String COL_ORG_NAME = "ORG_NAME";
073: public static final String TCOL_ORG_NAME = "CUSTOMER.ORG_NAME";
074: public static final int ICOL_ORG_NAME = 2;
075: public static final int JDBC_TYPE_ORG_NAME = 12;
076:
077: public static final String COL_URL = "URL";
078: public static final String TCOL_URL = "CUSTOMER.URL";
079: public static final int ICOL_URL = 3;
080: public static final int JDBC_TYPE_URL = 12;
081:
082: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
083: public static final String TCOL_LAST_UPDATED = "CUSTOMER.LAST_UPDATED";
084: public static final int ICOL_LAST_UPDATED = 4;
085: public static final int JDBC_TYPE_LAST_UPDATED = 91;
086:
087: public static final String COL_CREATION_DATE = "CREATION_DATE";
088: public static final String TCOL_CREATION_DATE = "CUSTOMER.CREATION_DATE";
089: public static final int ICOL_CREATION_DATE = 5;
090: public static final int JDBC_TYPE_CREATION_DATE = 91;
091:
092: private static final MetaTable table = new MetaTable("CUSTOMER",
093: "CUSTOMER", 6, 1);
094:
095: static {
096: table.setStaticFinal(true);
097: //
098: // Meta Foreign Keys:
099: //
100: table.addToForeignKey("CONTACT", new ForeignKeyEntry(
101: "CONTACT_ID", "CONTACT_ID"));
102: //
103: // Meta Natural Key:
104: //
105: // naturalKey has no context
106:
107: //
108: // Meta Columns:
109: //
110:
111: final MetaColumn metaCustomerId = new MetaColumn(
112: ICOL_CUSTOMER_ID, "CUSTOMER_ID", "CUSTOMER_ID", table);
113: metaCustomerId.setPrimaryKey(true);
114: metaCustomerId.setRequired(true);
115: metaCustomerId.setOptimisticLock(false);
116: metaCustomerId.setType(ColumnType.LONG);
117: metaCustomerId.setColumnSize(0);
118: metaCustomerId.setRemarks("");
119: metaCustomerId.setDecimalDigits(0);
120: metaCustomerId.setAutoGenerated(true);
121: metaCustomerId.setAutoIncrement(false);
122: metaCustomerId.setJdbcType(-5);
123: metaCustomerId
124: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.SimpleSequenceKeyGeneratorImpl());
125: {
126: HashMap staticAttributes = new HashMap();
127: staticAttributes.put("name", "CUSTOMER_SEQ");
128: metaCustomerId
129: .setGeneratorStaticAttributes(staticAttributes);
130: }
131: metaCustomerId.initializeKeyGenerator();
132: table.addToPrimaryKey(new Integer(ICOL_CUSTOMER_ID));
133: table.addColumn(metaCustomerId);
134:
135: final MetaColumn metaContactId = new MetaColumn(
136: ICOL_CONTACT_ID, "CONTACT_ID", "CONTACT_ID", table);
137: metaContactId.setPrimaryKey(false);
138: metaContactId.setRequired(true);
139: metaContactId.setOptimisticLock(false);
140: metaContactId.setType(ColumnType.LONG);
141: metaContactId.setColumnSize(0);
142: metaContactId.setRemarks("");
143: metaContactId.setDecimalDigits(0);
144: metaContactId.setAutoGenerated(false);
145: metaContactId.setAutoIncrement(false);
146: metaContactId.setJdbcType(-5);
147: table.addColumn(metaContactId);
148:
149: final MetaColumn metaOrgName = new MetaColumn(ICOL_ORG_NAME,
150: "ORG_NAME", "ORG_NAME", table);
151: metaOrgName.setPrimaryKey(false);
152: metaOrgName.setRequired(true);
153: metaOrgName.setOptimisticLock(false);
154: metaOrgName.setType(ColumnType.STRING);
155: metaOrgName.setColumnSize(40);
156: metaOrgName.setRemarks("");
157: metaOrgName.setDecimalDigits(0);
158: metaOrgName.setAutoGenerated(false);
159: metaOrgName.setAutoIncrement(false);
160: metaOrgName.setJdbcType(12);
161: table.addColumn(metaOrgName);
162:
163: final MetaColumn metaUrl = new MetaColumn(ICOL_URL, "URL",
164: "URL", table);
165: metaUrl.setPrimaryKey(false);
166: metaUrl.setRequired(true);
167: metaUrl.setOptimisticLock(false);
168: metaUrl.setType(ColumnType.STRING);
169: metaUrl.setColumnSize(40);
170: metaUrl.setRemarks("");
171: metaUrl.setDecimalDigits(0);
172: metaUrl.setAutoGenerated(false);
173: metaUrl.setAutoIncrement(false);
174: metaUrl.setJdbcType(12);
175: table.addColumn(metaUrl);
176:
177: final MetaColumn metaLastUpdated = new MetaColumn(
178: ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
179: table);
180: metaLastUpdated.setPrimaryKey(false);
181: metaLastUpdated.setRequired(false);
182: metaLastUpdated.setOptimisticLock(false);
183: metaLastUpdated.setType(ColumnType.DATE);
184: metaLastUpdated.setColumnSize(0);
185: metaLastUpdated.setRemarks("");
186: metaLastUpdated.setDecimalDigits(0);
187: metaLastUpdated.setAutoGenerated(true);
188: metaLastUpdated.setAutoIncrement(false);
189: metaLastUpdated.setJdbcType(91);
190: metaLastUpdated
191: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
192: metaLastUpdated.initializeKeyGenerator();
193: table.addColumn(metaLastUpdated);
194:
195: final MetaColumn metaCreationDate = new MetaColumn(
196: ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
197: table);
198: metaCreationDate.setPrimaryKey(false);
199: metaCreationDate.setRequired(false);
200: metaCreationDate.setOptimisticLock(false);
201: metaCreationDate.setType(ColumnType.DATE);
202: metaCreationDate.setColumnSize(0);
203: metaCreationDate.setRemarks("");
204: metaCreationDate.setDecimalDigits(0);
205: metaCreationDate.setAutoGenerated(true);
206: metaCreationDate.setAutoIncrement(false);
207: metaCreationDate.setJdbcType(91);
208: metaCreationDate
209: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
210: metaCreationDate.initializeKeyGenerator();
211: table.addColumn(metaCreationDate);
212:
213: }
214:
215: private Long customerId;
216: private Long contactId;
217: private String orgName;
218: private String url;
219: private Date lastUpdated;
220: private Date creationDate;
221:
222: //
223: // customerId:
224: //
225: public Long getCustomerId() {
226: return this .customerId;
227: }
228:
229: public void setCustomerId(Long customerId) {
230: if (record2().setObject(ICOL_CUSTOMER_ID, customerId)) {
231: this .customerId = customerId;
232: }
233: }
234:
235: public boolean izNullCustomerId() {
236: return record2().getObject(ICOL_CUSTOMER_ID) == null;
237: }
238:
239: public void setNullCustomerId() {
240: if (record2().setObject(ICOL_CUSTOMER_ID, null)) {
241: this .customerId = null;
242: }
243: }
244:
245: //
246: // contactId:
247: //
248: public Long getContactId() {
249: return this .contactId;
250: }
251:
252: public void setContactId(Long contactId) {
253: if (record2().setObject(ICOL_CONTACT_ID, contactId)) {
254: this .contactId = contactId;
255: }
256: }
257:
258: public boolean izNullContactId() {
259: return record2().getObject(ICOL_CONTACT_ID) == null;
260: }
261:
262: public void setNullContactId() {
263: if (record2().setObject(ICOL_CONTACT_ID, null)) {
264: this .contactId = null;
265: }
266: }
267:
268: //
269: // orgName:
270: //
271: public String getOrgName() {
272: return this .orgName;
273: }
274:
275: public void setOrgName(String orgName) {
276: if (record2().setObject(ICOL_ORG_NAME, orgName)) {
277: this .orgName = orgName;
278: }
279: }
280:
281: public boolean izNullOrgName() {
282: return record2().getObject(ICOL_ORG_NAME) == null;
283: }
284:
285: public void setNullOrgName() {
286: if (record2().setObject(ICOL_ORG_NAME, null)) {
287: this .orgName = null;
288: }
289: }
290:
291: //
292: // url:
293: //
294: public String getUrl() {
295: return this .url;
296: }
297:
298: public void setUrl(String url) {
299: if (record2().setObject(ICOL_URL, url)) {
300: this .url = url;
301: }
302: }
303:
304: public boolean izNullUrl() {
305: return record2().getObject(ICOL_URL) == null;
306: }
307:
308: public void setNullUrl() {
309: if (record2().setObject(ICOL_URL, null)) {
310: this .url = null;
311: }
312: }
313:
314: //
315: // lastUpdated:
316: //
317: public Date getLastUpdated() {
318: return this .lastUpdated;
319: }
320:
321: public void setLastUpdated(Date lastUpdated) {
322: if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
323: this .lastUpdated = lastUpdated;
324: }
325: }
326:
327: public boolean izNullLastUpdated() {
328: return record2().getObject(ICOL_LAST_UPDATED) == null;
329: }
330:
331: public void setNullLastUpdated() {
332: if (record2().setObject(ICOL_LAST_UPDATED, null)) {
333: this .lastUpdated = null;
334: }
335: }
336:
337: //
338: // creationDate:
339: //
340: public Date getCreationDate() {
341: return this .creationDate;
342: }
343:
344: public void setCreationDate(Date creationDate) {
345: if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
346: this .creationDate = creationDate;
347: }
348: }
349:
350: public boolean izNullCreationDate() {
351: return record2().getObject(ICOL_CREATION_DATE) == null;
352: }
353:
354: public void setNullCreationDate() {
355: if (record2().setObject(ICOL_CREATION_DATE, null)) {
356: this .creationDate = null;
357: }
358: }
359:
360: public void toBeanFields() {
361: toBeanFields(this );
362: }
363:
364: public void toBeanFields(PersistentObject from) {
365: customerId = (Long) from.record2().getObject(ICOL_CUSTOMER_ID);
366: contactId = (Long) from.record2().getObject(ICOL_CONTACT_ID);
367: orgName = (String) from.record2().getObject(ICOL_ORG_NAME);
368: url = (String) from.record2().getObject(ICOL_URL);
369: lastUpdated = (Date) from.record2()
370: .getObject(ICOL_LAST_UPDATED);
371: creationDate = (Date) from.record2().getObject(
372: ICOL_CREATION_DATE);
373: super .toBeanFields(from);
374: }
375:
376: public void fromBeanFields(PersistentObject persistentObject) {
377: CustomerPO from = (CustomerPO) persistentObject;
378: record2().getEntry(ICOL_CUSTOMER_ID).setUnmarkedValue(
379: from.customerId, from.customerId);
380: record2().getEntry(ICOL_CONTACT_ID).setUnmarkedValue(
381: from.contactId, from.contactId);
382: record2().getEntry(ICOL_ORG_NAME).setUnmarkedValue(
383: from.orgName, from.orgName);
384: record2().getEntry(ICOL_URL).setUnmarkedValue(from.url,
385: from.url);
386: record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
387: from.lastUpdated, from.lastUpdated);
388: record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
389: from.creationDate, from.creationDate);
390: super .fromBeanFieldsDataSaved(persistentObject);
391: }
392:
393: public String toString() {
394:
395: StringBuffer buffer = new StringBuffer();
396: buffer.append("{ " + "class = ").append(
397: this .getClass().getName()).append(" " + "table = ")
398: .append(TABLE_CUSTOMER).append(" columns = {");
399:
400: if (record() != null) {
401: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
402: record().getObject(ICOL_CUSTOMER_ID)).append(" ");
403: buffer.append(COL_CONTACT_ID).append(" = ").append(
404: record().getObject(ICOL_CONTACT_ID)).append(" ");
405: buffer.append(COL_ORG_NAME).append(" = ").append(
406: record().getObject(ICOL_ORG_NAME)).append(" ");
407: buffer.append(COL_URL).append(" = ").append(
408: record().getObject(ICOL_URL)).append(" ");
409: buffer.append(COL_LAST_UPDATED).append(" = ").append(
410: record().getObject(ICOL_LAST_UPDATED)).append(" ");
411: buffer.append(COL_CREATION_DATE).append(" = ").append(
412: record().getObject(ICOL_CREATION_DATE)).append(" ");
413: } else {
414: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
415: customerId).append(" ");
416: buffer.append(COL_CONTACT_ID).append(" = ").append(
417: contactId).append(" ");
418: buffer.append(COL_ORG_NAME).append(" = ").append(orgName)
419: .append(" ");
420: buffer.append(COL_URL).append(" = ").append(url)
421: .append(" ");
422: buffer.append(COL_LAST_UPDATED).append(" = ").append(
423: lastUpdated).append(" ");
424: buffer.append(COL_CREATION_DATE).append(" = ").append(
425: creationDate).append(" ");
426: }
427: buffer.append("}}");
428: return buffer.toString();
429: }
430:
431: // naturalKey has no context
432:
433: /**
434: * Equals by Basic Peristent object fields (without children objects)
435: */
436: public boolean equalsBasic(Object value) {
437: if (this == value)
438: return true;
439: if (value == null || getClass() != value.getClass())
440: return false;
441:
442: CustomerPO that = (CustomerPO) value;
443:
444: if (customerId != null ? !customerId.equals(that.customerId)
445: : that.customerId != null)
446: return false;
447: if (contactId != null ? !contactId.equals(that.contactId)
448: : that.contactId != null)
449: return false;
450: if (orgName != null ? !orgName.equals(that.orgName)
451: : that.orgName != null)
452: return false;
453: if (url != null ? !url.equals(that.url) : that.url != null)
454: return false;
455: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
456: : that.lastUpdated != null)
457: return false;
458: if (creationDate != null ? !creationDate
459: .equals(that.creationDate) : that.creationDate != null)
460: return false;
461: return true;
462: }
463:
464: /**
465: * hashCode by Basic Peristent object fields (without children objects)
466: */
467: public int hashCodeBasic() {
468: int result;
469: long temp;
470: result = (customerId != null ? customerId.hashCode() : 0);
471: result = 29 * result
472: + (contactId != null ? contactId.hashCode() : 0);
473: result = 29 * result
474: + (orgName != null ? orgName.hashCode() : 0);
475: result = 29 * result + (url != null ? url.hashCode() : 0);
476: result = 29 * result
477: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
478: result = 29 * result
479: + (creationDate != null ? creationDate.hashCode() : 0);
480:
481: return result;
482: }
483: }
|