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