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: public class CustomerContactRelPO 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_CUSTOMER_CONTACT_REL = "CUSTOMER_CONTACT_REL";
050:
051: public CustomerContactRelPO() {
052: super (new Record(table));
053: }
054:
055: public CustomerContactRelPO(Long contactId, String contactType,
056: Long customerId) {
057: this ();
058: setContactId(contactId);
059: setContactType(contactType);
060: setCustomerId(customerId);
061: }
062:
063: public static final String COL_CUSTOMER_ID = "CUSTOMER_ID";
064: public static final String TCOL_CUSTOMER_ID = "CUSTOMER_CONTACT_REL.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_CONTACT_ID = "CONTACT_ID";
069: public static final String TCOL_CONTACT_ID = "CUSTOMER_CONTACT_REL.CONTACT_ID";
070: public static final int ICOL_CONTACT_ID = 1;
071: public static final int JDBC_TYPE_CONTACT_ID = -5;
072:
073: public static final String COL_CONTACT_TYPE = "CONTACT_TYPE";
074: public static final String TCOL_CONTACT_TYPE = "CUSTOMER_CONTACT_REL.CONTACT_TYPE";
075: public static final int ICOL_CONTACT_TYPE = 2;
076: public static final int JDBC_TYPE_CONTACT_TYPE = 12;
077:
078: private static final MetaTable table = new MetaTable(
079: "CUSTOMER_CONTACT_REL", "CUSTOMER_CONTACT_REL", 3, 3);
080:
081: static {
082: table.setStaticFinal(true);
083: //
084: // Meta Foreign Keys:
085: //
086: table.addToForeignKey("CONTACT", new ForeignKeyEntry(
087: "CONTACT_ID", "CONTACT_ID"));
088: table.addToForeignKey("CUSTOMER", new ForeignKeyEntry(
089: "CUSTOMER_ID", "CUSTOMER_ID"));
090: //
091: // Meta Natural Key:
092: //
093: // naturalKey has no context
094:
095: //
096: // Meta Columns:
097: //
098:
099: final MetaColumn metaCustomerId = new MetaColumn(
100: ICOL_CUSTOMER_ID, "CUSTOMER_ID", "CUSTOMER_ID", table);
101: metaCustomerId.setPrimaryKey(true);
102: metaCustomerId.setRequired(true);
103: metaCustomerId.setOptimisticLock(false);
104: metaCustomerId.setType(ColumnType.LONG);
105: metaCustomerId.setColumnSize(0);
106: metaCustomerId.setRemarks("");
107: metaCustomerId.setDecimalDigits(0);
108: metaCustomerId.setAutoGenerated(false);
109: metaCustomerId.setAutoIncrement(false);
110: metaCustomerId.setJdbcType(-5);
111: table.addToPrimaryKey(new Integer(ICOL_CUSTOMER_ID));
112: table.addColumn(metaCustomerId);
113:
114: final MetaColumn metaContactId = new MetaColumn(
115: ICOL_CONTACT_ID, "CONTACT_ID", "CONTACT_ID", table);
116: metaContactId.setPrimaryKey(true);
117: metaContactId.setRequired(true);
118: metaContactId.setOptimisticLock(false);
119: metaContactId.setType(ColumnType.LONG);
120: metaContactId.setColumnSize(0);
121: metaContactId.setRemarks("");
122: metaContactId.setDecimalDigits(0);
123: metaContactId.setAutoGenerated(false);
124: metaContactId.setAutoIncrement(false);
125: metaContactId.setJdbcType(-5);
126: table.addToPrimaryKey(new Integer(ICOL_CONTACT_ID));
127: table.addColumn(metaContactId);
128:
129: final MetaColumn metaContactType = new MetaColumn(
130: ICOL_CONTACT_TYPE, "CONTACT_TYPE", "CONTACT_TYPE",
131: table);
132: metaContactType.setPrimaryKey(true);
133: metaContactType.setRequired(true);
134: metaContactType.setOptimisticLock(false);
135: metaContactType.setType(ColumnType.STRING);
136: metaContactType.setColumnSize(40);
137: metaContactType.setRemarks("");
138: metaContactType.setDecimalDigits(0);
139: metaContactType.setAutoGenerated(false);
140: metaContactType.setAutoIncrement(false);
141: metaContactType.setJdbcType(12);
142: table.addToPrimaryKey(new Integer(ICOL_CONTACT_TYPE));
143: table.addColumn(metaContactType);
144:
145: }
146:
147: private Long customerId;
148: private Long contactId;
149: private String contactType;
150:
151: //
152: // customerId:
153: //
154: public Long getCustomerId() {
155: return this .customerId;
156: }
157:
158: public void setCustomerId(Long customerId) {
159: if (record2().setObject(ICOL_CUSTOMER_ID, customerId)) {
160: this .customerId = customerId;
161: }
162: }
163:
164: public boolean izNullCustomerId() {
165: return record2().getObject(ICOL_CUSTOMER_ID) == null;
166: }
167:
168: public void setNullCustomerId() {
169: if (record2().setObject(ICOL_CUSTOMER_ID, null)) {
170: this .customerId = null;
171: }
172: }
173:
174: //
175: // contactId:
176: //
177: public Long getContactId() {
178: return this .contactId;
179: }
180:
181: public void setContactId(Long contactId) {
182: if (record2().setObject(ICOL_CONTACT_ID, contactId)) {
183: this .contactId = contactId;
184: }
185: }
186:
187: public boolean izNullContactId() {
188: return record2().getObject(ICOL_CONTACT_ID) == null;
189: }
190:
191: public void setNullContactId() {
192: if (record2().setObject(ICOL_CONTACT_ID, null)) {
193: this .contactId = null;
194: }
195: }
196:
197: //
198: // contactType:
199: //
200: public String getContactType() {
201: return this .contactType;
202: }
203:
204: public void setContactType(String contactType) {
205: if (record2().setObject(ICOL_CONTACT_TYPE, contactType)) {
206: this .contactType = contactType;
207: }
208: }
209:
210: public boolean izNullContactType() {
211: return record2().getObject(ICOL_CONTACT_TYPE) == null;
212: }
213:
214: public void setNullContactType() {
215: if (record2().setObject(ICOL_CONTACT_TYPE, null)) {
216: this .contactType = null;
217: }
218: }
219:
220: public void toBeanFields() {
221: toBeanFields(this );
222: }
223:
224: public void toBeanFields(PersistentObject from) {
225: customerId = (Long) from.record2().getObject(ICOL_CUSTOMER_ID);
226: contactId = (Long) from.record2().getObject(ICOL_CONTACT_ID);
227: contactType = (String) from.record2().getObject(
228: ICOL_CONTACT_TYPE);
229: super .toBeanFields(from);
230: }
231:
232: public void fromBeanFields(PersistentObject persistentObject) {
233: CustomerContactRelPO from = (CustomerContactRelPO) persistentObject;
234: record2().getEntry(ICOL_CUSTOMER_ID).setUnmarkedValue(
235: from.customerId, from.customerId);
236: record2().getEntry(ICOL_CONTACT_ID).setUnmarkedValue(
237: from.contactId, from.contactId);
238: record2().getEntry(ICOL_CONTACT_TYPE).setUnmarkedValue(
239: from.contactType, from.contactType);
240: super .fromBeanFieldsDataSaved(persistentObject);
241: }
242:
243: public String toString() {
244:
245: StringBuffer buffer = new StringBuffer();
246: buffer.append("{ " + "class = ").append(
247: this .getClass().getName()).append(" " + "table = ")
248: .append(TABLE_CUSTOMER_CONTACT_REL).append(
249: " columns = {");
250:
251: if (record() != null) {
252: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
253: record().getObject(ICOL_CUSTOMER_ID)).append(" ");
254: buffer.append(COL_CONTACT_ID).append(" = ").append(
255: record().getObject(ICOL_CONTACT_ID)).append(" ");
256: buffer.append(COL_CONTACT_TYPE).append(" = ").append(
257: record().getObject(ICOL_CONTACT_TYPE)).append(" ");
258: } else {
259: buffer.append(COL_CUSTOMER_ID).append(" = ").append(
260: customerId).append(" ");
261: buffer.append(COL_CONTACT_ID).append(" = ").append(
262: contactId).append(" ");
263: buffer.append(COL_CONTACT_TYPE).append(" = ").append(
264: contactType).append(" ");
265: }
266: buffer.append("}}");
267: return buffer.toString();
268: }
269:
270: // naturalKey has no context
271:
272: /**
273: * Equals by Basic Peristent object fields (without children objects)
274: */
275: public boolean equalsBasic(Object value) {
276: if (this == value)
277: return true;
278: if (value == null || getClass() != value.getClass())
279: return false;
280:
281: CustomerContactRelPO that = (CustomerContactRelPO) value;
282:
283: if (customerId != null ? !customerId.equals(that.customerId)
284: : that.customerId != null)
285: return false;
286: if (contactId != null ? !contactId.equals(that.contactId)
287: : that.contactId != null)
288: return false;
289: if (contactType != null ? !contactType.equals(that.contactType)
290: : that.contactType != null)
291: return false;
292: return true;
293: }
294:
295: /**
296: * hashCode by Basic Peristent object fields (without children objects)
297: */
298: public int hashCodeBasic() {
299: int result;
300: long temp;
301: result = (customerId != null ? customerId.hashCode() : 0);
302: result = 29 * result
303: + (contactId != null ? contactId.hashCode() : 0);
304: result = 29 * result
305: + (contactType != null ? contactType.hashCode() : 0);
306:
307: return result;
308: }
309: }
|