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