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