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.DLFileEntry;
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="DLFileEntryModelImpl.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>DLFileEntry</code> table
050: * in the database.
051: * </p>
052: *
053: * @author Brian Wing Shun Chan
054: *
055: * @see com.liferay.portlet.documentlibrary.service.model.DLFileEntry
056: * @see com.liferay.portlet.documentlibrary.service.model.DLFileEntryModel
057: * @see com.liferay.portlet.documentlibrary.service.model.impl.DLFileEntryImpl
058: *
059: */
060: public class DLFileEntryModelImpl extends BaseModelImpl {
061: public static final String TABLE_NAME = "DLFileEntry";
062: public static final Object[][] TABLE_COLUMNS = {
063: { "uuid_", new Integer(Types.VARCHAR) },
064:
065: { "fileEntryId", new Integer(Types.BIGINT) },
066:
067: { "companyId", new Integer(Types.BIGINT) },
068:
069: { "userId", new Integer(Types.BIGINT) },
070:
071: { "userName", new Integer(Types.VARCHAR) },
072:
073: { "versionUserId", new Integer(Types.BIGINT) },
074:
075: { "versionUserName", new Integer(Types.VARCHAR) },
076:
077: { "createDate", new Integer(Types.TIMESTAMP) },
078:
079: { "modifiedDate", new Integer(Types.TIMESTAMP) },
080:
081: { "folderId", new Integer(Types.BIGINT) },
082:
083: { "name", new Integer(Types.VARCHAR) },
084:
085: { "title", new Integer(Types.VARCHAR) },
086:
087: { "description", new Integer(Types.VARCHAR) },
088:
089: { "version", new Integer(Types.DOUBLE) },
090:
091: { "size_", new Integer(Types.INTEGER) },
092:
093: { "readCount", new Integer(Types.INTEGER) },
094:
095: { "extraSettings", new Integer(Types.CLOB) } };
096: public static final String TABLE_SQL_CREATE = "create table DLFileEntry (uuid_ VARCHAR(75) null,fileEntryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,versionUserId LONG,versionUserName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,folderId LONG,name VARCHAR(300) null,title VARCHAR(300) null,description STRING null,version DOUBLE,size_ INTEGER,readCount INTEGER,extraSettings TEXT null)";
097: public static final String TABLE_SQL_DROP = "drop table DLFileEntry";
098: public static final boolean CACHE_ENABLED = GetterUtil
099: .getBoolean(
100: PropsUtil
101: .get("value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
102: true);
103: public static final long LOCK_EXPIRATION_TIME = GetterUtil
104: .getLong(PropsUtil
105: .get("lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileEntry"));
106:
107: public DLFileEntryModelImpl() {
108: }
109:
110: public long getPrimaryKey() {
111: return _fileEntryId;
112: }
113:
114: public void setPrimaryKey(long pk) {
115: setFileEntryId(pk);
116: }
117:
118: public Serializable getPrimaryKeyObj() {
119: return new Long(_fileEntryId);
120: }
121:
122: public String getUuid() {
123: return GetterUtil.getString(_uuid);
124: }
125:
126: public void setUuid(String uuid) {
127: if ((uuid != null) && (uuid != _uuid)) {
128: _uuid = uuid;
129: }
130: }
131:
132: public long getFileEntryId() {
133: return _fileEntryId;
134: }
135:
136: public void setFileEntryId(long fileEntryId) {
137: if (fileEntryId != _fileEntryId) {
138: _fileEntryId = fileEntryId;
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 long getVersionUserId() {
176: return _versionUserId;
177: }
178:
179: public void setVersionUserId(long versionUserId) {
180: if (versionUserId != _versionUserId) {
181: _versionUserId = versionUserId;
182: }
183: }
184:
185: public String getVersionUserName() {
186: return GetterUtil.getString(_versionUserName);
187: }
188:
189: public void setVersionUserName(String versionUserName) {
190: if (((versionUserName == null) && (_versionUserName != null))
191: || ((versionUserName != null) && (_versionUserName == null))
192: || ((versionUserName != null)
193: && (_versionUserName != null) && !versionUserName
194: .equals(_versionUserName))) {
195: _versionUserName = versionUserName;
196: }
197: }
198:
199: public Date getCreateDate() {
200: return _createDate;
201: }
202:
203: public void setCreateDate(Date createDate) {
204: if (((createDate == null) && (_createDate != null))
205: || ((createDate != null) && (_createDate == null))
206: || ((createDate != null) && (_createDate != null) && !createDate
207: .equals(_createDate))) {
208: _createDate = createDate;
209: }
210: }
211:
212: public Date getModifiedDate() {
213: return _modifiedDate;
214: }
215:
216: public void setModifiedDate(Date modifiedDate) {
217: if (((modifiedDate == null) && (_modifiedDate != null))
218: || ((modifiedDate != null) && (_modifiedDate == null))
219: || ((modifiedDate != null) && (_modifiedDate != null) && !modifiedDate
220: .equals(_modifiedDate))) {
221: _modifiedDate = modifiedDate;
222: }
223: }
224:
225: public long getFolderId() {
226: return _folderId;
227: }
228:
229: public void setFolderId(long folderId) {
230: if (folderId != _folderId) {
231: _folderId = folderId;
232: }
233: }
234:
235: public String getName() {
236: return GetterUtil.getString(_name);
237: }
238:
239: public void setName(String name) {
240: if (((name == null) && (_name != null))
241: || ((name != null) && (_name == null))
242: || ((name != null) && (_name != null) && !name
243: .equals(_name))) {
244: _name = name;
245: }
246: }
247:
248: public String getTitle() {
249: return GetterUtil.getString(_title);
250: }
251:
252: public void setTitle(String title) {
253: if (((title == null) && (_title != null))
254: || ((title != null) && (_title == null))
255: || ((title != null) && (_title != null) && !title
256: .equals(_title))) {
257: _title = title;
258: }
259: }
260:
261: public String getDescription() {
262: return GetterUtil.getString(_description);
263: }
264:
265: public void setDescription(String description) {
266: if (((description == null) && (_description != null))
267: || ((description != null) && (_description == null))
268: || ((description != null) && (_description != null) && !description
269: .equals(_description))) {
270: _description = description;
271: }
272: }
273:
274: public double getVersion() {
275: return _version;
276: }
277:
278: public void setVersion(double version) {
279: if (version != _version) {
280: _version = version;
281: }
282: }
283:
284: public int getSize() {
285: return _size;
286: }
287:
288: public void setSize(int size) {
289: if (size != _size) {
290: _size = size;
291: }
292: }
293:
294: public int getReadCount() {
295: return _readCount;
296: }
297:
298: public void setReadCount(int readCount) {
299: if (readCount != _readCount) {
300: _readCount = readCount;
301: }
302: }
303:
304: public String getExtraSettings() {
305: return GetterUtil.getString(_extraSettings);
306: }
307:
308: public void setExtraSettings(String extraSettings) {
309: if (((extraSettings == null) && (_extraSettings != null))
310: || ((extraSettings != null) && (_extraSettings == null))
311: || ((extraSettings != null) && (_extraSettings != null) && !extraSettings
312: .equals(_extraSettings))) {
313: _extraSettings = extraSettings;
314: }
315: }
316:
317: public DLFileEntry toEscapedModel() {
318: if (isEscapedModel()) {
319: return (DLFileEntry) this ;
320: } else {
321: DLFileEntry model = new DLFileEntryImpl();
322:
323: model.setEscapedModel(true);
324:
325: model.setUuid(Html.escape(getUuid()));
326: model.setFileEntryId(getFileEntryId());
327: model.setCompanyId(getCompanyId());
328: model.setUserId(getUserId());
329: model.setUserName(Html.escape(getUserName()));
330: model.setVersionUserId(getVersionUserId());
331: model.setVersionUserName(Html.escape(getVersionUserName()));
332: model.setCreateDate(getCreateDate());
333: model.setModifiedDate(getModifiedDate());
334: model.setFolderId(getFolderId());
335: model.setName(Html.escape(getName()));
336: model.setTitle(Html.escape(getTitle()));
337: model.setDescription(Html.escape(getDescription()));
338: model.setVersion(getVersion());
339: model.setSize(getSize());
340: model.setReadCount(getReadCount());
341: model.setExtraSettings(Html.escape(getExtraSettings()));
342:
343: model = (DLFileEntry) Proxy.newProxyInstance(
344: DLFileEntry.class.getClassLoader(),
345: new Class[] { DLFileEntry.class },
346: new ReadOnlyBeanHandler(model));
347:
348: return model;
349: }
350: }
351:
352: public Object clone() {
353: DLFileEntryImpl clone = new DLFileEntryImpl();
354:
355: clone.setUuid(getUuid());
356: clone.setFileEntryId(getFileEntryId());
357: clone.setCompanyId(getCompanyId());
358: clone.setUserId(getUserId());
359: clone.setUserName(getUserName());
360: clone.setVersionUserId(getVersionUserId());
361: clone.setVersionUserName(getVersionUserName());
362: clone.setCreateDate(getCreateDate());
363: clone.setModifiedDate(getModifiedDate());
364: clone.setFolderId(getFolderId());
365: clone.setName(getName());
366: clone.setTitle(getTitle());
367: clone.setDescription(getDescription());
368: clone.setVersion(getVersion());
369: clone.setSize(getSize());
370: clone.setReadCount(getReadCount());
371: clone.setExtraSettings(getExtraSettings());
372:
373: return clone;
374: }
375:
376: public int compareTo(Object obj) {
377: if (obj == null) {
378: return -1;
379: }
380:
381: DLFileEntryImpl dlFileEntry = (DLFileEntryImpl) obj;
382:
383: int value = 0;
384:
385: if (getFolderId() < dlFileEntry.getFolderId()) {
386: value = -1;
387: } else if (getFolderId() > dlFileEntry.getFolderId()) {
388: value = 1;
389: } else {
390: value = 0;
391: }
392:
393: if (value != 0) {
394: return value;
395: }
396:
397: value = getName().compareTo(dlFileEntry.getName());
398:
399: if (value != 0) {
400: return value;
401: }
402:
403: return 0;
404: }
405:
406: public boolean equals(Object obj) {
407: if (obj == null) {
408: return false;
409: }
410:
411: DLFileEntryImpl dlFileEntry = null;
412:
413: try {
414: dlFileEntry = (DLFileEntryImpl) obj;
415: } catch (ClassCastException cce) {
416: return false;
417: }
418:
419: long pk = dlFileEntry.getPrimaryKey();
420:
421: if (getPrimaryKey() == pk) {
422: return true;
423: } else {
424: return false;
425: }
426: }
427:
428: public int hashCode() {
429: return (int) getPrimaryKey();
430: }
431:
432: private String _uuid;
433: private long _fileEntryId;
434: private long _companyId;
435: private long _userId;
436: private String _userName;
437: private long _versionUserId;
438: private String _versionUserName;
439: private Date _createDate;
440: private Date _modifiedDate;
441: private long _folderId;
442: private String _name;
443: private String _title;
444: private String _description;
445: private double _version;
446: private int _size;
447: private int _readCount;
448: private String _extraSettings;
449: }
|