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.ProxyUtil;
022 import com.liferay.portal.kernel.util.StringBundler;
023 import com.liferay.portal.model.CacheModel;
024 import com.liferay.portal.model.impl.BaseModelImpl;
025 import com.liferay.portal.service.ServiceContext;
026 import com.liferay.portal.util.PortalUtil;
027
028 import com.liferay.portlet.documentlibrary.model.DLFileRank;
029 import com.liferay.portlet.documentlibrary.model.DLFileRankModel;
030 import com.liferay.portlet.expando.model.ExpandoBridge;
031 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
032
033 import java.io.Serializable;
034
035 import java.sql.Types;
036
037 import java.util.Date;
038 import java.util.HashMap;
039 import java.util.Map;
040
041
054 public class DLFileRankModelImpl extends BaseModelImpl<DLFileRank>
055 implements DLFileRankModel {
056
061 public static final String TABLE_NAME = "DLFileRank";
062 public static final Object[][] TABLE_COLUMNS = {
063 { "fileRankId", Types.BIGINT },
064 { "groupId", Types.BIGINT },
065 { "companyId", Types.BIGINT },
066 { "userId", Types.BIGINT },
067 { "createDate", Types.TIMESTAMP },
068 { "fileEntryId", Types.BIGINT }
069 };
070 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,fileEntryId LONG)";
071 public static final String TABLE_SQL_DROP = "drop table DLFileRank";
072 public static final String ORDER_BY_JPQL = " ORDER BY dlFileRank.createDate DESC";
073 public static final String ORDER_BY_SQL = " ORDER BY DLFileRank.createDate DESC";
074 public static final String DATA_SOURCE = "liferayDataSource";
075 public static final String SESSION_FACTORY = "liferaySessionFactory";
076 public static final String TX_MANAGER = "liferayTransactionManager";
077 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
078 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileRank"),
079 true);
080 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
081 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileRank"),
082 true);
083 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
084 "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLFileRank"),
085 true);
086 public static long COMPANYID_COLUMN_BITMASK = 1L;
087 public static long FILEENTRYID_COLUMN_BITMASK = 2L;
088 public static long GROUPID_COLUMN_BITMASK = 4L;
089 public static long USERID_COLUMN_BITMASK = 8L;
090 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
091 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileRank"));
092
093 public DLFileRankModelImpl() {
094 }
095
096 public long getPrimaryKey() {
097 return _fileRankId;
098 }
099
100 public void setPrimaryKey(long primaryKey) {
101 setFileRankId(primaryKey);
102 }
103
104 public Serializable getPrimaryKeyObj() {
105 return new Long(_fileRankId);
106 }
107
108 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
109 setPrimaryKey(((Long)primaryKeyObj).longValue());
110 }
111
112 public Class<?> getModelClass() {
113 return DLFileRank.class;
114 }
115
116 public String getModelClassName() {
117 return DLFileRank.class.getName();
118 }
119
120 @Override
121 public Map<String, Object> getModelAttributes() {
122 Map<String, Object> attributes = new HashMap<String, Object>();
123
124 attributes.put("fileRankId", getFileRankId());
125 attributes.put("groupId", getGroupId());
126 attributes.put("companyId", getCompanyId());
127 attributes.put("userId", getUserId());
128 attributes.put("createDate", getCreateDate());
129 attributes.put("fileEntryId", getFileEntryId());
130
131 return attributes;
132 }
133
134 @Override
135 public void setModelAttributes(Map<String, Object> attributes) {
136 Long fileRankId = (Long)attributes.get("fileRankId");
137
138 if (fileRankId != null) {
139 setFileRankId(fileRankId);
140 }
141
142 Long groupId = (Long)attributes.get("groupId");
143
144 if (groupId != null) {
145 setGroupId(groupId);
146 }
147
148 Long companyId = (Long)attributes.get("companyId");
149
150 if (companyId != null) {
151 setCompanyId(companyId);
152 }
153
154 Long userId = (Long)attributes.get("userId");
155
156 if (userId != null) {
157 setUserId(userId);
158 }
159
160 Date createDate = (Date)attributes.get("createDate");
161
162 if (createDate != null) {
163 setCreateDate(createDate);
164 }
165
166 Long fileEntryId = (Long)attributes.get("fileEntryId");
167
168 if (fileEntryId != null) {
169 setFileEntryId(fileEntryId);
170 }
171 }
172
173 public long getFileRankId() {
174 return _fileRankId;
175 }
176
177 public void setFileRankId(long fileRankId) {
178 _fileRankId = fileRankId;
179 }
180
181 public long getGroupId() {
182 return _groupId;
183 }
184
185 public void setGroupId(long groupId) {
186 _columnBitmask |= GROUPID_COLUMN_BITMASK;
187
188 if (!_setOriginalGroupId) {
189 _setOriginalGroupId = true;
190
191 _originalGroupId = _groupId;
192 }
193
194 _groupId = groupId;
195 }
196
197 public long getOriginalGroupId() {
198 return _originalGroupId;
199 }
200
201 public long getCompanyId() {
202 return _companyId;
203 }
204
205 public void setCompanyId(long companyId) {
206 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
207
208 if (!_setOriginalCompanyId) {
209 _setOriginalCompanyId = true;
210
211 _originalCompanyId = _companyId;
212 }
213
214 _companyId = companyId;
215 }
216
217 public long getOriginalCompanyId() {
218 return _originalCompanyId;
219 }
220
221 public long getUserId() {
222 return _userId;
223 }
224
225 public void setUserId(long userId) {
226 _columnBitmask |= USERID_COLUMN_BITMASK;
227
228 if (!_setOriginalUserId) {
229 _setOriginalUserId = true;
230
231 _originalUserId = _userId;
232 }
233
234 _userId = userId;
235 }
236
237 public String getUserUuid() throws SystemException {
238 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
239 }
240
241 public void setUserUuid(String userUuid) {
242 _userUuid = userUuid;
243 }
244
245 public long getOriginalUserId() {
246 return _originalUserId;
247 }
248
249 public Date getCreateDate() {
250 return _createDate;
251 }
252
253 public void setCreateDate(Date createDate) {
254 _columnBitmask = -1L;
255
256 _createDate = createDate;
257 }
258
259 public long getFileEntryId() {
260 return _fileEntryId;
261 }
262
263 public void setFileEntryId(long fileEntryId) {
264 _columnBitmask |= FILEENTRYID_COLUMN_BITMASK;
265
266 if (!_setOriginalFileEntryId) {
267 _setOriginalFileEntryId = true;
268
269 _originalFileEntryId = _fileEntryId;
270 }
271
272 _fileEntryId = fileEntryId;
273 }
274
275 public long getOriginalFileEntryId() {
276 return _originalFileEntryId;
277 }
278
279 public long getColumnBitmask() {
280 return _columnBitmask;
281 }
282
283 @Override
284 public ExpandoBridge getExpandoBridge() {
285 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
286 DLFileRank.class.getName(), getPrimaryKey());
287 }
288
289 @Override
290 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
291 ExpandoBridge expandoBridge = getExpandoBridge();
292
293 expandoBridge.setAttributes(serviceContext);
294 }
295
296 @Override
297 public DLFileRank toEscapedModel() {
298 if (_escapedModel == null) {
299 _escapedModel = (DLFileRank)ProxyUtil.newProxyInstance(_classLoader,
300 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
301 }
302
303 return _escapedModel;
304 }
305
306 public DLFileRank toUnescapedModel() {
307 return (DLFileRank)this;
308 }
309
310 @Override
311 public Object clone() {
312 DLFileRankImpl dlFileRankImpl = new DLFileRankImpl();
313
314 dlFileRankImpl.setFileRankId(getFileRankId());
315 dlFileRankImpl.setGroupId(getGroupId());
316 dlFileRankImpl.setCompanyId(getCompanyId());
317 dlFileRankImpl.setUserId(getUserId());
318 dlFileRankImpl.setCreateDate(getCreateDate());
319 dlFileRankImpl.setFileEntryId(getFileEntryId());
320
321 dlFileRankImpl.resetOriginalValues();
322
323 return dlFileRankImpl;
324 }
325
326 public int compareTo(DLFileRank dlFileRank) {
327 int value = 0;
328
329 value = DateUtil.compareTo(getCreateDate(), dlFileRank.getCreateDate());
330
331 value = value * -1;
332
333 if (value != 0) {
334 return value;
335 }
336
337 return 0;
338 }
339
340 @Override
341 public boolean equals(Object obj) {
342 if (this == obj) {
343 return true;
344 }
345
346 if (!(obj instanceof DLFileRank)) {
347 return false;
348 }
349
350 DLFileRank dlFileRank = (DLFileRank)obj;
351
352 long primaryKey = dlFileRank.getPrimaryKey();
353
354 if (getPrimaryKey() == primaryKey) {
355 return true;
356 }
357 else {
358 return false;
359 }
360 }
361
362 @Override
363 public int hashCode() {
364 return (int)getPrimaryKey();
365 }
366
367 @Override
368 public void resetOriginalValues() {
369 DLFileRankModelImpl dlFileRankModelImpl = this;
370
371 dlFileRankModelImpl._originalGroupId = dlFileRankModelImpl._groupId;
372
373 dlFileRankModelImpl._setOriginalGroupId = false;
374
375 dlFileRankModelImpl._originalCompanyId = dlFileRankModelImpl._companyId;
376
377 dlFileRankModelImpl._setOriginalCompanyId = false;
378
379 dlFileRankModelImpl._originalUserId = dlFileRankModelImpl._userId;
380
381 dlFileRankModelImpl._setOriginalUserId = false;
382
383 dlFileRankModelImpl._originalFileEntryId = dlFileRankModelImpl._fileEntryId;
384
385 dlFileRankModelImpl._setOriginalFileEntryId = false;
386
387 dlFileRankModelImpl._columnBitmask = 0;
388 }
389
390 @Override
391 public CacheModel<DLFileRank> toCacheModel() {
392 DLFileRankCacheModel dlFileRankCacheModel = new DLFileRankCacheModel();
393
394 dlFileRankCacheModel.fileRankId = getFileRankId();
395
396 dlFileRankCacheModel.groupId = getGroupId();
397
398 dlFileRankCacheModel.companyId = getCompanyId();
399
400 dlFileRankCacheModel.userId = getUserId();
401
402 Date createDate = getCreateDate();
403
404 if (createDate != null) {
405 dlFileRankCacheModel.createDate = createDate.getTime();
406 }
407 else {
408 dlFileRankCacheModel.createDate = Long.MIN_VALUE;
409 }
410
411 dlFileRankCacheModel.fileEntryId = getFileEntryId();
412
413 return dlFileRankCacheModel;
414 }
415
416 @Override
417 public String toString() {
418 StringBundler sb = new StringBundler(13);
419
420 sb.append("{fileRankId=");
421 sb.append(getFileRankId());
422 sb.append(", groupId=");
423 sb.append(getGroupId());
424 sb.append(", companyId=");
425 sb.append(getCompanyId());
426 sb.append(", userId=");
427 sb.append(getUserId());
428 sb.append(", createDate=");
429 sb.append(getCreateDate());
430 sb.append(", fileEntryId=");
431 sb.append(getFileEntryId());
432 sb.append("}");
433
434 return sb.toString();
435 }
436
437 public String toXmlString() {
438 StringBundler sb = new StringBundler(22);
439
440 sb.append("<model><model-name>");
441 sb.append("com.liferay.portlet.documentlibrary.model.DLFileRank");
442 sb.append("</model-name>");
443
444 sb.append(
445 "<column><column-name>fileRankId</column-name><column-value><![CDATA[");
446 sb.append(getFileRankId());
447 sb.append("]]></column-value></column>");
448 sb.append(
449 "<column><column-name>groupId</column-name><column-value><![CDATA[");
450 sb.append(getGroupId());
451 sb.append("]]></column-value></column>");
452 sb.append(
453 "<column><column-name>companyId</column-name><column-value><![CDATA[");
454 sb.append(getCompanyId());
455 sb.append("]]></column-value></column>");
456 sb.append(
457 "<column><column-name>userId</column-name><column-value><![CDATA[");
458 sb.append(getUserId());
459 sb.append("]]></column-value></column>");
460 sb.append(
461 "<column><column-name>createDate</column-name><column-value><![CDATA[");
462 sb.append(getCreateDate());
463 sb.append("]]></column-value></column>");
464 sb.append(
465 "<column><column-name>fileEntryId</column-name><column-value><![CDATA[");
466 sb.append(getFileEntryId());
467 sb.append("]]></column-value></column>");
468
469 sb.append("</model>");
470
471 return sb.toString();
472 }
473
474 private static ClassLoader _classLoader = DLFileRank.class.getClassLoader();
475 private static Class<?>[] _escapedModelInterfaces = new Class[] {
476 DLFileRank.class
477 };
478 private long _fileRankId;
479 private long _groupId;
480 private long _originalGroupId;
481 private boolean _setOriginalGroupId;
482 private long _companyId;
483 private long _originalCompanyId;
484 private boolean _setOriginalCompanyId;
485 private long _userId;
486 private String _userUuid;
487 private long _originalUserId;
488 private boolean _setOriginalUserId;
489 private Date _createDate;
490 private long _fileEntryId;
491 private long _originalFileEntryId;
492 private boolean _setOriginalFileEntryId;
493 private long _columnBitmask;
494 private DLFileRank _escapedModel;
495 }