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.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.documentlibrary.model.DLFileRank;
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="DLFileRankModelImpl.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>DLFileRank</code> table
051: * in the database.
052: * </p>
053: *
054: * @author Brian Wing Shun Chan
055: *
056: * @see com.liferay.portlet.documentlibrary.service.model.DLFileRank
057: * @see com.liferay.portlet.documentlibrary.service.model.DLFileRankModel
058: * @see com.liferay.portlet.documentlibrary.service.model.impl.DLFileRankImpl
059: *
060: */
061: public class DLFileRankModelImpl extends BaseModelImpl {
062: public static final String TABLE_NAME = "DLFileRank";
063: public static final Object[][] TABLE_COLUMNS = {
064: { "fileRankId", new Integer(Types.BIGINT) },
065:
066: { "companyId", new Integer(Types.BIGINT) },
067:
068: { "userId", new Integer(Types.BIGINT) },
069:
070: { "createDate", new Integer(Types.TIMESTAMP) },
071:
072: { "folderId", new Integer(Types.BIGINT) },
073:
074: { "name", new Integer(Types.VARCHAR) } };
075: public static final String TABLE_SQL_CREATE = "create table DLFileRank (fileRankId LONG not null primary key,companyId LONG,userId LONG,createDate DATE null,folderId LONG,name VARCHAR(300) null)";
076: public static final String TABLE_SQL_DROP = "drop table DLFileRank";
077: public static final boolean CACHE_ENABLED = GetterUtil
078: .getBoolean(
079: PropsUtil
080: .get("value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileRank"),
081: true);
082: public static final long LOCK_EXPIRATION_TIME = GetterUtil
083: .getLong(PropsUtil
084: .get("lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileRank"));
085:
086: public DLFileRankModelImpl() {
087: }
088:
089: public long getPrimaryKey() {
090: return _fileRankId;
091: }
092:
093: public void setPrimaryKey(long pk) {
094: setFileRankId(pk);
095: }
096:
097: public Serializable getPrimaryKeyObj() {
098: return new Long(_fileRankId);
099: }
100:
101: public long getFileRankId() {
102: return _fileRankId;
103: }
104:
105: public void setFileRankId(long fileRankId) {
106: if (fileRankId != _fileRankId) {
107: _fileRankId = fileRankId;
108: }
109: }
110:
111: public long getCompanyId() {
112: return _companyId;
113: }
114:
115: public void setCompanyId(long companyId) {
116: if (companyId != _companyId) {
117: _companyId = companyId;
118: }
119: }
120:
121: public long getUserId() {
122: return _userId;
123: }
124:
125: public void setUserId(long userId) {
126: if (userId != _userId) {
127: _userId = userId;
128: }
129: }
130:
131: public Date getCreateDate() {
132: return _createDate;
133: }
134:
135: public void setCreateDate(Date createDate) {
136: if (((createDate == null) && (_createDate != null))
137: || ((createDate != null) && (_createDate == null))
138: || ((createDate != null) && (_createDate != null) && !createDate
139: .equals(_createDate))) {
140: _createDate = createDate;
141: }
142: }
143:
144: public long getFolderId() {
145: return _folderId;
146: }
147:
148: public void setFolderId(long folderId) {
149: if (folderId != _folderId) {
150: _folderId = folderId;
151: }
152: }
153:
154: public String getName() {
155: return GetterUtil.getString(_name);
156: }
157:
158: public void setName(String name) {
159: if (((name == null) && (_name != null))
160: || ((name != null) && (_name == null))
161: || ((name != null) && (_name != null) && !name
162: .equals(_name))) {
163: _name = name;
164: }
165: }
166:
167: public DLFileRank toEscapedModel() {
168: if (isEscapedModel()) {
169: return (DLFileRank) this ;
170: } else {
171: DLFileRank model = new DLFileRankImpl();
172:
173: model.setEscapedModel(true);
174:
175: model.setFileRankId(getFileRankId());
176: model.setCompanyId(getCompanyId());
177: model.setUserId(getUserId());
178: model.setCreateDate(getCreateDate());
179: model.setFolderId(getFolderId());
180: model.setName(Html.escape(getName()));
181:
182: model = (DLFileRank) Proxy.newProxyInstance(
183: DLFileRank.class.getClassLoader(),
184: new Class[] { DLFileRank.class },
185: new ReadOnlyBeanHandler(model));
186:
187: return model;
188: }
189: }
190:
191: public Object clone() {
192: DLFileRankImpl clone = new DLFileRankImpl();
193:
194: clone.setFileRankId(getFileRankId());
195: clone.setCompanyId(getCompanyId());
196: clone.setUserId(getUserId());
197: clone.setCreateDate(getCreateDate());
198: clone.setFolderId(getFolderId());
199: clone.setName(getName());
200:
201: return clone;
202: }
203:
204: public int compareTo(Object obj) {
205: if (obj == null) {
206: return -1;
207: }
208:
209: DLFileRankImpl dlFileRank = (DLFileRankImpl) obj;
210:
211: int value = 0;
212:
213: value = DateUtil.compareTo(getCreateDate(), dlFileRank
214: .getCreateDate());
215:
216: value = value * -1;
217:
218: if (value != 0) {
219: return value;
220: }
221:
222: return 0;
223: }
224:
225: public boolean equals(Object obj) {
226: if (obj == null) {
227: return false;
228: }
229:
230: DLFileRankImpl dlFileRank = null;
231:
232: try {
233: dlFileRank = (DLFileRankImpl) obj;
234: } catch (ClassCastException cce) {
235: return false;
236: }
237:
238: long pk = dlFileRank.getPrimaryKey();
239:
240: if (getPrimaryKey() == pk) {
241: return true;
242: } else {
243: return false;
244: }
245: }
246:
247: public int hashCode() {
248: return (int) getPrimaryKey();
249: }
250:
251: private long _fileRankId;
252: private long _companyId;
253: private long _userId;
254: private Date _createDate;
255: private long _folderId;
256: private String _name;
257: }
|