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.json.JSON;
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.kernel.util.StringPool;
024 import com.liferay.portal.kernel.workflow.WorkflowConstants;
025 import com.liferay.portal.model.CacheModel;
026 import com.liferay.portal.model.impl.BaseModelImpl;
027 import com.liferay.portal.service.ServiceContext;
028 import com.liferay.portal.util.PortalUtil;
029
030 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
031 import com.liferay.portlet.documentlibrary.model.DLFileShortcutModel;
032 import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
033 import com.liferay.portlet.expando.model.ExpandoBridge;
034 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
035
036 import java.io.Serializable;
037
038 import java.sql.Types;
039
040 import java.util.ArrayList;
041 import java.util.Date;
042 import java.util.List;
043
044
057 @JSON(strict = true)
058 public class DLFileShortcutModelImpl extends BaseModelImpl<DLFileShortcut>
059 implements DLFileShortcutModel {
060
065 public static final String TABLE_NAME = "DLFileShortcut";
066 public static final Object[][] TABLE_COLUMNS = {
067 { "uuid_", Types.VARCHAR },
068 { "fileShortcutId", Types.BIGINT },
069 { "groupId", Types.BIGINT },
070 { "companyId", Types.BIGINT },
071 { "userId", Types.BIGINT },
072 { "userName", Types.VARCHAR },
073 { "createDate", Types.TIMESTAMP },
074 { "modifiedDate", Types.TIMESTAMP },
075 { "repositoryId", Types.BIGINT },
076 { "folderId", Types.BIGINT },
077 { "toFileEntryId", Types.BIGINT },
078 { "status", Types.INTEGER },
079 { "statusByUserId", Types.BIGINT },
080 { "statusByUserName", Types.VARCHAR },
081 { "statusDate", Types.TIMESTAMP }
082 };
083 public static final String TABLE_SQL_CREATE = "create table DLFileShortcut (uuid_ VARCHAR(75) null,fileShortcutId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,repositoryId LONG,folderId LONG,toFileEntryId LONG,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
084 public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
085 public static final String DATA_SOURCE = "liferayDataSource";
086 public static final String SESSION_FACTORY = "liferaySessionFactory";
087 public static final String TX_MANAGER = "liferayTransactionManager";
088 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
090 true);
091 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
092 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
093 true);
094 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
095 "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
096 true);
097 public static long FOLDERID_COLUMN_BITMASK = 1L;
098 public static long GROUPID_COLUMN_BITMASK = 2L;
099 public static long STATUS_COLUMN_BITMASK = 4L;
100 public static long TOFILEENTRYID_COLUMN_BITMASK = 8L;
101 public static long UUID_COLUMN_BITMASK = 16L;
102
103
109 public static DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
110 DLFileShortcut model = new DLFileShortcutImpl();
111
112 model.setUuid(soapModel.getUuid());
113 model.setFileShortcutId(soapModel.getFileShortcutId());
114 model.setGroupId(soapModel.getGroupId());
115 model.setCompanyId(soapModel.getCompanyId());
116 model.setUserId(soapModel.getUserId());
117 model.setUserName(soapModel.getUserName());
118 model.setCreateDate(soapModel.getCreateDate());
119 model.setModifiedDate(soapModel.getModifiedDate());
120 model.setRepositoryId(soapModel.getRepositoryId());
121 model.setFolderId(soapModel.getFolderId());
122 model.setToFileEntryId(soapModel.getToFileEntryId());
123 model.setStatus(soapModel.getStatus());
124 model.setStatusByUserId(soapModel.getStatusByUserId());
125 model.setStatusByUserName(soapModel.getStatusByUserName());
126 model.setStatusDate(soapModel.getStatusDate());
127
128 return model;
129 }
130
131
137 public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
138 List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
139
140 for (DLFileShortcutSoap soapModel : soapModels) {
141 models.add(toModel(soapModel));
142 }
143
144 return models;
145 }
146
147 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
148 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
149
150 public DLFileShortcutModelImpl() {
151 }
152
153 public long getPrimaryKey() {
154 return _fileShortcutId;
155 }
156
157 public void setPrimaryKey(long primaryKey) {
158 setFileShortcutId(primaryKey);
159 }
160
161 public Serializable getPrimaryKeyObj() {
162 return new Long(_fileShortcutId);
163 }
164
165 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
166 setPrimaryKey(((Long)primaryKeyObj).longValue());
167 }
168
169 public Class<?> getModelClass() {
170 return DLFileShortcut.class;
171 }
172
173 public String getModelClassName() {
174 return DLFileShortcut.class.getName();
175 }
176
177 @JSON
178 public String getUuid() {
179 if (_uuid == null) {
180 return StringPool.BLANK;
181 }
182 else {
183 return _uuid;
184 }
185 }
186
187 public void setUuid(String uuid) {
188 if (_originalUuid == null) {
189 _originalUuid = _uuid;
190 }
191
192 _uuid = uuid;
193 }
194
195 public String getOriginalUuid() {
196 return GetterUtil.getString(_originalUuid);
197 }
198
199 @JSON
200 public long getFileShortcutId() {
201 return _fileShortcutId;
202 }
203
204 public void setFileShortcutId(long fileShortcutId) {
205 _fileShortcutId = fileShortcutId;
206 }
207
208 @JSON
209 public long getGroupId() {
210 return _groupId;
211 }
212
213 public void setGroupId(long groupId) {
214 _columnBitmask |= GROUPID_COLUMN_BITMASK;
215
216 if (!_setOriginalGroupId) {
217 _setOriginalGroupId = true;
218
219 _originalGroupId = _groupId;
220 }
221
222 _groupId = groupId;
223 }
224
225 public long getOriginalGroupId() {
226 return _originalGroupId;
227 }
228
229 @JSON
230 public long getCompanyId() {
231 return _companyId;
232 }
233
234 public void setCompanyId(long companyId) {
235 _companyId = companyId;
236 }
237
238 @JSON
239 public long getUserId() {
240 return _userId;
241 }
242
243 public void setUserId(long userId) {
244 _userId = userId;
245 }
246
247 public String getUserUuid() throws SystemException {
248 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
249 }
250
251 public void setUserUuid(String userUuid) {
252 _userUuid = userUuid;
253 }
254
255 @JSON
256 public String getUserName() {
257 if (_userName == null) {
258 return StringPool.BLANK;
259 }
260 else {
261 return _userName;
262 }
263 }
264
265 public void setUserName(String userName) {
266 _userName = userName;
267 }
268
269 @JSON
270 public Date getCreateDate() {
271 return _createDate;
272 }
273
274 public void setCreateDate(Date createDate) {
275 _createDate = createDate;
276 }
277
278 @JSON
279 public Date getModifiedDate() {
280 return _modifiedDate;
281 }
282
283 public void setModifiedDate(Date modifiedDate) {
284 _modifiedDate = modifiedDate;
285 }
286
287 @JSON
288 public long getRepositoryId() {
289 return _repositoryId;
290 }
291
292 public void setRepositoryId(long repositoryId) {
293 _repositoryId = repositoryId;
294 }
295
296 @JSON
297 public long getFolderId() {
298 return _folderId;
299 }
300
301 public void setFolderId(long folderId) {
302 _columnBitmask |= FOLDERID_COLUMN_BITMASK;
303
304 if (!_setOriginalFolderId) {
305 _setOriginalFolderId = true;
306
307 _originalFolderId = _folderId;
308 }
309
310 _folderId = folderId;
311 }
312
313 public long getOriginalFolderId() {
314 return _originalFolderId;
315 }
316
317 @JSON
318 public long getToFileEntryId() {
319 return _toFileEntryId;
320 }
321
322 public void setToFileEntryId(long toFileEntryId) {
323 _columnBitmask |= TOFILEENTRYID_COLUMN_BITMASK;
324
325 if (!_setOriginalToFileEntryId) {
326 _setOriginalToFileEntryId = true;
327
328 _originalToFileEntryId = _toFileEntryId;
329 }
330
331 _toFileEntryId = toFileEntryId;
332 }
333
334 public long getOriginalToFileEntryId() {
335 return _originalToFileEntryId;
336 }
337
338 @JSON
339 public int getStatus() {
340 return _status;
341 }
342
343 public void setStatus(int status) {
344 _columnBitmask |= STATUS_COLUMN_BITMASK;
345
346 if (!_setOriginalStatus) {
347 _setOriginalStatus = true;
348
349 _originalStatus = _status;
350 }
351
352 _status = status;
353 }
354
355 public int getOriginalStatus() {
356 return _originalStatus;
357 }
358
359 @JSON
360 public long getStatusByUserId() {
361 return _statusByUserId;
362 }
363
364 public void setStatusByUserId(long statusByUserId) {
365 _statusByUserId = statusByUserId;
366 }
367
368 public String getStatusByUserUuid() throws SystemException {
369 return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
370 _statusByUserUuid);
371 }
372
373 public void setStatusByUserUuid(String statusByUserUuid) {
374 _statusByUserUuid = statusByUserUuid;
375 }
376
377 @JSON
378 public String getStatusByUserName() {
379 if (_statusByUserName == null) {
380 return StringPool.BLANK;
381 }
382 else {
383 return _statusByUserName;
384 }
385 }
386
387 public void setStatusByUserName(String statusByUserName) {
388 _statusByUserName = statusByUserName;
389 }
390
391 @JSON
392 public Date getStatusDate() {
393 return _statusDate;
394 }
395
396 public void setStatusDate(Date statusDate) {
397 _statusDate = statusDate;
398 }
399
400
403 public boolean getApproved() {
404 return isApproved();
405 }
406
407 public boolean isApproved() {
408 if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
409 return true;
410 }
411 else {
412 return false;
413 }
414 }
415
416 public boolean isDraft() {
417 if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
418 return true;
419 }
420 else {
421 return false;
422 }
423 }
424
425 public boolean isExpired() {
426 if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
427 return true;
428 }
429 else {
430 return false;
431 }
432 }
433
434 public boolean isPending() {
435 if (getStatus() == WorkflowConstants.STATUS_PENDING) {
436 return true;
437 }
438 else {
439 return false;
440 }
441 }
442
443 public long getColumnBitmask() {
444 return _columnBitmask;
445 }
446
447 @Override
448 public DLFileShortcut toEscapedModel() {
449 if (_escapedModelProxy == null) {
450 _escapedModelProxy = (DLFileShortcut)ProxyUtil.newProxyInstance(_classLoader,
451 _escapedModelProxyInterfaces,
452 new AutoEscapeBeanHandler(this));
453 }
454
455 return _escapedModelProxy;
456 }
457
458 @Override
459 public ExpandoBridge getExpandoBridge() {
460 if (_expandoBridge == null) {
461 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
462 DLFileShortcut.class.getName(), getPrimaryKey());
463 }
464
465 return _expandoBridge;
466 }
467
468 @Override
469 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
470 getExpandoBridge().setAttributes(serviceContext);
471 }
472
473 @Override
474 public Object clone() {
475 DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
476
477 dlFileShortcutImpl.setUuid(getUuid());
478 dlFileShortcutImpl.setFileShortcutId(getFileShortcutId());
479 dlFileShortcutImpl.setGroupId(getGroupId());
480 dlFileShortcutImpl.setCompanyId(getCompanyId());
481 dlFileShortcutImpl.setUserId(getUserId());
482 dlFileShortcutImpl.setUserName(getUserName());
483 dlFileShortcutImpl.setCreateDate(getCreateDate());
484 dlFileShortcutImpl.setModifiedDate(getModifiedDate());
485 dlFileShortcutImpl.setRepositoryId(getRepositoryId());
486 dlFileShortcutImpl.setFolderId(getFolderId());
487 dlFileShortcutImpl.setToFileEntryId(getToFileEntryId());
488 dlFileShortcutImpl.setStatus(getStatus());
489 dlFileShortcutImpl.setStatusByUserId(getStatusByUserId());
490 dlFileShortcutImpl.setStatusByUserName(getStatusByUserName());
491 dlFileShortcutImpl.setStatusDate(getStatusDate());
492
493 dlFileShortcutImpl.resetOriginalValues();
494
495 return dlFileShortcutImpl;
496 }
497
498 public int compareTo(DLFileShortcut dlFileShortcut) {
499 long primaryKey = dlFileShortcut.getPrimaryKey();
500
501 if (getPrimaryKey() < primaryKey) {
502 return -1;
503 }
504 else if (getPrimaryKey() > primaryKey) {
505 return 1;
506 }
507 else {
508 return 0;
509 }
510 }
511
512 @Override
513 public boolean equals(Object obj) {
514 if (obj == null) {
515 return false;
516 }
517
518 DLFileShortcut dlFileShortcut = null;
519
520 try {
521 dlFileShortcut = (DLFileShortcut)obj;
522 }
523 catch (ClassCastException cce) {
524 return false;
525 }
526
527 long primaryKey = dlFileShortcut.getPrimaryKey();
528
529 if (getPrimaryKey() == primaryKey) {
530 return true;
531 }
532 else {
533 return false;
534 }
535 }
536
537 @Override
538 public int hashCode() {
539 return (int)getPrimaryKey();
540 }
541
542 @Override
543 public void resetOriginalValues() {
544 DLFileShortcutModelImpl dlFileShortcutModelImpl = this;
545
546 dlFileShortcutModelImpl._originalUuid = dlFileShortcutModelImpl._uuid;
547
548 dlFileShortcutModelImpl._originalGroupId = dlFileShortcutModelImpl._groupId;
549
550 dlFileShortcutModelImpl._setOriginalGroupId = false;
551
552 dlFileShortcutModelImpl._originalFolderId = dlFileShortcutModelImpl._folderId;
553
554 dlFileShortcutModelImpl._setOriginalFolderId = false;
555
556 dlFileShortcutModelImpl._originalToFileEntryId = dlFileShortcutModelImpl._toFileEntryId;
557
558 dlFileShortcutModelImpl._setOriginalToFileEntryId = false;
559
560 dlFileShortcutModelImpl._originalStatus = dlFileShortcutModelImpl._status;
561
562 dlFileShortcutModelImpl._setOriginalStatus = false;
563
564 dlFileShortcutModelImpl._columnBitmask = 0;
565 }
566
567 @Override
568 public CacheModel<DLFileShortcut> toCacheModel() {
569 DLFileShortcutCacheModel dlFileShortcutCacheModel = new DLFileShortcutCacheModel();
570
571 dlFileShortcutCacheModel.uuid = getUuid();
572
573 String uuid = dlFileShortcutCacheModel.uuid;
574
575 if ((uuid != null) && (uuid.length() == 0)) {
576 dlFileShortcutCacheModel.uuid = null;
577 }
578
579 dlFileShortcutCacheModel.fileShortcutId = getFileShortcutId();
580
581 dlFileShortcutCacheModel.groupId = getGroupId();
582
583 dlFileShortcutCacheModel.companyId = getCompanyId();
584
585 dlFileShortcutCacheModel.userId = getUserId();
586
587 dlFileShortcutCacheModel.userName = getUserName();
588
589 String userName = dlFileShortcutCacheModel.userName;
590
591 if ((userName != null) && (userName.length() == 0)) {
592 dlFileShortcutCacheModel.userName = null;
593 }
594
595 Date createDate = getCreateDate();
596
597 if (createDate != null) {
598 dlFileShortcutCacheModel.createDate = createDate.getTime();
599 }
600 else {
601 dlFileShortcutCacheModel.createDate = Long.MIN_VALUE;
602 }
603
604 Date modifiedDate = getModifiedDate();
605
606 if (modifiedDate != null) {
607 dlFileShortcutCacheModel.modifiedDate = modifiedDate.getTime();
608 }
609 else {
610 dlFileShortcutCacheModel.modifiedDate = Long.MIN_VALUE;
611 }
612
613 dlFileShortcutCacheModel.repositoryId = getRepositoryId();
614
615 dlFileShortcutCacheModel.folderId = getFolderId();
616
617 dlFileShortcutCacheModel.toFileEntryId = getToFileEntryId();
618
619 dlFileShortcutCacheModel.status = getStatus();
620
621 dlFileShortcutCacheModel.statusByUserId = getStatusByUserId();
622
623 dlFileShortcutCacheModel.statusByUserName = getStatusByUserName();
624
625 String statusByUserName = dlFileShortcutCacheModel.statusByUserName;
626
627 if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
628 dlFileShortcutCacheModel.statusByUserName = null;
629 }
630
631 Date statusDate = getStatusDate();
632
633 if (statusDate != null) {
634 dlFileShortcutCacheModel.statusDate = statusDate.getTime();
635 }
636 else {
637 dlFileShortcutCacheModel.statusDate = Long.MIN_VALUE;
638 }
639
640 return dlFileShortcutCacheModel;
641 }
642
643 @Override
644 public String toString() {
645 StringBundler sb = new StringBundler(31);
646
647 sb.append("{uuid=");
648 sb.append(getUuid());
649 sb.append(", fileShortcutId=");
650 sb.append(getFileShortcutId());
651 sb.append(", groupId=");
652 sb.append(getGroupId());
653 sb.append(", companyId=");
654 sb.append(getCompanyId());
655 sb.append(", userId=");
656 sb.append(getUserId());
657 sb.append(", userName=");
658 sb.append(getUserName());
659 sb.append(", createDate=");
660 sb.append(getCreateDate());
661 sb.append(", modifiedDate=");
662 sb.append(getModifiedDate());
663 sb.append(", repositoryId=");
664 sb.append(getRepositoryId());
665 sb.append(", folderId=");
666 sb.append(getFolderId());
667 sb.append(", toFileEntryId=");
668 sb.append(getToFileEntryId());
669 sb.append(", status=");
670 sb.append(getStatus());
671 sb.append(", statusByUserId=");
672 sb.append(getStatusByUserId());
673 sb.append(", statusByUserName=");
674 sb.append(getStatusByUserName());
675 sb.append(", statusDate=");
676 sb.append(getStatusDate());
677 sb.append("}");
678
679 return sb.toString();
680 }
681
682 public String toXmlString() {
683 StringBundler sb = new StringBundler(49);
684
685 sb.append("<model><model-name>");
686 sb.append("com.liferay.portlet.documentlibrary.model.DLFileShortcut");
687 sb.append("</model-name>");
688
689 sb.append(
690 "<column><column-name>uuid</column-name><column-value><![CDATA[");
691 sb.append(getUuid());
692 sb.append("]]></column-value></column>");
693 sb.append(
694 "<column><column-name>fileShortcutId</column-name><column-value><![CDATA[");
695 sb.append(getFileShortcutId());
696 sb.append("]]></column-value></column>");
697 sb.append(
698 "<column><column-name>groupId</column-name><column-value><![CDATA[");
699 sb.append(getGroupId());
700 sb.append("]]></column-value></column>");
701 sb.append(
702 "<column><column-name>companyId</column-name><column-value><![CDATA[");
703 sb.append(getCompanyId());
704 sb.append("]]></column-value></column>");
705 sb.append(
706 "<column><column-name>userId</column-name><column-value><![CDATA[");
707 sb.append(getUserId());
708 sb.append("]]></column-value></column>");
709 sb.append(
710 "<column><column-name>userName</column-name><column-value><![CDATA[");
711 sb.append(getUserName());
712 sb.append("]]></column-value></column>");
713 sb.append(
714 "<column><column-name>createDate</column-name><column-value><![CDATA[");
715 sb.append(getCreateDate());
716 sb.append("]]></column-value></column>");
717 sb.append(
718 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
719 sb.append(getModifiedDate());
720 sb.append("]]></column-value></column>");
721 sb.append(
722 "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
723 sb.append(getRepositoryId());
724 sb.append("]]></column-value></column>");
725 sb.append(
726 "<column><column-name>folderId</column-name><column-value><![CDATA[");
727 sb.append(getFolderId());
728 sb.append("]]></column-value></column>");
729 sb.append(
730 "<column><column-name>toFileEntryId</column-name><column-value><![CDATA[");
731 sb.append(getToFileEntryId());
732 sb.append("]]></column-value></column>");
733 sb.append(
734 "<column><column-name>status</column-name><column-value><![CDATA[");
735 sb.append(getStatus());
736 sb.append("]]></column-value></column>");
737 sb.append(
738 "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
739 sb.append(getStatusByUserId());
740 sb.append("]]></column-value></column>");
741 sb.append(
742 "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
743 sb.append(getStatusByUserName());
744 sb.append("]]></column-value></column>");
745 sb.append(
746 "<column><column-name>statusDate</column-name><column-value><![CDATA[");
747 sb.append(getStatusDate());
748 sb.append("]]></column-value></column>");
749
750 sb.append("</model>");
751
752 return sb.toString();
753 }
754
755 private static ClassLoader _classLoader = DLFileShortcut.class.getClassLoader();
756 private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
757 DLFileShortcut.class
758 };
759 private String _uuid;
760 private String _originalUuid;
761 private long _fileShortcutId;
762 private long _groupId;
763 private long _originalGroupId;
764 private boolean _setOriginalGroupId;
765 private long _companyId;
766 private long _userId;
767 private String _userUuid;
768 private String _userName;
769 private Date _createDate;
770 private Date _modifiedDate;
771 private long _repositoryId;
772 private long _folderId;
773 private long _originalFolderId;
774 private boolean _setOriginalFolderId;
775 private long _toFileEntryId;
776 private long _originalToFileEntryId;
777 private boolean _setOriginalToFileEntryId;
778 private int _status;
779 private int _originalStatus;
780 private boolean _setOriginalStatus;
781 private long _statusByUserId;
782 private String _statusByUserUuid;
783 private String _statusByUserName;
784 private Date _statusDate;
785 private transient ExpandoBridge _expandoBridge;
786 private long _columnBitmask;
787 private DLFileShortcut _escapedModelProxy;
788 }