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.Website;
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="WebsiteModelImpl.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>Website</code> table
049: * in the database.
050: * </p>
051: *
052: * @author Brian Wing Shun Chan
053: *
054: * @see com.liferay.portal.service.model.Website
055: * @see com.liferay.portal.service.model.WebsiteModel
056: * @see com.liferay.portal.service.model.impl.WebsiteImpl
057: *
058: */
059: public class WebsiteModelImpl extends BaseModelImpl {
060: public static final String TABLE_NAME = "Website";
061: public static final Object[][] TABLE_COLUMNS = {
062: { "websiteId", 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: { "url", 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 Website (websiteId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,classPK LONG,url STRING null,typeId INTEGER,primary_ BOOLEAN)";
084: public static final String TABLE_SQL_DROP = "drop table Website";
085: public static final boolean CACHE_ENABLED = GetterUtil
086: .getBoolean(
087: PropsUtil
088: .get("value.object.finder.cache.enabled.com.liferay.portal.model.Website"),
089: true);
090: public static final long LOCK_EXPIRATION_TIME = GetterUtil
091: .getLong(PropsUtil
092: .get("lock.expiration.time.com.liferay.portal.model.Website"));
093:
094: public WebsiteModelImpl() {
095: }
096:
097: public long getPrimaryKey() {
098: return _websiteId;
099: }
100:
101: public void setPrimaryKey(long pk) {
102: setWebsiteId(pk);
103: }
104:
105: public Serializable getPrimaryKeyObj() {
106: return new Long(_websiteId);
107: }
108:
109: public long getWebsiteId() {
110: return _websiteId;
111: }
112:
113: public void setWebsiteId(long websiteId) {
114: if (websiteId != _websiteId) {
115: _websiteId = websiteId;
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 getUrl() {
199: return GetterUtil.getString(_url);
200: }
201:
202: public void setUrl(String url) {
203: if (((url == null) && (_url != null))
204: || ((url != null) && (_url == null))
205: || ((url != null) && (_url != null) && !url
206: .equals(_url))) {
207: _url = url;
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 Website toEscapedModel() {
236: if (isEscapedModel()) {
237: return (Website) this ;
238: } else {
239: Website model = new WebsiteImpl();
240:
241: model.setEscapedModel(true);
242:
243: model.setWebsiteId(getWebsiteId());
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.setUrl(Html.escape(getUrl()));
252: model.setTypeId(getTypeId());
253: model.setPrimary(getPrimary());
254:
255: model = (Website) Proxy.newProxyInstance(Website.class
256: .getClassLoader(), new Class[] { Website.class },
257: new ReadOnlyBeanHandler(model));
258:
259: return model;
260: }
261: }
262:
263: public Object clone() {
264: WebsiteImpl clone = new WebsiteImpl();
265:
266: clone.setWebsiteId(getWebsiteId());
267: clone.setCompanyId(getCompanyId());
268: clone.setUserId(getUserId());
269: clone.setUserName(getUserName());
270: clone.setCreateDate(getCreateDate());
271: clone.setModifiedDate(getModifiedDate());
272: clone.setClassNameId(getClassNameId());
273: clone.setClassPK(getClassPK());
274: clone.setUrl(getUrl());
275: clone.setTypeId(getTypeId());
276: clone.setPrimary(getPrimary());
277:
278: return clone;
279: }
280:
281: public int compareTo(Object obj) {
282: if (obj == null) {
283: return -1;
284: }
285:
286: WebsiteImpl website = (WebsiteImpl) obj;
287:
288: int value = 0;
289:
290: value = DateUtil.compareTo(getCreateDate(), website
291: .getCreateDate());
292:
293: if (value != 0) {
294: return value;
295: }
296:
297: return 0;
298: }
299:
300: public boolean equals(Object obj) {
301: if (obj == null) {
302: return false;
303: }
304:
305: WebsiteImpl website = null;
306:
307: try {
308: website = (WebsiteImpl) obj;
309: } catch (ClassCastException cce) {
310: return false;
311: }
312:
313: long pk = website.getPrimaryKey();
314:
315: if (getPrimaryKey() == pk) {
316: return true;
317: } else {
318: return false;
319: }
320: }
321:
322: public int hashCode() {
323: return (int) getPrimaryKey();
324: }
325:
326: private long _websiteId;
327: private long _companyId;
328: private long _userId;
329: private String _userName;
330: private Date _createDate;
331: private Date _modifiedDate;
332: private long _classNameId;
333: private long _classPK;
334: private String _url;
335: private int _typeId;
336: private boolean _primary;
337: }
|