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.Phone;
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="PhoneModelImpl.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>Phone</code> table
049: * in the database.
050: * </p>
051: *
052: * @author Brian Wing Shun Chan
053: *
054: * @see com.liferay.portal.service.model.Phone
055: * @see com.liferay.portal.service.model.PhoneModel
056: * @see com.liferay.portal.service.model.impl.PhoneImpl
057: *
058: */
059: public class PhoneModelImpl extends BaseModelImpl {
060: public static final String TABLE_NAME = "Phone";
061: public static final Object[][] TABLE_COLUMNS = {
062: { "phoneId", 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: { "number_", new Integer(Types.VARCHAR) },
079:
080: { "extension", new Integer(Types.VARCHAR) },
081:
082: { "typeId", new Integer(Types.INTEGER) },
083:
084: { "primary_", new Integer(Types.BOOLEAN) } };
085: public static final String TABLE_SQL_CREATE = "create table Phone (phoneId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,number_ VARCHAR(75) null,extension VARCHAR(75) null,typeId INTEGER,primary_ BOOLEAN)";
086: public static final String TABLE_SQL_DROP = "drop table Phone";
087: public static final boolean CACHE_ENABLED = GetterUtil
088: .getBoolean(
089: PropsUtil
090: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Phone"),
091: true);
092: public static final long LOCK_EXPIRATION_TIME = GetterUtil
093: .getLong(PropsUtil
094: .get("lock.expiration.time.com.liferay.portal.model.Phone"));
095:
096: public PhoneModelImpl() {
097: }
098:
099: public long getPrimaryKey() {
100: return _phoneId;
101: }
102:
103: public void setPrimaryKey(long pk) {
104: setPhoneId(pk);
105: }
106:
107: public Serializable getPrimaryKeyObj() {
108: return new Long(_phoneId);
109: }
110:
111: public long getPhoneId() {
112: return _phoneId;
113: }
114:
115: public void setPhoneId(long phoneId) {
116: if (phoneId != _phoneId) {
117: _phoneId = phoneId;
118: }
119: }
120:
121: public long getCompanyId() {
122: return _companyId;
123: }
124:
125: public void setCompanyId(long companyId) {
126: if (companyId != _companyId) {
127: _companyId = companyId;
128: }
129: }
130:
131: public long getUserId() {
132: return _userId;
133: }
134:
135: public void setUserId(long userId) {
136: if (userId != _userId) {
137: _userId = userId;
138: }
139: }
140:
141: public String getUserName() {
142: return GetterUtil.getString(_userName);
143: }
144:
145: public void setUserName(String userName) {
146: if (((userName == null) && (_userName != null))
147: || ((userName != null) && (_userName == null))
148: || ((userName != null) && (_userName != null) && !userName
149: .equals(_userName))) {
150: _userName = userName;
151: }
152: }
153:
154: public Date getCreateDate() {
155: return _createDate;
156: }
157:
158: public void setCreateDate(Date createDate) {
159: if (((createDate == null) && (_createDate != null))
160: || ((createDate != null) && (_createDate == null))
161: || ((createDate != null) && (_createDate != null) && !createDate
162: .equals(_createDate))) {
163: _createDate = createDate;
164: }
165: }
166:
167: public Date getModifiedDate() {
168: return _modifiedDate;
169: }
170:
171: public void setModifiedDate(Date modifiedDate) {
172: if (((modifiedDate == null) && (_modifiedDate != null))
173: || ((modifiedDate != null) && (_modifiedDate == null))
174: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
175: .equals(_modifiedDate))) {
176: _modifiedDate = modifiedDate;
177: }
178: }
179:
180: public long getClassNameId() {
181: return _classNameId;
182: }
183:
184: public void setClassNameId(long classNameId) {
185: if (classNameId != _classNameId) {
186: _classNameId = classNameId;
187: }
188: }
189:
190: public long getClassPK() {
191: return _classPK;
192: }
193:
194: public void setClassPK(long classPK) {
195: if (classPK != _classPK) {
196: _classPK = classPK;
197: }
198: }
199:
200: public String getNumber() {
201: return GetterUtil.getString(_number);
202: }
203:
204: public void setNumber(String number) {
205: if (((number == null) && (_number != null))
206: || ((number != null) && (_number == null))
207: || ((number != null) && (_number != null) && !number
208: .equals(_number))) {
209: _number = number;
210: }
211: }
212:
213: public String getExtension() {
214: return GetterUtil.getString(_extension);
215: }
216:
217: public void setExtension(String extension) {
218: if (((extension == null) && (_extension != null))
219: || ((extension != null) && (_extension == null))
220: || ((extension != null) && (_extension != null) && !extension
221: .equals(_extension))) {
222: _extension = extension;
223: }
224: }
225:
226: public int getTypeId() {
227: return _typeId;
228: }
229:
230: public void setTypeId(int typeId) {
231: if (typeId != _typeId) {
232: _typeId = typeId;
233: }
234: }
235:
236: public boolean getPrimary() {
237: return _primary;
238: }
239:
240: public boolean isPrimary() {
241: return _primary;
242: }
243:
244: public void setPrimary(boolean primary) {
245: if (primary != _primary) {
246: _primary = primary;
247: }
248: }
249:
250: public Phone toEscapedModel() {
251: if (isEscapedModel()) {
252: return (Phone) this ;
253: } else {
254: Phone model = new PhoneImpl();
255:
256: model.setEscapedModel(true);
257:
258: model.setPhoneId(getPhoneId());
259: model.setCompanyId(getCompanyId());
260: model.setUserId(getUserId());
261: model.setUserName(Html.escape(getUserName()));
262: model.setCreateDate(getCreateDate());
263: model.setModifiedDate(getModifiedDate());
264: model.setClassNameId(getClassNameId());
265: model.setClassPK(getClassPK());
266: model.setNumber(Html.escape(getNumber()));
267: model.setExtension(Html.escape(getExtension()));
268: model.setTypeId(getTypeId());
269: model.setPrimary(getPrimary());
270:
271: model = (Phone) Proxy.newProxyInstance(Phone.class
272: .getClassLoader(), new Class[] { Phone.class },
273: new ReadOnlyBeanHandler(model));
274:
275: return model;
276: }
277: }
278:
279: public Object clone() {
280: PhoneImpl clone = new PhoneImpl();
281:
282: clone.setPhoneId(getPhoneId());
283: clone.setCompanyId(getCompanyId());
284: clone.setUserId(getUserId());
285: clone.setUserName(getUserName());
286: clone.setCreateDate(getCreateDate());
287: clone.setModifiedDate(getModifiedDate());
288: clone.setClassNameId(getClassNameId());
289: clone.setClassPK(getClassPK());
290: clone.setNumber(getNumber());
291: clone.setExtension(getExtension());
292: clone.setTypeId(getTypeId());
293: clone.setPrimary(getPrimary());
294:
295: return clone;
296: }
297:
298: public int compareTo(Object obj) {
299: if (obj == null) {
300: return -1;
301: }
302:
303: PhoneImpl phone = (PhoneImpl) obj;
304:
305: int value = 0;
306:
307: value = DateUtil.compareTo(getCreateDate(), phone
308: .getCreateDate());
309:
310: if (value != 0) {
311: return value;
312: }
313:
314: return 0;
315: }
316:
317: public boolean equals(Object obj) {
318: if (obj == null) {
319: return false;
320: }
321:
322: PhoneImpl phone = null;
323:
324: try {
325: phone = (PhoneImpl) obj;
326: } catch (ClassCastException cce) {
327: return false;
328: }
329:
330: long pk = phone.getPrimaryKey();
331:
332: if (getPrimaryKey() == pk) {
333: return true;
334: } else {
335: return false;
336: }
337: }
338:
339: public int hashCode() {
340: return (int) getPrimaryKey();
341: }
342:
343: private long _phoneId;
344: private long _companyId;
345: private long _userId;
346: private String _userName;
347: private Date _createDate;
348: private Date _modifiedDate;
349: private long _classNameId;
350: private long _classPK;
351: private String _number;
352: private String _extension;
353: private int _typeId;
354: private boolean _primary;
355: }
|