001    /**
002     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.documentlibrary.model.impl;
016    
017    import aQute.bnd.annotation.ProviderType;
018    
019    import com.liferay.portal.NoSuchModelException;
020    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
021    import com.liferay.portal.kernel.exception.PortalException;
022    import com.liferay.portal.kernel.json.JSON;
023    import com.liferay.portal.kernel.trash.TrashHandler;
024    import com.liferay.portal.kernel.trash.TrashHandlerRegistryUtil;
025    import com.liferay.portal.kernel.util.GetterUtil;
026    import com.liferay.portal.kernel.util.ProxyUtil;
027    import com.liferay.portal.kernel.util.StringBundler;
028    import com.liferay.portal.kernel.util.StringPool;
029    import com.liferay.portal.kernel.util.Validator;
030    import com.liferay.portal.kernel.workflow.WorkflowConstants;
031    import com.liferay.portal.model.CacheModel;
032    import com.liferay.portal.model.ContainerModel;
033    import com.liferay.portal.model.TrashedModel;
034    import com.liferay.portal.model.User;
035    import com.liferay.portal.model.impl.BaseModelImpl;
036    import com.liferay.portal.service.ServiceContext;
037    import com.liferay.portal.service.UserLocalServiceUtil;
038    import com.liferay.portal.util.PortalUtil;
039    
040    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
041    import com.liferay.portlet.documentlibrary.model.DLFileShortcutModel;
042    import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
043    import com.liferay.portlet.expando.model.ExpandoBridge;
044    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
045    import com.liferay.portlet.exportimport.lar.StagedModelType;
046    import com.liferay.portlet.trash.model.TrashEntry;
047    import com.liferay.portlet.trash.service.TrashEntryLocalServiceUtil;
048    
049    import java.io.Serializable;
050    
051    import java.sql.Types;
052    
053    import java.util.ArrayList;
054    import java.util.Date;
055    import java.util.HashMap;
056    import java.util.List;
057    import java.util.Map;
058    
059    /**
060     * The base model implementation for the DLFileShortcut service. Represents a row in the "DLFileShortcut" database table, with each column mapped to a property of this class.
061     *
062     * <p>
063     * This implementation and its corresponding interface {@link DLFileShortcutModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DLFileShortcutImpl}.
064     * </p>
065     *
066     * @author Brian Wing Shun Chan
067     * @see DLFileShortcutImpl
068     * @see DLFileShortcut
069     * @see DLFileShortcutModel
070     * @generated
071     */
072    @JSON(strict = true)
073    @ProviderType
074    public class DLFileShortcutModelImpl extends BaseModelImpl<DLFileShortcut>
075            implements DLFileShortcutModel {
076            /*
077             * NOTE FOR DEVELOPERS:
078             *
079             * Never modify or reference this class directly. All methods that expect a document library file shortcut model instance should use the {@link DLFileShortcut} interface instead.
080             */
081            public static final String TABLE_NAME = "DLFileShortcut";
082            public static final Object[][] TABLE_COLUMNS = {
083                            { "uuid_", Types.VARCHAR },
084                            { "fileShortcutId", Types.BIGINT },
085                            { "groupId", Types.BIGINT },
086                            { "companyId", Types.BIGINT },
087                            { "userId", Types.BIGINT },
088                            { "userName", Types.VARCHAR },
089                            { "createDate", Types.TIMESTAMP },
090                            { "modifiedDate", Types.TIMESTAMP },
091                            { "repositoryId", Types.BIGINT },
092                            { "folderId", Types.BIGINT },
093                            { "toFileEntryId", Types.BIGINT },
094                            { "treePath", Types.VARCHAR },
095                            { "active_", Types.BOOLEAN },
096                            { "status", Types.INTEGER },
097                            { "statusByUserId", Types.BIGINT },
098                            { "statusByUserName", Types.VARCHAR },
099                            { "statusDate", Types.TIMESTAMP }
100                    };
101            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,treePath STRING null,active_ BOOLEAN,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
102            public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
103            public static final String ORDER_BY_JPQL = " ORDER BY dlFileShortcut.fileShortcutId ASC";
104            public static final String ORDER_BY_SQL = " ORDER BY DLFileShortcut.fileShortcutId ASC";
105            public static final String DATA_SOURCE = "liferayDataSource";
106            public static final String SESSION_FACTORY = "liferaySessionFactory";
107            public static final String TX_MANAGER = "liferayTransactionManager";
108            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109                                    "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
110                            true);
111            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
112                                    "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
113                            true);
114            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
115                                    "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
116                            true);
117            public static final long ACTIVE_COLUMN_BITMASK = 1L;
118            public static final long COMPANYID_COLUMN_BITMASK = 2L;
119            public static final long FOLDERID_COLUMN_BITMASK = 4L;
120            public static final long GROUPID_COLUMN_BITMASK = 8L;
121            public static final long STATUS_COLUMN_BITMASK = 16L;
122            public static final long TOFILEENTRYID_COLUMN_BITMASK = 32L;
123            public static final long UUID_COLUMN_BITMASK = 64L;
124            public static final long FILESHORTCUTID_COLUMN_BITMASK = 128L;
125    
126            /**
127             * Converts the soap model instance into a normal model instance.
128             *
129             * @param soapModel the soap model instance to convert
130             * @return the normal model instance
131             */
132            public static DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
133                    if (soapModel == null) {
134                            return null;
135                    }
136    
137                    DLFileShortcut model = new DLFileShortcutImpl();
138    
139                    model.setUuid(soapModel.getUuid());
140                    model.setFileShortcutId(soapModel.getFileShortcutId());
141                    model.setGroupId(soapModel.getGroupId());
142                    model.setCompanyId(soapModel.getCompanyId());
143                    model.setUserId(soapModel.getUserId());
144                    model.setUserName(soapModel.getUserName());
145                    model.setCreateDate(soapModel.getCreateDate());
146                    model.setModifiedDate(soapModel.getModifiedDate());
147                    model.setRepositoryId(soapModel.getRepositoryId());
148                    model.setFolderId(soapModel.getFolderId());
149                    model.setToFileEntryId(soapModel.getToFileEntryId());
150                    model.setTreePath(soapModel.getTreePath());
151                    model.setActive(soapModel.getActive());
152                    model.setStatus(soapModel.getStatus());
153                    model.setStatusByUserId(soapModel.getStatusByUserId());
154                    model.setStatusByUserName(soapModel.getStatusByUserName());
155                    model.setStatusDate(soapModel.getStatusDate());
156    
157                    return model;
158            }
159    
160            /**
161             * Converts the soap model instances into normal model instances.
162             *
163             * @param soapModels the soap model instances to convert
164             * @return the normal model instances
165             */
166            public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
167                    if (soapModels == null) {
168                            return null;
169                    }
170    
171                    List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
172    
173                    for (DLFileShortcutSoap soapModel : soapModels) {
174                            models.add(toModel(soapModel));
175                    }
176    
177                    return models;
178            }
179    
180            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
181                                    "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileShortcut"));
182    
183            public DLFileShortcutModelImpl() {
184            }
185    
186            @Override
187            public long getPrimaryKey() {
188                    return _fileShortcutId;
189            }
190    
191            @Override
192            public void setPrimaryKey(long primaryKey) {
193                    setFileShortcutId(primaryKey);
194            }
195    
196            @Override
197            public Serializable getPrimaryKeyObj() {
198                    return _fileShortcutId;
199            }
200    
201            @Override
202            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
203                    setPrimaryKey(((Long)primaryKeyObj).longValue());
204            }
205    
206            @Override
207            public Class<?> getModelClass() {
208                    return DLFileShortcut.class;
209            }
210    
211            @Override
212            public String getModelClassName() {
213                    return DLFileShortcut.class.getName();
214            }
215    
216            @Override
217            public Map<String, Object> getModelAttributes() {
218                    Map<String, Object> attributes = new HashMap<String, Object>();
219    
220                    attributes.put("uuid", getUuid());
221                    attributes.put("fileShortcutId", getFileShortcutId());
222                    attributes.put("groupId", getGroupId());
223                    attributes.put("companyId", getCompanyId());
224                    attributes.put("userId", getUserId());
225                    attributes.put("userName", getUserName());
226                    attributes.put("createDate", getCreateDate());
227                    attributes.put("modifiedDate", getModifiedDate());
228                    attributes.put("repositoryId", getRepositoryId());
229                    attributes.put("folderId", getFolderId());
230                    attributes.put("toFileEntryId", getToFileEntryId());
231                    attributes.put("treePath", getTreePath());
232                    attributes.put("active", getActive());
233                    attributes.put("status", getStatus());
234                    attributes.put("statusByUserId", getStatusByUserId());
235                    attributes.put("statusByUserName", getStatusByUserName());
236                    attributes.put("statusDate", getStatusDate());
237    
238                    attributes.put("entityCacheEnabled", isEntityCacheEnabled());
239                    attributes.put("finderCacheEnabled", isFinderCacheEnabled());
240    
241                    return attributes;
242            }
243    
244            @Override
245            public void setModelAttributes(Map<String, Object> attributes) {
246                    String uuid = (String)attributes.get("uuid");
247    
248                    if (uuid != null) {
249                            setUuid(uuid);
250                    }
251    
252                    Long fileShortcutId = (Long)attributes.get("fileShortcutId");
253    
254                    if (fileShortcutId != null) {
255                            setFileShortcutId(fileShortcutId);
256                    }
257    
258                    Long groupId = (Long)attributes.get("groupId");
259    
260                    if (groupId != null) {
261                            setGroupId(groupId);
262                    }
263    
264                    Long companyId = (Long)attributes.get("companyId");
265    
266                    if (companyId != null) {
267                            setCompanyId(companyId);
268                    }
269    
270                    Long userId = (Long)attributes.get("userId");
271    
272                    if (userId != null) {
273                            setUserId(userId);
274                    }
275    
276                    String userName = (String)attributes.get("userName");
277    
278                    if (userName != null) {
279                            setUserName(userName);
280                    }
281    
282                    Date createDate = (Date)attributes.get("createDate");
283    
284                    if (createDate != null) {
285                            setCreateDate(createDate);
286                    }
287    
288                    Date modifiedDate = (Date)attributes.get("modifiedDate");
289    
290                    if (modifiedDate != null) {
291                            setModifiedDate(modifiedDate);
292                    }
293    
294                    Long repositoryId = (Long)attributes.get("repositoryId");
295    
296                    if (repositoryId != null) {
297                            setRepositoryId(repositoryId);
298                    }
299    
300                    Long folderId = (Long)attributes.get("folderId");
301    
302                    if (folderId != null) {
303                            setFolderId(folderId);
304                    }
305    
306                    Long toFileEntryId = (Long)attributes.get("toFileEntryId");
307    
308                    if (toFileEntryId != null) {
309                            setToFileEntryId(toFileEntryId);
310                    }
311    
312                    String treePath = (String)attributes.get("treePath");
313    
314                    if (treePath != null) {
315                            setTreePath(treePath);
316                    }
317    
318                    Boolean active = (Boolean)attributes.get("active");
319    
320                    if (active != null) {
321                            setActive(active);
322                    }
323    
324                    Integer status = (Integer)attributes.get("status");
325    
326                    if (status != null) {
327                            setStatus(status);
328                    }
329    
330                    Long statusByUserId = (Long)attributes.get("statusByUserId");
331    
332                    if (statusByUserId != null) {
333                            setStatusByUserId(statusByUserId);
334                    }
335    
336                    String statusByUserName = (String)attributes.get("statusByUserName");
337    
338                    if (statusByUserName != null) {
339                            setStatusByUserName(statusByUserName);
340                    }
341    
342                    Date statusDate = (Date)attributes.get("statusDate");
343    
344                    if (statusDate != null) {
345                            setStatusDate(statusDate);
346                    }
347            }
348    
349            @JSON
350            @Override
351            public String getUuid() {
352                    if (_uuid == null) {
353                            return StringPool.BLANK;
354                    }
355                    else {
356                            return _uuid;
357                    }
358            }
359    
360            @Override
361            public void setUuid(String uuid) {
362                    if (_originalUuid == null) {
363                            _originalUuid = _uuid;
364                    }
365    
366                    _uuid = uuid;
367            }
368    
369            public String getOriginalUuid() {
370                    return GetterUtil.getString(_originalUuid);
371            }
372    
373            @JSON
374            @Override
375            public long getFileShortcutId() {
376                    return _fileShortcutId;
377            }
378    
379            @Override
380            public void setFileShortcutId(long fileShortcutId) {
381                    _fileShortcutId = fileShortcutId;
382            }
383    
384            @JSON
385            @Override
386            public long getGroupId() {
387                    return _groupId;
388            }
389    
390            @Override
391            public void setGroupId(long groupId) {
392                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
393    
394                    if (!_setOriginalGroupId) {
395                            _setOriginalGroupId = true;
396    
397                            _originalGroupId = _groupId;
398                    }
399    
400                    _groupId = groupId;
401            }
402    
403            public long getOriginalGroupId() {
404                    return _originalGroupId;
405            }
406    
407            @JSON
408            @Override
409            public long getCompanyId() {
410                    return _companyId;
411            }
412    
413            @Override
414            public void setCompanyId(long companyId) {
415                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
416    
417                    if (!_setOriginalCompanyId) {
418                            _setOriginalCompanyId = true;
419    
420                            _originalCompanyId = _companyId;
421                    }
422    
423                    _companyId = companyId;
424            }
425    
426            public long getOriginalCompanyId() {
427                    return _originalCompanyId;
428            }
429    
430            @JSON
431            @Override
432            public long getUserId() {
433                    return _userId;
434            }
435    
436            @Override
437            public void setUserId(long userId) {
438                    _userId = userId;
439            }
440    
441            @Override
442            public String getUserUuid() {
443                    try {
444                            User user = UserLocalServiceUtil.getUserById(getUserId());
445    
446                            return user.getUuid();
447                    }
448                    catch (PortalException pe) {
449                            return StringPool.BLANK;
450                    }
451            }
452    
453            @Override
454            public void setUserUuid(String userUuid) {
455            }
456    
457            @JSON
458            @Override
459            public String getUserName() {
460                    if (_userName == null) {
461                            return StringPool.BLANK;
462                    }
463                    else {
464                            return _userName;
465                    }
466            }
467    
468            @Override
469            public void setUserName(String userName) {
470                    _userName = userName;
471            }
472    
473            @JSON
474            @Override
475            public Date getCreateDate() {
476                    return _createDate;
477            }
478    
479            @Override
480            public void setCreateDate(Date createDate) {
481                    _createDate = createDate;
482            }
483    
484            @JSON
485            @Override
486            public Date getModifiedDate() {
487                    return _modifiedDate;
488            }
489    
490            public boolean hasSetModifiedDate() {
491                    return _setModifiedDate;
492            }
493    
494            @Override
495            public void setModifiedDate(Date modifiedDate) {
496                    _setModifiedDate = true;
497    
498                    _modifiedDate = modifiedDate;
499            }
500    
501            @JSON
502            @Override
503            public long getRepositoryId() {
504                    return _repositoryId;
505            }
506    
507            @Override
508            public void setRepositoryId(long repositoryId) {
509                    _repositoryId = repositoryId;
510            }
511    
512            @JSON
513            @Override
514            public long getFolderId() {
515                    return _folderId;
516            }
517    
518            @Override
519            public void setFolderId(long folderId) {
520                    _columnBitmask |= FOLDERID_COLUMN_BITMASK;
521    
522                    if (!_setOriginalFolderId) {
523                            _setOriginalFolderId = true;
524    
525                            _originalFolderId = _folderId;
526                    }
527    
528                    _folderId = folderId;
529            }
530    
531            public long getOriginalFolderId() {
532                    return _originalFolderId;
533            }
534    
535            @JSON
536            @Override
537            public long getToFileEntryId() {
538                    return _toFileEntryId;
539            }
540    
541            @Override
542            public void setToFileEntryId(long toFileEntryId) {
543                    _columnBitmask |= TOFILEENTRYID_COLUMN_BITMASK;
544    
545                    if (!_setOriginalToFileEntryId) {
546                            _setOriginalToFileEntryId = true;
547    
548                            _originalToFileEntryId = _toFileEntryId;
549                    }
550    
551                    _toFileEntryId = toFileEntryId;
552            }
553    
554            public long getOriginalToFileEntryId() {
555                    return _originalToFileEntryId;
556            }
557    
558            @JSON
559            @Override
560            public String getTreePath() {
561                    if (_treePath == null) {
562                            return StringPool.BLANK;
563                    }
564                    else {
565                            return _treePath;
566                    }
567            }
568    
569            @Override
570            public void setTreePath(String treePath) {
571                    _treePath = treePath;
572            }
573    
574            @JSON
575            @Override
576            public boolean getActive() {
577                    return _active;
578            }
579    
580            @Override
581            public boolean isActive() {
582                    return _active;
583            }
584    
585            @Override
586            public void setActive(boolean active) {
587                    _columnBitmask |= ACTIVE_COLUMN_BITMASK;
588    
589                    if (!_setOriginalActive) {
590                            _setOriginalActive = true;
591    
592                            _originalActive = _active;
593                    }
594    
595                    _active = active;
596            }
597    
598            public boolean getOriginalActive() {
599                    return _originalActive;
600            }
601    
602            @JSON
603            @Override
604            public int getStatus() {
605                    return _status;
606            }
607    
608            @Override
609            public void setStatus(int status) {
610                    _columnBitmask |= STATUS_COLUMN_BITMASK;
611    
612                    if (!_setOriginalStatus) {
613                            _setOriginalStatus = true;
614    
615                            _originalStatus = _status;
616                    }
617    
618                    _status = status;
619            }
620    
621            public int getOriginalStatus() {
622                    return _originalStatus;
623            }
624    
625            @JSON
626            @Override
627            public long getStatusByUserId() {
628                    return _statusByUserId;
629            }
630    
631            @Override
632            public void setStatusByUserId(long statusByUserId) {
633                    _statusByUserId = statusByUserId;
634            }
635    
636            @Override
637            public String getStatusByUserUuid() {
638                    try {
639                            User user = UserLocalServiceUtil.getUserById(getStatusByUserId());
640    
641                            return user.getUuid();
642                    }
643                    catch (PortalException pe) {
644                            return StringPool.BLANK;
645                    }
646            }
647    
648            @Override
649            public void setStatusByUserUuid(String statusByUserUuid) {
650            }
651    
652            @JSON
653            @Override
654            public String getStatusByUserName() {
655                    if (_statusByUserName == null) {
656                            return StringPool.BLANK;
657                    }
658                    else {
659                            return _statusByUserName;
660                    }
661            }
662    
663            @Override
664            public void setStatusByUserName(String statusByUserName) {
665                    _statusByUserName = statusByUserName;
666            }
667    
668            @JSON
669            @Override
670            public Date getStatusDate() {
671                    return _statusDate;
672            }
673    
674            @Override
675            public void setStatusDate(Date statusDate) {
676                    _statusDate = statusDate;
677            }
678    
679            @Override
680            public StagedModelType getStagedModelType() {
681                    return new StagedModelType(PortalUtil.getClassNameId(
682                                    DLFileShortcut.class.getName()));
683            }
684    
685            @Override
686            public TrashEntry getTrashEntry() throws PortalException {
687                    if (!isInTrash()) {
688                            return null;
689                    }
690    
691                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
692                                    getTrashEntryClassPK());
693    
694                    if (trashEntry != null) {
695                            return trashEntry;
696                    }
697    
698                    TrashHandler trashHandler = getTrashHandler();
699    
700                    if (!Validator.isNull(trashHandler.getContainerModelClassName(
701                                                    getPrimaryKey()))) {
702                            ContainerModel containerModel = null;
703    
704                            try {
705                                    containerModel = trashHandler.getParentContainerModel(this);
706                            }
707                            catch (NoSuchModelException nsme) {
708                                    return null;
709                            }
710    
711                            while (containerModel != null) {
712                                    if (containerModel instanceof TrashedModel) {
713                                            TrashedModel trashedModel = (TrashedModel)containerModel;
714    
715                                            return trashedModel.getTrashEntry();
716                                    }
717    
718                                    trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName(
719                                                            containerModel.getContainerModelId()));
720    
721                                    if (trashHandler == null) {
722                                            return null;
723                                    }
724    
725                                    containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
726                            }
727                    }
728    
729                    return null;
730            }
731    
732            @Override
733            public long getTrashEntryClassPK() {
734                    return getPrimaryKey();
735            }
736    
737            @Override
738            public TrashHandler getTrashHandler() {
739                    return TrashHandlerRegistryUtil.getTrashHandler(getModelClassName());
740            }
741    
742            @Override
743            public boolean isInTrash() {
744                    if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
745                            return true;
746                    }
747                    else {
748                            return false;
749                    }
750            }
751    
752            @Override
753            public boolean isInTrashContainer() {
754                    TrashHandler trashHandler = getTrashHandler();
755    
756                    if ((trashHandler == null) ||
757                                    Validator.isNull(trashHandler.getContainerModelClassName(
758                                                    getPrimaryKey()))) {
759                            return false;
760                    }
761    
762                    try {
763                            ContainerModel containerModel = trashHandler.getParentContainerModel(this);
764    
765                            if (containerModel == null) {
766                                    return false;
767                            }
768    
769                            if (containerModel instanceof TrashedModel) {
770                                    return ((TrashedModel)containerModel).isInTrash();
771                            }
772                    }
773                    catch (Exception e) {
774                    }
775    
776                    return false;
777            }
778    
779            @Override
780            public boolean isInTrashExplicitly() {
781                    if (!isInTrash()) {
782                            return false;
783                    }
784    
785                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
786                                    getTrashEntryClassPK());
787    
788                    if (trashEntry != null) {
789                            return true;
790                    }
791    
792                    return false;
793            }
794    
795            @Override
796            public boolean isInTrashImplicitly() {
797                    if (!isInTrash()) {
798                            return false;
799                    }
800    
801                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
802                                    getTrashEntryClassPK());
803    
804                    if (trashEntry != null) {
805                            return false;
806                    }
807    
808                    return true;
809            }
810    
811            /**
812             * @deprecated As of 6.1.0, replaced by {@link #isApproved}
813             */
814            @Deprecated
815            @Override
816            public boolean getApproved() {
817                    return isApproved();
818            }
819    
820            @Override
821            public boolean isApproved() {
822                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
823                            return true;
824                    }
825                    else {
826                            return false;
827                    }
828            }
829    
830            @Override
831            public boolean isDenied() {
832                    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
833                            return true;
834                    }
835                    else {
836                            return false;
837                    }
838            }
839    
840            @Override
841            public boolean isDraft() {
842                    if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
843                            return true;
844                    }
845                    else {
846                            return false;
847                    }
848            }
849    
850            @Override
851            public boolean isExpired() {
852                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
853                            return true;
854                    }
855                    else {
856                            return false;
857                    }
858            }
859    
860            @Override
861            public boolean isInactive() {
862                    if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
863                            return true;
864                    }
865                    else {
866                            return false;
867                    }
868            }
869    
870            @Override
871            public boolean isIncomplete() {
872                    if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
873                            return true;
874                    }
875                    else {
876                            return false;
877                    }
878            }
879    
880            @Override
881            public boolean isPending() {
882                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
883                            return true;
884                    }
885                    else {
886                            return false;
887                    }
888            }
889    
890            @Override
891            public boolean isScheduled() {
892                    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
893                            return true;
894                    }
895                    else {
896                            return false;
897                    }
898            }
899    
900            public long getColumnBitmask() {
901                    return _columnBitmask;
902            }
903    
904            @Override
905            public ExpandoBridge getExpandoBridge() {
906                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
907                            DLFileShortcut.class.getName(), getPrimaryKey());
908            }
909    
910            @Override
911            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
912                    ExpandoBridge expandoBridge = getExpandoBridge();
913    
914                    expandoBridge.setAttributes(serviceContext);
915            }
916    
917            @Override
918            public DLFileShortcut toEscapedModel() {
919                    if (_escapedModel == null) {
920                            _escapedModel = (DLFileShortcut)ProxyUtil.newProxyInstance(_classLoader,
921                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
922                    }
923    
924                    return _escapedModel;
925            }
926    
927            @Override
928            public Object clone() {
929                    DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
930    
931                    dlFileShortcutImpl.setUuid(getUuid());
932                    dlFileShortcutImpl.setFileShortcutId(getFileShortcutId());
933                    dlFileShortcutImpl.setGroupId(getGroupId());
934                    dlFileShortcutImpl.setCompanyId(getCompanyId());
935                    dlFileShortcutImpl.setUserId(getUserId());
936                    dlFileShortcutImpl.setUserName(getUserName());
937                    dlFileShortcutImpl.setCreateDate(getCreateDate());
938                    dlFileShortcutImpl.setModifiedDate(getModifiedDate());
939                    dlFileShortcutImpl.setRepositoryId(getRepositoryId());
940                    dlFileShortcutImpl.setFolderId(getFolderId());
941                    dlFileShortcutImpl.setToFileEntryId(getToFileEntryId());
942                    dlFileShortcutImpl.setTreePath(getTreePath());
943                    dlFileShortcutImpl.setActive(getActive());
944                    dlFileShortcutImpl.setStatus(getStatus());
945                    dlFileShortcutImpl.setStatusByUserId(getStatusByUserId());
946                    dlFileShortcutImpl.setStatusByUserName(getStatusByUserName());
947                    dlFileShortcutImpl.setStatusDate(getStatusDate());
948    
949                    dlFileShortcutImpl.resetOriginalValues();
950    
951                    return dlFileShortcutImpl;
952            }
953    
954            @Override
955            public int compareTo(DLFileShortcut dlFileShortcut) {
956                    long primaryKey = dlFileShortcut.getPrimaryKey();
957    
958                    if (getPrimaryKey() < primaryKey) {
959                            return -1;
960                    }
961                    else if (getPrimaryKey() > primaryKey) {
962                            return 1;
963                    }
964                    else {
965                            return 0;
966                    }
967            }
968    
969            @Override
970            public boolean equals(Object obj) {
971                    if (this == obj) {
972                            return true;
973                    }
974    
975                    if (!(obj instanceof DLFileShortcut)) {
976                            return false;
977                    }
978    
979                    DLFileShortcut dlFileShortcut = (DLFileShortcut)obj;
980    
981                    long primaryKey = dlFileShortcut.getPrimaryKey();
982    
983                    if (getPrimaryKey() == primaryKey) {
984                            return true;
985                    }
986                    else {
987                            return false;
988                    }
989            }
990    
991            @Override
992            public int hashCode() {
993                    return (int)getPrimaryKey();
994            }
995    
996            @Override
997            public boolean isEntityCacheEnabled() {
998                    return ENTITY_CACHE_ENABLED;
999            }
1000    
1001            @Override
1002            public boolean isFinderCacheEnabled() {
1003                    return FINDER_CACHE_ENABLED;
1004            }
1005    
1006            @Override
1007            public void resetOriginalValues() {
1008                    DLFileShortcutModelImpl dlFileShortcutModelImpl = this;
1009    
1010                    dlFileShortcutModelImpl._originalUuid = dlFileShortcutModelImpl._uuid;
1011    
1012                    dlFileShortcutModelImpl._originalGroupId = dlFileShortcutModelImpl._groupId;
1013    
1014                    dlFileShortcutModelImpl._setOriginalGroupId = false;
1015    
1016                    dlFileShortcutModelImpl._originalCompanyId = dlFileShortcutModelImpl._companyId;
1017    
1018                    dlFileShortcutModelImpl._setOriginalCompanyId = false;
1019    
1020                    dlFileShortcutModelImpl._setModifiedDate = false;
1021    
1022                    dlFileShortcutModelImpl._originalFolderId = dlFileShortcutModelImpl._folderId;
1023    
1024                    dlFileShortcutModelImpl._setOriginalFolderId = false;
1025    
1026                    dlFileShortcutModelImpl._originalToFileEntryId = dlFileShortcutModelImpl._toFileEntryId;
1027    
1028                    dlFileShortcutModelImpl._setOriginalToFileEntryId = false;
1029    
1030                    dlFileShortcutModelImpl._originalActive = dlFileShortcutModelImpl._active;
1031    
1032                    dlFileShortcutModelImpl._setOriginalActive = false;
1033    
1034                    dlFileShortcutModelImpl._originalStatus = dlFileShortcutModelImpl._status;
1035    
1036                    dlFileShortcutModelImpl._setOriginalStatus = false;
1037    
1038                    dlFileShortcutModelImpl._columnBitmask = 0;
1039            }
1040    
1041            @Override
1042            public CacheModel<DLFileShortcut> toCacheModel() {
1043                    DLFileShortcutCacheModel dlFileShortcutCacheModel = new DLFileShortcutCacheModel();
1044    
1045                    dlFileShortcutCacheModel.uuid = getUuid();
1046    
1047                    String uuid = dlFileShortcutCacheModel.uuid;
1048    
1049                    if ((uuid != null) && (uuid.length() == 0)) {
1050                            dlFileShortcutCacheModel.uuid = null;
1051                    }
1052    
1053                    dlFileShortcutCacheModel.fileShortcutId = getFileShortcutId();
1054    
1055                    dlFileShortcutCacheModel.groupId = getGroupId();
1056    
1057                    dlFileShortcutCacheModel.companyId = getCompanyId();
1058    
1059                    dlFileShortcutCacheModel.userId = getUserId();
1060    
1061                    dlFileShortcutCacheModel.userName = getUserName();
1062    
1063                    String userName = dlFileShortcutCacheModel.userName;
1064    
1065                    if ((userName != null) && (userName.length() == 0)) {
1066                            dlFileShortcutCacheModel.userName = null;
1067                    }
1068    
1069                    Date createDate = getCreateDate();
1070    
1071                    if (createDate != null) {
1072                            dlFileShortcutCacheModel.createDate = createDate.getTime();
1073                    }
1074                    else {
1075                            dlFileShortcutCacheModel.createDate = Long.MIN_VALUE;
1076                    }
1077    
1078                    Date modifiedDate = getModifiedDate();
1079    
1080                    if (modifiedDate != null) {
1081                            dlFileShortcutCacheModel.modifiedDate = modifiedDate.getTime();
1082                    }
1083                    else {
1084                            dlFileShortcutCacheModel.modifiedDate = Long.MIN_VALUE;
1085                    }
1086    
1087                    dlFileShortcutCacheModel.repositoryId = getRepositoryId();
1088    
1089                    dlFileShortcutCacheModel.folderId = getFolderId();
1090    
1091                    dlFileShortcutCacheModel.toFileEntryId = getToFileEntryId();
1092    
1093                    dlFileShortcutCacheModel.treePath = getTreePath();
1094    
1095                    String treePath = dlFileShortcutCacheModel.treePath;
1096    
1097                    if ((treePath != null) && (treePath.length() == 0)) {
1098                            dlFileShortcutCacheModel.treePath = null;
1099                    }
1100    
1101                    dlFileShortcutCacheModel.active = getActive();
1102    
1103                    dlFileShortcutCacheModel.status = getStatus();
1104    
1105                    dlFileShortcutCacheModel.statusByUserId = getStatusByUserId();
1106    
1107                    dlFileShortcutCacheModel.statusByUserName = getStatusByUserName();
1108    
1109                    String statusByUserName = dlFileShortcutCacheModel.statusByUserName;
1110    
1111                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
1112                            dlFileShortcutCacheModel.statusByUserName = null;
1113                    }
1114    
1115                    Date statusDate = getStatusDate();
1116    
1117                    if (statusDate != null) {
1118                            dlFileShortcutCacheModel.statusDate = statusDate.getTime();
1119                    }
1120                    else {
1121                            dlFileShortcutCacheModel.statusDate = Long.MIN_VALUE;
1122                    }
1123    
1124                    return dlFileShortcutCacheModel;
1125            }
1126    
1127            @Override
1128            public String toString() {
1129                    StringBundler sb = new StringBundler(35);
1130    
1131                    sb.append("{uuid=");
1132                    sb.append(getUuid());
1133                    sb.append(", fileShortcutId=");
1134                    sb.append(getFileShortcutId());
1135                    sb.append(", groupId=");
1136                    sb.append(getGroupId());
1137                    sb.append(", companyId=");
1138                    sb.append(getCompanyId());
1139                    sb.append(", userId=");
1140                    sb.append(getUserId());
1141                    sb.append(", userName=");
1142                    sb.append(getUserName());
1143                    sb.append(", createDate=");
1144                    sb.append(getCreateDate());
1145                    sb.append(", modifiedDate=");
1146                    sb.append(getModifiedDate());
1147                    sb.append(", repositoryId=");
1148                    sb.append(getRepositoryId());
1149                    sb.append(", folderId=");
1150                    sb.append(getFolderId());
1151                    sb.append(", toFileEntryId=");
1152                    sb.append(getToFileEntryId());
1153                    sb.append(", treePath=");
1154                    sb.append(getTreePath());
1155                    sb.append(", active=");
1156                    sb.append(getActive());
1157                    sb.append(", status=");
1158                    sb.append(getStatus());
1159                    sb.append(", statusByUserId=");
1160                    sb.append(getStatusByUserId());
1161                    sb.append(", statusByUserName=");
1162                    sb.append(getStatusByUserName());
1163                    sb.append(", statusDate=");
1164                    sb.append(getStatusDate());
1165                    sb.append("}");
1166    
1167                    return sb.toString();
1168            }
1169    
1170            @Override
1171            public String toXmlString() {
1172                    StringBundler sb = new StringBundler(55);
1173    
1174                    sb.append("<model><model-name>");
1175                    sb.append("com.liferay.portlet.documentlibrary.model.DLFileShortcut");
1176                    sb.append("</model-name>");
1177    
1178                    sb.append(
1179                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1180                    sb.append(getUuid());
1181                    sb.append("]]></column-value></column>");
1182                    sb.append(
1183                            "<column><column-name>fileShortcutId</column-name><column-value><![CDATA[");
1184                    sb.append(getFileShortcutId());
1185                    sb.append("]]></column-value></column>");
1186                    sb.append(
1187                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1188                    sb.append(getGroupId());
1189                    sb.append("]]></column-value></column>");
1190                    sb.append(
1191                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1192                    sb.append(getCompanyId());
1193                    sb.append("]]></column-value></column>");
1194                    sb.append(
1195                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1196                    sb.append(getUserId());
1197                    sb.append("]]></column-value></column>");
1198                    sb.append(
1199                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1200                    sb.append(getUserName());
1201                    sb.append("]]></column-value></column>");
1202                    sb.append(
1203                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1204                    sb.append(getCreateDate());
1205                    sb.append("]]></column-value></column>");
1206                    sb.append(
1207                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1208                    sb.append(getModifiedDate());
1209                    sb.append("]]></column-value></column>");
1210                    sb.append(
1211                            "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
1212                    sb.append(getRepositoryId());
1213                    sb.append("]]></column-value></column>");
1214                    sb.append(
1215                            "<column><column-name>folderId</column-name><column-value><![CDATA[");
1216                    sb.append(getFolderId());
1217                    sb.append("]]></column-value></column>");
1218                    sb.append(
1219                            "<column><column-name>toFileEntryId</column-name><column-value><![CDATA[");
1220                    sb.append(getToFileEntryId());
1221                    sb.append("]]></column-value></column>");
1222                    sb.append(
1223                            "<column><column-name>treePath</column-name><column-value><![CDATA[");
1224                    sb.append(getTreePath());
1225                    sb.append("]]></column-value></column>");
1226                    sb.append(
1227                            "<column><column-name>active</column-name><column-value><![CDATA[");
1228                    sb.append(getActive());
1229                    sb.append("]]></column-value></column>");
1230                    sb.append(
1231                            "<column><column-name>status</column-name><column-value><![CDATA[");
1232                    sb.append(getStatus());
1233                    sb.append("]]></column-value></column>");
1234                    sb.append(
1235                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1236                    sb.append(getStatusByUserId());
1237                    sb.append("]]></column-value></column>");
1238                    sb.append(
1239                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1240                    sb.append(getStatusByUserName());
1241                    sb.append("]]></column-value></column>");
1242                    sb.append(
1243                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1244                    sb.append(getStatusDate());
1245                    sb.append("]]></column-value></column>");
1246    
1247                    sb.append("</model>");
1248    
1249                    return sb.toString();
1250            }
1251    
1252            private static final ClassLoader _classLoader = DLFileShortcut.class.getClassLoader();
1253            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1254                            DLFileShortcut.class
1255                    };
1256            private String _uuid;
1257            private String _originalUuid;
1258            private long _fileShortcutId;
1259            private long _groupId;
1260            private long _originalGroupId;
1261            private boolean _setOriginalGroupId;
1262            private long _companyId;
1263            private long _originalCompanyId;
1264            private boolean _setOriginalCompanyId;
1265            private long _userId;
1266            private String _userName;
1267            private Date _createDate;
1268            private Date _modifiedDate;
1269            private boolean _setModifiedDate;
1270            private long _repositoryId;
1271            private long _folderId;
1272            private long _originalFolderId;
1273            private boolean _setOriginalFolderId;
1274            private long _toFileEntryId;
1275            private long _originalToFileEntryId;
1276            private boolean _setOriginalToFileEntryId;
1277            private String _treePath;
1278            private boolean _active;
1279            private boolean _originalActive;
1280            private boolean _setOriginalActive;
1281            private int _status;
1282            private int _originalStatus;
1283            private boolean _setOriginalStatus;
1284            private long _statusByUserId;
1285            private String _statusByUserName;
1286            private Date _statusDate;
1287            private long _columnBitmask;
1288            private DLFileShortcut _escapedModel;
1289    }