001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.DateUtil;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.StringBundler;
022 import com.liferay.portal.kernel.util.StringPool;
023 import com.liferay.portal.model.impl.BaseModelImpl;
024 import com.liferay.portal.service.ServiceContext;
025 import com.liferay.portal.util.PortalUtil;
026
027 import com.liferay.portlet.documentlibrary.model.DLFileRank;
028 import com.liferay.portlet.documentlibrary.model.DLFileRankModel;
029 import com.liferay.portlet.expando.model.ExpandoBridge;
030 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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
057 public class DLFileRankModelImpl extends BaseModelImpl<DLFileRank>
058 implements DLFileRankModel {
059 public static final String TABLE_NAME = "DLFileRank";
060 public static final Object[][] TABLE_COLUMNS = {
061 { "fileRankId", new Integer(Types.BIGINT) },
062 { "groupId", new Integer(Types.BIGINT) },
063 { "companyId", new Integer(Types.BIGINT) },
064 { "userId", new Integer(Types.BIGINT) },
065 { "createDate", new Integer(Types.TIMESTAMP) },
066 { "folderId", new Integer(Types.BIGINT) },
067 { "name", new Integer(Types.VARCHAR) }
068 };
069 public static final String TABLE_SQL_CREATE = "create table DLFileRank (fileRankId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,createDate DATE null,folderId LONG,name VARCHAR(255) null)";
070 public static final String TABLE_SQL_DROP = "drop table DLFileRank";
071 public static final String ORDER_BY_JPQL = " ORDER BY dlFileRank.createDate DESC";
072 public static final String ORDER_BY_SQL = " ORDER BY DLFileRank.createDate DESC";
073 public static final String DATA_SOURCE = "liferayDataSource";
074 public static final String SESSION_FACTORY = "liferaySessionFactory";
075 public static final String TX_MANAGER = "liferayTransactionManager";
076 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
077 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileRank"),
078 true);
079 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
080 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileRank"),
081 true);
082 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
083 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileRank"));
084
085 public DLFileRankModelImpl() {
086 }
087
088 public long getPrimaryKey() {
089 return _fileRankId;
090 }
091
092 public void setPrimaryKey(long pk) {
093 setFileRankId(pk);
094 }
095
096 public Serializable getPrimaryKeyObj() {
097 return new Long(_fileRankId);
098 }
099
100 public long getFileRankId() {
101 return _fileRankId;
102 }
103
104 public void setFileRankId(long fileRankId) {
105 _fileRankId = fileRankId;
106 }
107
108 public long getGroupId() {
109 return _groupId;
110 }
111
112 public void setGroupId(long groupId) {
113 _groupId = groupId;
114 }
115
116 public long getCompanyId() {
117 return _companyId;
118 }
119
120 public void setCompanyId(long companyId) {
121 _companyId = companyId;
122
123 if (!_setOriginalCompanyId) {
124 _setOriginalCompanyId = true;
125
126 _originalCompanyId = companyId;
127 }
128 }
129
130 public long getOriginalCompanyId() {
131 return _originalCompanyId;
132 }
133
134 public long getUserId() {
135 return _userId;
136 }
137
138 public void setUserId(long userId) {
139 _userId = userId;
140
141 if (!_setOriginalUserId) {
142 _setOriginalUserId = true;
143
144 _originalUserId = userId;
145 }
146 }
147
148 public String getUserUuid() throws SystemException {
149 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
150 }
151
152 public void setUserUuid(String userUuid) {
153 _userUuid = userUuid;
154 }
155
156 public long getOriginalUserId() {
157 return _originalUserId;
158 }
159
160 public Date getCreateDate() {
161 return _createDate;
162 }
163
164 public void setCreateDate(Date createDate) {
165 _createDate = createDate;
166 }
167
168 public long getFolderId() {
169 return _folderId;
170 }
171
172 public void setFolderId(long folderId) {
173 _folderId = folderId;
174
175 if (!_setOriginalFolderId) {
176 _setOriginalFolderId = true;
177
178 _originalFolderId = folderId;
179 }
180 }
181
182 public long getOriginalFolderId() {
183 return _originalFolderId;
184 }
185
186 public String getName() {
187 if (_name == null) {
188 return StringPool.BLANK;
189 }
190 else {
191 return _name;
192 }
193 }
194
195 public void setName(String name) {
196 _name = name;
197
198 if (_originalName == null) {
199 _originalName = name;
200 }
201 }
202
203 public String getOriginalName() {
204 return GetterUtil.getString(_originalName);
205 }
206
207 public DLFileRank toEscapedModel() {
208 if (isEscapedModel()) {
209 return (DLFileRank)this;
210 }
211 else {
212 return (DLFileRank)Proxy.newProxyInstance(DLFileRank.class.getClassLoader(),
213 new Class[] { DLFileRank.class },
214 new AutoEscapeBeanHandler(this));
215 }
216 }
217
218 public ExpandoBridge getExpandoBridge() {
219 if (_expandoBridge == null) {
220 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
221 DLFileRank.class.getName(), getPrimaryKey());
222 }
223
224 return _expandoBridge;
225 }
226
227 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
228 getExpandoBridge().setAttributes(serviceContext);
229 }
230
231 public Object clone() {
232 DLFileRankImpl clone = new DLFileRankImpl();
233
234 clone.setFileRankId(getFileRankId());
235 clone.setGroupId(getGroupId());
236 clone.setCompanyId(getCompanyId());
237 clone.setUserId(getUserId());
238 clone.setCreateDate(getCreateDate());
239 clone.setFolderId(getFolderId());
240 clone.setName(getName());
241
242 return clone;
243 }
244
245 public int compareTo(DLFileRank dlFileRank) {
246 int value = 0;
247
248 value = DateUtil.compareTo(getCreateDate(), dlFileRank.getCreateDate());
249
250 value = value * -1;
251
252 if (value != 0) {
253 return value;
254 }
255
256 return 0;
257 }
258
259 public boolean equals(Object obj) {
260 if (obj == null) {
261 return false;
262 }
263
264 DLFileRank dlFileRank = null;
265
266 try {
267 dlFileRank = (DLFileRank)obj;
268 }
269 catch (ClassCastException cce) {
270 return false;
271 }
272
273 long pk = dlFileRank.getPrimaryKey();
274
275 if (getPrimaryKey() == pk) {
276 return true;
277 }
278 else {
279 return false;
280 }
281 }
282
283 public int hashCode() {
284 return (int)getPrimaryKey();
285 }
286
287 public String toString() {
288 StringBundler sb = new StringBundler(15);
289
290 sb.append("{fileRankId=");
291 sb.append(getFileRankId());
292 sb.append(", groupId=");
293 sb.append(getGroupId());
294 sb.append(", companyId=");
295 sb.append(getCompanyId());
296 sb.append(", userId=");
297 sb.append(getUserId());
298 sb.append(", createDate=");
299 sb.append(getCreateDate());
300 sb.append(", folderId=");
301 sb.append(getFolderId());
302 sb.append(", name=");
303 sb.append(getName());
304 sb.append("}");
305
306 return sb.toString();
307 }
308
309 public String toXmlString() {
310 StringBundler sb = new StringBundler(25);
311
312 sb.append("<model><model-name>");
313 sb.append("com.liferay.portlet.documentlibrary.model.DLFileRank");
314 sb.append("</model-name>");
315
316 sb.append(
317 "<column><column-name>fileRankId</column-name><column-value><![CDATA[");
318 sb.append(getFileRankId());
319 sb.append("]]></column-value></column>");
320 sb.append(
321 "<column><column-name>groupId</column-name><column-value><![CDATA[");
322 sb.append(getGroupId());
323 sb.append("]]></column-value></column>");
324 sb.append(
325 "<column><column-name>companyId</column-name><column-value><![CDATA[");
326 sb.append(getCompanyId());
327 sb.append("]]></column-value></column>");
328 sb.append(
329 "<column><column-name>userId</column-name><column-value><![CDATA[");
330 sb.append(getUserId());
331 sb.append("]]></column-value></column>");
332 sb.append(
333 "<column><column-name>createDate</column-name><column-value><![CDATA[");
334 sb.append(getCreateDate());
335 sb.append("]]></column-value></column>");
336 sb.append(
337 "<column><column-name>folderId</column-name><column-value><![CDATA[");
338 sb.append(getFolderId());
339 sb.append("]]></column-value></column>");
340 sb.append(
341 "<column><column-name>name</column-name><column-value><![CDATA[");
342 sb.append(getName());
343 sb.append("]]></column-value></column>");
344
345 sb.append("</model>");
346
347 return sb.toString();
348 }
349
350 private long _fileRankId;
351 private long _groupId;
352 private long _companyId;
353 private long _originalCompanyId;
354 private boolean _setOriginalCompanyId;
355 private long _userId;
356 private String _userUuid;
357 private long _originalUserId;
358 private boolean _setOriginalUserId;
359 private Date _createDate;
360 private long _folderId;
361 private long _originalFolderId;
362 private boolean _setOriginalFolderId;
363 private String _name;
364 private String _originalName;
365 private transient ExpandoBridge _expandoBridge;
366 }