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