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.BookmarksFolder;
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="BookmarksFolderModelImpl.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>BookmarksFolder</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.bookmarks.service.model.BookmarksFolder
056: * @see com.liferay.portlet.bookmarks.service.model.BookmarksFolderModel
057: * @see com.liferay.portlet.bookmarks.service.model.impl.BookmarksFolderImpl
058: *
059: */
060: public class BookmarksFolderModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "BookmarksFolder";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "folderId", new Integer(Types.BIGINT) },
066:
067: { "groupId", new Integer(Types.BIGINT) },
068:
069: { "companyId", new Integer(Types.BIGINT) },
070:
071: { "userId", new Integer(Types.BIGINT) },
072:
073: { "createDate", new Integer(Types.TIMESTAMP) },
074:
075: { "modifiedDate", new Integer(Types.TIMESTAMP) },
076:
077: { "parentFolderId", new Integer(Types.BIGINT) },
078:
079: { "name", new Integer(Types.VARCHAR) },
080:
081: { "description", new Integer(Types.VARCHAR) } };
082: public static final String TABLE_SQL_CREATE = "create table BookmarksFolder (uuid_ VARCHAR(75) null,folderId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,parentFolderId LONG,name VARCHAR(75) null,description STRING null)";
083: public static final String TABLE_SQL_DROP = "drop table BookmarksFolder";
084: public static final boolean CACHE_ENABLED = GetterUtil
085: .getBoolean(
086: PropsUtil
087: .get("value.object.finder.cache.enabled.com.liferay.portlet.bookmarks.model.BookmarksFolder"),
088: true);
089: public static final long LOCK_EXPIRATION_TIME = GetterUtil
090: .getLong(PropsUtil
091: .get("lock.expiration.time.com.liferay.portlet.bookmarks.model.BookmarksFolder"));
092:
093: public BookmarksFolderModelImpl() {
094: }
095:
096: public long getPrimaryKey() {
097: return _folderId;
098: }
099:
100: public void setPrimaryKey(long pk) {
101: setFolderId(pk);
102: }
103:
104: public Serializable getPrimaryKeyObj() {
105: return new Long(_folderId);
106: }
107:
108: public String getUuid() {
109: return GetterUtil.getString(_uuid);
110: }
111:
112: public void setUuid(String uuid) {
113: if ((uuid != null) && (uuid != _uuid)) {
114: _uuid = uuid;
115: }
116: }
117:
118: public long getFolderId() {
119: return _folderId;
120: }
121:
122: public void setFolderId(long folderId) {
123: if (folderId != _folderId) {
124: _folderId = folderId;
125: }
126: }
127:
128: public long getGroupId() {
129: return _groupId;
130: }
131:
132: public void setGroupId(long groupId) {
133: if (groupId != _groupId) {
134: _groupId = groupId;
135: }
136: }
137:
138: public long getCompanyId() {
139: return _companyId;
140: }
141:
142: public void setCompanyId(long companyId) {
143: if (companyId != _companyId) {
144: _companyId = companyId;
145: }
146: }
147:
148: public long getUserId() {
149: return _userId;
150: }
151:
152: public void setUserId(long userId) {
153: if (userId != _userId) {
154: _userId = userId;
155: }
156: }
157:
158: public Date getCreateDate() {
159: return _createDate;
160: }
161:
162: public void setCreateDate(Date createDate) {
163: if (((createDate == null) && (_createDate != null))
164: || ((createDate != null) && (_createDate == null))
165: || ((createDate != null) && (_createDate != null) && !createDate
166: .equals(_createDate))) {
167: _createDate = createDate;
168: }
169: }
170:
171: public Date getModifiedDate() {
172: return _modifiedDate;
173: }
174:
175: public void setModifiedDate(Date modifiedDate) {
176: if (((modifiedDate == null) && (_modifiedDate != null))
177: || ((modifiedDate != null) && (_modifiedDate == null))
178: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
179: .equals(_modifiedDate))) {
180: _modifiedDate = modifiedDate;
181: }
182: }
183:
184: public long getParentFolderId() {
185: return _parentFolderId;
186: }
187:
188: public void setParentFolderId(long parentFolderId) {
189: if (parentFolderId != _parentFolderId) {
190: _parentFolderId = parentFolderId;
191: }
192: }
193:
194: public String getName() {
195: return GetterUtil.getString(_name);
196: }
197:
198: public void setName(String name) {
199: if (((name == null) && (_name != null))
200: || ((name != null) && (_name == null))
201: || ((name != null) && (_name != null) && !name
202: .equals(_name))) {
203: _name = name;
204: }
205: }
206:
207: public String getDescription() {
208: return GetterUtil.getString(_description);
209: }
210:
211: public void setDescription(String description) {
212: if (((description == null) && (_description != null))
213: || ((description != null) && (_description == null))
214: || ((description != null) && (_description != null) && !description
215: .equals(_description))) {
216: _description = description;
217: }
218: }
219:
220: public BookmarksFolder toEscapedModel() {
221: if (isEscapedModel()) {
222: return (BookmarksFolder) this ;
223: } else {
224: BookmarksFolder model = new BookmarksFolderImpl();
225:
226: model.setEscapedModel(true);
227:
228: model.setUuid(Html.escape(getUuid()));
229: model.setFolderId(getFolderId());
230: model.setGroupId(getGroupId());
231: model.setCompanyId(getCompanyId());
232: model.setUserId(getUserId());
233: model.setCreateDate(getCreateDate());
234: model.setModifiedDate(getModifiedDate());
235: model.setParentFolderId(getParentFolderId());
236: model.setName(Html.escape(getName()));
237: model.setDescription(Html.escape(getDescription()));
238:
239: model = (BookmarksFolder) Proxy.newProxyInstance(
240: BookmarksFolder.class.getClassLoader(),
241: new Class[] { BookmarksFolder.class },
242: new ReadOnlyBeanHandler(model));
243:
244: return model;
245: }
246: }
247:
248: public Object clone() {
249: BookmarksFolderImpl clone = new BookmarksFolderImpl();
250:
251: clone.setUuid(getUuid());
252: clone.setFolderId(getFolderId());
253: clone.setGroupId(getGroupId());
254: clone.setCompanyId(getCompanyId());
255: clone.setUserId(getUserId());
256: clone.setCreateDate(getCreateDate());
257: clone.setModifiedDate(getModifiedDate());
258: clone.setParentFolderId(getParentFolderId());
259: clone.setName(getName());
260: clone.setDescription(getDescription());
261:
262: return clone;
263: }
264:
265: public int compareTo(Object obj) {
266: if (obj == null) {
267: return -1;
268: }
269:
270: BookmarksFolderImpl bookmarksFolder = (BookmarksFolderImpl) obj;
271:
272: int value = 0;
273:
274: if (getParentFolderId() < bookmarksFolder.getParentFolderId()) {
275: value = -1;
276: } else if (getParentFolderId() > bookmarksFolder
277: .getParentFolderId()) {
278: value = 1;
279: } else {
280: value = 0;
281: }
282:
283: if (value != 0) {
284: return value;
285: }
286:
287: value = getName().toLowerCase().compareTo(
288: bookmarksFolder.getName().toLowerCase());
289:
290: if (value != 0) {
291: return value;
292: }
293:
294: return 0;
295: }
296:
297: public boolean equals(Object obj) {
298: if (obj == null) {
299: return false;
300: }
301:
302: BookmarksFolderImpl bookmarksFolder = null;
303:
304: try {
305: bookmarksFolder = (BookmarksFolderImpl) obj;
306: } catch (ClassCastException cce) {
307: return false;
308: }
309:
310: long pk = bookmarksFolder.getPrimaryKey();
311:
312: if (getPrimaryKey() == pk) {
313: return true;
314: } else {
315: return false;
316: }
317: }
318:
319: public int hashCode() {
320: return (int) getPrimaryKey();
321: }
322:
323: private String _uuid;
324: private long _folderId;
325: private long _groupId;
326: private long _companyId;
327: private long _userId;
328: private Date _createDate;
329: private Date _modifiedDate;
330: private long _parentFolderId;
331: private String _name;
332: private String _description;
333: }
|