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.lar.StagedModelType;
024    import com.liferay.portal.kernel.trash.TrashHandler;
025    import com.liferay.portal.kernel.trash.TrashHandlerRegistryUtil;
026    import com.liferay.portal.kernel.util.GetterUtil;
027    import com.liferay.portal.kernel.util.ProxyUtil;
028    import com.liferay.portal.kernel.util.StringBundler;
029    import com.liferay.portal.kernel.util.StringPool;
030    import com.liferay.portal.kernel.util.Validator;
031    import com.liferay.portal.kernel.workflow.WorkflowConstants;
032    import com.liferay.portal.model.CacheModel;
033    import com.liferay.portal.model.ContainerModel;
034    import com.liferay.portal.model.TrashedModel;
035    import com.liferay.portal.model.User;
036    import com.liferay.portal.model.impl.BaseModelImpl;
037    import com.liferay.portal.service.ServiceContext;
038    import com.liferay.portal.service.UserLocalServiceUtil;
039    import com.liferay.portal.util.PortalUtil;
040    
041    import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
042    import com.liferay.portlet.documentlibrary.model.DLFileShortcutModel;
043    import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
044    import com.liferay.portlet.expando.model.ExpandoBridge;
045    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
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 com.liferay.portlet.documentlibrary.model.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 com.liferay.portlet.documentlibrary.model.DLFileShortcut
069     * @see com.liferay.portlet.documentlibrary.model.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 com.liferay.portlet.documentlibrary.model.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            @Override
491            public void setModifiedDate(Date modifiedDate) {
492                    _modifiedDate = modifiedDate;
493            }
494    
495            @JSON
496            @Override
497            public long getRepositoryId() {
498                    return _repositoryId;
499            }
500    
501            @Override
502            public void setRepositoryId(long repositoryId) {
503                    _repositoryId = repositoryId;
504            }
505    
506            @JSON
507            @Override
508            public long getFolderId() {
509                    return _folderId;
510            }
511    
512            @Override
513            public void setFolderId(long folderId) {
514                    _columnBitmask |= FOLDERID_COLUMN_BITMASK;
515    
516                    if (!_setOriginalFolderId) {
517                            _setOriginalFolderId = true;
518    
519                            _originalFolderId = _folderId;
520                    }
521    
522                    _folderId = folderId;
523            }
524    
525            public long getOriginalFolderId() {
526                    return _originalFolderId;
527            }
528    
529            @JSON
530            @Override
531            public long getToFileEntryId() {
532                    return _toFileEntryId;
533            }
534    
535            @Override
536            public void setToFileEntryId(long toFileEntryId) {
537                    _columnBitmask |= TOFILEENTRYID_COLUMN_BITMASK;
538    
539                    if (!_setOriginalToFileEntryId) {
540                            _setOriginalToFileEntryId = true;
541    
542                            _originalToFileEntryId = _toFileEntryId;
543                    }
544    
545                    _toFileEntryId = toFileEntryId;
546            }
547    
548            public long getOriginalToFileEntryId() {
549                    return _originalToFileEntryId;
550            }
551    
552            @JSON
553            @Override
554            public String getTreePath() {
555                    if (_treePath == null) {
556                            return StringPool.BLANK;
557                    }
558                    else {
559                            return _treePath;
560                    }
561            }
562    
563            @Override
564            public void setTreePath(String treePath) {
565                    _treePath = treePath;
566            }
567    
568            @JSON
569            @Override
570            public boolean getActive() {
571                    return _active;
572            }
573    
574            @Override
575            public boolean isActive() {
576                    return _active;
577            }
578    
579            @Override
580            public void setActive(boolean active) {
581                    _columnBitmask |= ACTIVE_COLUMN_BITMASK;
582    
583                    if (!_setOriginalActive) {
584                            _setOriginalActive = true;
585    
586                            _originalActive = _active;
587                    }
588    
589                    _active = active;
590            }
591    
592            public boolean getOriginalActive() {
593                    return _originalActive;
594            }
595    
596            @JSON
597            @Override
598            public int getStatus() {
599                    return _status;
600            }
601    
602            @Override
603            public void setStatus(int status) {
604                    _columnBitmask |= STATUS_COLUMN_BITMASK;
605    
606                    if (!_setOriginalStatus) {
607                            _setOriginalStatus = true;
608    
609                            _originalStatus = _status;
610                    }
611    
612                    _status = status;
613            }
614    
615            public int getOriginalStatus() {
616                    return _originalStatus;
617            }
618    
619            @JSON
620            @Override
621            public long getStatusByUserId() {
622                    return _statusByUserId;
623            }
624    
625            @Override
626            public void setStatusByUserId(long statusByUserId) {
627                    _statusByUserId = statusByUserId;
628            }
629    
630            @Override
631            public String getStatusByUserUuid() {
632                    try {
633                            User user = UserLocalServiceUtil.getUserById(getStatusByUserId());
634    
635                            return user.getUuid();
636                    }
637                    catch (PortalException pe) {
638                            return StringPool.BLANK;
639                    }
640            }
641    
642            @Override
643            public void setStatusByUserUuid(String statusByUserUuid) {
644            }
645    
646            @JSON
647            @Override
648            public String getStatusByUserName() {
649                    if (_statusByUserName == null) {
650                            return StringPool.BLANK;
651                    }
652                    else {
653                            return _statusByUserName;
654                    }
655            }
656    
657            @Override
658            public void setStatusByUserName(String statusByUserName) {
659                    _statusByUserName = statusByUserName;
660            }
661    
662            @JSON
663            @Override
664            public Date getStatusDate() {
665                    return _statusDate;
666            }
667    
668            @Override
669            public void setStatusDate(Date statusDate) {
670                    _statusDate = statusDate;
671            }
672    
673            @Override
674            public StagedModelType getStagedModelType() {
675                    return new StagedModelType(PortalUtil.getClassNameId(
676                                    DLFileShortcut.class.getName()));
677            }
678    
679            @Override
680            public TrashEntry getTrashEntry() throws PortalException {
681                    if (!isInTrash()) {
682                            return null;
683                    }
684    
685                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
686                                    getTrashEntryClassPK());
687    
688                    if (trashEntry != null) {
689                            return trashEntry;
690                    }
691    
692                    TrashHandler trashHandler = getTrashHandler();
693    
694                    if (!Validator.isNull(trashHandler.getContainerModelClassName(
695                                                    getPrimaryKey()))) {
696                            ContainerModel containerModel = null;
697    
698                            try {
699                                    containerModel = trashHandler.getParentContainerModel(this);
700                            }
701                            catch (NoSuchModelException nsme) {
702                                    return null;
703                            }
704    
705                            while (containerModel != null) {
706                                    if (containerModel instanceof TrashedModel) {
707                                            TrashedModel trashedModel = (TrashedModel)containerModel;
708    
709                                            return trashedModel.getTrashEntry();
710                                    }
711    
712                                    trashHandler = TrashHandlerRegistryUtil.getTrashHandler(trashHandler.getContainerModelClassName(
713                                                            containerModel.getContainerModelId()));
714    
715                                    if (trashHandler == null) {
716                                            return null;
717                                    }
718    
719                                    containerModel = trashHandler.getContainerModel(containerModel.getParentContainerModelId());
720                            }
721                    }
722    
723                    return null;
724            }
725    
726            @Override
727            public long getTrashEntryClassPK() {
728                    return getPrimaryKey();
729            }
730    
731            @Override
732            public TrashHandler getTrashHandler() {
733                    return TrashHandlerRegistryUtil.getTrashHandler(getModelClassName());
734            }
735    
736            @Override
737            public boolean isInTrash() {
738                    if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
739                            return true;
740                    }
741                    else {
742                            return false;
743                    }
744            }
745    
746            @Override
747            public boolean isInTrashContainer() {
748                    TrashHandler trashHandler = getTrashHandler();
749    
750                    if ((trashHandler == null) ||
751                                    Validator.isNull(trashHandler.getContainerModelClassName(
752                                                    getPrimaryKey()))) {
753                            return false;
754                    }
755    
756                    try {
757                            ContainerModel containerModel = trashHandler.getParentContainerModel(this);
758    
759                            if (containerModel == null) {
760                                    return false;
761                            }
762    
763                            if (containerModel instanceof TrashedModel) {
764                                    return ((TrashedModel)containerModel).isInTrash();
765                            }
766                    }
767                    catch (Exception e) {
768                    }
769    
770                    return false;
771            }
772    
773            @Override
774            public boolean isInTrashExplicitly() {
775                    if (!isInTrash()) {
776                            return false;
777                    }
778    
779                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
780                                    getTrashEntryClassPK());
781    
782                    if (trashEntry != null) {
783                            return true;
784                    }
785    
786                    return false;
787            }
788    
789            @Override
790            public boolean isInTrashImplicitly() {
791                    if (!isInTrash()) {
792                            return false;
793                    }
794    
795                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
796                                    getTrashEntryClassPK());
797    
798                    if (trashEntry != null) {
799                            return false;
800                    }
801    
802                    return true;
803            }
804    
805            /**
806             * @deprecated As of 6.1.0, replaced by {@link #isApproved}
807             */
808            @Deprecated
809            @Override
810            public boolean getApproved() {
811                    return isApproved();
812            }
813    
814            @Override
815            public boolean isApproved() {
816                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
817                            return true;
818                    }
819                    else {
820                            return false;
821                    }
822            }
823    
824            @Override
825            public boolean isDenied() {
826                    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
827                            return true;
828                    }
829                    else {
830                            return false;
831                    }
832            }
833    
834            @Override
835            public boolean isDraft() {
836                    if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
837                            return true;
838                    }
839                    else {
840                            return false;
841                    }
842            }
843    
844            @Override
845            public boolean isExpired() {
846                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
847                            return true;
848                    }
849                    else {
850                            return false;
851                    }
852            }
853    
854            @Override
855            public boolean isInactive() {
856                    if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
857                            return true;
858                    }
859                    else {
860                            return false;
861                    }
862            }
863    
864            @Override
865            public boolean isIncomplete() {
866                    if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
867                            return true;
868                    }
869                    else {
870                            return false;
871                    }
872            }
873    
874            @Override
875            public boolean isPending() {
876                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
877                            return true;
878                    }
879                    else {
880                            return false;
881                    }
882            }
883    
884            @Override
885            public boolean isScheduled() {
886                    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
887                            return true;
888                    }
889                    else {
890                            return false;
891                    }
892            }
893    
894            public long getColumnBitmask() {
895                    return _columnBitmask;
896            }
897    
898            @Override
899            public ExpandoBridge getExpandoBridge() {
900                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
901                            DLFileShortcut.class.getName(), getPrimaryKey());
902            }
903    
904            @Override
905            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
906                    ExpandoBridge expandoBridge = getExpandoBridge();
907    
908                    expandoBridge.setAttributes(serviceContext);
909            }
910    
911            @Override
912            public DLFileShortcut toEscapedModel() {
913                    if (_escapedModel == null) {
914                            _escapedModel = (DLFileShortcut)ProxyUtil.newProxyInstance(_classLoader,
915                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
916                    }
917    
918                    return _escapedModel;
919            }
920    
921            @Override
922            public Object clone() {
923                    DLFileShortcutImpl dlFileShortcutImpl = new DLFileShortcutImpl();
924    
925                    dlFileShortcutImpl.setUuid(getUuid());
926                    dlFileShortcutImpl.setFileShortcutId(getFileShortcutId());
927                    dlFileShortcutImpl.setGroupId(getGroupId());
928                    dlFileShortcutImpl.setCompanyId(getCompanyId());
929                    dlFileShortcutImpl.setUserId(getUserId());
930                    dlFileShortcutImpl.setUserName(getUserName());
931                    dlFileShortcutImpl.setCreateDate(getCreateDate());
932                    dlFileShortcutImpl.setModifiedDate(getModifiedDate());
933                    dlFileShortcutImpl.setRepositoryId(getRepositoryId());
934                    dlFileShortcutImpl.setFolderId(getFolderId());
935                    dlFileShortcutImpl.setToFileEntryId(getToFileEntryId());
936                    dlFileShortcutImpl.setTreePath(getTreePath());
937                    dlFileShortcutImpl.setActive(getActive());
938                    dlFileShortcutImpl.setStatus(getStatus());
939                    dlFileShortcutImpl.setStatusByUserId(getStatusByUserId());
940                    dlFileShortcutImpl.setStatusByUserName(getStatusByUserName());
941                    dlFileShortcutImpl.setStatusDate(getStatusDate());
942    
943                    dlFileShortcutImpl.resetOriginalValues();
944    
945                    return dlFileShortcutImpl;
946            }
947    
948            @Override
949            public int compareTo(DLFileShortcut dlFileShortcut) {
950                    long primaryKey = dlFileShortcut.getPrimaryKey();
951    
952                    if (getPrimaryKey() < primaryKey) {
953                            return -1;
954                    }
955                    else if (getPrimaryKey() > primaryKey) {
956                            return 1;
957                    }
958                    else {
959                            return 0;
960                    }
961            }
962    
963            @Override
964            public boolean equals(Object obj) {
965                    if (this == obj) {
966                            return true;
967                    }
968    
969                    if (!(obj instanceof DLFileShortcut)) {
970                            return false;
971                    }
972    
973                    DLFileShortcut dlFileShortcut = (DLFileShortcut)obj;
974    
975                    long primaryKey = dlFileShortcut.getPrimaryKey();
976    
977                    if (getPrimaryKey() == primaryKey) {
978                            return true;
979                    }
980                    else {
981                            return false;
982                    }
983            }
984    
985            @Override
986            public int hashCode() {
987                    return (int)getPrimaryKey();
988            }
989    
990            @Override
991            public boolean isEntityCacheEnabled() {
992                    return ENTITY_CACHE_ENABLED;
993            }
994    
995            @Override
996            public boolean isFinderCacheEnabled() {
997                    return FINDER_CACHE_ENABLED;
998            }
999    
1000            @Override
1001            public void resetOriginalValues() {
1002                    DLFileShortcutModelImpl dlFileShortcutModelImpl = this;
1003    
1004                    dlFileShortcutModelImpl._originalUuid = dlFileShortcutModelImpl._uuid;
1005    
1006                    dlFileShortcutModelImpl._originalGroupId = dlFileShortcutModelImpl._groupId;
1007    
1008                    dlFileShortcutModelImpl._setOriginalGroupId = false;
1009    
1010                    dlFileShortcutModelImpl._originalCompanyId = dlFileShortcutModelImpl._companyId;
1011    
1012                    dlFileShortcutModelImpl._setOriginalCompanyId = false;
1013    
1014                    dlFileShortcutModelImpl._originalFolderId = dlFileShortcutModelImpl._folderId;
1015    
1016                    dlFileShortcutModelImpl._setOriginalFolderId = false;
1017    
1018                    dlFileShortcutModelImpl._originalToFileEntryId = dlFileShortcutModelImpl._toFileEntryId;
1019    
1020                    dlFileShortcutModelImpl._setOriginalToFileEntryId = false;
1021    
1022                    dlFileShortcutModelImpl._originalActive = dlFileShortcutModelImpl._active;
1023    
1024                    dlFileShortcutModelImpl._setOriginalActive = false;
1025    
1026                    dlFileShortcutModelImpl._originalStatus = dlFileShortcutModelImpl._status;
1027    
1028                    dlFileShortcutModelImpl._setOriginalStatus = false;
1029    
1030                    dlFileShortcutModelImpl._columnBitmask = 0;
1031            }
1032    
1033            @Override
1034            public CacheModel<DLFileShortcut> toCacheModel() {
1035                    DLFileShortcutCacheModel dlFileShortcutCacheModel = new DLFileShortcutCacheModel();
1036    
1037                    dlFileShortcutCacheModel.uuid = getUuid();
1038    
1039                    String uuid = dlFileShortcutCacheModel.uuid;
1040    
1041                    if ((uuid != null) && (uuid.length() == 0)) {
1042                            dlFileShortcutCacheModel.uuid = null;
1043                    }
1044    
1045                    dlFileShortcutCacheModel.fileShortcutId = getFileShortcutId();
1046    
1047                    dlFileShortcutCacheModel.groupId = getGroupId();
1048    
1049                    dlFileShortcutCacheModel.companyId = getCompanyId();
1050    
1051                    dlFileShortcutCacheModel.userId = getUserId();
1052    
1053                    dlFileShortcutCacheModel.userName = getUserName();
1054    
1055                    String userName = dlFileShortcutCacheModel.userName;
1056    
1057                    if ((userName != null) && (userName.length() == 0)) {
1058                            dlFileShortcutCacheModel.userName = null;
1059                    }
1060    
1061                    Date createDate = getCreateDate();
1062    
1063                    if (createDate != null) {
1064                            dlFileShortcutCacheModel.createDate = createDate.getTime();
1065                    }
1066                    else {
1067                            dlFileShortcutCacheModel.createDate = Long.MIN_VALUE;
1068                    }
1069    
1070                    Date modifiedDate = getModifiedDate();
1071    
1072                    if (modifiedDate != null) {
1073                            dlFileShortcutCacheModel.modifiedDate = modifiedDate.getTime();
1074                    }
1075                    else {
1076                            dlFileShortcutCacheModel.modifiedDate = Long.MIN_VALUE;
1077                    }
1078    
1079                    dlFileShortcutCacheModel.repositoryId = getRepositoryId();
1080    
1081                    dlFileShortcutCacheModel.folderId = getFolderId();
1082    
1083                    dlFileShortcutCacheModel.toFileEntryId = getToFileEntryId();
1084    
1085                    dlFileShortcutCacheModel.treePath = getTreePath();
1086    
1087                    String treePath = dlFileShortcutCacheModel.treePath;
1088    
1089                    if ((treePath != null) && (treePath.length() == 0)) {
1090                            dlFileShortcutCacheModel.treePath = null;
1091                    }
1092    
1093                    dlFileShortcutCacheModel.active = getActive();
1094    
1095                    dlFileShortcutCacheModel.status = getStatus();
1096    
1097                    dlFileShortcutCacheModel.statusByUserId = getStatusByUserId();
1098    
1099                    dlFileShortcutCacheModel.statusByUserName = getStatusByUserName();
1100    
1101                    String statusByUserName = dlFileShortcutCacheModel.statusByUserName;
1102    
1103                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
1104                            dlFileShortcutCacheModel.statusByUserName = null;
1105                    }
1106    
1107                    Date statusDate = getStatusDate();
1108    
1109                    if (statusDate != null) {
1110                            dlFileShortcutCacheModel.statusDate = statusDate.getTime();
1111                    }
1112                    else {
1113                            dlFileShortcutCacheModel.statusDate = Long.MIN_VALUE;
1114                    }
1115    
1116                    return dlFileShortcutCacheModel;
1117            }
1118    
1119            @Override
1120            public String toString() {
1121                    StringBundler sb = new StringBundler(35);
1122    
1123                    sb.append("{uuid=");
1124                    sb.append(getUuid());
1125                    sb.append(", fileShortcutId=");
1126                    sb.append(getFileShortcutId());
1127                    sb.append(", groupId=");
1128                    sb.append(getGroupId());
1129                    sb.append(", companyId=");
1130                    sb.append(getCompanyId());
1131                    sb.append(", userId=");
1132                    sb.append(getUserId());
1133                    sb.append(", userName=");
1134                    sb.append(getUserName());
1135                    sb.append(", createDate=");
1136                    sb.append(getCreateDate());
1137                    sb.append(", modifiedDate=");
1138                    sb.append(getModifiedDate());
1139                    sb.append(", repositoryId=");
1140                    sb.append(getRepositoryId());
1141                    sb.append(", folderId=");
1142                    sb.append(getFolderId());
1143                    sb.append(", toFileEntryId=");
1144                    sb.append(getToFileEntryId());
1145                    sb.append(", treePath=");
1146                    sb.append(getTreePath());
1147                    sb.append(", active=");
1148                    sb.append(getActive());
1149                    sb.append(", status=");
1150                    sb.append(getStatus());
1151                    sb.append(", statusByUserId=");
1152                    sb.append(getStatusByUserId());
1153                    sb.append(", statusByUserName=");
1154                    sb.append(getStatusByUserName());
1155                    sb.append(", statusDate=");
1156                    sb.append(getStatusDate());
1157                    sb.append("}");
1158    
1159                    return sb.toString();
1160            }
1161    
1162            @Override
1163            public String toXmlString() {
1164                    StringBundler sb = new StringBundler(55);
1165    
1166                    sb.append("<model><model-name>");
1167                    sb.append("com.liferay.portlet.documentlibrary.model.DLFileShortcut");
1168                    sb.append("</model-name>");
1169    
1170                    sb.append(
1171                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1172                    sb.append(getUuid());
1173                    sb.append("]]></column-value></column>");
1174                    sb.append(
1175                            "<column><column-name>fileShortcutId</column-name><column-value><![CDATA[");
1176                    sb.append(getFileShortcutId());
1177                    sb.append("]]></column-value></column>");
1178                    sb.append(
1179                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1180                    sb.append(getGroupId());
1181                    sb.append("]]></column-value></column>");
1182                    sb.append(
1183                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1184                    sb.append(getCompanyId());
1185                    sb.append("]]></column-value></column>");
1186                    sb.append(
1187                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1188                    sb.append(getUserId());
1189                    sb.append("]]></column-value></column>");
1190                    sb.append(
1191                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1192                    sb.append(getUserName());
1193                    sb.append("]]></column-value></column>");
1194                    sb.append(
1195                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1196                    sb.append(getCreateDate());
1197                    sb.append("]]></column-value></column>");
1198                    sb.append(
1199                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1200                    sb.append(getModifiedDate());
1201                    sb.append("]]></column-value></column>");
1202                    sb.append(
1203                            "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
1204                    sb.append(getRepositoryId());
1205                    sb.append("]]></column-value></column>");
1206                    sb.append(
1207                            "<column><column-name>folderId</column-name><column-value><![CDATA[");
1208                    sb.append(getFolderId());
1209                    sb.append("]]></column-value></column>");
1210                    sb.append(
1211                            "<column><column-name>toFileEntryId</column-name><column-value><![CDATA[");
1212                    sb.append(getToFileEntryId());
1213                    sb.append("]]></column-value></column>");
1214                    sb.append(
1215                            "<column><column-name>treePath</column-name><column-value><![CDATA[");
1216                    sb.append(getTreePath());
1217                    sb.append("]]></column-value></column>");
1218                    sb.append(
1219                            "<column><column-name>active</column-name><column-value><![CDATA[");
1220                    sb.append(getActive());
1221                    sb.append("]]></column-value></column>");
1222                    sb.append(
1223                            "<column><column-name>status</column-name><column-value><![CDATA[");
1224                    sb.append(getStatus());
1225                    sb.append("]]></column-value></column>");
1226                    sb.append(
1227                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1228                    sb.append(getStatusByUserId());
1229                    sb.append("]]></column-value></column>");
1230                    sb.append(
1231                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1232                    sb.append(getStatusByUserName());
1233                    sb.append("]]></column-value></column>");
1234                    sb.append(
1235                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1236                    sb.append(getStatusDate());
1237                    sb.append("]]></column-value></column>");
1238    
1239                    sb.append("</model>");
1240    
1241                    return sb.toString();
1242            }
1243    
1244            private static final ClassLoader _classLoader = DLFileShortcut.class.getClassLoader();
1245            private static final Class<?>[] _escapedModelInterfaces = new Class[] {
1246                            DLFileShortcut.class
1247                    };
1248            private String _uuid;
1249            private String _originalUuid;
1250            private long _fileShortcutId;
1251            private long _groupId;
1252            private long _originalGroupId;
1253            private boolean _setOriginalGroupId;
1254            private long _companyId;
1255            private long _originalCompanyId;
1256            private boolean _setOriginalCompanyId;
1257            private long _userId;
1258            private String _userName;
1259            private Date _createDate;
1260            private Date _modifiedDate;
1261            private long _repositoryId;
1262            private long _folderId;
1263            private long _originalFolderId;
1264            private boolean _setOriginalFolderId;
1265            private long _toFileEntryId;
1266            private long _originalToFileEntryId;
1267            private boolean _setOriginalToFileEntryId;
1268            private String _treePath;
1269            private boolean _active;
1270            private boolean _originalActive;
1271            private boolean _setOriginalActive;
1272            private int _status;
1273            private int _originalStatus;
1274            private boolean _setOriginalStatus;
1275            private long _statusByUserId;
1276            private String _statusByUserName;
1277            private Date _statusDate;
1278            private long _columnBitmask;
1279            private DLFileShortcut _escapedModel;
1280    }