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