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