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 SignonPO 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_SIGNON = "SIGNON";
050:
051: public SignonPO() {
052: super (new Record(table));
053: }
054:
055: public SignonPO(String userName) {
056: this ();
057: setUserName(userName);
058: }
059:
060: public static final String COL_USER_NAME = "USER_NAME";
061: public static final String TCOL_USER_NAME = "SIGNON.USER_NAME";
062: public static final int ICOL_USER_NAME = 0;
063: public static final int JDBC_TYPE_USER_NAME = 12;
064:
065: public static final String COL_PASSWORD = "PASSWORD";
066: public static final String TCOL_PASSWORD = "SIGNON.PASSWORD";
067: public static final int ICOL_PASSWORD = 1;
068: public static final int JDBC_TYPE_PASSWORD = 12;
069:
070: private static final MetaTable table = new MetaTable("SIGNON",
071: "SIGNON", 2, 1);
072:
073: static {
074: table.setStaticFinal(true);
075: //
076: // Meta Foreign Keys:
077: //
078: table.addToForeignKey("ACCOUNT", new ForeignKeyEntry("USER_ID",
079: "USER_NAME"));
080: //
081: // Meta Natural Key:
082: //
083: // naturalKey has no context
084:
085: //
086: // Meta Columns:
087: //
088:
089: final MetaColumn metaUserName = new MetaColumn(ICOL_USER_NAME,
090: "USER_NAME", "USER_NAME", table);
091: metaUserName.setPrimaryKey(true);
092: metaUserName.setRequired(true);
093: metaUserName.setOptimisticLock(false);
094: metaUserName.setType(ColumnType.STRING);
095: metaUserName.setColumnSize(25);
096: metaUserName.setRemarks("");
097: metaUserName.setDecimalDigits(0);
098: metaUserName.setAutoGenerated(false);
099: metaUserName.setAutoIncrement(false);
100: metaUserName.setJdbcType(12);
101: table.addToPrimaryKey(new Integer(ICOL_USER_NAME));
102: table.addColumn(metaUserName);
103:
104: final MetaColumn metaPassword = new MetaColumn(ICOL_PASSWORD,
105: "PASSWORD", "PASSWORD", table);
106: metaPassword.setPrimaryKey(false);
107: metaPassword.setRequired(true);
108: metaPassword.setOptimisticLock(false);
109: metaPassword.setType(ColumnType.STRING);
110: metaPassword.setColumnSize(25);
111: metaPassword.setRemarks("");
112: metaPassword.setDecimalDigits(0);
113: metaPassword.setAutoGenerated(false);
114: metaPassword.setAutoIncrement(false);
115: metaPassword.setJdbcType(12);
116: table.addColumn(metaPassword);
117:
118: }
119:
120: private String userName;
121: private String password;
122:
123: //
124: // userName:
125: //
126: public String getUserName() {
127: return this .userName;
128: }
129:
130: public void setUserName(String userName) {
131: if (record2().setObject(ICOL_USER_NAME, userName)) {
132: this .userName = userName;
133: }
134: }
135:
136: public boolean izNullUserName() {
137: return record2().getObject(ICOL_USER_NAME) == null;
138: }
139:
140: public void setNullUserName() {
141: if (record2().setObject(ICOL_USER_NAME, null)) {
142: this .userName = null;
143: }
144: }
145:
146: //
147: // password:
148: //
149: public String getPassword() {
150: return this .password;
151: }
152:
153: public void setPassword(String password) {
154: if (record2().setObject(ICOL_PASSWORD, password)) {
155: this .password = password;
156: }
157: }
158:
159: public boolean izNullPassword() {
160: return record2().getObject(ICOL_PASSWORD) == null;
161: }
162:
163: public void setNullPassword() {
164: if (record2().setObject(ICOL_PASSWORD, null)) {
165: this .password = null;
166: }
167: }
168:
169: public void toBeanFields() {
170: toBeanFields(this );
171: }
172:
173: public void toBeanFields(PersistentObject from) {
174: userName = (String) from.record2().getObject(ICOL_USER_NAME);
175: password = (String) from.record2().getObject(ICOL_PASSWORD);
176: super .toBeanFields(from);
177: }
178:
179: public void fromBeanFields(PersistentObject persistentObject) {
180: SignonPO from = (SignonPO) persistentObject;
181: record2().getEntry(ICOL_USER_NAME).setUnmarkedValue(
182: from.userName, from.userName);
183: record2().getEntry(ICOL_PASSWORD).setUnmarkedValue(
184: from.password, from.password);
185: super .fromBeanFieldsDataSaved(persistentObject);
186: }
187:
188: public String toString() {
189:
190: StringBuffer buffer = new StringBuffer();
191: buffer.append("{ " + "class = ").append(
192: this .getClass().getName()).append(" " + "table = ")
193: .append(TABLE_SIGNON).append(" columns = {");
194:
195: if (record() != null) {
196: buffer.append(COL_USER_NAME).append(" = ").append(
197: record().getObject(ICOL_USER_NAME)).append(" ");
198: buffer.append(COL_PASSWORD).append(" = ").append(
199: record().getObject(ICOL_PASSWORD)).append(" ");
200: } else {
201: buffer.append(COL_USER_NAME).append(" = ").append(userName)
202: .append(" ");
203: buffer.append(COL_PASSWORD).append(" = ").append(password)
204: .append(" ");
205: }
206: buffer.append("}}");
207: return buffer.toString();
208: }
209:
210: // naturalKey has no context
211:
212: /**
213: * Equals by Basic Peristent object fields (without children objects)
214: */
215: public boolean equalsBasic(Object value) {
216: if (this == value)
217: return true;
218: if (value == null || getClass() != value.getClass())
219: return false;
220:
221: SignonPO that = (SignonPO) value;
222:
223: if (userName != null ? !userName.equals(that.userName)
224: : that.userName != null)
225: return false;
226: if (password != null ? !password.equals(that.password)
227: : that.password != null)
228: return false;
229: return true;
230: }
231:
232: /**
233: * hashCode by Basic Peristent object fields (without children objects)
234: */
235: public int hashCodeBasic() {
236: int result;
237: long temp;
238: result = (userName != null ? userName.hashCode() : 0);
239: result = 29 * result
240: + (password != null ? password.hashCode() : 0);
241:
242: return result;
243: }
244: }
|