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