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.portlet.blogs.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.impl.BaseModelImpl;
027: import com.liferay.portal.util.PropsUtil;
028:
029: import com.liferay.portlet.blogs.model.BlogsEntry;
030:
031: import com.liferay.util.Html;
032:
033: import java.io.Serializable;
034:
035: import java.lang.reflect.Proxy;
036:
037: import java.sql.Types;
038:
039: import java.util.Date;
040:
041: /**
042: * <a href="BlogsEntryModelImpl.java.html"><b><i>View Source</i></b></a>
043: *
044: * <p>
045: * ServiceBuilder generated this class. Modifications in this class will be
046: * overwritten the next time is generated.
047: * </p>
048: *
049: * <p>
050: * This class is a model that represents the <code>BlogsEntry</code> table
051: * in the database.
052: * </p>
053: *
054: * @author Brian Wing Shun Chan
055: *
056: * @see com.liferay.portlet.blogs.service.model.BlogsEntry
057: * @see com.liferay.portlet.blogs.service.model.BlogsEntryModel
058: * @see com.liferay.portlet.blogs.service.model.impl.BlogsEntryImpl
059: *
060: */
061: public class BlogsEntryModelImpl extends BaseModelImpl {
062: public static final String TABLE_NAME = "BlogsEntry";
063: public static final Object[][] TABLE_COLUMNS = {
064: { "uuid_", new Integer(Types.VARCHAR) },
065:
066: { "entryId", new Integer(Types.BIGINT) },
067:
068: { "groupId", new Integer(Types.BIGINT) },
069:
070: { "companyId", new Integer(Types.BIGINT) },
071:
072: { "userId", new Integer(Types.BIGINT) },
073:
074: { "userName", new Integer(Types.VARCHAR) },
075:
076: { "createDate", new Integer(Types.TIMESTAMP) },
077:
078: { "modifiedDate", new Integer(Types.TIMESTAMP) },
079:
080: { "title", new Integer(Types.VARCHAR) },
081:
082: { "urlTitle", new Integer(Types.VARCHAR) },
083:
084: { "content", new Integer(Types.CLOB) },
085:
086: { "displayDate", new Integer(Types.TIMESTAMP) } };
087: public static final String TABLE_SQL_CREATE = "create table BlogsEntry (uuid_ VARCHAR(75) null,entryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,title VARCHAR(150) null,urlTitle VARCHAR(150) null,content TEXT null,displayDate DATE null)";
088: public static final String TABLE_SQL_DROP = "drop table BlogsEntry";
089: public static final boolean CACHE_ENABLED = GetterUtil
090: .getBoolean(
091: PropsUtil
092: .get("value.object.finder.cache.enabled.com.liferay.portlet.blogs.model.BlogsEntry"),
093: true);
094: public static final long LOCK_EXPIRATION_TIME = GetterUtil
095: .getLong(PropsUtil
096: .get("lock.expiration.time.com.liferay.portlet.blogs.model.BlogsEntry"));
097:
098: public BlogsEntryModelImpl() {
099: }
100:
101: public long getPrimaryKey() {
102: return _entryId;
103: }
104:
105: public void setPrimaryKey(long pk) {
106: setEntryId(pk);
107: }
108:
109: public Serializable getPrimaryKeyObj() {
110: return new Long(_entryId);
111: }
112:
113: public String getUuid() {
114: return GetterUtil.getString(_uuid);
115: }
116:
117: public void setUuid(String uuid) {
118: if ((uuid != null) && (uuid != _uuid)) {
119: _uuid = uuid;
120: }
121: }
122:
123: public long getEntryId() {
124: return _entryId;
125: }
126:
127: public void setEntryId(long entryId) {
128: if (entryId != _entryId) {
129: _entryId = entryId;
130: }
131: }
132:
133: public long getGroupId() {
134: return _groupId;
135: }
136:
137: public void setGroupId(long groupId) {
138: if (groupId != _groupId) {
139: _groupId = groupId;
140: }
141: }
142:
143: public long getCompanyId() {
144: return _companyId;
145: }
146:
147: public void setCompanyId(long companyId) {
148: if (companyId != _companyId) {
149: _companyId = companyId;
150: }
151: }
152:
153: public long getUserId() {
154: return _userId;
155: }
156:
157: public void setUserId(long userId) {
158: if (userId != _userId) {
159: _userId = userId;
160: }
161: }
162:
163: public String getUserName() {
164: return GetterUtil.getString(_userName);
165: }
166:
167: public void setUserName(String userName) {
168: if (((userName == null) && (_userName != null))
169: || ((userName != null) && (_userName == null))
170: || ((userName != null) && (_userName != null) && !userName
171: .equals(_userName))) {
172: _userName = userName;
173: }
174: }
175:
176: public Date getCreateDate() {
177: return _createDate;
178: }
179:
180: public void setCreateDate(Date createDate) {
181: if (((createDate == null) && (_createDate != null))
182: || ((createDate != null) && (_createDate == null))
183: || ((createDate != null) && (_createDate != null) && !createDate
184: .equals(_createDate))) {
185: _createDate = createDate;
186: }
187: }
188:
189: public Date getModifiedDate() {
190: return _modifiedDate;
191: }
192:
193: public void setModifiedDate(Date modifiedDate) {
194: if (((modifiedDate == null) && (_modifiedDate != null))
195: || ((modifiedDate != null) && (_modifiedDate == null))
196: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
197: .equals(_modifiedDate))) {
198: _modifiedDate = modifiedDate;
199: }
200: }
201:
202: public String getTitle() {
203: return GetterUtil.getString(_title);
204: }
205:
206: public void setTitle(String title) {
207: if (((title == null) && (_title != null))
208: || ((title != null) && (_title == null))
209: || ((title != null) && (_title != null) && !title
210: .equals(_title))) {
211: _title = title;
212: }
213: }
214:
215: public String getUrlTitle() {
216: return GetterUtil.getString(_urlTitle);
217: }
218:
219: public void setUrlTitle(String urlTitle) {
220: if (((urlTitle == null) && (_urlTitle != null))
221: || ((urlTitle != null) && (_urlTitle == null))
222: || ((urlTitle != null) && (_urlTitle != null) && !urlTitle
223: .equals(_urlTitle))) {
224: _urlTitle = urlTitle;
225: }
226: }
227:
228: public String getContent() {
229: return GetterUtil.getString(_content);
230: }
231:
232: public void setContent(String content) {
233: if (((content == null) && (_content != null))
234: || ((content != null) && (_content == null))
235: || ((content != null) && (_content != null) && !content
236: .equals(_content))) {
237: _content = content;
238: }
239: }
240:
241: public Date getDisplayDate() {
242: return _displayDate;
243: }
244:
245: public void setDisplayDate(Date displayDate) {
246: if (((displayDate == null) && (_displayDate != null))
247: || ((displayDate != null) && (_displayDate == null))
248: || ((displayDate != null) && (_displayDate != null) && !displayDate
249: .equals(_displayDate))) {
250: _displayDate = displayDate;
251: }
252: }
253:
254: public BlogsEntry toEscapedModel() {
255: if (isEscapedModel()) {
256: return (BlogsEntry) this ;
257: } else {
258: BlogsEntry model = new BlogsEntryImpl();
259:
260: model.setEscapedModel(true);
261:
262: model.setUuid(Html.escape(getUuid()));
263: model.setEntryId(getEntryId());
264: model.setGroupId(getGroupId());
265: model.setCompanyId(getCompanyId());
266: model.setUserId(getUserId());
267: model.setUserName(Html.escape(getUserName()));
268: model.setCreateDate(getCreateDate());
269: model.setModifiedDate(getModifiedDate());
270: model.setTitle(Html.escape(getTitle()));
271: model.setUrlTitle(Html.escape(getUrlTitle()));
272: model.setContent(Html.escape(getContent()));
273: model.setDisplayDate(getDisplayDate());
274:
275: model = (BlogsEntry) Proxy.newProxyInstance(
276: BlogsEntry.class.getClassLoader(),
277: new Class[] { BlogsEntry.class },
278: new ReadOnlyBeanHandler(model));
279:
280: return model;
281: }
282: }
283:
284: public Object clone() {
285: BlogsEntryImpl clone = new BlogsEntryImpl();
286:
287: clone.setUuid(getUuid());
288: clone.setEntryId(getEntryId());
289: clone.setGroupId(getGroupId());
290: clone.setCompanyId(getCompanyId());
291: clone.setUserId(getUserId());
292: clone.setUserName(getUserName());
293: clone.setCreateDate(getCreateDate());
294: clone.setModifiedDate(getModifiedDate());
295: clone.setTitle(getTitle());
296: clone.setUrlTitle(getUrlTitle());
297: clone.setContent(getContent());
298: clone.setDisplayDate(getDisplayDate());
299:
300: return clone;
301: }
302:
303: public int compareTo(Object obj) {
304: if (obj == null) {
305: return -1;
306: }
307:
308: BlogsEntryImpl blogsEntry = (BlogsEntryImpl) obj;
309:
310: int value = 0;
311:
312: value = DateUtil.compareTo(getDisplayDate(), blogsEntry
313: .getDisplayDate());
314:
315: value = value * -1;
316:
317: if (value != 0) {
318: return value;
319: }
320:
321: return 0;
322: }
323:
324: public boolean equals(Object obj) {
325: if (obj == null) {
326: return false;
327: }
328:
329: BlogsEntryImpl blogsEntry = null;
330:
331: try {
332: blogsEntry = (BlogsEntryImpl) obj;
333: } catch (ClassCastException cce) {
334: return false;
335: }
336:
337: long pk = blogsEntry.getPrimaryKey();
338:
339: if (getPrimaryKey() == pk) {
340: return true;
341: } else {
342: return false;
343: }
344: }
345:
346: public int hashCode() {
347: return (int) getPrimaryKey();
348: }
349:
350: private String _uuid;
351: private long _entryId;
352: private long _groupId;
353: private long _companyId;
354: private long _userId;
355: private String _userName;
356: private Date _createDate;
357: private Date _modifiedDate;
358: private String _title;
359: private String _urlTitle;
360: private String _content;
361: private Date _displayDate;
362: }
|