001: /**
002: * Copyright (c) 2000-2008 Liferay, Inc. All rights reserved.
003: *
004: * Permission is hereby granted, free of charge, to any person obtaining a copy
005: * of this software and associated documentation files (the "Software"), to deal
006: * in the Software without restriction, including without limitation the rights
007: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
008: * copies of the Software, and to permit persons to whom the Software is
009: * furnished to do so, subject to the following conditions:
010: *
011: * The above copyright notice and this permission notice shall be included in
012: * all copies or substantial portions of the Software.
013: *
014: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
015: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
016: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
017: * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
018: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
019: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
020: * SOFTWARE.
021: */package com.liferay.portal.model.impl;
022:
023: import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
024: import com.liferay.portal.kernel.util.DateUtil;
025: import com.liferay.portal.kernel.util.GetterUtil;
026: import com.liferay.portal.model.EmailAddress;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import com.liferay.util.Html;
030:
031: import java.io.Serializable;
032:
033: import java.lang.reflect.Proxy;
034:
035: import java.sql.Types;
036:
037: import java.util.Date;
038:
039: /**
040: * <a href="EmailAddressModelImpl.java.html"><b><i>View Source</i></b></a>
041: *
042: * <p>
043: * ServiceBuilder generated this class. Modifications in this class will be
044: * overwritten the next time is generated.
045: * </p>
046: *
047: * <p>
048: * This class is a model that represents the <code>EmailAddress</code> table
049: * in the database.
050: * </p>
051: *
052: * @author Brian Wing Shun Chan
053: *
054: * @see com.liferay.portal.service.model.EmailAddress
055: * @see com.liferay.portal.service.model.EmailAddressModel
056: * @see com.liferay.portal.service.model.impl.EmailAddressImpl
057: *
058: */
059: public class EmailAddressModelImpl extends BaseModelImpl {
060: public static final String TABLE_NAME = "EmailAddress";
061: public static final Object[][] TABLE_COLUMNS = {
062: { "emailAddressId", new Integer(Types.BIGINT) },
063:
064: { "companyId", new Integer(Types.BIGINT) },
065:
066: { "userId", new Integer(Types.BIGINT) },
067:
068: { "userName", new Integer(Types.VARCHAR) },
069:
070: { "createDate", new Integer(Types.TIMESTAMP) },
071:
072: { "modifiedDate", new Integer(Types.TIMESTAMP) },
073:
074: { "classNameId", new Integer(Types.BIGINT) },
075:
076: { "classPK", new Integer(Types.BIGINT) },
077:
078: { "address", new Integer(Types.VARCHAR) },
079:
080: { "typeId", new Integer(Types.INTEGER) },
081:
082: { "primary_", new Integer(Types.BOOLEAN) } };
083: public static final String TABLE_SQL_CREATE = "create table EmailAddress (emailAddressId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,address VARCHAR(75) null,typeId INTEGER,primary_ BOOLEAN)";
084: public static final String TABLE_SQL_DROP = "drop table EmailAddress";
085: public static final boolean CACHE_ENABLED = GetterUtil
086: .getBoolean(
087: PropsUtil
088: .get("value.object.finder.cache.enabled.com.liferay.portal.model.EmailAddress"),
089: true);
090: public static final long LOCK_EXPIRATION_TIME = GetterUtil
091: .getLong(PropsUtil
092: .get("lock.expiration.time.com.liferay.portal.model.EmailAddress"));
093:
094: public EmailAddressModelImpl() {
095: }
096:
097: public long getPrimaryKey() {
098: return _emailAddressId;
099: }
100:
101: public void setPrimaryKey(long pk) {
102: setEmailAddressId(pk);
103: }
104:
105: public Serializable getPrimaryKeyObj() {
106: return new Long(_emailAddressId);
107: }
108:
109: public long getEmailAddressId() {
110: return _emailAddressId;
111: }
112:
113: public void setEmailAddressId(long emailAddressId) {
114: if (emailAddressId != _emailAddressId) {
115: _emailAddressId = emailAddressId;
116: }
117: }
118:
119: public long getCompanyId() {
120: return _companyId;
121: }
122:
123: public void setCompanyId(long companyId) {
124: if (companyId != _companyId) {
125: _companyId = companyId;
126: }
127: }
128:
129: public long getUserId() {
130: return _userId;
131: }
132:
133: public void setUserId(long userId) {
134: if (userId != _userId) {
135: _userId = userId;
136: }
137: }
138:
139: public String getUserName() {
140: return GetterUtil.getString(_userName);
141: }
142:
143: public void setUserName(String userName) {
144: if (((userName == null) && (_userName != null))
145: || ((userName != null) && (_userName == null))
146: || ((userName != null) && (_userName != null) && !userName
147: .equals(_userName))) {
148: _userName = userName;
149: }
150: }
151:
152: public Date getCreateDate() {
153: return _createDate;
154: }
155:
156: public void setCreateDate(Date createDate) {
157: if (((createDate == null) && (_createDate != null))
158: || ((createDate != null) && (_createDate == null))
159: || ((createDate != null) && (_createDate != null) && !createDate
160: .equals(_createDate))) {
161: _createDate = createDate;
162: }
163: }
164:
165: public Date getModifiedDate() {
166: return _modifiedDate;
167: }
168:
169: public void setModifiedDate(Date modifiedDate) {
170: if (((modifiedDate == null) && (_modifiedDate != null))
171: || ((modifiedDate != null) && (_modifiedDate == null))
172: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
173: .equals(_modifiedDate))) {
174: _modifiedDate = modifiedDate;
175: }
176: }
177:
178: public long getClassNameId() {
179: return _classNameId;
180: }
181:
182: public void setClassNameId(long classNameId) {
183: if (classNameId != _classNameId) {
184: _classNameId = classNameId;
185: }
186: }
187:
188: public long getClassPK() {
189: return _classPK;
190: }
191:
192: public void setClassPK(long classPK) {
193: if (classPK != _classPK) {
194: _classPK = classPK;
195: }
196: }
197:
198: public String getAddress() {
199: return GetterUtil.getString(_address);
200: }
201:
202: public void setAddress(String address) {
203: if (((address == null) && (_address != null))
204: || ((address != null) && (_address == null))
205: || ((address != null) && (_address != null) && !address
206: .equals(_address))) {
207: _address = address;
208: }
209: }
210:
211: public int getTypeId() {
212: return _typeId;
213: }
214:
215: public void setTypeId(int typeId) {
216: if (typeId != _typeId) {
217: _typeId = typeId;
218: }
219: }
220:
221: public boolean getPrimary() {
222: return _primary;
223: }
224:
225: public boolean isPrimary() {
226: return _primary;
227: }
228:
229: public void setPrimary(boolean primary) {
230: if (primary != _primary) {
231: _primary = primary;
232: }
233: }
234:
235: public EmailAddress toEscapedModel() {
236: if (isEscapedModel()) {
237: return (EmailAddress) this ;
238: } else {
239: EmailAddress model = new EmailAddressImpl();
240:
241: model.setEscapedModel(true);
242:
243: model.setEmailAddressId(getEmailAddressId());
244: model.setCompanyId(getCompanyId());
245: model.setUserId(getUserId());
246: model.setUserName(Html.escape(getUserName()));
247: model.setCreateDate(getCreateDate());
248: model.setModifiedDate(getModifiedDate());
249: model.setClassNameId(getClassNameId());
250: model.setClassPK(getClassPK());
251: model.setAddress(Html.escape(getAddress()));
252: model.setTypeId(getTypeId());
253: model.setPrimary(getPrimary());
254:
255: model = (EmailAddress) Proxy.newProxyInstance(
256: EmailAddress.class.getClassLoader(),
257: new Class[] { EmailAddress.class },
258: new ReadOnlyBeanHandler(model));
259:
260: return model;
261: }
262: }
263:
264: public Object clone() {
265: EmailAddressImpl clone = new EmailAddressImpl();
266:
267: clone.setEmailAddressId(getEmailAddressId());
268: clone.setCompanyId(getCompanyId());
269: clone.setUserId(getUserId());
270: clone.setUserName(getUserName());
271: clone.setCreateDate(getCreateDate());
272: clone.setModifiedDate(getModifiedDate());
273: clone.setClassNameId(getClassNameId());
274: clone.setClassPK(getClassPK());
275: clone.setAddress(getAddress());
276: clone.setTypeId(getTypeId());
277: clone.setPrimary(getPrimary());
278:
279: return clone;
280: }
281:
282: public int compareTo(Object obj) {
283: if (obj == null) {
284: return -1;
285: }
286:
287: EmailAddressImpl emailAddress = (EmailAddressImpl) obj;
288:
289: int value = 0;
290:
291: value = DateUtil.compareTo(getCreateDate(), emailAddress
292: .getCreateDate());
293:
294: if (value != 0) {
295: return value;
296: }
297:
298: return 0;
299: }
300:
301: public boolean equals(Object obj) {
302: if (obj == null) {
303: return false;
304: }
305:
306: EmailAddressImpl emailAddress = null;
307:
308: try {
309: emailAddress = (EmailAddressImpl) obj;
310: } catch (ClassCastException cce) {
311: return false;
312: }
313:
314: long pk = emailAddress.getPrimaryKey();
315:
316: if (getPrimaryKey() == pk) {
317: return true;
318: } else {
319: return false;
320: }
321: }
322:
323: public int hashCode() {
324: return (int) getPrimaryKey();
325: }
326:
327: private long _emailAddressId;
328: private long _companyId;
329: private long _userId;
330: private String _userName;
331: private Date _createDate;
332: private Date _modifiedDate;
333: private long _classNameId;
334: private long _classPK;
335: private String _address;
336: private int _typeId;
337: private boolean _primary;
338: }
|