001: /**
002: * GENERATED CODE: DO NOT MODIFY IT UNDER ANY CIRCUMSTANCES!!!
003: */package com.completex.objective.persistency.examples.ex003.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_ORG_NAME = "ORG_NAME";
068: public static final String TCOL_ORG_NAME = "CUSTOMER.ORG_NAME";
069: public static final int ICOL_ORG_NAME = 1;
070: public static final int JDBC_TYPE_ORG_NAME = 12;
071:
072: public static final String COL_URL = "URL";
073: public static final String TCOL_URL = "CUSTOMER.URL";
074: public static final int ICOL_URL = 2;
075: public static final int JDBC_TYPE_URL = 12;
076:
077: public static final String COL_LAST_UPDATED = "LAST_UPDATED";
078: public static final String TCOL_LAST_UPDATED = "CUSTOMER.LAST_UPDATED";
079: public static final int ICOL_LAST_UPDATED = 3;
080: public static final int JDBC_TYPE_LAST_UPDATED = 91;
081:
082: public static final String COL_CREATION_DATE = "CREATION_DATE";
083: public static final String TCOL_CREATION_DATE = "CUSTOMER.CREATION_DATE";
084: public static final int ICOL_CREATION_DATE = 4;
085: public static final int JDBC_TYPE_CREATION_DATE = 91;
086:
087: private static final MetaTable table = new MetaTable("CUSTOMER",
088: "CUSTOMER", 5, 1);
089:
090: static {
091: table.setStaticFinal(true);
092: //
093: // Meta Foreign Keys:
094: //
095: //
096: // Meta Natural Key:
097: //
098: // naturalKey has no context
099:
100: //
101: // Meta Columns:
102: //
103:
104: final MetaColumn metaCustomerId = new MetaColumn(
105: ICOL_CUSTOMER_ID, "CUSTOMER_ID", "CUSTOMER_ID", table);
106: metaCustomerId.setPrimaryKey(true);
107: metaCustomerId.setRequired(true);
108: metaCustomerId.setOptimisticLock(false);
109: metaCustomerId.setType(ColumnType.LONG);
110: metaCustomerId.setColumnSize(0);
111: metaCustomerId.setRemarks("");
112: metaCustomerId.setDecimalDigits(0);
113: metaCustomerId.setAutoGenerated(true);
114: metaCustomerId.setAutoIncrement(false);
115: metaCustomerId.setJdbcType(-5);
116: metaCustomerId
117: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.SimpleSequenceKeyGeneratorImpl());
118: {
119: HashMap staticAttributes = new HashMap();
120: staticAttributes.put("name", "CUSTOMER_SEQ");
121: metaCustomerId
122: .setGeneratorStaticAttributes(staticAttributes);
123: }
124: metaCustomerId.initializeKeyGenerator();
125: table.addToPrimaryKey(new Integer(ICOL_CUSTOMER_ID));
126: table.addColumn(metaCustomerId);
127:
128: final MetaColumn metaOrgName = new MetaColumn(ICOL_ORG_NAME,
129: "ORG_NAME", "ORG_NAME", table);
130: metaOrgName.setPrimaryKey(false);
131: metaOrgName.setRequired(true);
132: metaOrgName.setOptimisticLock(false);
133: metaOrgName.setType(ColumnType.STRING);
134: metaOrgName.setColumnSize(40);
135: metaOrgName.setRemarks("");
136: metaOrgName.setDecimalDigits(0);
137: metaOrgName.setAutoGenerated(false);
138: metaOrgName.setAutoIncrement(false);
139: metaOrgName.setJdbcType(12);
140: table.addColumn(metaOrgName);
141:
142: final MetaColumn metaUrl = new MetaColumn(ICOL_URL, "URL",
143: "URL", table);
144: metaUrl.setPrimaryKey(false);
145: metaUrl.setRequired(true);
146: metaUrl.setOptimisticLock(false);
147: metaUrl.setType(ColumnType.STRING);
148: metaUrl.setColumnSize(40);
149: metaUrl.setRemarks("");
150: metaUrl.setDecimalDigits(0);
151: metaUrl.setAutoGenerated(false);
152: metaUrl.setAutoIncrement(false);
153: metaUrl.setJdbcType(12);
154: table.addColumn(metaUrl);
155:
156: final MetaColumn metaLastUpdated = new MetaColumn(
157: ICOL_LAST_UPDATED, "LAST_UPDATED", "LAST_UPDATED",
158: table);
159: metaLastUpdated.setPrimaryKey(false);
160: metaLastUpdated.setRequired(false);
161: metaLastUpdated.setOptimisticLock(false);
162: metaLastUpdated.setType(ColumnType.DATE);
163: metaLastUpdated.setColumnSize(0);
164: metaLastUpdated.setRemarks("");
165: metaLastUpdated.setDecimalDigits(0);
166: metaLastUpdated.setAutoGenerated(true);
167: metaLastUpdated.setAutoIncrement(false);
168: metaLastUpdated.setJdbcType(91);
169: metaLastUpdated
170: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.LastUpdatedDateGenerator());
171: metaLastUpdated.initializeKeyGenerator();
172: table.addColumn(metaLastUpdated);
173:
174: final MetaColumn metaCreationDate = new MetaColumn(
175: ICOL_CREATION_DATE, "CREATION_DATE", "CREATION_DATE",
176: table);
177: metaCreationDate.setPrimaryKey(false);
178: metaCreationDate.setRequired(false);
179: metaCreationDate.setOptimisticLock(false);
180: metaCreationDate.setType(ColumnType.DATE);
181: metaCreationDate.setColumnSize(0);
182: metaCreationDate.setRemarks("");
183: metaCreationDate.setDecimalDigits(0);
184: metaCreationDate.setAutoGenerated(true);
185: metaCreationDate.setAutoIncrement(false);
186: metaCreationDate.setJdbcType(91);
187: metaCreationDate
188: .setKeyGenerator(new com.completex.objective.components.persistency.key.impl.CreatedDateGenerator());
189: metaCreationDate.initializeKeyGenerator();
190: table.addColumn(metaCreationDate);
191:
192: }
193:
194: private Long customerId;
195: private String orgName;
196: private String url;
197: private Date lastUpdated;
198: private Date creationDate;
199:
200: //
201: // customerId:
202: //
203: public Long getCustomerId() {
204: return this .customerId;
205: }
206:
207: public void setCustomerId(Long customerId) {
208: if (record2().setObject(ICOL_CUSTOMER_ID, customerId)) {
209: this .customerId = customerId;
210: }
211: }
212:
213: public boolean izNullCustomerId() {
214: return record2().getObject(ICOL_CUSTOMER_ID) == null;
215: }
216:
217: public void setNullCustomerId() {
218: if (record2().setObject(ICOL_CUSTOMER_ID, null)) {
219: this .customerId = null;
220: }
221: }
222:
223: //
224: // orgName:
225: //
226: public String getOrgName() {
227: return this .orgName;
228: }
229:
230: public void setOrgName(String orgName) {
231: if (record2().setObject(ICOL_ORG_NAME, orgName)) {
232: this .orgName = orgName;
233: }
234: }
235:
236: public boolean izNullOrgName() {
237: return record2().getObject(ICOL_ORG_NAME) == null;
238: }
239:
240: public void setNullOrgName() {
241: if (record2().setObject(ICOL_ORG_NAME, null)) {
242: this .orgName = null;
243: }
244: }
245:
246: //
247: // url:
248: //
249: public String getUrl() {
250: return this .url;
251: }
252:
253: public void setUrl(String url) {
254: if (record2().setObject(ICOL_URL, url)) {
255: this .url = url;
256: }
257: }
258:
259: public boolean izNullUrl() {
260: return record2().getObject(ICOL_URL) == null;
261: }
262:
263: public void setNullUrl() {
264: if (record2().setObject(ICOL_URL, null)) {
265: this .url = null;
266: }
267: }
268:
269: //
270: // lastUpdated:
271: //
272: public Date getLastUpdated() {
273: return this .lastUpdated;
274: }
275:
276: public void setLastUpdated(Date lastUpdated) {
277: if (record2().setObject(ICOL_LAST_UPDATED, lastUpdated)) {
278: this .lastUpdated = lastUpdated;
279: }
280: }
281:
282: public boolean izNullLastUpdated() {
283: return record2().getObject(ICOL_LAST_UPDATED) == null;
284: }
285:
286: public void setNullLastUpdated() {
287: if (record2().setObject(ICOL_LAST_UPDATED, null)) {
288: this .lastUpdated = null;
289: }
290: }
291:
292: //
293: // creationDate:
294: //
295: public Date getCreationDate() {
296: return this .creationDate;
297: }
298:
299: public void setCreationDate(Date creationDate) {
300: if (record2().setObject(ICOL_CREATION_DATE, creationDate)) {
301: this .creationDate = creationDate;
302: }
303: }
304:
305: public boolean izNullCreationDate() {
306: return record2().getObject(ICOL_CREATION_DATE) == null;
307: }
308:
309: public void setNullCreationDate() {
310: if (record2().setObject(ICOL_CREATION_DATE, null)) {
311: this .creationDate = null;
312: }
313: }
314:
315: public void toBeanFields() {
316: toBeanFields(this );
317: }
318:
319: public void toBeanFields(PersistentObject from) {
320: customerId = (Long) from.record2().getObject(ICOL_CUSTOMER_ID);
321: orgName = (String) from.record2().getObject(ICOL_ORG_NAME);
322: url = (String) from.record2().getObject(ICOL_URL);
323: lastUpdated = (Date) from.record2()
324: .getObject(ICOL_LAST_UPDATED);
325: creationDate = (Date) from.record2().getObject(
326: ICOL_CREATION_DATE);
327: super .toBeanFields(from);
328: }
329:
330: public void fromBeanFields(PersistentObject persistentObject) {
331: CustomerPO from = (CustomerPO) persistentObject;
332: record2().getEntry(ICOL_CUSTOMER_ID).setUnmarkedValue(
333: from.customerId, from.customerId);
334: record2().getEntry(ICOL_ORG_NAME).setUnmarkedValue(
335: from.orgName, from.orgName);
336: record2().getEntry(ICOL_URL).setUnmarkedValue(from.url,
337: from.url);
338: record2().getEntry(ICOL_LAST_UPDATED).setUnmarkedValue(
339: from.lastUpdated, from.lastUpdated);
340: record2().getEntry(ICOL_CREATION_DATE).setUnmarkedValue(
341: from.creationDate, from.creationDate);
342: super .fromBeanFieldsDataSaved(persistentObject);
343: }
344:
345: public String toString() {
346:
347: StringBuffer buffer = new StringBuffer();
348: buffer.append("{ " + "class = ").append(
349: this .getClass().getName()).append(" " + "table = ")
350: .append(TABLE_CUSTOMER).append(" columns = {");
351:
352: if (record() != null) {
353: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
354: record().getObject(ICOL_CUSTOMER_ID)).append(" ");
355: buffer.append(COL_ORG_NAME).append(" = ").append(
356: record().getObject(ICOL_ORG_NAME)).append(" ");
357: buffer.append(COL_URL).append(" = ").append(
358: record().getObject(ICOL_URL)).append(" ");
359: buffer.append(COL_LAST_UPDATED).append(" = ").append(
360: record().getObject(ICOL_LAST_UPDATED)).append(" ");
361: buffer.append(COL_CREATION_DATE).append(" = ").append(
362: record().getObject(ICOL_CREATION_DATE)).append(" ");
363: } else {
364: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
365: customerId).append(" ");
366: buffer.append(COL_ORG_NAME).append(" = ").append(orgName)
367: .append(" ");
368: buffer.append(COL_URL).append(" = ").append(url)
369: .append(" ");
370: buffer.append(COL_LAST_UPDATED).append(" = ").append(
371: lastUpdated).append(" ");
372: buffer.append(COL_CREATION_DATE).append(" = ").append(
373: creationDate).append(" ");
374: }
375: buffer.append("}}");
376: return buffer.toString();
377: }
378:
379: // naturalKey has no context
380:
381: /**
382: * Equals by Basic Peristent object fields (without children objects)
383: */
384: public boolean equalsBasic(Object value) {
385: if (this == value)
386: return true;
387: if (value == null || getClass() != value.getClass())
388: return false;
389:
390: CustomerPO that = (CustomerPO) value;
391:
392: if (customerId != null ? !customerId.equals(that.customerId)
393: : that.customerId != null)
394: return false;
395: if (orgName != null ? !orgName.equals(that.orgName)
396: : that.orgName != null)
397: return false;
398: if (url != null ? !url.equals(that.url) : that.url != null)
399: return false;
400: if (lastUpdated != null ? !lastUpdated.equals(that.lastUpdated)
401: : that.lastUpdated != null)
402: return false;
403: if (creationDate != null ? !creationDate
404: .equals(that.creationDate) : that.creationDate != null)
405: return false;
406: return true;
407: }
408:
409: /**
410: * hashCode by Basic Peristent object fields (without children objects)
411: */
412: public int hashCodeBasic() {
413: int result;
414: long temp;
415: result = (customerId != null ? customerId.hashCode() : 0);
416: result = 29 * result
417: + (orgName != null ? orgName.hashCode() : 0);
418: result = 29 * result + (url != null ? url.hashCode() : 0);
419: result = 29 * result
420: + (lastUpdated != null ? lastUpdated.hashCode() : 0);
421: result = 29 * result
422: + (creationDate != null ? creationDate.hashCode() : 0);
423:
424: return result;
425: }
426: }
|